From braught at dickinson.edu Wed Aug 2 16:33:45 2006 From: braught at dickinson.edu (Grant Braught) Date: Wed Aug 2 16:34:29 2006 Subject: [Pyro-users] Hemisson with PyroLive and BlueTooth Module Message-ID: <2024079C-6B25-40B1-8C8F-ABE506D5C003@dickinson.edu> Has anyone had any luck getting the Hemisson with the BlueTooth Module to work with PyroLive? I gave it a try today and didn't have much luck. I'm using PyroLive v. 4.8.2. When I startup, I run a script that makes the changes to the hcid.conf and rfcomm.conf files as described in the WIKI, restarts the bluez-utils, brings up the hci USB device and then binds the ports. When I run Pyrobot (GUI or TTY), It looks like it is sending information to the Hemisson (the little rx light on the BlueTooth board blinks) but nothing happens. The Hemisson doesn't move and none of the sensor values are updated. Also, everything looks fine when I run "hciconfig" and "hcitool scan" I've tried everything I can think of and now I'm hoping someone has seen a similar problem and has some suggestions. Any help would be greatly appreciated. Thanks, Grant _____________________________________________________________ Grant Braught | Phone: (717) 245-1401 Assoc. Prof. of Computer Science | Fax: (717) 245-1642 Dickinson College | EMail: braught@dickinson.edu P.O. Box 1773 | Web: www.dickinson.edu/~braught Carlisle, PA 17013 | From w.richert at gmx.net Thu Aug 3 06:05:35 2006 From: w.richert at gmx.net (Willi Richert) Date: Thu Aug 3 06:05:34 2006 Subject: [Pyro-users] Known issues with pyrobotics and SMP? Message-ID: <200608031205.35457.w.richert@gmx.net> Hi, I'm trying to use pyrobotics at a Intel(R) Xeon(TM) CPU 3.06GHz with kernel 2.6.8-2-686-smp #1 SMP Mon Jan 24 02:32:52 EST 2005 i686 GNU/Linux I have no root access so I had to tweak a little bit here and there. PlayerStage runs just fine. Also python2.4 works as expected. Pyrobotics (I copied it from my local working pyrobotics install from cvs) , in contrast, works not as expected. Sometimes I get: Traceback (most recent call last): File "pyrotest/TestBrainRunner.py", line 61, in ? r=TestBrainRunner() File "pyrotest/TestBrainRunner.py", line 22, in __init__ r = PlayerRobot(name=ec[0], port=ec[1])#, hostname="ikarus.c-lab.de") File "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/player.py", line 469, in __init__ deviceName = self.startDevice(device) File "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/__init__.py", line 246, in startDevice dev = self.startDevices(item, **args) File "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/__init__.py", line 268, in startDevices deviceList = self.startDeviceBuiltin(item) File "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/player.py", line 541, in startDeviceBuiltin return {"position": PlayerPositionDevice(self._client, "position")} File "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/player.py", line 28, in __init__ self.startDevice(mode) File "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/player.py", line 48, in startDevice raise playerc.playerc_error_str() got the wrong kind of reply (not good). Sometimes it works. So before I get into deep I would like to ask whether there are known bugs using pyrobotics at a dual core Xeon. Thanks, wr From w.richert at gmx.net Thu Aug 3 07:47:11 2006 From: w.richert at gmx.net (Willi Richert) Date: Thu Aug 3 07:47:09 2006 Subject: [Pyro-users] Known issues with pyrobotics and SMP? In-Reply-To: <200608031205.35457.w.richert@gmx.net> References: <200608031205.35457.w.richert@gmx.net> Message-ID: <200608031347.12277.w.richert@gmx.net> Hi, I found it. On SMP machines you need to set cpu affinity to restrict the python process to only one CPU. This can be done with the taskset utility (http://rlove.org/schedutils/schedutils-1.5.0.tar.gz). Thanks for listening, wr Am Donnerstag, 3. August 2006 12:05 schrieb Willi Richert: > Hi, > > I'm trying to use pyrobotics at a Intel(R) Xeon(TM) CPU 3.06GHz with kernel > 2.6.8-2-686-smp #1 SMP Mon Jan 24 02:32:52 EST 2005 i686 GNU/Linux > > I have no root access so I had to tweak a little bit here and there. > PlayerStage runs just fine. Also python2.4 works as expected. Pyrobotics (I > copied it from my local working pyrobotics install from cvs) , in contrast, > works not as expected. > > Sometimes I get: > Traceback (most recent call last): > File "pyrotest/TestBrainRunner.py", line 61, in ? > r=TestBrainRunner() > File "pyrotest/TestBrainRunner.py", line 22, in __init__ > r = PlayerRobot(name=ec[0], port=ec[1])#, hostname="ikarus.c-lab.de") > > File > "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/pla >yer.py", line 469, in __init__ > deviceName = self.startDevice(device) > > File > "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/__i >nit__.py", line 246, in startDevice > dev = self.startDevices(item, **args) > > File > "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/__i >nit__.py", line 268, in startDevices > deviceList = self.startDeviceBuiltin(item) > > File > "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/pla >yer.py", line 541, in startDeviceBuiltin > return {"position": PlayerPositionDevice(self._client, "position")} > > File > "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/pla >yer.py", line 28, in __init__ > self.startDevice(mode) > > File > "/globals/u7/richert/software/lib/python2.4/site-packages/pyrobot/robot/pla >yer.py", line 48, in startDevice > raise playerc.playerc_error_str() > got the wrong kind of reply (not good). > > Sometimes it works. So before I get into deep I would like to ask whether > there are known bugs using pyrobotics at a dual core Xeon. > > > > Thanks, > wr > _______________________________________________ > Pyro-users mailing list > Pyro-users@emergent.brynmawr.edu > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users From dblank at brynmawr.edu Thu Aug 3 09:10:56 2006 From: dblank at brynmawr.edu (dblank@brynmawr.edu) Date: Thu Aug 3 09:10:50 2006 Subject: [Pyro-users] Known issues with pyrobotics and SMP? In-Reply-To: <200608031347.12277.w.richert@gmx.net> References: <200608031205.35457.w.richert@gmx.net> <200608031347.12277.w.richert@gmx.net> Message-ID: <18027.68.34.179.248.1154610656.squirrel@webmail.brynmawr.edu> > Hi, > > I found it. On SMP machines you need to set cpu affinity to restrict the > python process to only one CPU. This can be done with the taskset utility > (http://rlove.org/schedutils/schedutils-1.5.0.tar.gz). Thanks, Willi. I, too, have had problems with SMP machines and Tkinter. I wonder if this was the problem? What command, exactly, do you issue? Do you think it would be useful to have something like: % pyrobot --smp=0 if smp_flag == 0: pid = os.getpid() os.system("taskset -p %d ..." % pid) print "Pyrobot running with SMP off" -Doug > Thanks for listening, > wr From w.richert at gmx.net Thu Aug 3 09:27:24 2006 From: w.richert at gmx.net (Willi Richert) Date: Thu Aug 3 09:27:23 2006 Subject: [Pyro-users] Known issues with pyrobotics and SMP? In-Reply-To: <18027.68.34.179.248.1154610656.squirrel@webmail.brynmawr.edu> References: <200608031205.35457.w.richert@gmx.net> <200608031347.12277.w.richert@gmx.net> <18027.68.34.179.248.1154610656.squirrel@webmail.brynmawr.edu> Message-ID: <200608031527.24961.w.richert@gmx.net> Hi, With taskset you can bind a process to a set of CPUs. What I do is taskset 1 python BrainRunner.py which allows python only to run on CPU 1. You can also use taskset to change the CPUs for already running processes. Apparantly, the source of evil is python's GIL. This will not be changed before python 3. Have fun, wr Am Donnerstag, 3. August 2006 15:10 schrieb dblank@brynmawr.edu: > > Hi, > > > > I found it. On SMP machines you need to set cpu affinity to restrict the > > python process to only one CPU. This can be done with the taskset utility > > (http://rlove.org/schedutils/schedutils-1.5.0.tar.gz). > > Thanks, Willi. I, too, have had problems with SMP machines and Tkinter. I > wonder if this was the problem? > > What command, exactly, do you issue? Do you think it would be useful to > have something like: > > % pyrobot --smp=0 > > if smp_flag == 0: > pid = os.getpid() > os.system("taskset -p %d ..." % pid) > print "Pyrobot running with SMP off" > > -Doug > > > Thanks for listening, > > wr From w.richert at gmx.net Thu Aug 3 10:23:15 2006 From: w.richert at gmx.net (Willi Richert) Date: Thu Aug 3 10:23:16 2006 Subject: [Pyro-users] Known issues with pyrobotics and SMP? In-Reply-To: <18027.68.34.179.248.1154610656.squirrel@webmail.brynmawr.edu> References: <200608031205.35457.w.richert@gmx.net> <200608031347.12277.w.richert@gmx.net> <18027.68.34.179.248.1154610656.squirrel@webmail.brynmawr.edu> Message-ID: <200608031623.16083.w.richert@gmx.net> Hi, the best thing would be to automatically detect whether pyrobotics is running on a SMP machine and - taskset it or - issue an error and exit if taskset is not found. That would have saved me a whole day bugtracking ;-) wr Am Donnerstag, 3. August 2006 15:10 schrieb dblank@brynmawr.edu: > > Hi, > > > > I found it. On SMP machines you need to set cpu affinity to restrict the > > python process to only one CPU. This can be done with the taskset utility > > (http://rlove.org/schedutils/schedutils-1.5.0.tar.gz). > > Thanks, Willi. I, too, have had problems with SMP machines and Tkinter. I > wonder if this was the problem? > > What command, exactly, do you issue? Do you think it would be useful to > have something like: > > % pyrobot --smp=0 > > if smp_flag == 0: > pid = os.getpid() > os.system("taskset -p %d ..." % pid) > print "Pyrobot running with SMP off" > > -Doug > > > Thanks for listening, > > wr From dblank at brynmawr.edu Thu Aug 3 11:57:58 2006 From: dblank at brynmawr.edu (dblank@brynmawr.edu) Date: Thu Aug 3 11:57:54 2006 Subject: [Pyro-users] Known issues with pyrobotics and SMP? In-Reply-To: <200608031623.16083.w.richert@gmx.net> References: <200608031205.35457.w.richert@gmx.net> <200608031347.12277.w.richert@gmx.net> <18027.68.34.179.248.1154610656.squirrel@webmail.brynmawr.edu> <200608031623.16083.w.richert@gmx.net> Message-ID: <56433.68.34.179.248.1154620678.squirrel@webmail.brynmawr.edu> > Hi, > > the best thing would be to automatically detect whether pyrobotics is > running > on a SMP machine and > - taskset it or > - issue an error and exit if taskset is not found. > > That would have saved me a whole day bugtracking ;-) Sorry about that, and thanks for the solution. I've changed the main pyrobot startup program (in CVS) to look for taskset, and issue a command to set it to the default CPU affinity list 0. You can override the CPU affinity list in pyro like: pyrobot -p 1 pyrobot -p 0,1,5 pyrobot --proc=1,2 which is handy if you want to, say, run 4 pyro's on a quad SMP computer. If you don't have the error that Willi reported, you might get better behavior by listing all of your CPUs (i.e., "-p 0,1" or "-p 0,1,2,3") as Python and Pyro might be able to use the other CPUs. Pyro doesn't exit if an error is encounter in changing the CPU affinity list, but it does print an error and a warning to the console (if running under posix). Under Windows and non-posix OSs, it will run as normal. Let us know if that helps or hurts. -Doug > wr > > Am Donnerstag, 3. August 2006 15:10 schrieb dblank@brynmawr.edu: >> > Hi, >> > >> > I found it. On SMP machines you need to set cpu affinity to restrict >> the >> > python process to only one CPU. This can be done with the taskset >> utility >> > (http://rlove.org/schedutils/schedutils-1.5.0.tar.gz). >> >> Thanks, Willi. I, too, have had problems with SMP machines and Tkinter. >> I >> wonder if this was the problem? >> >> What command, exactly, do you issue? Do you think it would be useful to >> have something like: >> >> % pyrobot --smp=0 >> >> if smp_flag == 0: >> pid = os.getpid() >> os.system("taskset -p %d ..." % pid) >> print "Pyrobot running with SMP off" >> >> -Doug >> >> > Thanks for listening, >> > wr > From kim.wheeler at roadnarrowsrobotics.com Thu Aug 3 15:04:18 2006 From: kim.wheeler at roadnarrowsrobotics.com (Kim Wheeler) Date: Thu Aug 3 15:04:33 2006 Subject: [Pyro-users] Hemisson with PyroLive and BlueTooth Module In-Reply-To: <2024079C-6B25-40B1-8C8F-ABE506D5C003@dickinson.edu> References: <2024079C-6B25-40B1-8C8F-ABE506D5C003@dickinson.edu> Message-ID: <44D248B2.4070801@roadnarrowsrobotics.com> Hi Grant, Did you upload the Hemisson OS HemiOs-1.50RNf.HEX.gz from RoadNarrows site: http://roadnarrowsrobotics.com/support/hemisson/supHem-Base.html ? This modified OS is generally needed with Pyro because the default OS in the Hemisson will jam if there isn't intra character delay in the serial comm. Its easy to change the Hemi OS, you just need to put the Hemisson in Program mode and run the Hemisson Uploader program on windows. Let me know if you have any questions. - Kim kim.wheeler@roadnarrowsrobotics.com Grant Braught wrote: > Has anyone had any luck getting the Hemisson with the BlueTooth Module > to work with PyroLive? I gave it a try today and didn't have much luck. > > I'm using PyroLive v. 4.8.2. When I startup, I run a script that makes > the changes to the hcid.conf and rfcomm.conf files as described in the > WIKI, restarts the bluez-utils, brings up the hci USB device and then > binds the ports. When I run Pyrobot (GUI or TTY), It looks like it is > sending information to the Hemisson (the little rx light on the > BlueTooth board blinks) but nothing happens. The Hemisson doesn't > move and none of the sensor values are updated. Also, everything > looks fine when I run "hciconfig" and "hcitool scan" > > I've tried everything I can think of and now I'm hoping someone has > seen a similar problem and has some suggestions. Any help would be > greatly appreciated. > > Thanks, > Grant > _____________________________________________________________ > Grant Braught | Phone: (717) 245-1401 > Assoc. Prof. of Computer Science | Fax: (717) 245-1642 > Dickinson College | EMail: braught@dickinson.edu > P.O. Box 1773 | Web: www.dickinson.edu/~braught > Carlisle, PA 17013 | > > > _______________________________________________ > Pyro-users mailing list > Pyro-users@emergent.brynmawr.edu > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > > __________ NOD32 1.1689 (20060802) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > > -- Kim Wheeler RoadNarrows LLC 1151 Eagle Dr. #140 Loveland, CO 80537 Phone: (970) 593-0370 Fax: (970) 461-9969 Website: www.roadnarrowsrobotics.com From braught at dickinson.edu Thu Aug 3 17:51:44 2006 From: braught at dickinson.edu (Grant Braught) Date: Thu Aug 3 17:52:23 2006 Subject: [Pyro-users] Hemisson with PyroLive and BlueTooth Module In-Reply-To: <44D248B2.4070801@roadnarrowsrobotics.com> References: <2024079C-6B25-40B1-8C8F-ABE506D5C003@dickinson.edu> <44D248B2.4070801@roadnarrowsrobotics.com> Message-ID: <9AD975D8-E6C5-4031-8265-6DF5CBF0FD26@dickinson.edu> Thanks Kim, that did the trick. I had been trying to use the HemiOS 1.5Rc which I guess is an older version but was the newest one I had come across until you sent me the link! Thanks again. Grant On Aug 3, 2006, at 3:04 PM, Kim Wheeler wrote: > Hi Grant, > > Did you upload the Hemisson OS HemiOs-1.50RNf.HEX.gz from > RoadNarrows site: > http://roadnarrowsrobotics.com/support/hemisson/supHem-Base.html ? > > This modified OS is generally needed with Pyro because the default > OS in the Hemisson will jam if there isn't intra character delay in > the serial comm. Its easy to change the Hemi OS, you just need to > put the Hemisson in Program mode and run the Hemisson Uploader > program on windows. > > Let me know if you have any questions. > - Kim > > kim.wheeler@roadnarrowsrobotics.com > > > > > Grant Braught wrote: >> Has anyone had any luck getting the Hemisson with the BlueTooth >> Module to work with PyroLive? I gave it a try today and didn't >> have much luck. >> >> I'm using PyroLive v. 4.8.2. When I startup, I run a script that >> makes the changes to the hcid.conf and rfcomm.conf files as >> described in the WIKI, restarts the bluez-utils, brings up the hci >> USB device and then binds the ports. When I run Pyrobot (GUI or >> TTY), It looks like it is sending information to the Hemisson (the >> little rx light on the BlueTooth board blinks) but nothing >> happens. The Hemisson doesn't move and none of the sensor values >> are updated. Also, everything looks fine when I run "hciconfig" >> and "hcitool scan" >> >> I've tried everything I can think of and now I'm hoping someone >> has seen a similar problem and has some suggestions. Any help >> would be greatly appreciated. >> >> Thanks, >> Grant >> _____________________________________________________________ >> Grant Braught | Phone: (717) 245-1401 >> Assoc. Prof. of Computer Science | Fax: (717) 245-1642 >> Dickinson College | EMail: braught@dickinson.edu >> P.O. Box 1773 | Web: www.dickinson.edu/~braught >> Carlisle, PA 17013 | >> >> >> _______________________________________________ >> Pyro-users mailing list >> Pyro-users@emergent.brynmawr.edu >> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users >> >> >> __________ NOD32 1.1689 (20060802) Information __________ >> >> This message was checked by NOD32 antivirus system. >> http://www.eset.com >> >> >> > > > -- > > > Kim Wheeler > RoadNarrows LLC > 1151 Eagle Dr. #140 > Loveland, CO 80537 > Phone: (970) 593-0370 > Fax: (970) 461-9969 > Website: www.roadnarrowsrobotics.com From dblank at brynmawr.edu Fri Aug 4 11:46:59 2006 From: dblank at brynmawr.edu (dblank@brynmawr.edu) Date: Fri Aug 4 11:46:55 2006 Subject: [Pyro-users] Symposium on AI and Robotics Message-ID: <40149.68.34.179.248.1154706419.squirrel@webmail.brynmawr.edu> [All of you on the pyro-users list might be interested in the following symposium. It should be a great meeting to present, or explore ideas in teaching AI and robotics. Have something you'd like to share? Submit it! -Doug] 2007 AAAI Spring Symposium - Call for Participation "Robots and Robot Venues: Resources for AI Education" March 26-28, 2007 Stanford University Submission deadline: October 3, 2006 URL: http://www.cs.hmc.edu/roboteducation/ This 2007 AAAI spring symposium will bring together hardware, software, and curriculum designers involved with educational autonomous robotics, robot contest and exhibition organizers, and other interested educators. The symposium will investigate and articulate how educators, especially undergraduate educators, can make the best use of autonomous robots and robot-themed venues as educational experiences. The program will include sessions on - hardware, software, and curricular issues in using autonomous robots - leveraging robot competitions/exhibitions effectively for education - a hands-on robot exhibition on the final symposium day We encourage you to submit technical papers, emerging projects, curricular trials, research-to-classroom bridges, robot exhibition & competition experiences, and other work using robots for undergraduate CS generally and/or AI-related topics specifically. Submissions may be from 2-6 pages in length and should be sent to dodds@cs.hmc.edu by Oct. 3, 2006. Additional details are available at the symposium webpage: http://www.cs.hmc.edu/roboteducation/ We look forward to your submission and participation! >From the symposium organizers, Doug Blank, Bryn Mawr College Zachary Dodds, Harvey Mudd College Paul Rybski, Carnegie Mellon University Jerry Weinberg, Southern Illinois University Edwardsville Holly Yanco, University of Massachusetts Lowell From snow91 at potsdam.edu Mon Aug 7 12:05:45 2006 From: snow91 at potsdam.edu (James Snow) Date: Mon Aug 7 12:05:44 2006 Subject: [Pyro-users] Pyro now supports the Roomba, and the IntelliBrain-Bot Message-ID: <38394.137.143.153.138.1154966745.squirrel@bearmail.potsdam.edu> Thought I'd make a quick post and let everyone know that Pyro now supports two new robots. The IntelliBrain-Bot and Roomba have both been added to the hardware section of the site. Code for both has also been added on those pages. Thank You, James Snow From anthonyu at ucla.edu Fri Aug 11 16:33:00 2006 From: anthonyu at ucla.edu (Anthony D. Urso) Date: Fri Aug 11 16:32:43 2006 Subject: [Pyro-users] My conx SRN is ignoring the context layer Message-ID: <44DCE97C.1000600@ucla.edu> I am trying to wire up an SRN with conx such that it is able to exploit the context of the previous letter in order to disambiguate the current letter during handwriting recognition. I have an idea about how to accomplish this, but I don't know if I am coding it correctly for conx. Here is the relevant code: srn = SRN() srn.setSequenceType("random-segmented") srn.learnDuringSequence = True # I tried "predict" here instead, but it was not able to learn # and I don't really want to predict anything srn.associate("input", "output") srn.add(conx.Layer("input", 62)) srn.addContextLayer("context", 128, "hidden") srn.add(conx.Layer("hidden", 128)) srn.add(conx.Layer("output", 62)) srn.connect("input", "hidden") # I also tried connecting the context directly to output, # no difference srn.connect("context", "hidden") srn.connect("hidden", "output") srn.setPatterns(patterns) srn.setInputs(inputs) srn.setOutputs(targets) srn.setReportRate(1) srn.setEpsilon(1) srn.setMomentum(.5) srn.train(500) Using patterns, I train that network on 2000 common English words and some number strings. The inputs are 62 dimensional vectors expressing how closely the given character is to the ideal for each letter. During training, I only use the ideal letters. Then to test, I do: srn = conx.loadNetworkFromFile("srn.dat.pickle") srn.learning = 0 for char in chars: srn.step(input = char) print wordnet["context"].getActivationsList() print wordnet["output"].getActivationsList() The network is able to quickly train to 100% correct, but it is unable to generalize, or even show any context changes on the inputs it has trained on. For instance, even though the context layer changes, the output activation for an ambiguous vertical line (perhaps an "l" or a "1") is exactly the same if it is preceded by an "a" or a "2." This leads me to believe that the context to hidden weights are being ignored either during training or for the step(input = char) above. I am not currently using propagate() for testing, since it seems to want patterns, and the handwritten letters I am testing against are too irregular to reasonably make patterns for. I'm sure that I have left something out of the code, or misunderstood the purpose of something. Any help would be appreciated. Thanks, Anthony From braught at dickinson.edu Fri Aug 18 16:25:35 2006 From: braught at dickinson.edu (Grant Braught) Date: Fri Aug 18 16:25:52 2006 Subject: [Pyro-users] Problems with Pioneer 3DX Bumpers Message-ID: <8BBD0B70-364A-4053-BBAD-BC6806071B52@dickinson.edu> I've just setup and configured Pyro to run on a new Pioneer 3DX with on-board computer running Debian. Everything seems to work great except I'm not able to get any bumper readings (The bumpers test fine in the ARIA demo software). However, Pyro generate and AttributeError when I try to access the bumper[0] device. For example, typing the following into the Command: box in pyrobot: [s.value for s in robot.bumper[0]["all"]] Generates the error: ERROR: exceptions.AttributeError invalid device groupname 'all' Traceback (most recent call last): File "./gui__init__.py", line 306 in processCommand File "", line 1, in ? File "./robot/device.py", line 335 in __getitem__ AttributeError: invalid device groupname 'all' exceptions.AttributeError: in command line When I look directly at the bumpers with: robot.bumper[0].value All that is displayed is an empty list: [] Any ideas what might be going on? Any help or suggestions will be appreciated. Thanks, Grant _____________________________________________________________ Grant Braught | Phone: (717) 245-1401 Assoc. Prof. of Computer Science | Fax: (717) 245-1642 Dickinson College | EMail: braught@dickinson.edu P.O. Box 1773 | Web: www.dickinson.edu/~braught Carlisle, PA 17013 | From andrewfelch at gmail.com Sat Aug 19 18:29:36 2006 From: andrewfelch at gmail.com (Andrew Felch) Date: Sat Aug 19 18:29:29 2006 Subject: [Pyro-users] anybody got aibo microphone working? Message-ID: <93dc9d160608191529n25d3fe9et26cc33e178fa3694@mail.gmail.com> I'm helping start a robot lab and we are considering using aibo + pyro for our first jaunt. One issue is that we will definately need microphone input from the aibo, so I'm wondering if anyone has ever got that working in Python/Pyro before? One goal of the lab is to maintain abstraction from the hardware details as much as possible (e.g. buying off the shelf robots), so I'm hoping it would not be difficult for me to get the microphone working. Any help is greatly appreciated, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20060819/96d63588/attachment.htm From chrisspen at gmail.com Wed Aug 23 18:41:14 2006 From: chrisspen at gmail.com (Chris S) Date: Wed Aug 23 18:41:13 2006 Subject: [Pyro-users] Named NN Input Layers Message-ID: Is it possible to have several named input layers in a Conx neural network? I have a network that takes input from multiple sources and I'd prefer setting those inputs by name instead of concatenating all my sources into a fixed array and then setting that to a single "input" layer. Regards, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20060823/9179ca77/attachment.htm From dblank at brynmawr.edu Wed Aug 23 19:36:35 2006 From: dblank at brynmawr.edu (dblank@brynmawr.edu) Date: Wed Aug 23 19:36:28 2006 Subject: [Pyro-users] Named NN Input Layers In-Reply-To: References: Message-ID: <58997.68.34.179.248.1156376195.squirrel@webmail.brynmawr.edu> > Is it possible to have several named input layers in a Conx neural > network? > I have a network that takes input from multiple sources and I'd prefer > setting those inputs by name instead of concatenating all my sources into > a > fixed array and then setting that to a single "input" layer. Chris, I guess you may know that you can use the Network.mapInputs() function, that takes a list of pairs of (layerName, offset), like: from pyrobot.brain.conx import * net = Network() net.addLayer("input1", 2) net.addLayer("input2", 3) net.addLayer("input3", 4) net.addLayer("hidden", 5) net.addLayer("output", 1) net.connect("input1", "hidden") net.connect("input2", "hidden") net.connect("input3", "hidden") net.connect("hidden", "output") net.displayConnections() net.setInputs([[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]]) net.setTargets([[1.0]]) net.mapInputs((("input1", 0), ("input2", 2), ("input3", 5))) net.interactive = 1 net.train() that will map the first 2 inputs to input1, the next 3 to input2. You could overload Network.getInput(i) which returns a dictionary with each name and associated pattern. Now that I think about it, we could allow setInputs() to take a list of dictionaries. Would that be helpful? -Doug > Regards, > Chris > _______________________________________________ > Pyro-users mailing list > Pyro-users@emergent.brynmawr.edu > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > From chrisspen at gmail.com Wed Aug 23 22:09:59 2006 From: chrisspen at gmail.com (Chris S) Date: Wed Aug 23 22:09:52 2006 Subject: [Pyro-users] Named NN Input Layers In-Reply-To: <58997.68.34.179.248.1156376195.squirrel@webmail.brynmawr.edu> References: <58997.68.34.179.248.1156376195.squirrel@webmail.brynmawr.edu> Message-ID: On 8/23/06, dblank@brynmawr.edu wrote: > I guess you may know that you can use the Network.mapInputs() function, > that takes a list of pairs of (layerName, offset), like: > > from pyrobot.brain.conx import * > net = Network() > net.addLayer("input1", 2) > net.addLayer("input2", 3) > net.addLayer("input3", 4) > net.addLayer("hidden", 5) > net.addLayer("output", 1) > net.connect("input1", "hidden") > net.connect("input2", "hidden") > net.connect("input3", "hidden") > net.connect("hidden", "output") > net.displayConnections() > net.setInputs([[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]]) > net.setTargets([[1.0]]) > net.mapInputs((("input1", 0), > ("input2", 2), > ("input3", 5))) > net.interactive = 1 > net.train() > > that will map the first 2 inputs to input1, the next 3 to input2. > > You could overload Network.getInput(i) which returns a dictionary with > each name and associated pattern. > > Now that I think about it, we could allow setInputs() to take a list of > dictionaries. Would that be helpful? Yes. I don't really see how mapInputs helps. I'd rather not have to worry about maintaining indices or a single list of inputs. As you mentioned, it would be convenient if I could do: net.setInputs(input1=[0.0, 0.1], input2=[0.2, 0.3, 0.4], input3=[0.5, 0.6, 0.7, 0.8]) or net.propagate(input1=[0.0, 0.1], input2=[0.2, 0.3, 0.4], input3=[0.5, 0.6, 0.7, 0.8]) From dblank at brynmawr.edu Wed Aug 23 23:18:34 2006 From: dblank at brynmawr.edu (dblank@brynmawr.edu) Date: Wed Aug 23 23:18:27 2006 Subject: [Pyro-users] Named NN Input Layers In-Reply-To: References: <58997.68.34.179.248.1156376195.squirrel@webmail.brynmawr.edu> Message-ID: <45463.68.34.179.248.1156389514.squirrel@webmail.brynmawr.edu> Chris said: > Yes. I don't really see how mapInputs helps. I'd rather not have to > worry about maintaining indices or a single list of inputs. As you > mentioned, it would be convenient if I could do: > > net.setInputs(input1=[0.0, 0.1], input2=[0.2, 0.3, 0.4], input3=[0.5, > 0.6, 0.7, 0.8]) For now I made a little change now allows you to: net.setInputs( [{"input1": [.1, .2], "input2": [.3, .4, .5], "input3": [.6, .7, .8, .9]}, {"input1": [.01, .02], "input2": [.03, .04, .05], "input3": [.06, .07, .08, .09]} ] ) and you can put targets in there too (or in setTargets() which also now allows lists of dicts). > or > > net.propagate(input1=[0.0, 0.1], input2=[0.2, 0.3, 0.4], input3=[0.5, > 0.6, 0.7, 0.8]) > propagate() already allows you to do that (as does step()). The above list-of-dicts change is now in cvs. Thanks; good idea! -Doug From dblank at brynmawr.edu Thu Aug 24 15:59:48 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Aug 24 16:00:16 2006 Subject: [Pyro-users] My conx SRN is ignoring the context layer In-Reply-To: <44DCE97C.1000600@ucla.edu> References: <44DCE97C.1000600@ucla.edu> Message-ID: <44EE0534.80709@brynmawr.edu> Anthony, I tried the following and it seemed to work. (I used the shorter version of addLayer, because I wasn't sure what the "conx" object was in your sample code): from pyrobot.brain.conx import SRN, loadNetworkFromFile length = 62 # length of patterns sequence = 2 # length of sequence def makePattern(i): pat = [0.0] * length pat[i % length] = 1.0 return pat def makePatternDict(): d = {} for i in range(length): d[str(i)] = makePattern(i) return d srn = SRN() srn.setSequenceType("random-segmented") srn.learnDuringSequence = True srn.associate("input", "output") srn.addLayer("input", 62) srn.addContextLayer("context", 128, "hidden") srn.addLayer("hidden", 128) srn.addLayer("output", 62) srn.connect("input", "hidden") srn.connect("context", "hidden") srn.connect("hidden", "output") patterns = makePatternDict() inputs = [makePattern(i) + makePattern(i + 1) for i in range(length)] targets = [makePattern(i + 1) + makePattern(i + 2) for i in range(length)] srn.setPatterns(patterns) srn.setInputs(inputs) srn.setOutputs(targets) srn.setReportRate(1) srn.setEpsilon(1) srn.setMomentum(.5) srn.train(5) srn.saveNetworkToFile("srn.dat") srn2 = loadNetworkFromFile("srn.dat.pickle") srn2.learning = 0 srn2.interactive = 1 print srn2.sweep() Mine would take a while to train. One thing that might cause problem is that you create "srn", but then use "wordnet" when testing. I'm using Conx version 1.227. -Doug Anthony D. Urso wrote: > I am trying to wire up an SRN with conx such that it is able to exploit > the context of the previous letter in order to disambiguate the current > letter during handwriting recognition. > > I have an idea about how to accomplish this, but I don't know if I am > coding it correctly for conx. > > Here is the relevant code: > > srn = SRN() > > srn.setSequenceType("random-segmented") > srn.learnDuringSequence = True > > # I tried "predict" here instead, but it was not able to learn > # and I don't really want to predict anything > srn.associate("input", "output") > > srn.add(conx.Layer("input", 62)) > srn.addContextLayer("context", 128, "hidden") > srn.add(conx.Layer("hidden", 128)) > srn.add(conx.Layer("output", 62)) > > srn.connect("input", "hidden") > # I also tried connecting the context directly to output, > # no difference > srn.connect("context", "hidden") > srn.connect("hidden", "output") > > srn.setPatterns(patterns) > srn.setInputs(inputs) > srn.setOutputs(targets) > > srn.setReportRate(1) > srn.setEpsilon(1) > srn.setMomentum(.5) > srn.train(500) > > Using patterns, I train that network on 2000 common English words and > some number strings. The inputs are 62 dimensional vectors expressing > how closely the given character is to the ideal for each letter. During > training, I only use the ideal letters. > > Then to test, I do: > > srn = conx.loadNetworkFromFile("srn.dat.pickle") > srn.learning = 0 > > for char in chars: > srn.step(input = char) > print wordnet["context"].getActivationsList() > print wordnet["output"].getActivationsList() > > The network is able to quickly train to 100% correct, but it is unable > to generalize, or even show any context changes on the inputs it has > trained on. > > For instance, even though the context layer changes, the output > activation for an ambiguous vertical line (perhaps an "l" or a "1") is > exactly the same if it is preceded by an "a" or a "2." This leads me to > believe that the context to hidden weights are being ignored either > during training or for the step(input = char) above. > > I am not currently using propagate() for testing, since it seems to want > patterns, and the handwritten letters I am testing against are too > irregular to reasonably make patterns for. > > I am using conx.py version 1.201. > > I guess the big question I have would be how to call propagate() without using patterns. I have been doing so in the Network class, but it raises an exception in the SRN class: > > Traceback (most recent call last): > File "recognize.py", line 62, in ? > srn.propagate(input = char) > File "conx.py", line 3055, in propagate > return Network.propagate(self, **args) > File "conx.py", line 1778, in propagate > self.verifyInputs() # better have inputs set > File "conx.py", line 1408, in verifyInputs > raise LayerError, "Inputs are not set and verifyInputs() was called on layer '%s'." % layer.name > conx.LayerError: Inputs are not set and verifyInputs() was called on layer 'context'. > > Using the step() method with the same input does not raise any exceptions. > > I'm sure that I have left something out of the code, or misunderstood > the purpose of something. Any help would be appreciated. > > Thanks, > Anthony > > _______________________________________________ > Pyro-users mailing list > Pyro-users@emergent.brynmawr.edu > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > -- Douglas S. Blank Computer Science Assistant Professor Bryn Mawr College (610)526-6501 http://cs.brynmawr.edu/~dblank From dblank at brynmawr.edu Thu Aug 24 16:08:09 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Aug 24 16:08:46 2006 Subject: [Pyro-users] Problems with Pioneer 3DX Bumpers In-Reply-To: <8BBD0B70-364A-4053-BBAD-BC6806071B52@dickinson.edu> References: <8BBD0B70-364A-4053-BBAD-BC6806071B52@dickinson.edu> Message-ID: <44EE0729.1000507@brynmawr.edu> Grant, What version of Pyro are you using? Also, I assume that you are using Player to talk to the Pioneer? What version of Player are you using? The missing group named "all" is an oversight, but something else must be going on to get an empty list back. -Doug Grant Braught wrote: > I've just setup and configured Pyro to run on a new Pioneer 3DX with > on-board computer running Debian. Everything seems to work great > except I'm not able to get any bumper readings (The bumpers test fine > in the ARIA demo software). However, Pyro generate and AttributeError > when I try to access the bumper[0] device. For example, typing the > following into the Command: box in pyrobot: > > [s.value for s in robot.bumper[0]["all"]] > > Generates the error: > > ERROR: exceptions.AttributeError invalid device groupname 'all' > Traceback (most recent call last): > File "./gui__init__.py", line 306 in processCommand > File "", line 1, in ? > File "./robot/device.py", line 335 in __getitem__ > AttributeError: invalid device groupname 'all' > exceptions.AttributeError: in command line > > When I look directly at the bumpers with: > > robot.bumper[0].value > > All that is displayed is an empty list: > > [] > > > Any ideas what might be going on? Any help or suggestions will be > appreciated. > > Thanks, > Grant > _____________________________________________________________ > Grant Braught | Phone: (717) 245-1401 > Assoc. Prof. of Computer Science | Fax: (717) 245-1642 > Dickinson College | EMail: braught@dickinson.edu > P.O. Box 1773 | Web: www.dickinson.edu/~braught > Carlisle, PA 17013 | > > > _______________________________________________ > Pyro-users mailing list > Pyro-users@emergent.brynmawr.edu > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > -- Douglas S. Blank Computer Science Assistant Professor Bryn Mawr College (610)526-6501 http://cs.brynmawr.edu/~dblank From dblank at brynmawr.edu Thu Aug 24 16:17:26 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Aug 24 16:17:54 2006 Subject: [Pyro-users] anybody got aibo microphone working? In-Reply-To: <93dc9d160608191529n25d3fe9et26cc33e178fa3694@mail.gmail.com> References: <93dc9d160608191529n25d3fe9et26cc33e178fa3694@mail.gmail.com> Message-ID: <44EE0956.90008@brynmawr.edu> Andrew Felch wrote: > I'm helping start a robot lab and we are considering using aibo + > pyro for our first jaunt. One issue is that we will definately need > microphone input from the aibo, so I'm wondering if anyone has ever got > that working in Python/Pyro before? One goal of the lab is to maintain > abstraction from the hardware details as much as possible ( e.g. buying > off the shelf robots), so I'm hoping it would not be difficult for me to > get the microphone working. > > Any help is greatly appreciated, > Andrew Andrew, Pyro uses the debugging tool from Tekkotsu (their Monitor) to communicate with the robot. I don't think that Tekkotsu exports any audio, either receiving or sending. However, that would be very useful to have. I some idea what it would take to develop such an interface. Some questions arise: - when would you send audio to the offboard Pyro computer? continuously? only when a sound loud enough occurs? - what format do you need on the computer? raw audio, or fft? - how will you package up the audio signal? You would have to add a behavior on the Aibo in Tekkotsu's C++ code, start up a server on a port, and send the data whenever you wish (every n milliseconds, every second, when a sound event occurs, etc). Then you would need Pyro code that would connect onto the port to receive the audio. Tekkotsu/Pyro do something similar with the camera images. You could also just do that on the PC. Does the sound really need to come from the robot? It sounds like an interesting project, and we would be willing to help in whatever fashion we can. (We'll be doing something similar on another platform, so we'll need to solve these issues eventually any way.) -Doug > > ------------------------------------------------------------------------ > > _______________________________________________ > Pyro-users mailing list > Pyro-users@emergent.brynmawr.edu > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users -- Douglas S. Blank Computer Science Assistant Professor Bryn Mawr College (610)526-6501 http://cs.brynmawr.edu/~dblank From chrisspen at gmail.com Fri Aug 25 10:17:15 2006 From: chrisspen at gmail.com (Chris S) Date: Fri Aug 25 10:17:07 2006 Subject: [Pyro-users] Named NN Input Layers In-Reply-To: <45463.68.34.179.248.1156389514.squirrel@webmail.brynmawr.edu> References: <58997.68.34.179.248.1156376195.squirrel@webmail.brynmawr.edu> <45463.68.34.179.248.1156389514.squirrel@webmail.brynmawr.edu> Message-ID: On 8/23/06, dblank@brynmawr.edu wrote: > propagate() already allows you to do that (as does step()). > > The above list-of-dicts change is now in cvs. Thanks; good idea! Glad I could help. However, I just tried using the new code and I get the following error when I run train(). I think the problem is that I'm using crossvalidation. getDataCrossValidation() is returning "input", which is an invalid layer name since I'm using multiple input layers. self.net.train() File "c:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1680, in train (tssCVErr, totalCVCorrect, totalCVCount, totalCVPCorrect) = self.sweepCrossValidation() File "c:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1840, in sweepCross Validation (error, correct, total, pcorrect) = self.step( **set ) File "c:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1738, in step self.propagate(**args) File "c:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1946, in propagate layer = self.getLayer(key) File "c:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1127, in getLayer return self.layersByName[name] KeyError: 'input' From dblank at brynmawr.edu Fri Aug 25 12:01:53 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri Aug 25 12:02:23 2006 Subject: [Pyro-users] Named NN Input Layers In-Reply-To: References: <58997.68.34.179.248.1156376195.squirrel@webmail.brynmawr.edu> <45463.68.34.179.248.1156389514.squirrel@webmail.brynmawr.edu> Message-ID: <44EF1EF1.4050404@brynmawr.edu> Chris S wrote: > On 8/23/06, dblank@brynmawr.edu wrote: > >> propagate() already allows you to do that (as does step()). >> >> The above list-of-dicts change is now in cvs. Thanks; good idea! > > > Glad I could help. However, I just tried using the new code and I get > the following error when I run train(). I think the problem is that > I'm using crossvalidation. getDataCrossValidation() is returning > "input", which is an invalid layer name since I'm using multiple input > layers. Yep, you were right; fixed in CVS. I just looked through the code to see if "input" and "output" names were assumed anywhere else, and there is one place: in the SRN.step() method which is probably going to cause problems for you. Let me look at that and see what the best way to remove that last assumption... -Doug -- Douglas S. Blank Computer Science Assistant Professor Bryn Mawr College (610)526-6501 http://cs.brynmawr.edu/~dblank From andrewfelch at gmail.com Fri Aug 25 13:01:44 2006 From: andrewfelch at gmail.com (Andrew Felch) Date: Fri Aug 25 13:01:37 2006 Subject: [Pyro-users] anybody got aibo microphone working? In-Reply-To: <44EE0956.90008@brynmawr.edu> References: <93dc9d160608191529n25d3fe9et26cc33e178fa3694@mail.gmail.com> <44EE0956.90008@brynmawr.edu> Message-ID: <93dc9d160608251001i77452ea2y3767edefc83b0b78@mail.gmail.com> Wow, thanks for your help, as it would probably take me a long time to learn how to extend tekkotsu. To address the questions so far: - when would you send audio to the offboard Pyro computer? continuously? only when a sound loud enough occurs? Either would be fine, but it would be nice to be able to receive a constant stream of sound (seems like this would be the simplest thing to implement on the aibo, though most bandwidth intensive). If the recording is 16-bit 16 khz, that comes out to 256 kbps with my math, which seems reasonable for my environment. - what format do you need on the computer? raw audio, or fft? Either would be fine, but I would want to be able to reproduce the sound to show demos and create movies of the aibo's behavior in the context of what it is actually hearing. My audio processing will operate on fft's. If the fft windows overlap enough, it is possible to reproduce the audio just from them. I had always figured that the fft would be generated on the pyro computer, but that was just my initial inclination. - how will you package up the audio signal? At 2 megabytes a minute (256 kbps), an hour of audio fits in 120 MB, which could be stored on a hard drive in raw format with no problems. (I would also like to be able to send audio to the aibo, but I don't know how hard that would be to implement). The audio needs to come from the robot because we will be taking it into real world situations (though covered by a wifi net) to try to teach the aibo in a more human environment. Eventually we hope for the robot to be able to interact as it listens to conversations. Any way you can help would be greatly appreciated. Our project requires input from the 3 modalities, auditory, visual, and proprioception (force feedback at joints). Our project is also unique in that we are covered by a very robust wifi net in a natural setting (Dartmouth College). Thanks, Andrew Felch On 8/24/06, Douglas S. Blank wrote: > > Andrew Felch wrote: > > I'm helping start a robot lab and we are considering using aibo + > > pyro for our first jaunt. One issue is that we will definately need > > microphone input from the aibo, so I'm wondering if anyone has ever got > > that working in Python/Pyro before? One goal of the lab is to maintain > > abstraction from the hardware details as much as possible ( e.g. buying > > off the shelf robots), so I'm hoping it would not be difficult for me to > > get the microphone working. > > > > Any help is greatly appreciated, > > Andrew > > Andrew, > > Pyro uses the debugging tool from Tekkotsu (their Monitor) to > communicate with the robot. I don't think that Tekkotsu exports any > audio, either receiving or sending. However, that would be very useful > to have. I some idea what it would take to develop such an interface. > Some questions arise: > > - when would you send audio to the offboard Pyro computer? continuously? > only when a sound loud enough occurs? > > - what format do you need on the computer? raw audio, or fft? > > - how will you package up the audio signal? > > You would have to add a behavior on the Aibo in Tekkotsu's C++ code, > start up a server on a port, and send the data whenever you wish (every > n milliseconds, every second, when a sound event occurs, etc). Then you > would need Pyro code that would connect onto the port to receive the > audio. Tekkotsu/Pyro do something similar with the camera images. > > You could also just do that on the PC. Does the sound really need to > come from the robot? > > It sounds like an interesting project, and we would be willing to help > in whatever fashion we can. (We'll be doing something similar on another > platform, so we'll need to solve these issues eventually any way.) > > -Doug > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Pyro-users mailing list > > Pyro-users@emergent.brynmawr.edu > > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > > -- > Douglas S. Blank Computer Science > Assistant Professor Bryn Mawr College > (610)526-6501 http://cs.brynmawr.edu/~dblank > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20060825/6c367476/attachment.htm From dblank at brynmawr.edu Mon Aug 28 15:02:01 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Mon Aug 28 15:02:33 2006 Subject: [Pyro-users] anybody got aibo microphone working? In-Reply-To: <93dc9d160608251001i77452ea2y3767edefc83b0b78@mail.gmail.com> References: <93dc9d160608191529n25d3fe9et26cc33e178fa3694@mail.gmail.com> <44EE0956.90008@brynmawr.edu> <93dc9d160608251001i77452ea2y3767edefc83b0b78@mail.gmail.com> Message-ID: <44F33DA9.7070207@brynmawr.edu> Andrew, This was easier than I would have guessed: the Tekkotsu developers already have a "Microphone Server" and a "Speaker Server" in Tekkotsu. Here is a message from Ethan Tira-Thompson on the Tekkotsu_dev mailing list: > Actually, the basics are already in place... take a look at > Behaviors/Mon/SpeakerServer.{h,cc} > > Once you activate the Microphone Server under TekkotsuMon in the > ControllerGUI, you should be able to connect to port 10070 (as > defined by mic_port in project/ms/config/tekkotsu.cfg) and receive > the microphone data. There are additional settings in tekkotsu.cfg to > control the sample rate, sample bits, and stereo setting. I haven't > played with this code too much (was submitted by Alexander Klyubin), > but it should do what you expect. > > FYI, there's also a "Speaker Server" which opens on 10071 which will > allow streaming audio back to play out of the Aibo's speakers. > > Does that fit what you're looking for? > > -ethan So, you'll be able to do this at a pretty high level (eg, Python code and Tekkotsu configure file.) It will go something like this: 1. Take a look at your memstick in config/tekkotsu.cfg in the [Sound] section, and change to values that you like (or just note what they are) 2. Start the Tekkotsu Monitor Java Client and connect onto the Aibo. You can download and find out more about Tekkotsu Monitor at http://www.cs.cmu.edu/~tekkotsu/TekkotsuMon.html. You can test to see if this actually works. Once that you know how this works, note how you turn on the Microphone Server from the menu. 2. Take a look at pyrobot/robot/aibo.py to see how the Python code works. You may have to write a special thread that downloads the sound as fast as possible. In the Pyro vision code, we have to decode that in C++ code, but vision probably has much larger data. 3. Write some code that will create a Listener. You can start the Microphone Server by entering the 10070 in the PORT class, and then creating a Listener. Ethan didn't say what format the data was in, but I suspect it is easily interpretable. See if you make any progress with that, and let us know if you need some more information. You can ask Ethan specific questions about Tekkotsu on their mailing list: http://groups.yahoo.com/group/tekkotsu_dev/ Good luck! -Doug Andrew Felch wrote: > Wow, thanks for your help, as it would probably take me a long time > to learn how to extend tekkotsu. To address the questions so far: > > - when would you send audio to the offboard Pyro computer? > continuously? only when a sound loud enough occurs? > > Either would be fine, but it would be nice to be able to receive a > constant stream of sound (seems like this would be the simplest thing > to implement on the aibo, though most bandwidth intensive). If the > recording is 16-bit 16 khz, that comes out to 256 kbps with my math, > which seems reasonable for my environment. > > - what format do you need on the computer? raw audio, or fft? > > Either would be fine, but I would want to be able to reproduce the > sound to show demos and create movies of the aibo's behavior in the > context of what it is actually hearing. My audio processing will > operate on fft's. If the fft windows overlap enough, it is possible > to reproduce the audio just from them. I had always figured that the > fft would be generated on the pyro computer, but that was just my > initial inclination. > > - how will you package up the audio signal? > > At 2 megabytes a minute (256 kbps), an hour of audio fits in 120 MB, > which could be stored on a hard drive in raw format with no > problems. (I would also like to be able to send audio to the aibo, > but I don't know how hard that would be to implement). > > The audio needs to come from the robot because we will be taking it > into real world situations (though covered by a wifi net) to try to > teach the aibo in a more human environment. Eventually we hope for > the robot to be able to interact as it listens to conversations. > > Any way you can help would be greatly appreciated. Our project > requires input from the 3 modalities, auditory, visual, and > proprioception (force feedback at joints). Our project is also > unique in that we are covered by a very robust wifi net in a natural > setting (Dartmouth College). > > Thanks, Andrew Felch > > > On 8/24/06, *Douglas S. Blank* > wrote: > > Andrew Felch wrote: >> I'm helping start a robot lab and we are considering using aibo + >> pyro for our first jaunt. One issue is that we will definately >> need microphone input from the aibo, so I'm wondering if anyone has >> > ever got >> that working in Python/Pyro before? One goal of the lab is to > maintain >> abstraction from the hardware details as much as possible ( e.g. > buying >> off the shelf robots), so I'm hoping it would not be difficult > for me to >> get the microphone working. >> >> Any help is greatly appreciated, Andrew > > Andrew, > > Pyro uses the debugging tool from Tekkotsu (their Monitor) to > communicate with the robot. I don't think that Tekkotsu exports any > audio, either receiving or sending. However, that would be very > useful to have. I some idea what it would take to develop such an > interface. Some questions arise: > > - when would you send audio to the offboard Pyro computer? > continuously? only when a sound loud enough occurs? > > - what format do you need on the computer? raw audio, or fft? > > - how will you package up the audio signal? > > You would have to add a behavior on the Aibo in Tekkotsu's C++ code, > start up a server on a port, and send the data whenever you wish > (every n milliseconds, every second, when a sound event occurs, etc). > Then you would need Pyro code that would connect onto the port to > receive the audio. Tekkotsu/Pyro do something similar with the camera > images. > > You could also just do that on the PC. Does the sound really need to > come from the robot? > > It sounds like an interesting project, and we would be willing to > help in whatever fashion we can. (We'll be doing something similar on > another platform, so we'll need to solve these issues eventually any > way.) > > -Doug > >> >> > ------------------------------------------------------------------------ > >> >> _______________________________________________ Pyro-users mailing >> list Pyro-users@emergent.brynmawr.edu > >> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > > -- Douglas S. Blank Computer Science Assistant Professor > Bryn Mawr College (610)526-6501 > http://cs.brynmawr.edu/~dblank > > -- Douglas S. Blank Computer Science Assistant Professor Bryn Mawr College (610)526-6501 http://cs.brynmawr.edu/~dblank From chrisspen at gmail.com Mon Aug 28 16:19:07 2006 From: chrisspen at gmail.com (Chris S) Date: Mon Aug 28 16:19:00 2006 Subject: [Pyro-users] Conx Auto Cross Validation Message-ID: How do you know if auto cross validation is happening in Conx? When I turn it on, the results don't seem any different than when I have it off. For example, I might do something like: net.setAutoCrossValidation(1) net.setUseCrossValidationToStop(1) net.stopPercent = 0.85 net.setReportRate(10) net.setEpsilon(0.5) net.setTolerance(0.2) inputs, targets = getSomeData() net.setInputs(inputs) net.setTargets(targets) net.train() net.setInputs([]) net.setTargets([]) However, the reports quickly start showing: Step # 1000 | TSS Error: 0.0000 | Correct: 1.0000 Shouldn't training stop long before it starts getting everything correct? Is there any way to report what percentage of the auto-generated cross validation set the net is getting correct? Chris From dblank at brynmawr.edu Mon Aug 28 16:49:31 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Mon Aug 28 16:50:03 2006 Subject: [Pyro-users] Conx Auto Cross Validation In-Reply-To: References: Message-ID: <44F356DB.6070207@brynmawr.edu> Chris S wrote: > How do you know if auto cross validation is happening in Conx? When I > turn it on, the results don't seem any different than when I have it > off. For example, I might do something like: > > net.setAutoCrossValidation(1) > net.setUseCrossValidationToStop(1) > net.stopPercent = 0.85 > net.setReportRate(10) > net.setEpsilon(0.5) > net.setTolerance(0.2) > > inputs, targets = getSomeData() > net.setInputs(inputs) > net.setTargets(targets) > > net.train() > net.setInputs([]) > net.setTargets([]) > > However, the reports quickly start showing: > Step # 1000 | TSS Error: 0.0000 | Correct: 1.0000 When I run: from pyrobot.brain.conx import * net = Network() net.addLayers(2, 2, 1) net.setAutoCrossValidation(1) net.setUseCrossValidationToStop(1) net.stopPercent = 0.85 net.setReportRate(10) net.setEpsilon(0.5) net.setTolerance(0.2) inputs, targets = [[0,0],[0,1],[1,0],[1,1]],[[0],[1],[1],[0]] net.setInputs(inputs) net.setTargets(targets) net.train() I get: $ python testconx.py Conx, version 1.230 (psyco enabled) Conx using seed: 1156839583.4 Epoch # 10 | TSS Error: 1.0759 | Correct: 0.0000 | RMS Error: 0.5186 CV # 10 | TSS Error: 1.0000 | Correct: 0.0000 | RMS Error: 0.5000 Epoch # 20 | TSS Error: 1.0525 | Correct: 0.0000 | RMS Error: 0.5130 CV # 20 | TSS Error: 1.0185 | Correct: 0.0000 | RMS Error: 0.5046 Epoch # 30 | TSS Error: 1.1221 | Correct: 0.0000 | RMS Error: 0.5296 CV # 30 | TSS Error: 0.9996 | Correct: 0.0000 | RMS Error: 0.4999 ... Epoch # 170 | TSS Error: 0.1734 | Correct: 0.2500 | RMS Error: 0.2082 CV # 170 | TSS Error: 0.1328 | Correct: 0.5000 | RMS Error: 0.1822 Epoch # 180 | TSS Error: 0.0502 | Correct: 1.0000 | RMS Error: 0.1121 CV # 180 | TSS Error: 0.0453 | Correct: 1.0000 | RMS Error: 0.1064 ---------------------------------------------------- Final # 180 | TSS Error: 0.0502 | Correct: 1.0000 | RMS Error: 0.1121 CV # 180 | TSS Error: 0.0453 | Correct: 1.0000 | RMS Error: 0.1064 ---------------------------------------------------- which shows the Cross Vadidation (CV) reporting interspersed with the regular reporting. It looks like the SRN code would still do this. Can you send a simplified version of your entire code? -Doug > Shouldn't training stop long before it starts getting everything > correct? Is there any way to report what percentage of the > auto-generated cross validation set the net is getting correct? > > Chris > _______________________________________________ > Pyro-users mailing list > Pyro-users@emergent.brynmawr.edu > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > -- Douglas S. Blank Computer Science Assistant Professor Bryn Mawr College (610)526-6501 http://cs.brynmawr.edu/~dblank From chrisspen at gmail.com Mon Aug 28 18:48:23 2006 From: chrisspen at gmail.com (Chris S) Date: Mon Aug 28 18:48:20 2006 Subject: [Pyro-users] Conx Auto Cross Validation In-Reply-To: <44F356DB.6070207@brynmawr.edu> References: <44F356DB.6070207@brynmawr.edu> Message-ID: On 8/28/06, Douglas S. Blank wrote: > which shows the Cross Vadidation (CV) reporting interspersed with the > regular reporting. It looks like the SRN code would still do this. Can > you send a simplified version of your entire code? > > -Doug Ah, nevermind. I eventually got output like that, but I overlooked the "CV" line. Thanks for the help. Chris From anthonyu at ucla.edu Thu Aug 31 01:18:19 2006 From: anthonyu at ucla.edu (Anthony D. Urso) Date: Thu Aug 31 01:18:15 2006 Subject: [Pyro-users] My conx SRN is ignoring the context layer In-Reply-To: <44EE0534.80709@brynmawr.edu> References: <44DCE97C.1000600@ucla.edu> <44EE0534.80709@brynmawr.edu> Message-ID: <44F6711B.9090001@ucla.edu> Thank you for the hints. I've changed my tack and I have started a simpler project in order to learn the API. My program is now getting the error: conx.LayerError: ('Mismatched target size and layer size in call to copyTargets()', (91, 1)) which is weird, since those sizes match the length of the inputs and targets, so there should be no mismatch. I tried to run the below (slightly modified) sample program from http://emergent.brynmawr.edu/eprg/?page=PyroConx but it gets a similar error, also below. This is all under conx.py 1.230. What do you think the problem is? Thanks for your help, Anthony **** from conx import SRN n = SRN() # Sequence is automatically used when the input pattern is # larger than the input layer: 1 input, but input pattern has # more elements n.addLayer('input', 1) n.addContextLayer('context', 5) n.addLayer('hidden', 5) n.addLayer('output', 1) n.connect('input', 'hidden') n.connect('context', 'hidden') n.connect('hidden', 'output') n.setInputs([[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]]) n.setOutputs([[0.0], [1.0], [1.0], [0.0]]) n.setSequenceType("random-segmented") n.setReportRate(100) n.setResetEpoch(10000) n.setTolerance(.4) n.reset() n.setEpsilon(1.5) n.setMomentum(.9) n.train() Conx, version 1.230 (psyco enabled) Conx using seed: 1157013335.09 Initializing 'Simple Recurrent Network' weights... Traceback (most recent call last): File "train_fsax.py", line 33, in ? n.train() File "/home/anthonyu/Projects/thesis/conx.py", line 1682, in train (tssErr, totalCorrect, totalCount, totalPCorrect) = self.sweep() File "/home/anthonyu/Projects/thesis/conx.py", line 1817, in sweep (error, correct, total, pcorrect) = self.step( **datum ) File "/home/anthonyu/Projects/thesis/conx.py", line 3488, in step retvals = self.networkStep(**dict) File "/home/anthonyu/Projects/thesis/conx.py", line 3500, in networkStep return Network.step(self, **args) File "/home/anthonyu/Projects/thesis/conx.py", line 1768, in step (error, correct, total, pcorrect) = self.backprop(**args) # compute_error() File "/home/anthonyu/Projects/thesis/conx.py", line 3393, in backprop retval = Network.backprop(self, **args) File "/home/anthonyu/Projects/thesis/conx.py", line 2170, in backprop retval = self.compute_error(**args) File "/home/anthonyu/Projects/thesis/conx.py", line 2336, in compute_error self.copyTargets(layer, args[key]) File "/home/anthonyu/Projects/thesis/conx.py", line 1421, in copyTargets layer.copyTargets(vector[start:start+layer.size]) File "/home/anthonyu/Projects/thesis/conx.py", line 555, in copyTargets raise LayerError, \ conx.LayerError: ('Mismatched target size and layer size in call to copyTargets()', (0, 1)) Douglas S. Blank wrote: > Anthony, > > I tried the following and it seemed to work. (I used the shorter version > of addLayer, because I wasn't sure what the "conx" object was in your > sample code): > > from pyrobot.brain.conx import SRN, loadNetworkFromFile > > length = 62 # length of patterns > sequence = 2 # length of sequence > def makePattern(i): > pat = [0.0] * length > pat[i % length] = 1.0 > return pat > def makePatternDict(): > d = {} > for i in range(length): > d[str(i)] = makePattern(i) > return d > > srn = SRN() > srn.setSequenceType("random-segmented") > srn.learnDuringSequence = True > srn.associate("input", "output") > srn.addLayer("input", 62) > srn.addContextLayer("context", 128, "hidden") > srn.addLayer("hidden", 128) > srn.addLayer("output", 62) > srn.connect("input", "hidden") > srn.connect("context", "hidden") > srn.connect("hidden", "output") > patterns = makePatternDict() > inputs = [makePattern(i) + makePattern(i + 1) for i in range(length)] > targets = [makePattern(i + 1) + makePattern(i + 2) for i in range(length)] > srn.setPatterns(patterns) > srn.setInputs(inputs) > srn.setOutputs(targets) > srn.setReportRate(1) > srn.setEpsilon(1) > srn.setMomentum(.5) > srn.train(5) > > srn.saveNetworkToFile("srn.dat") > > srn2 = loadNetworkFromFile("srn.dat.pickle") > srn2.learning = 0 > srn2.interactive = 1 > print srn2.sweep() > > > Mine would take a while to train. One thing that might cause problem is > that you create "srn", but then use "wordnet" when testing. > > I'm using Conx version 1.227. > > -Doug > > Anthony D. Urso wrote: >> I am trying to wire up an SRN with conx such that it is able to exploit >> the context of the previous letter in order to disambiguate the current >> letter during handwriting recognition. >> >> I have an idea about how to accomplish this, but I don't know if I am >> coding it correctly for conx. >> >> Here is the relevant code: >> >> srn = SRN() >> >> srn.setSequenceType("random-segmented") >> srn.learnDuringSequence = True >> >> # I tried "predict" here instead, but it was not able to learn >> # and I don't really want to predict anything >> srn.associate("input", "output") >> >> srn.add(conx.Layer("input", 62)) >> srn.addContextLayer("context", 128, "hidden") >> srn.add(conx.Layer("hidden", 128)) >> srn.add(conx.Layer("output", 62)) >> >> srn.connect("input", "hidden") >> # I also tried connecting the context directly to output, >> # no difference >> srn.connect("context", "hidden") >> srn.connect("hidden", "output") >> >> srn.setPatterns(patterns) >> srn.setInputs(inputs) >> srn.setOutputs(targets) >> >> srn.setReportRate(1) >> srn.setEpsilon(1) >> srn.setMomentum(.5) >> srn.train(500) >> >> Using patterns, I train that network on 2000 common English words and >> some number strings. The inputs are 62 dimensional vectors expressing >> how closely the given character is to the ideal for each letter. During >> training, I only use the ideal letters. >> >> Then to test, I do: >> >> srn = conx.loadNetworkFromFile("srn.dat.pickle") >> srn.learning = 0 >> >> for char in chars: >> srn.step(input = char) >> print wordnet["context"].getActivationsList() >> print wordnet["output"].getActivationsList() >> >> The network is able to quickly train to 100% correct, but it is unable >> to generalize, or even show any context changes on the inputs it has >> trained on. >> >> For instance, even though the context layer changes, the output >> activation for an ambiguous vertical line (perhaps an "l" or a "1") is >> exactly the same if it is preceded by an "a" or a "2." This leads me to >> believe that the context to hidden weights are being ignored either >> during training or for the step(input = char) above. >> >> I am not currently using propagate() for testing, since it seems to want >> patterns, and the handwritten letters I am testing against are too >> irregular to reasonably make patterns for. >> >> I am using conx.py version 1.201. >> >> I guess the big question I have would be how to call propagate() >> without using patterns. I have been doing so in the Network class, >> but it raises an exception in the SRN class: >> >> Traceback (most recent call last): >> File "recognize.py", line 62, in ? >> srn.propagate(input = char) >> File "conx.py", line 3055, in propagate >> return Network.propagate(self, **args) >> File "conx.py", line 1778, in propagate >> self.verifyInputs() # better have inputs set >> File "conx.py", line 1408, in verifyInputs >> raise LayerError, "Inputs are not set and verifyInputs() was >> called on layer '%s'." % layer.name >> conx.LayerError: Inputs are not set and verifyInputs() was called on >> layer 'context'. >> >> Using the step() method with the same input does not raise any >> exceptions. >> >> I'm sure that I have left something out of the code, or misunderstood >> the purpose of something. Any help would be appreciated. >> >> Thanks, >> Anthony >> >> _______________________________________________ >> Pyro-users mailing list >> Pyro-users@emergent.brynmawr.edu >> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users >> >> > > From dblank at brynmawr.edu Thu Aug 31 12:52:45 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Aug 31 12:53:56 2006 Subject: [Pyro-users] My conx SRN is ignoring the context layer In-Reply-To: <44F6711B.9090001@ucla.edu> References: <44DCE97C.1000600@ucla.edu> <44EE0534.80709@brynmawr.edu> <44F6711B.9090001@ucla.edu> Message-ID: <44F713DD.4010103@brynmawr.edu> Anthony D. Urso wrote: > Thank you for the hints. > > I've changed my tack and I have started a simpler project in order to > learn the API. My program is now getting the error: > > conx.LayerError: ('Mismatched target size and layer size in call to > copyTargets()', (91, 1)) > > which is weird, since those sizes match the length of the inputs and > targets, so there should be no mismatch. > > I tried to run the below (slightly modified) sample program from > http://emergent.brynmawr.edu/eprg/?page=PyroConx but it gets a similar > error, also below. Anthony, You're welcome! First, you are looking at some outdated docs there. You should be looking at: http://pyrorobotics.org/?page=PyroModulesContents especially, section 8, PyroModuleNeuralNetworks. There was an assumption in the newest conx that the number of outputs would match the number of inputs in sequences. (I think that this may have been a very new assumption resulting in the changes last week to clean up the code in the SRN.step() method.) But, if you just add a target value for each of your inputs, your code would run. For example: n.setOutputs([[0.0, 0.0], [1.0, 1.0], [1.0, 1.0], [0.0, 0.0]]) However, that probably won't learn. Your epsilon is probably way too big (1.5) and the default is to have n.learnDuringSequence = 1, which would be very confusing for this sequence. Here is a silightly updated version that depends on a slight change in CVS to handle the static output target that should be able to learn XOR in time: from pyrobot.brain.conx import SRN n = SRN() # Sequence is automatically used when the input pattern is # larger than the input layer: 1 input, but input pattern has # more elements n.addLayer('input', 1) n.addContextLayer('context', 10) n.addLayer('hidden', 10) n.addLayer('output', 1) n.connect('input', 'hidden') n.connect('context', 'hidden') n.connect('hidden', 'output') n.setInputs([[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]]) n.setOutputs([[0.0], [1.0], [1.0], [0.0]]) n.setSequenceType("random-segmented") n.setReportRate(100) n.setResetEpoch(10000) n.setTolerance(.4) n.setEpsilon(.5) n.setMomentum(0.0) n.learnDuringSequence = 0 n.train() It is still running on my computer. I suspect some slight variation (epsilon, hidden size, etc) should learn this. I know I've done this before, so if you can't get it, something is wrong. -Doug > This is all under conx.py 1.230. > > What do you think the problem is? > > Thanks for your help, > Anthony > > **** > > from conx import SRN > > n = SRN() > # Sequence is automatically used when the input pattern is > # larger than the input layer: 1 input, but input pattern has > # more elements > n.addLayer('input', 1) > n.addContextLayer('context', 5) > n.addLayer('hidden', 5) > n.addLayer('output', 1) > > n.connect('input', 'hidden') > n.connect('context', 'hidden') > n.connect('hidden', 'output') > > n.setInputs([[0.0, 0.0], > [0.0, 1.0], > [1.0, 0.0], > [1.0, 1.0]]) > > n.setOutputs([[0.0], > [1.0], > [1.0], > [0.0]]) > > n.setSequenceType("random-segmented") > n.setReportRate(100) > n.setResetEpoch(10000) > n.setTolerance(.4) > n.reset() > n.setEpsilon(1.5) > n.setMomentum(.9) > n.train() > > Conx, version 1.230 (psyco enabled) > Conx using seed: 1157013335.09 > Initializing 'Simple Recurrent Network' weights... > Traceback (most recent call last): > File "train_fsax.py", line 33, in ? > n.train() > File "/home/anthonyu/Projects/thesis/conx.py", line 1682, in train > (tssErr, totalCorrect, totalCount, totalPCorrect) = self.sweep() > File "/home/anthonyu/Projects/thesis/conx.py", line 1817, in sweep > (error, correct, total, pcorrect) = self.step( **datum ) > File "/home/anthonyu/Projects/thesis/conx.py", line 3488, in step > retvals = self.networkStep(**dict) > File "/home/anthonyu/Projects/thesis/conx.py", line 3500, in networkStep > return Network.step(self, **args) > File "/home/anthonyu/Projects/thesis/conx.py", line 1768, in step > (error, correct, total, pcorrect) = self.backprop(**args) # > compute_error() > File "/home/anthonyu/Projects/thesis/conx.py", line 3393, in backprop > retval = Network.backprop(self, **args) > File "/home/anthonyu/Projects/thesis/conx.py", line 2170, in backprop > retval = self.compute_error(**args) > File "/home/anthonyu/Projects/thesis/conx.py", line 2336, in > compute_error > self.copyTargets(layer, args[key]) > File "/home/anthonyu/Projects/thesis/conx.py", line 1421, in copyTargets > layer.copyTargets(vector[start:start+layer.size]) > File "/home/anthonyu/Projects/thesis/conx.py", line 555, in copyTargets > raise LayerError, \ > conx.LayerError: ('Mismatched target size and layer size in call to > copyTargets()', (0, 1)) > > Douglas S. Blank wrote: > >> Anthony, >> >> I tried the following and it seemed to work. (I used the shorter >> version of addLayer, because I wasn't sure what the "conx" object was >> in your sample code): >> >> from pyrobot.brain.conx import SRN, loadNetworkFromFile >> >> length = 62 # length of patterns >> sequence = 2 # length of sequence >> def makePattern(i): >> pat = [0.0] * length >> pat[i % length] = 1.0 >> return pat >> def makePatternDict(): >> d = {} >> for i in range(length): >> d[str(i)] = makePattern(i) >> return d >> >> srn = SRN() >> srn.setSequenceType("random-segmented") >> srn.learnDuringSequence = True >> srn.associate("input", "output") >> srn.addLayer("input", 62) >> srn.addContextLayer("context", 128, "hidden") >> srn.addLayer("hidden", 128) >> srn.addLayer("output", 62) >> srn.connect("input", "hidden") >> srn.connect("context", "hidden") >> srn.connect("hidden", "output") >> patterns = makePatternDict() >> inputs = [makePattern(i) + makePattern(i + 1) for i in range(length)] >> targets = [makePattern(i + 1) + makePattern(i + 2) for i in >> range(length)] >> srn.setPatterns(patterns) >> srn.setInputs(inputs) >> srn.setOutputs(targets) >> srn.setReportRate(1) >> srn.setEpsilon(1) >> srn.setMomentum(.5) >> srn.train(5) >> >> srn.saveNetworkToFile("srn.dat") >> >> srn2 = loadNetworkFromFile("srn.dat.pickle") >> srn2.learning = 0 >> srn2.interactive = 1 >> print srn2.sweep() >> >> >> Mine would take a while to train. One thing that might cause problem >> is that you create "srn", but then use "wordnet" when testing. >> >> I'm using Conx version 1.227. >> >> -Doug >> >> Anthony D. Urso wrote: >> >>> I am trying to wire up an SRN with conx such that it is able to exploit >>> the context of the previous letter in order to disambiguate the current >>> letter during handwriting recognition. >>> >>> I have an idea about how to accomplish this, but I don't know if I am >>> coding it correctly for conx. >>> >>> Here is the relevant code: >>> >>> srn = SRN() >>> >>> srn.setSequenceType("random-segmented") >>> srn.learnDuringSequence = True >>> >>> # I tried "predict" here instead, but it was not able to learn >>> # and I don't really want to predict anything >>> srn.associate("input", "output") >>> >>> srn.add(conx.Layer("input", 62)) >>> srn.addContextLayer("context", 128, "hidden") >>> srn.add(conx.Layer("hidden", 128)) >>> srn.add(conx.Layer("output", 62)) >>> >>> srn.connect("input", "hidden") >>> # I also tried connecting the context directly to output, >>> # no difference >>> srn.connect("context", "hidden") >>> srn.connect("hidden", "output") >>> >>> srn.setPatterns(patterns) >>> srn.setInputs(inputs) >>> srn.setOutputs(targets) >>> >>> srn.setReportRate(1) >>> srn.setEpsilon(1) >>> srn.setMomentum(.5) >>> srn.train(500) >>> >>> Using patterns, I train that network on 2000 common English words and >>> some number strings. The inputs are 62 dimensional vectors expressing >>> how closely the given character is to the ideal for each letter. During >>> training, I only use the ideal letters. >>> >>> Then to test, I do: >>> >>> srn = conx.loadNetworkFromFile("srn.dat.pickle") >>> srn.learning = 0 >>> >>> for char in chars: >>> srn.step(input = char) >>> print wordnet["context"].getActivationsList() >>> print wordnet["output"].getActivationsList() >>> >>> The network is able to quickly train to 100% correct, but it is unable >>> to generalize, or even show any context changes on the inputs it has >>> trained on. >>> >>> For instance, even though the context layer changes, the output >>> activation for an ambiguous vertical line (perhaps an "l" or a "1") is >>> exactly the same if it is preceded by an "a" or a "2." This leads me to >>> believe that the context to hidden weights are being ignored either >>> during training or for the step(input = char) above. >>> >>> I am not currently using propagate() for testing, since it seems to want >>> patterns, and the handwritten letters I am testing against are too >>> irregular to reasonably make patterns for. >>> >>> I am using conx.py version 1.201. >>> >>> I guess the big question I have would be how to call propagate() >>> without using patterns. I have been doing so in the Network class, >>> but it raises an exception in the SRN class: >>> >>> Traceback (most recent call last): >>> File "recognize.py", line 62, in ? >>> srn.propagate(input = char) >>> File "conx.py", line 3055, in propagate >>> return Network.propagate(self, **args) >>> File "conx.py", line 1778, in propagate >>> self.verifyInputs() # better have inputs set >>> File "conx.py", line 1408, in verifyInputs >>> raise LayerError, "Inputs are not set and verifyInputs() was >>> called on layer '%s'." % layer.name >>> conx.LayerError: Inputs are not set and verifyInputs() was called on >>> layer 'context'. >>> >>> Using the step() method with the same input does not raise any >>> exceptions. >>> >>> I'm sure that I have left something out of the code, or misunderstood >>> the purpose of something. Any help would be appreciated. >>> >>> Thanks, >>> Anthony >>> >>> _______________________________________________ >>> Pyro-users mailing list >>> Pyro-users@emergent.brynmawr.edu >>> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users >>> >>> >> >> > > -- Douglas S. Blank Computer Science Assistant Professor Bryn Mawr College (610)526-6501 http://cs.brynmawr.edu/~dblank From anthonyu at ucla.edu Thu Aug 31 16:17:47 2006 From: anthonyu at ucla.edu (Anthony D. Urso) Date: Thu Aug 31 16:17:49 2006 Subject: [Pyro-users] My conx SRN is ignoring the context layer In-Reply-To: <44F713DD.4010103@brynmawr.edu> References: <44DCE97C.1000600@ucla.edu> <44EE0534.80709@brynmawr.edu> <44F6711B.9090001@ucla.edu> <44F713DD.4010103@brynmawr.edu> Message-ID: <44F743EB.6010404@ucla.edu> Douglas S. Blank wrote: > Anthony, > > You're welcome! > > First, you are looking at some outdated docs there. You should be > looking at: > > http://pyrorobotics.org/?page=PyroModulesContents > > especially, section 8, PyroModuleNeuralNetworks. > > There was an assumption in the newest conx that the number of outputs > would match the number of inputs in sequences. (I think that this may > have been a very new assumption resulting in the changes last week to > clean up the code in the SRN.step() method.) I see. I actually wanted to have equal length inputs and targets, but the example from those old docs made me think it was not the correct way to go about it. But, I think I'm closing in on the real problem now. The SRN class wants the argument to the setInputs method to look like: [[...],[...],...] But I'm trying to feed it a list of variable-length sequences of vectors which looks like this: [[[...],[...],...],[[...],[...]],...] The former is a list of sequences, which should work just fine. The problem is that, in my case, these latter sequences are also lists since they consist of raw input layer activations. A totally nonsense example of what I'm currently trying to do: n.addLayer('input', 2) n.addContextLayer('context', 10) n.addLayer('hidden', 10) n.addLayer('output', 1) n.setInputs([[[0, 1], [2, 3]], [[0, 1], [2, 3], [4, 5]] [[0, 1]]]) n.setOutputs([[1, 3], [1, 3, 5] [1]]) What is the correct way to set such inputs and outputs? Thanks, Anthony > But, if you just add a target value for each of your inputs, your code > would run. For example: > > n.setOutputs([[0.0, 0.0], > [1.0, 1.0], > [1.0, 1.0], > [0.0, 0.0]]) > > However, that probably won't learn. Your epsilon is probably way too big > (1.5) and the default is to have n.learnDuringSequence = 1, which would > be very confusing for this sequence. > > Here is a silightly updated version that depends on a slight change in > CVS to handle the static output target that should be able to learn XOR > in time: > > from pyrobot.brain.conx import SRN > n = SRN() > # Sequence is automatically used when the input pattern is > # larger than the input layer: 1 input, but input pattern has > # more elements > n.addLayer('input', 1) > n.addContextLayer('context', 10) > n.addLayer('hidden', 10) > n.addLayer('output', 1) > > n.connect('input', 'hidden') > n.connect('context', 'hidden') > n.connect('hidden', 'output') > > n.setInputs([[0.0, 0.0], > [0.0, 1.0], > [1.0, 0.0], > [1.0, 1.0]]) > > n.setOutputs([[0.0], > [1.0], > [1.0], > [0.0]]) > > n.setSequenceType("random-segmented") > n.setReportRate(100) > n.setResetEpoch(10000) > n.setTolerance(.4) > n.setEpsilon(.5) > n.setMomentum(0.0) > n.learnDuringSequence = 0 > n.train() > > It is still running on my computer. I suspect some slight variation > (epsilon, hidden size, etc) should learn this. I know I've done this > before, so if you can't get it, something is wrong. > > -Doug > >> This is all under conx.py 1.230. >> >> What do you think the problem is? >> >> Thanks for your help, >> Anthony >> >> **** >> >> from conx import SRN >> >> n = SRN() >> # Sequence is automatically used when the input pattern is >> # larger than the input layer: 1 input, but input pattern has >> # more elements >> n.addLayer('input', 1) >> n.addContextLayer('context', 5) >> n.addLayer('hidden', 5) >> n.addLayer('output', 1) >> >> n.connect('input', 'hidden') >> n.connect('context', 'hidden') >> n.connect('hidden', 'output') >> >> n.setInputs([[0.0, 0.0], >> [0.0, 1.0], >> [1.0, 0.0], >> [1.0, 1.0]]) >> >> n.setOutputs([[0.0], >> [1.0], >> [1.0], >> [0.0]]) >> >> n.setSequenceType("random-segmented") >> n.setReportRate(100) >> n.setResetEpoch(10000) >> n.setTolerance(.4) >> n.reset() >> n.setEpsilon(1.5) >> n.setMomentum(.9) >> n.train() >> >> Conx, version 1.230 (psyco enabled) >> Conx using seed: 1157013335.09 >> Initializing 'Simple Recurrent Network' weights... >> Traceback (most recent call last): >> File "train_fsax.py", line 33, in ? >> n.train() >> File "/home/anthonyu/Projects/thesis/conx.py", line 1682, in train >> (tssErr, totalCorrect, totalCount, totalPCorrect) = self.sweep() >> File "/home/anthonyu/Projects/thesis/conx.py", line 1817, in sweep >> (error, correct, total, pcorrect) = self.step( **datum ) >> File "/home/anthonyu/Projects/thesis/conx.py", line 3488, in step >> retvals = self.networkStep(**dict) >> File "/home/anthonyu/Projects/thesis/conx.py", line 3500, in >> networkStep >> return Network.step(self, **args) >> File "/home/anthonyu/Projects/thesis/conx.py", line 1768, in step >> (error, correct, total, pcorrect) = self.backprop(**args) # >> compute_error() >> File "/home/anthonyu/Projects/thesis/conx.py", line 3393, in backprop >> retval = Network.backprop(self, **args) >> File "/home/anthonyu/Projects/thesis/conx.py", line 2170, in backprop >> retval = self.compute_error(**args) >> File "/home/anthonyu/Projects/thesis/conx.py", line 2336, in >> compute_error >> self.copyTargets(layer, args[key]) >> File "/home/anthonyu/Projects/thesis/conx.py", line 1421, in >> copyTargets >> layer.copyTargets(vector[start:start+layer.size]) >> File "/home/anthonyu/Projects/thesis/conx.py", line 555, in copyTargets >> raise LayerError, \ >> conx.LayerError: ('Mismatched target size and layer size in call to >> copyTargets()', (0, 1)) >> >> Douglas S. Blank wrote: >> >>> Anthony, >>> >>> I tried the following and it seemed to work. (I used the shorter >>> version of addLayer, because I wasn't sure what the "conx" object was >>> in your sample code): >>> >>> from pyrobot.brain.conx import SRN, loadNetworkFromFile >>> >>> length = 62 # length of patterns >>> sequence = 2 # length of sequence >>> def makePattern(i): >>> pat = [0.0] * length >>> pat[i % length] = 1.0 >>> return pat >>> def makePatternDict(): >>> d = {} >>> for i in range(length): >>> d[str(i)] = makePattern(i) >>> return d >>> >>> srn = SRN() >>> srn.setSequenceType("random-segmented") >>> srn.learnDuringSequence = True >>> srn.associate("input", "output") >>> srn.addLayer("input", 62) >>> srn.addContextLayer("context", 128, "hidden") >>> srn.addLayer("hidden", 128) >>> srn.addLayer("output", 62) >>> srn.connect("input", "hidden") >>> srn.connect("context", "hidden") >>> srn.connect("hidden", "output") >>> patterns = makePatternDict() >>> inputs = [makePattern(i) + makePattern(i + 1) for i in range(length)] >>> targets = [makePattern(i + 1) + makePattern(i + 2) for i in >>> range(length)] >>> srn.setPatterns(patterns) >>> srn.setInputs(inputs) >>> srn.setOutputs(targets) >>> srn.setReportRate(1) >>> srn.setEpsilon(1) >>> srn.setMomentum(.5) >>> srn.train(5) >>> >>> srn.saveNetworkToFile("srn.dat") >>> >>> srn2 = loadNetworkFromFile("srn.dat.pickle") >>> srn2.learning = 0 >>> srn2.interactive = 1 >>> print srn2.sweep() >>> >>> >>> Mine would take a while to train. One thing that might cause problem >>> is that you create "srn", but then use "wordnet" when testing. >>> >>> I'm using Conx version 1.227. >>> >>> -Doug >>> >>> Anthony D. Urso wrote: >>> >>>> I am trying to wire up an SRN with conx such that it is able to exploit >>>> the context of the previous letter in order to disambiguate the current >>>> letter during handwriting recognition. >>>> >>>> I have an idea about how to accomplish this, but I don't know if I am >>>> coding it correctly for conx. >>>> >>>> Here is the relevant code: >>>> >>>> srn = SRN() >>>> >>>> srn.setSequenceType("random-segmented") >>>> srn.learnDuringSequence = True >>>> >>>> # I tried "predict" here instead, but it was not able to learn >>>> # and I don't really want to predict anything >>>> srn.associate("input", "output") >>>> >>>> srn.add(conx.Layer("input", 62)) >>>> srn.addContextLayer("context", 128, "hidden") >>>> srn.add(conx.Layer("hidden", 128)) >>>> srn.add(conx.Layer("output", 62)) >>>> >>>> srn.connect("input", "hidden") >>>> # I also tried connecting the context directly to output, >>>> # no difference >>>> srn.connect("context", "hidden") >>>> srn.connect("hidden", "output") >>>> >>>> srn.setPatterns(patterns) >>>> srn.setInputs(inputs) >>>> srn.setOutputs(targets) >>>> >>>> srn.setReportRate(1) >>>> srn.setEpsilon(1) >>>> srn.setMomentum(.5) >>>> srn.train(500) >>>> >>>> Using patterns, I train that network on 2000 common English words and >>>> some number strings. The inputs are 62 dimensional vectors expressing >>>> how closely the given character is to the ideal for each letter. >>>> During >>>> training, I only use the ideal letters. >>>> >>>> Then to test, I do: >>>> >>>> srn = conx.loadNetworkFromFile("srn.dat.pickle") >>>> srn.learning = 0 >>>> >>>> for char in chars: >>>> srn.step(input = char) >>>> print wordnet["context"].getActivationsList() >>>> print wordnet["output"].getActivationsList() >>>> >>>> The network is able to quickly train to 100% correct, but it is unable >>>> to generalize, or even show any context changes on the inputs it has >>>> trained on. >>>> >>>> For instance, even though the context layer changes, the output >>>> activation for an ambiguous vertical line (perhaps an "l" or a "1") is >>>> exactly the same if it is preceded by an "a" or a "2." This leads >>>> me to >>>> believe that the context to hidden weights are being ignored either >>>> during training or for the step(input = char) above. >>>> >>>> I am not currently using propagate() for testing, since it seems to >>>> want >>>> patterns, and the handwritten letters I am testing against are too >>>> irregular to reasonably make patterns for. >>>> >>>> I am using conx.py version 1.201. >>>> >>>> I guess the big question I have would be how to call propagate() >>>> without using patterns. I have been doing so in the Network class, >>>> but it raises an exception in the SRN class: >>>> >>>> Traceback (most recent call last): >>>> File "recognize.py", line 62, in ? >>>> srn.propagate(input = char) >>>> File "conx.py", line 3055, in propagate >>>> return Network.propagate(self, **args) >>>> File "conx.py", line 1778, in propagate >>>> self.verifyInputs() # better have inputs set >>>> File "conx.py", line 1408, in verifyInputs >>>> raise LayerError, "Inputs are not set and verifyInputs() was >>>> called on layer '%s'." % layer.name >>>> conx.LayerError: Inputs are not set and verifyInputs() was called on >>>> layer 'context'. >>>> >>>> Using the step() method with the same input does not raise any >>>> exceptions. >>>> >>>> I'm sure that I have left something out of the code, or misunderstood >>>> the purpose of something. Any help would be appreciated. >>>> >>>> Thanks, >>>> Anthony >>>> >>>> _______________________________________________ >>>> Pyro-users mailing list >>>> Pyro-users@emergent.brynmawr.edu >>>> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users >>>> >>>> >>> >>> >> >> > >