Victor Meunier

Software engineer

How to install and setup OpenVino for the Neural Compute Stick 2 on Ubuntu

Today, we'll see how to setup your Ubuntu installation to use the Neural Compute Stick 2. This tutorial is working for both a normal installation and a VM of Ubuntu 16_04. I've personnally tested both. Let's get to it!

Prerequisites

First of all, you need to install Ubuntu 16_04 on your computer or in a VM. Note that there will be one more step with the VM, but we'll get to it later on, don't worry.

Step 1 - OpenVino download and install

For this part I'm not reinventing anything, the directions are available on OpenVino's website but they are not very accurate about the path you should use. Anyway, use whatever tutorial you want, I'm going to tell you what steps I did exactly, and it worked for me!

Go to the following link and register to receive your download link. Once you're on the download page, choose the latest version for Linux, this will download a .tar.gz file. Head to wherever you downloaded it and unzip it. Mine is in the Downloads folder.

                    cd ~/Downloads
                    tar xvf l_openvino_toolkit_<VERSION>.tgz
                    cd l_openvino_toolkit_<VERSION>
                    ./install_cv_sdk_dependencies.sh
                    ./install_GUI.sh
                  

Replace <VERSION> by the version you have. If you don't use sudo to launch install_GUI.sh, the installation will be in ~/<user>/intel. That's important for the rest of the installation.

Check everything when prompted for what to install

You'll be prompted with a GUI and asked what to install. Check everything.

Step 2 - Set the USB rules

We'll now update the udev rules for the stick.

                    cd ~/Downloads
                    
                    cat < 97-usbboot.rules
                    SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
                    SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
                    SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
                    EOF
                    
                    sudo cp 97-usbboot.rules /etc/udev/rules.d/
                    sudo udevadm control --reload-rules
                    sudo udevadm trigger
                    sudo ldconfig
                    rm 97-usbboot.rules
                  

Step 3 - Test the install

Follow this step and note that if you're on a VM, it will probably fail. You'll have the instructions just after that. Note the -d MYRIAD tells the program to run it on your stick.

                    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
                  

Virtual Machine (optionnal)

If you're using a VM for this, you need to add USB filters to capture the NCS2. You can find tutorials online, telling you to add USB filters by vendor ID. I've tried but it was not enough. Here's how I did it.

Head to the configuration of your VM, to the USB tab and click on the little USB+ icone. You should see a device called "Movidius Ltd. Movidius MyriadX", click on it to add it.

Adding "Movidius MyriadX to the VM's USB filter

Now, launch one of the example to do the inference on the stick. If you're on windows, you'll hear a sound of a USB disconnecting, that's the "Myriad" device disconnecting and now "Intel Corporation VSC Loopback Device" should appear. Click on it to capture it.

Adding "Intel VSC loopback to the VM's USB filter

Last step is going back to the usb tab in the VM configuration and make sure that the order is right. "Intel Corporation VSC Loopback Device" should be first! This is crucial, and it's the only way it worked for me.

Right order for the USB filters

Right now, your device is in a weird state where it's not recognized. Simply disconnect and reconnect. You should see in the USB tab, the "MyriadX" device. If that's the case, try to run the example again. You'll hear the USB disconnect sound, but this time the VSC will be correctly captured and the model should run fine.

Final thought

I'm a bit disappointed in the lack of OS support. I assume that it must be hard to support multiple OS's and test all of them, but still, only ubuntu 16_04, in 2019...

Windows is also supported but what I mean is that, at least Ubuntu 18 should be officially supported.

Also the VM support should be better. Especially since so few OS's are officially supported. Not everyone has access to a Ubuntu 16 machine without a VM. A lot of people seem to have problem with the USB.. Again, I understand that there might be some hidden complexity, but I expect more coming from Intel.

Besides that, I think this a great device, and I can't wait to see what I'll achieve with it. I'm currently working on converting Handpose to compare performance and run it on the RPi3.

Coming next

In a next blog post, I'll show you how to convert your Keras and Tensorflow model to run on the Neural Compute Stick 2. See you around for more!

Share it!

Comments

Subscribe to my weekly newsletter