Skip to main content

Intel Movidius



Intel Movidius is an interesting piece of hardware that could work on embedded system like Raspberry Pi that will enable neural network computing. Even thought is only supported under Linux, we could always use Oracle Virtual Box to get it to work on Mac or Windows platform.
Intel Movidius also support both Caffe and TensorFlow models and the typical workflow is as follow :-
Typical Intel Movidius workflow (Image courtesy: https://movidius.github.io/ncsdk/)
The full documentation is available at Intel Movidius NCSDK[1]
In this post, I will be focusing on how to get started on Oracle Virtual Box and Rapsberry Pi 3 Model B environment using Ubuntu 16.x variant.

Oracle Virtual Box

Grab the installation from Oracle Virtual Box download[2] and install the Extension Pack.
Before install Ubuntu 16.x, configure/add the following USB devices. Note that Intel Movidius has two modes, hence two different device configurations are needed
Configuration 1
Name : Movidius VSC Loopback Device [0100]
Vendor ID : 03e7
Product ID : f63b
Revision : 0100
Manufacturer : Movidius
Product : VSC Loopback Device
Configuration 2
Name : Movidius Ltd. Movidius MA2X5X [0001]
Vendor ID : 03e7
Product ID : 2150
Revision : 0001
Manufacturer : Movidius Ltd.
Product : Movidius MA2X5X
As shown as image below, the configuration require for Oracle Virtual Box USB devices using Configuration 1 and Configuration 2
Oracle Virtual Box USB setup

Raspberry Pi 3 Model B

Currently I am using NOOBS from Raspberry official website[3]. Note that we need to attach to a display and keyboard+mouse for the initial install. After that everything will be headless by turning on the SSH on Raspberry Pi 3 Model B. The raspberry folks has quite good documentation from Raspberry Documentation[4] on turning on SSH login
Raspberry Pi has a bit more work to install OpenCV from source[5] which include
1. Increasing swap size
We also need to increase swap size by editing the file at /etc/dphys-swapfile with the following, CONF_SWAPSIZE=2048 to have 2GB swap memory
then issue the following commands to take effects
$ sudo /etc/init.d/dphys-swapfile stop
$ sudo /etc/init.d/dphys-swapfile start
2. Clean upWe going to remove wolfram and libreoffice to save some space which come with default with NOOBS
$ sudo apt-get purge wolfram-engine
$ sudo apt-get purge libreoffice*
$ sudo apt-get clean
$ sudo apt-get autoremove
3. Install dependenciesThe dependencies include build tools and some development libraries essential to build Open CV
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install build-essential cmake pkg-config
$ sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
$ sudo apt-get install libxvidcore-dev libx264-dev
$ sudo apt-get install libgtk2.0-dev libgtk-3-dev
$ sudo apt-get install libcanberra-gtk*
$ sudo apt-get install libatlas-base-dev gfortran
$ sudo apt-get install python2.7-dev python3-dev
4. Download Open CV sourceWe need to build both opencv and opencv_contrib source code
$ cd ~
$ wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.3.0.zip
$ unzip opencv.zip
$ wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.3.0.zip
$ unzip opencv_contrib.zip
5. Compile Open CV sourceWe will be compiling Open CV from source for the ARM platform
$ cd ~/opencv-3.3.0/
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
 -D CMAKE_INSTALL_PREFIX=/usr/local \
 -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
 -D ENABLE_NEON=ON \
 -D ENABLE_VFPV3=ON \
 -D BUILD_TESTS=OFF \
 -D INSTALL_PYTHON_EXAMPLES=OFF \
 -D BUILD_EXAMPLES=OFF ..
6. Last step for Open CVWe going to move the default installed library (cv2.cpython-35m-arm-linux-gnueabihf.so) as cv2.so
$ cd /usr/local/lib/python3.5/site-packages/
$ sudo mv cv2.cpython-35m-arm-linux-gnueabihf.so cv2.so
7. Install TensorFlowWe need to install ARM version of TensorFlow for Raspberry Pi 3 Model B
$ wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v1.4.0/tensorflow-1.4.0-cp35-none-linux_armv7l.whl
$ pip3 install tensorflow-1.4.0-cp35-none-linux_armv7l.whl

General Intel Movidius Install

These steps apply for both Oracle Virtual Box and Raspberry Pi 3 Model B setup
$ sudo apt-get install git
$ git clone https://github.com/movidius/ncsdk
$ cd ncsdk
$ make install

Testing and Benchmark

I did some benchmark test using ncappzoo from https://github.com/movidius/ncappzoo using the following steps
$ git clone https://github.com/movidius/ncappzoo
$ cd ncappzoo/apps/benchmarkncs
$ ./mobilenets_benchmark.sh | grep FPS
Comparison in term of run time speed between using time command
Raspberry Pi 3 Model B:
real 40m56.595s
user 36m41.170s
sys 0m58.780s
Oracle Virtual Box:
real 11m52.631s
user 4m43.956s
sys 0m37.612s
It seem like Intel Movidius performance is in par between embedded system (Raspberry Pi 3 Model B) and a desktop / laptop system (Oracle Virtual Box). The only drawback during the test is the amount of time to run the test but I guess the important point is running the neural network model.
According to Intel Movidius official site[6], possible applications cover robotics, AR/VR, Wearables and Smart Security. One of the cool idea I could think off is to modify some robotic car solution from Sun Founder[7] to have Intel Movidius as vision for both self driving capability and face recognition that could detect intruder.
Should you have any problem or question regarding to this article, please do not hesitate to leave a comment below or drop me an email:me@chclab.net

Popular posts from this blog

#Facebook Video vs #YouTube Video find better one.

Live streams are now, mainstream. Live video has grown faster than most mediums, because it establishes a real-time connection and facilitates a conversation between the streamer and the audience. Nowadays, most social media platforms and video platforms allow you to stream live video. But, between the 2 major platforms, YouTube and Facebook, which one is actually the best for you to live stream to? On this blog post, we’ll talk about YouTube live vs. Facebook live. Here, you’ll find a side-by-side comparison between Facebook and YouTube, to help you decide where to focus your live streaming efforts as a brand or individual. Regardless of the platform, you prefer, keep in mind that they are the 2 biggest platforms out there. If you want to build an online audience, it’s wise to have an online presence on both. You can share different content on each of them, but for live streaming events and intricate live videos, you can and should go live on both platforms at the same time. This way,...

Thousands of Government Websites Hacked to Mine Cryptocurrencies

There was a time when hackers simply defaced websites to get attention, then they started hijacking them to spread banking trojan and ransomware, and now the trend has shifted towards injecting scripts into sites to mine cryptocurrencies. iPhone-X Styled ASUS Zenfone 5, Brings Along More Zenfone 5 Lite Renders Thousands of government websites around the world have been found infected with a specific script that secretly forces visitors' computers to mine cryptocurrency for attackers. Have you ever faced difficulty in transferring cash to a friend or relative The cryptocurrency mining script injection found on over 4,000 websites, including those belonging to UK's National Health Service (NHS), the Student Loan Company, and data protection watchdog Information Commissioner's Office (ICO), Queensland legislation, as well as the US government's court system. World’s tallest hotel Users who visited the hacked websites immediately had their computers...

CCI imposes Rs 135.86 crore penalty on Google for search bias

CCI noted in its order that undue intervention in product design can affect legitimate product improvements, given that design is an important dimension of competition. 4G smartphones at Rs 500, on a monthly plan of Rs 60 NEW DELHI|MUMBAI: The Competition Commission of India (CCI) has imposed a ?136-crore fine on Google for "search bias" and abusing its "dominant position". The Indian competition regulator's ruling comes after similar setbacks in the European Union and Russia for the world's most popular search engine. An introduction to Progressive Web Apps In a 190-page order, the Competition Commission of India (CCI) said Google abused its dominant position on three counts that largely relate to search, while no foul play was seen in case of advertising. CCI imposed a penalty amounting to 5% of the average revenue generated from India over the three years to FY15, an amount of ?135.85 crore, which has to be deposited within 60 days. A ma...