I am running on Ubuntu 16.04 with the Neural Compute Stick 2 (NCS2). This post shows my trials and fails as I tried to get the NCS2 up and running. I eventually got it running. I'll create another post that skips over the fails, but this post may be of use.
Table of Contents
- Original Movidius MDK
- Install External Dependencies
- Define Environment Variables
- Configure Model Optimizaer
- Setup Inference on Neural Compute Stick 2
- Setup Vision Accelerator
- Setup to Run Sample App
- Inference Engine Samples
- Download Sample Videos
- Install Pre-Trained Models
- Convert Model to Inference Engine Format
- IMPORTANT UNDOCUMENTED COPY
- SUCESS MYRIAD IS ALIVE
Original Movidius MDK
I started with the original Movidius MDK and didn't have any luck. I switch to OpenVINO and eventually got the NCS2 to run. It looks like the Movidius MDK doesn't support Myriad X. The install completed, but it couldn't connect to the Myriad X. I got the following error:
[Error 7] Toolkit Error: USB Failure. Code: Error opening device
After I installed Ubuntu 16.04 I ran the following steps to the ncsdk2. I repeat, I did not successfully connect to the NCS2 until I switched to openVINO.
sudo apt-get update && sudo apt-get dist-upgrade
sudo apt-get install git
sudo apt-get install nedit
mkdir git-clones
cd git-clones/
git clone -b ncsdk2 https://github.com/movidius/ncsdk.git
cd ncsdk/
make install
export PYTHONPATH="${PYTHONPATH}:/opt/movidius/caffe/python"
make examples
cd /opt/intel/openvino/deployment_tools/model_optimizer/install_prerequisites
sudo ./install_prerequisites.sh
cd /opt/intel/openvino/deployment_tools/demo
./demo_squeezenet_download_convert_run.sh
./demo_security_barrier_camera.sh
sudo usermod -a -G users "$(whoami)"
Install OpenVINO
Follow the OpenVINO Install Guide
Download with OpenVINO with browser.
cd ~/Downloads
tar xvf l_openvino_toolkit_.tgz
cd l_openvino_toolkit_
./install_cv_sdk_dependencies.sh
./install_GUI.sh
Install External Dependencies
cd /opt/intel/openvino/install_dependencies
sudo -E ./install_openvino_dependencies.sh
Define Environment Variables
Add the following to .bashrc.
source /opt/intel/openvino/bin/setupvars.sh
Configure Model Optimizaer
cd /opt/intel/openvino/deployment_tools/model_optimizer/install_prerequisites
sudo ./install_prerequisites.sh
Verify Install
This verifies openVino was installed correctly. It does not use the USB NCS2 Stick.
cd /opt/intel/openvino/deployment_tools/demo
./demo_squeezenet_download_convert_run.sh
Verify Inference Pipeline
This verifies the Inference Pipeline is working correctly. It does not use the USB NCS2 Stick.
cd /opt/intel/openvino/deployment_tools/demo
./demo_security_barrier_camera.sh
Setup Inference on Neural Compute Stick 2
LOAD THE MYRIAD USB RULES.
sudo usermod -a -G users "$(whoami)"
sudo cp /opt/intel/openvino/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo ldconfig
Setup Vision Accelerator
sudo apt install libusb-1.0-0 libboost-program-options1.58.0 libboost-thread1.58.0 libboost-filesystem1.58.0 libssl1.0.0 libudev1 libjson-c2 libelf-dev -y
sudo usermod -a -G users "$(whoami)"
kill -9 $(pidof hddldaemon autoboot)
cd ${HDDL_INSTALL_DIR}/drivers
sudo cp -av ${HDDL_INSTALL_DIR}/etc /
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo ldconfig
Setup to Run Sample App
mkdir ~/squeezenet1.1_FP16
cd ~/squeezenet1.1_FP16
python3 /opt/intel/openvino/deployment_tools/model_optimizer/mo.py --input_model ~/openvino_models/models/FP32/classification/squeezenet/1.1/caffe/squeezenet1.1.caffemodel --data_type FP16 --output_dir .
cp ~/openvino_models/ir/FP32/classification/squeezenet/1.1/caffe/squeezenet1.1.labels .
sudo cp /opt/intel/openvino/deployment_tools/demo/car.png ~/inference_engine_samples_build/intel64/Release
I got the error inference_engine_samples/intel64/Release': No such file or directory. The path should be inference_engine_samples_build/intel64/Release
Inference Engine Samples
Run CMake to create Makefiles and Executables
The executables are in intel64/Release.
mkdir -p ~/ncs2/build
cd ~/ncs2/build
cmake -DCMAKE_BUILD_TYPE=Release $INTEL_OPENVINO_DIR/deployment_tools/inference_engine/samples
Download Sample Videos
cd ~/ncs2/build/intel64/Release/
git clone https://github.com/intel-iot-devkit/sample-videos.git
Install Pre-Trained Models
The instructions say to install these, but they're already installed
sudo -E pip3 install pyyaml requests
$INTEL_OPENVINO_DIR/deployment_tools/tools/model_downloader/downloader.py -h
$INTEL_OPENVINO_DIR/deployment_tools/tools/model_downloader/downloader.py --all
Convert Model to Inference Engine Format
pip3 install -r requirements.txt export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
python3 $INTEL_OPENVINO_DIR/deployment_tools/model_optimizer/mo.py --framework caffe --input_model classification/alexnet/caffe/alexnet.caffemodel
Run Classification Sample
./classification_sample -i sample-images/cat.jpg -m alexnet.xml -nt 5 -d CPU
./classification_sample -i sample-images/cat.jpg -m alexnet.xml -nt 5 -d MYRIAD
The CPU works but MYRIAD generated the following error:
[ ERROR ] Can not init USB device: NC_ERROR
DEBUG
Check if the USB Rules are setup correctly
One of the installation steps create 97-usbboot.rules. Double check to make sure it's correct. It looks correct.
jwrr@jwrr:~/ncs2/builds/intel64/Release$ cat /etc/udev/rules.d/97-myriad-usbboot.rules
SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0660", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0660", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0660", ENV{ID_MM_DEVICE_IGNORE}="1"
Ubuntu See What USB Devices are Connected
Run lsusb to see what USB devices are connected. The first run is with the
NCS2 connected. The second run is without. It looks like Bus 003 Device 011: ID 03e7:2485*
is the NCS2.
Run
jwrr@jwrr:~/ncs2/builds/intel64/Release$ lsusb
Bus 002 Device 004: ID 047b:0011 Silitek Corp. SK-1688U Keyboard
Bus 002 Device 003: ID 0461:4d64 Primax Electronics, Ltd
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 011: ID 03e7:2485
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jwrr@jwrr:~/ncs2/builds/intel64/Release$ lsusb
Bus 002 Device 004: ID 047b:0011 Silitek Corp. SK-1688U Keyboard
Bus 002 Device 003: ID 0461:4d64 Primax Electronics, Ltd
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
dmesg > dmesg.txt
[ 3818.214919] usb 3-4: new high-speed USB device number 10 using xhci_hcd
[ 3818.363542] usb 3-4: New USB device found, idVendor=03e7, idProduct=2485
[ 3818.363546] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3818.363548] usb 3-4: Product: Movidius MyriadX
[ 3818.363550] usb 3-4: Manufacturer: Movidius Ltd.
[ 3818.363552] usb 3-4: SerialNumber: 03e72485
[ 3829.153556] usb 3-4: USB disconnect, device number 10
[ 3831.134804] usb 3-4: new high-speed USB device number 11 using xhci_hcd
[ 3831.283430] usb 3-4: New USB device found, idVendor=03e7, idProduct=2485
[ 3831.283433] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3831.283436] usb 3-4: Product: Movidius MyriadX
[ 3831.283438] usb 3-4: Manufacturer: Movidius Ltd.
[ 3831.283439] usb 3-4: SerialNumber: 03e72485
[ 3906.460590] usb 3-4: USB disconnect, device number 11
Try Hello NCS
To test if your NCS device can enumerate as a USB 3 device, please try the following:
Unplug NCS2
sudo dmesg -C # to clear messages
Connect NCS2
python3 hello_ncs.py # to run hello script
dmesg # re-run
jwrr@jwrr:~/git-clones/ncsdk/examples/apps/hello_ncs_py$ python3 hello_ncs.py D: [ 0] ncDeviceCreate:308	ncDeviceCreate index 0
D: [ 0] ncDeviceCreate:308	ncDeviceCreate index 1
D: [ 0] ncDeviceOpen:524	File path /usr/local/lib/mvnc/MvNCAPI-ma2480.mvcmd
W: [ 0] ncDeviceOpen:528	ncDeviceOpen() XLinkBootRemote returned error 3
Error - Could not open NCS device.
IMPORTANT UNDOCUMENTED COPY
sudo cp /opt/intel/openvino_2019.1.094/deployment_tools/inference_engine/lib/intel64/MvNCAPI-ma2480.mvcmd /usr/local/lib/mvnc/MvNCAPI-ma2480.mvcmd
jwrr@jwrr:~/git-clones/ncsdk/examples/apps/hello_ncs_py$ python3 hello_ncs.py D: [ 0] ncDeviceCreate:308	ncDeviceCreate index 0
D: [ 0] ncDeviceCreate:308	ncDeviceCreate index 1
D: [ 0] ncDeviceOpen:524	File path /usr/local/lib/mvnc/MvNCAPI-ma2480.mvcmd
I: [ 0] ncDeviceOpen:530	ncDeviceOpen() XLinkBootRemote returned success 0
I: [ 0] ncDeviceOpen:568	XLinkConnect done - link Id 0
D: [ 0] ncDeviceOpen:582	done
I: [ 0] ncDeviceOpen:584	Booted 3-ma2480 -> VSC
I: [ 0] getDevAttributes:383	Device attributes
I: [ 0] getDevAttributes:386	Device FW version: 444c4454.2480.0.0
I: [ 0] getDevAttributes:388	mvTensorVersion 3.0
I: [ 0] getDevAttributes:389	Maximum graphs: 10
I: [ 0] getDevAttributes:390	Maximum fifos: 20
I: [ 0] getDevAttributes:392	Maximum graph option class: 1
I: [ 0] getDevAttributes:394	Maximum device option class: 2
I: [ 0] getDevAttributes:395	Device memory capacity: 519274992
Hello NCS! Device opened normally.
I: [ 0] ncDeviceClose:776	closing device
Goodbye NCS! Device closed normally.
NCS device working.
Now when we run the classification_sample we get the following new unsupported network precision error. Progress!
jwrr@jwrr:~/ncs2/builds/intel64/Release$ ./classification_sample -i ~/ncs2/sample-images/cat.jpg -m ~/ncs2/alexnet.xml -nt 5 -d MYRIAD
[ INFO ] InferenceEngine:
	API version ............ 1.6
	Build .................. custom_releases/2019/R1_c9b66a26e4d65bb986bb740e73f58c6e9e84c7c2
