myo-raw
myo-raw copied to clipboard
Error with classify_myo.py
Hi,
When I launch classify_myo.py, this is what I get:
Traceback (most recent call last):
File “classify_myo.py”, line 88, in
No issue with myo_raw.py
Tested on: Myo firmware 0.8.17.2 OSX 10.9.3 & Windows 7
Thank you for your work!
I'm having the same problem. Also thanks for making this. I was starting to regret getting the myo.
This is probably because sklearn is not installed. I intended to make all the scripts do something reasonable without it, but I guess I missed that spot. I've pushed a change that should fix it, though if you're planning to work with the data, sklearn might be useful to have anyway.
Oh, I did install skcit-learn with "pip install scikit-learn" though Is it the same module ?
Hmm, that should work. Does it work to run "from sklearn import neighbors, svm" in an interactive Python shell?
Well, when I ran "from sklearn import neighbors, svm", some modules were missing : scipy and numpy-MKL. I installed these modules and the command runs fine now.
But I still have the same error when I run classify_myo.py
funny, its the same for me as well.
Same thing - noticed that in myo.py
if HAVE_SK and self.X.shape[0] >= 20: self.nn = neighbors.KNeighborsClassifier(n_neighbors=15, algorithm='kd_tree').fit(self.X[::3], self.Y[::3]) else: self.nn = None
here self.X.shape[0] is 0 for me and al lthe vals%d.dat files are all 0. Seems like no data is being picked up.
Tried running myo_raw.py, works fine until I get this error:
ValueError: Cannot configure port, some setting was wrong. Original message: Win dowsError(31, 'A device attached to the system is not functioning.')
at line 51. in myo_raw.py, where self.ser.timeout = None, I changed that to self.ser.timeout = timeout,
I added dsrdtr=1 to self.ser = serial.Serial(port=tty, baudrate=9600, dsrdtr=1) Which makes it seem more stable. Putting the BT under hardware control seems to work better. I get less frequent error 31s.
I then just wrapped self.ser.timeout = timeout into try: self.ser.timeout = timeout except: print('Funny error') pass as a stopgap measure :D
So far so good.
Now for classify... Noticed that self.X.shape[0] >= 20 doesn't really fit 15 neighbors if we're doing self.X[::3], so I set that to self.X.shape[0] >= 50 instead. This makes it work quite well.
Just my 2 cents worth.
I'm having the same isue as parent as well.
Error: using device: /dev/ttyACM1 scanning... scan response: Packet(80, 06, 00, [D2 00 DD 86 1E A9 39 C9 00 FF 15 02 01 06 11 06 42 48 12 4A 7F 2C 48 47 B9 DE 04 A9 01 00 06 D5]) firmware version: 0.8.18.2
Traceback (most recent call last):
File "classify_myo.py", line 89, in
Device: Myo, firmware 0.8.18.2 Python: 2.7.6 scikit-learn (0.15.2) scipy (0.13.3) made sure that Scipy was installed as recommended for Ubuntu 14.04 : http://www.scipy.org/install.html
I'm new to Python (C, C++) and I don't quite understand what's going on in your data structure, or the error is reporting NoneType.
The error is NoneType because m.cls.nn is none, not initialized. If you look at my fork I've put a patch on it.
Awesome, thank you jarrelscy! I'll include that tomorrow when I get back to work. I have some awesome fun times ahead of me!
If you got this problem and you have the sklearn lib installed, then your val_.dat files are corrupted. rm vals_.dat, proceed to comment out the "try: except:" block for importing sklearn(should be at the top of myo.py and classify_myo.py), and replace it by HAVE_SK = False. Proceed to generate the files using classify_myo.py, then revert the changes. Should be a temporary workaround.