TB3 Movidius Neural Compute Stick
From wikidb
Depreciated 2018
References
Movidius Install
Movidius Background
- NCS: Neural Compute Stick
- Movidius Developer Site
- NCS Forum
- Movidius NCS on the PI 3 There are good reference on here to follow up.
- Object Detection Example Code
- Tensorflow Example from Intel
- Deploying Custom Caffe Model
- Tensorflow on Movidius
- Tensorflow Image Recongniton
- Machine Learning Meetup about Movidius
On Dual Boot
Install
Step 2
mkdir -p ~/workspace cd ~/workspace git clone https://github.com/movidius/ncsdk.git cd ~/workspace/ncsdk make install ... Successfully installed mvnc-1.12.0.1 You are using pip version 8.1.1, however version 10.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Processing /opt/movidius/NCSDK/ncsdk-x86_64/api Installing collected packages: mvnc Running setup.py install for mvnc: started Running setup.py install for mvnc: finished with status 'done' Successfully installed mvnc-1.12.0.1 You are using pip version 8.1.1, however version 10.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. NCS Libraries have been installed in /usr/local/lib NCS Toolkit binaries have been installed in /usr/local/bin NCS Include files have been installed in /usr/local/include NCS Python API has been installed in /opt/movidius, and PYTHONPATH environment variable updated Updating udev rules... Adding user 'eepp' to 'users' group Setup is complete. The PYTHONPATH enviroment variable was added to your .bashrc as described in the Caffe documentation. Keep in mind that only newly spawned terminals can see this variable! This means that you need to open a new terminal in order to be able to use the NCSDK. Please provide feedback in our support forum if you encountered difficulties.
USB
Initial and after NCS plugin lsusb
lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 005: ID 04f3:2494 Elan Microelectronics Corp. Bus 001 Device 004: ID 8087:0a2a Intel Corp. Bus 001 Device 003: ID 0bda:58c2 Realtek Semiconductor Corp. Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 005: ID 04f3:2494 Elan Microelectronics Corp. Bus 001 Device 004: ID 8087:0a2a Intel Corp. Bus 001 Device 003: ID 0bda:58c2 Realtek Semiconductor Corp. Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 006: ID 03e7:2150 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Tests
Python
$ cd ~/workspace/ncsdk/examples/apps/hello_ncs_py/ $ python hello_ncs.py Hello NCS! Device opened normally. Goodbye NCS! Device closed normally. NCS device working.
C++
$ cd ../hello_ncs_cpp/cpp/ $ ./hello_ncs_cpp Hello NCS! Device opened normally. Goodbye NCS! Device Closed normally. NCS device working.
Examples
Step 3
- Restarted terminal
- Plugged in the NCS
cd ~/workspace/ncsdk make examples ... m2col_v2, because its output is used in concat Layer InceptionV1/InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/Relu forced to im2col_v2, because its output is used in concat /usr/local/bin/ncsdk/Controllers/FileIO.py:52: UserWarning: You are using a large type. Consider reducing your data sizes for best performance "Consider reducing your data sizes for best performance\033[0m") USB: Transferring Data... USB: Myriad Execution Finished USB: Myriad Connection Closing. USB: Myriad Connection Closed. Result: Validation Pass Result: (1, 1, 1001) 1) 829 1.0 Expected: (1, 1, 1, 1001) 1) 829 0.999999 ------------------------------------------------------------ Obtained values ------------------------------------------------------------ Obtained Min Pixel Accuracy: 7.152562488954572e-05% (max allowed=2%), Pass Obtained Average Pixel Accuracy: 1.4048030516633503e-07% (max allowed=1%), Pass Obtained Percentage of wrong values: 0.0% (max allowed=0%), Pass Obtained Pixel-wise L2 error: 2.8985500054121263e-06% (max allowed=1%), Pass Obtained Global Sum Difference: 1.4062068203202216e-06 ------------------------------------------------------------ test -f graph || mvNCCompile -s 12 output/inception-v1.meta -in=input -on=InceptionV1/Logits/Predictions/Reshape_1 make[3]: Leaving directory '/home/eepp/workspace/ncsdk/examples/tensorflow/inception_v1' make[2]: Leaving directory '/home/eepp/workspace/ncsdk/examples/tensorflow' make -C data/. make[2]: Entering directory '/home/eepp/workspace/ncsdk/examples/data' Possible Make targets make help - shows this message make clean - Removes all temp files from all directories make[2]: Leaving directory '/home/eepp/workspace/ncsdk/examples/data' make[1]: Leaving directory '/home/eepp/workspace/ncsdk/examples'
- df puts us at 13%
Make GoogLeNet
- Error while "making run". Not sure which makes should be run and what they do. See README.md.
eepp@TB3Dell:~/workspace/ncsdk/examples/caffe/GoogLeNet$ make run making prereqs (cd ../../data/ilsvrc12; make) make[1]: Entering directory '/home/eepp/workspace/ncsdk/examples/data/ilsvrc12' make[1]: Leaving directory '/home/eepp/workspace/ncsdk/examples/data/ilsvrc12' making prototxt Prototxt file already exists making caffemodel caffemodel file already exists making compile mvNCCompile -w bvlc_googlenet.caffemodel -s 12 deploy.prototxt mvNCCompile v02.00, Copyright @ Movidius Ltd 2016 ... making run ./run.py Traceback (most recent call last): File "./run.py", line 22, in <module> import cv2 ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type Makefile:91: recipe for target 'run' failed make: *** [run] Error 1
Run GoogLetNet
- "python run.py" works and gives the correct results from these images. See below.
- "./run.py" fails. See below
eepp@TB3Dell:~/workspace/ncsdk/examples/caffe/GoogLeNet$ ls ../../data/images/ 512_Amplifier.jpg 512_Remote.jpg nps_electric_guitar.png 512_Ball.jpg 512_Sink.jpg nps_guac.png 512_Cellphone.jpg 512_Slippers.jpg nps_keyboard.png 512_ElectricGuitar.jpg cat.jpg nps_mouse.png 512_InkjetPrinter.jpg nps_acoustic_guitar.png nps_mug.png 512_LaserPrinter.jpg nps_backpack.png nps_screwdriver.png 512_Monitor.jpg nps_baseball.png 512_Phone.jpg nps_chair.png
epp@TB3Dell:~/workspace/ncsdk/examples/caffe/GoogLeNet$ python run.py Device 0 Address: 2 - VID/PID 03e7:2150 Starting wait for connect with 2000ms timeout Found Address: 2 - VID/PID 03e7:2150 Found EP 0x81 : max packet size is 512 bytes Found EP 0x01 : max packet size is 512 bytes Found and opened device Performing bulk write of 865724 bytes... Successfully sent 865724 bytes of data in 90.766466 ms (9.096077 MB/s) Boot successful, device address 2 Found Address: 2 - VID/PID 03e7:f63b done Booted 2 -> VSC ------- predictions -------- prediction 0 (probability 0.99609) is n03272010 electric guitar label index is: 546 prediction 1 (probability 0.0035095) is n02676566 acoustic guitar label index is: 402 prediction 2 (probability 0.0) is n02396427 wild boar, boar, Sus scrofa label index is: 342 prediction 3 (probability 0.0) is n02391049 zebra label index is: 340 prediction 4 (probability 0.0) is n02389026 sorrel label index is: 339
eepp@TB3Dell:~/workspace/ncsdk/examples/caffe/GoogLeNet$ ./run.py Traceback (most recent call last): File "./run.py", line 22, in <module> import cv2 ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type
Use eog to view emages.
Tensorflow
cd ~/workspace/ncsdk/examples/tensorflow/inception_v3
make all Layer InceptionV3/InceptionV3/Mixed_7c/Branch_3/Conv2d_0b_1x1/Relu forced to im2col_v2, because its output is used in concat /usr/local/bin/ncsdk/Controllers/FileIO.py:52: UserWarning: You are using a large type. Consider reducing your data sizes for best performance "Consider reducing your data sizes for best performance\033[0m") USB: Transferring Data... USB: Myriad Execution Finished USB: Myriad Connection Closing. USB: Myriad Connection Closed. Result: Validation Pass Result: (1, 1, 1001) 1) 917 1.0 Expected: (1, 1, 1, 1001) 1) 917 1.0 ------------------------------------------------------------ Obtained values ------------------------------------------------------------ Obtained Min Pixel Accuracy: 0.0% (max allowed=2%), Pass Obtained Average Pixel Accuracy: 0.0% (max allowed=1%), Pass Obtained Percentage of wrong values: 0.0% (max allowed=0%), Pass Obtained Pixel-wise L2 error: 0.0% (max allowed=1%), Pass Obtained Global Sum Difference: 0.0 ------------------------------------------------------------ test -f graph || mvNCCompile -s 12 output/inception-v3.meta -in=input -on=InceptionV3/Predictions/Reshape_1
Didn't get reasonable results. Should get electric guitar
python run.py ('Number of categories:', 1001) Start download to NCS... ******************************************************************************* inception-v3 on NCS ****************************************************************************** (112, 'nematode, nematode worm, roundworm', 0.021759) (550, 'envelope', 0.017181) (624, 'letter opener, paper knife, paperknife', 0.012436) (474, 'can opener, tin opener', 0.011734) (513, 'corkscrew, bottle screw', 0.010895) ******************************************************************************* Finished
On VirtualBox
Install
mkdir -p ~/workspace cd ~/workspace git clone https://github.com/movidius/ncsdk.git ls cd ~/workspace/ncsdk ls make install ... Successfully installed mvnc-1.12.0.1 You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. NCS Libraries have been installed in /usr/local/lib NCS Toolkit binaries have been installed in /usr/local/bin NCS Include files have been installed in /usr/local/include NCS Python API has been installed in /opt/movidius, and PYTHONPATH environment variable updated Updating udev rules... Adding user 'eepp' to 'users' group Setup is complete. The PYTHONPATH enviroment variable was added to your .bashrc as described in the Caffe documentation. Keep in mind that only newly spawned terminals can see this variable! This means that you need to open a new terminal in order to be able to use the NCSDK. Please provide feedback in our support forum if you encountered difficulties.
Investigating Movidus NCS USB Connection
lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 03e7:2150 Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The 03e7 id is the Movidius driver
lsusb -v -s 1:3 Bus 001 Device 003: ID 03e7:2150 ... idVendor 0x03e7 idProduct 0x2150 bcdDevice 0.01 iManufacturer 1 Movidius Ltd. iProduct 2 Movidius MA2X5X ...
Build Examples
Problem One
cd ~/workspace/ncsdk make examples ... [Error 7] Toolkit Error: USB Failure. Code: No devices found
Fix One
- Macke Examples Error - followed Tome_at_Intel February 8 instructions
cd ncsdk/ make uninstall cd .. rm -rf ncsdk/ git clone https://github.com/movidius/ncsdk cd ncsdk/
Problem Two
making run .... ./run.py Traceback (most recent call last): File "./run.py", line 22, in <module> import cv2 ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type Makefile:91: recipe for target 'run' failed make: *** [run] Error 1
Fix Two
Import Error ROS python3 opencv. ROS creates its own open cv which is compatible with python2 only. I do the following.I followed zishan’s instructions
sudo mv cv2.so cv2_renamed.so
I noticed that the NCS went away during the make run process. It no longer shows up in the lsusb list. I need to go through the VituralBox Devices -> USB menu to re-enable it.
I entered make run again.
Problem Three
make run ... Performing bulk write of 865724 bytes... Successfully sent 865724 bytes of data in 236.494626 ms (3.491068 MB/s) Boot successful, device address 2 Traceback (most recent call last): File "./run.py", line 58, in <module> device.OpenDevice() File "/usr/local/lib/python3.5/dist-packages/mvnc/mvncapi.py", line 147, in OpenDevice raise Exception(Status(status)) Exception: mvncStatus.ERROR Makefile:91: recipe for target 'run' failed make: *** [run] Error 1
lsusb confirms that the Vovidius NCS is not connected
Stalled
Reported at Compatibility of Movidius ncsdk with ROS. Not sure how to approach this. Going to focus here next.