[ INFO ] Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] /home/jwrr/ncs2/sample-images/cat.jpg
[ INFO ] Loading plugin
	API version ............ 1.6
	Build .................. 22443
	Description ....... myriadPlugin
[ INFO ] Loading network files:
	/home/jwrr/ncs2/alexnet.xml
	/home/jwrr/ncs2/alexnet.bin
[ INFO ] Preparing input blobs
[ WARNING ] Image is resized from (1000, 667) to (227, 227)
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the plugin
[ ERROR ] [VPU] Unsupported network precision : FP32
Recompile models with FP16
The Model Optimizer,
mo.py**, defaults to FP32. FP32 is the only format supported by the CPU but the NCS2 only supports FP16. Let's re-run the Model Optimizer with --data_type FP16 in the builds/intel64/Release folder.
cd ~/ncs2/builds/intel64/Release
mkdir FP16
cd FP16
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
python3 $INTEL_OPENVINO_DIR/deployment_tools/model_optimizer/mo.py --framework caffe --input_model ~/ncs2/classification/alexnet/caffe/alexnet.caffemodel --data_type FP16
Re-run the classification_sample example.
cd ~/ncs2/builds/intel64/Release
./classification_sample -i ~/ncs2/sample-images/cat.jpg -m FP16/alexnet.xml -nt 5 -d MYRIAD
SUCESS MYRIAD IS ALIVE
SUCCESS! It looks like the myriad is now running with the following results.
jwrr@jwrr:~/ncs2/builds/intel64/Release$ ./classification_sample -i ~/ncs2/sample-images/cat.jpg -m alexnet.xml -nt 5 -d MYRIAD
[ INFO ] InferenceEngine:
	API version ............ 1.6
	Build .................. custom_releases/2019/R1_c9b66a26e4d65bb986bb740e73f58c6e9e84c7c2
[ INFO ] Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] /home/jwrr/ncs2/sample-images/cat.jpg
[ INFO ] Loading plugin
	API version ............ 1.6
	Build .................. 22443
	Description ....... myriadPlugin
[ INFO ] Loading network files:
alexnet.xml alexnet.bin [ INFO ] Preparing input blobs
[ WARNING ] Image is resized from (1000, 667) to (227, 227)
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the plugin
[ INFO ] Starting inference (1 iterations)
[ INFO ] Processing output blobs
Top 5 results:
Image /home/jwrr/ncs2/sample-images/cat.jpg
classid probability
------- -----------
281 0.6025391
285 0.1987305
282 0.1488037
287 0.0465088
289 0.0012226
.
total inference time: 25.2723787
Average running time of one iteration: 25.2723787 ms
Throughput: 39.5688911 FPS
[ INFO ] Execution successful
Run with Labels
cp ~/openvino_models/ir/FP32/classification/squeezenet/1.1/caffe/squeezenet1.1.labels .
RACHEL
https://software.intel.com/en-us/forums/computer-vision/topic/783210
delete me
cd ~/intel/computer_vision_sdk/deployment_tools/model_optimizer/install_prerequisites/ ./install_prerequisites.sh
cd ~/intel/computer_vision_sdk/deployment_tools/demo ./demo_squeezenet_download_convert_run.sh -d MYRIAD