<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>AI Prototyping on the Edge with the Intel Neural Compute Stick 2</title><link>https://community.element14.com/learn/learning-center/the-tech-connection/w/documents/20701/ai-prototyping-on-the-edge-with-the-intel-neural-compute-stick-2</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>AI Prototyping on the Edge with the Intel Neural Compute Stick 2</title><link>https://community.element14.com/learn/learning-center/the-tech-connection/w/documents/20701/ai-prototyping-on-the-edge-with-the-intel-neural-compute-stick-2</link><pubDate>Tue, 12 Oct 2021 17:36:47 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:49604dd3-077c-43e5-b7c6-c7129c992cfb</guid><dc:creator>rscasny</dc:creator><comments>https://community.element14.com/learn/learning-center/the-tech-connection/w/documents/20701/ai-prototyping-on-the-edge-with-the-intel-neural-compute-stick-2#comments</comments><description>Current Revision posted to Documents by rscasny on 10/12/2021 5:36:47 PM&lt;br /&gt;
&lt;p style="margin:0;"&gt;IoT applications typically include any application that monitors a physical environment. Examples include airplane telemetry, tracking fauna, manipulating blinds via voice commands, and surveillance using drones. Many such applications require functional Artificial Intelligence (AI) capabilities, including image, audio, and video analysis. AI is an umbrella term, and all AI machines are trained using Machine Learning Algorithms (MLAs).&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/158x133/__key/communityserver-wikis-components-files/00-00-00-03-89/4578.contentimage_5F00_214653.jpg"&gt;&lt;img alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/03/89/4578.contentimage_214653.jpg-158x133.jpg?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=pJVizV%2BjkO69ooBL9st9lwhKiAxpLDbH60hgBLRijpo%3D&amp;amp;se=2026-08-13T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=h1OlEfrf/0KCpVWuQ26L+w==" style="max-height: 133px;max-width: 158px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;The term &amp;quot;Edge AI&amp;quot; is loaned from edge computing, which implies computation closer to the data source. In AI terms, it generally means any action that happens outside data centers or bulky computers, such as drones, cellphones, and autonomous vehicles. These Edge AI devices have diverse physical size and are designed or supported by multiple vendors. In this article, we will focus on pocket-sized platforms that individuals and small companies purchase and use.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;In such Edge use-cases, processing time-delays determine that data not be dispatched to the cloud; instead, algorithms armed with sufficient computing power are required. Edge devices such as vehicles or drones lack such computational power, necessitating the presence of dedicated hardware like the Intel &lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; Neural compute Stick 2 (NCS2), employed as a neural network inference accelerator providing additional performance.&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;br /&gt;&lt;span class="e14-conditional-content e14-init-hidden e14-conditional-country-AT_BE_BG_CZ_DK_EE_FI_FR_DE_HU_IE_IL_IT_LV_LT_NL_NO_PL_PT_RO_RU_SK_SI_ES_SE_CH_TR_UK_"&gt;&lt;span class="e14-button-primary e14-button-large"&gt;&lt;a href="https://www.avnet.com/shop/emea/products/intel/ncsm2450dk1-962297-3074457345635531599?CMP=GL-Avnet-E14-cross-sell" target="_blank" title="Buy Now"&gt;Buy Now&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; &lt;span class="e14-conditional-content e14-init-hidden e14-conditional-country-CA_MX_US_BR_"&gt;&lt;span class="e14-button-primary e14-button-large"&gt;&lt;a href="https://www.avnet.com/shop/us/products/intel/ncsm2450dk1-962297-3074457345639989184?CMP=GL-Avnet-E14-cross-sell" target="_blank" title="Buy Now"&gt;Buy Now&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/336x189/__key/communityserver-wikis-components-files/00-00-00-03-89/2425.contentimage_5F00_214654.png"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/03/89/2425.contentimage_214654.png-336x189.png?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=ZzJsHK1yT7ZRb9F3NmSFLTUdnygdjEyRAWDoxXi5qHA%3D&amp;amp;se=2026-08-13T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=xnX2PWSBuOQOyKVAPNzMiA==" style="max-height: 189px;max-width: 336px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Figure 1: Intel &lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; Neural compute Stick 2&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Movidius is chiefly designed to execute AI workloads built on inference or trained models. NVIDIA&amp;#39;s GPU serves an identical function plus training. It thus depends on whether the device under consideration will work in execute-only-mode or be capable of streamlining/re-training its models (brains) as well. However, these are all valid options, as long as such tasks are completed within a reasonable period.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;As per the work cycle, developers train AI models and transfer results to the NCS2, connecting it to a low-cost computer like an Arduino or Raspberry Pi dedicated to its immediate task. Intel-provided use case examples include image classification, object detection, and motion detection. AI even helps to stabilize videos.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Edge device processing provides the significant advantage of time and cost avoidance. This is particularly evident when you upload streams of data, like photos of a vehicle that drives past a security gate. The computer vision verifies the number plate characters and communicates them to the device.&amp;nbsp; The outcome either raises the boom gate (authorized vehicle) or lowers it (unauthorized/unwelcome entity). If you use a connected device, only updates need to be pushed to the registered number plate database (a compact dataset). If business requirements compel log entries, as well as the need for secure areas, a compact data log can be transmitted from the Edge device back to the server, with expensive processing being done on the NCS2.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="float:right;width:180px;border:1px solid #898989;padding:8px 12px 16px;margin:12px 5px 12px;background-color:#fafafa;"&gt;&lt;p style="margin:0;color:#007fac;font-weight:bold;font-size:20px;padding-bottom:2px;border-bottom:1px solid #898989;margin-bottom:6px;"&gt;AI Prototyping&lt;/p&gt;&lt;p style="margin:0;"&gt;Shop our wide variety of embedded computers, including single-board computers, development boards, and accessories for prototyping.&lt;/p&gt;&lt;p style="margin:0;padding-top:12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="e14-conditional-content e14-init-hidden e14-conditional-country-CA_"&gt;&lt;span class="e14-button-large e14-button-primary"&gt;Shop Now&lt;/span&gt;&lt;/span&gt; &lt;span class="e14-conditional-content e14-init-hidden e14-conditional-country-MX_"&gt;&lt;span class="e14-button-large e14-button-primary"&gt;Shop Now&lt;/span&gt;&lt;/span&gt; &lt;span class="e14-conditional-content e14-init-hidden e14-conditional-country-BR_US_"&gt;&lt;span class="e14-button-large e14-button-primary"&gt;Shop Now&lt;/span&gt;&lt;/span&gt; &lt;span class="e14-conditional-content e14-init-hidden e14-conditional-country-AT_BE_BG_CZ_DK_EE_FI_FR_DE_HU_IE_IL_IT_LV_LT_NL_NO_PL_PT_RO_RU_SK_SI_ES_SE_CH_TR_UK_"&gt;&lt;span class="e14-button-large e14-button-primary"&gt;Shop Now&lt;/span&gt;&lt;/span&gt; &lt;span class="e14-conditional-content e14-init-hidden e14-conditional-country-AU_CN_HK_IN_KR_MY_NZ_PH_SG_TH_TW_"&gt;&lt;span class="e14-button-large e14-button-primary"&gt;Shop Now&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;p style="margin:0;"&gt;The Intel &lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; Movidius Myriad X VPU powers the Intel NCS2 and is the first to be equipped with a neural compute engine – an exclusive hardware neural network inference accelerator, generating additional performance. Paired with the Intel Distribution of the OpenVINO toolkit supporting additional networks, the Intel NCS2 provides exceptional prototyping flexibility to developers.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;strong&gt;Working with Neural Compute Stick 2&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;With merely a laptop and the Intel &lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; NCS2, developers can get AI and computer vision applications up and running in minutes. The Intel &lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; NCS2 runs on a standard USB 3.0 port and needs no additional hardware, enabling users to seamlessly convert and then deploy PC-trained models to a broad range of devices natively. Internet or cloud connectivity becomes superfluous.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Intel &lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; has simplified project deployment on embedded devices through its OpenVINO toolkit, which is designed to profile, tune, and subsequently deploy convolutional neural networks. It targets applications that need real-time inferencing using low power. This software tools set simplifies the deployment process on various Intel AI solutions and supports models in ONNX, Caffe, TensorFlow, and MXNet formats.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;OpenVINO, a primary development software toolkit for NCS2 and other Intel hardware, allows the development and deployment of machine vision solutions delivering high inferencing speed and accuracy. OpenVINO combines camera processing, CV acceleration tools, and optimized DL computation for heterogeneous execution environments. This implies that CNN-based solutions using this toolkit can maximize performance by extending their workloads across the Intel hardware (including CPUs, GPUs, FPGAs, VPUs, and IPUs) only using a standard API. Equated with NCSDK, OpenVINO also allows for CNN-based inference at the edge, but with superior pre-optimized kernels and calls for OpenCV API. The OpenVINO development workflow depicted in Figure 2 initially includes training a CNN model in one of the machine learning (ML) libraries. The model optimizer is subsequently used to produce the Intermediate Representation (IR) model graph. The IR contains two files: topology description in XML format and binary data of the model weights. The IR is used to read, load, and infer using the Inference Engine with the latter accommodating unified functions to span multiple Intel platforms. User applications integrate this API to use the model IR to execute deep learning inference.&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/620x193/__key/communityserver-wikis-components-files/00-00-00-03-89/5657.contentimage_5F00_214655.png"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/03/89/5657.contentimage_214655.png-620x193.png?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=kFra4r6L9uVSibk3xQAIh30VNeQmTNfI%2BCAiPVANXdI%3D&amp;amp;se=2026-08-13T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=Go36H/+15L37KQuiYzAQkA==" style="max-height: 193px;max-width: 620px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;Figure 2: The workflow diagram of the OpenVINO toolkit&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;strong&gt;Getting Started with the Neural Compute Stick 2 and Inference on the Raspberry Pi&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;We will now learn how to use the OpenVINO toolkit in conjunction with OpenCV for quicker DL inference on a Raspberry Pi. A TinyYOLO - a compact You Only Look Once (YOLO) DL model version - is taken as an example. This model is heavy for a Raspberry Pi, but with the Neural Compute Stick 2 we will engineer a better frame rate than merely using a Raspberry Pi.&lt;/p&gt;&lt;p style="margin:0;"&gt;We need a Raspberry Pi 4 Model B, a USB cable, and the Neural Compute Stick 2. A Raspberry Pi camera is optional, if you are not loading video from the disk.&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/620x349/__key/communityserver-wikis-components-files/00-00-00-03-89/0842.contentimage_5F00_214656.jpg"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/03/89/0842.contentimage_214656.jpg-620x349.jpg?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=Sd2nfzFmZflHVbpViMI2uLa7TWGSU3BWbbvMdtBXFMA%3D&amp;amp;se=2026-08-13T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=64/qQZglLwQRdpSsTF7/Hw==" style="max-height: 349px;max-width: 620px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;Figure 3: Intel NCS2 on Raspberry Pi 4&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Let us first install a few dependencies required by openCV and OpenVINO:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get update &amp;amp;&amp;amp; sudo apt-get upgrade&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get install build-essential cmake unzip pkg-config&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Next, it is time to install a selection of image and video libraries — these are key to work with image and video files:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get install libxvidcore-dev libx264-dev&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get install libgtk-3-dev&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get install libcanberra-gtk*&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Next, we need two packages which contain numerical optimizations for OpenCV:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get install libatlas-base-dev gfortran&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Add the following command to download the python headers:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo apt-get install python3-dev&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;strong&gt;Installation of OpenVINO&amp;#39;s optimized OpenCV on the Raspberry Pi&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;"&gt;&lt;strong&gt;&lt;span style="font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;$ wget &lt;/span&gt;&lt;span style="font-size:9.0pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;a class="jive-link-external-small" href="https://download.01.org/opencv/2020/openvinotoolkit/2020.1/l_openvino_toolkit_runtime_raspbian_p_2020.1.023.tgz" rel="nofollow ugc noopener" target="_blank"&gt;&lt;span style="color:#2873ee;"&gt;https://download.01.org/opencv/2020/openvinotoolkit/2020.1/l_openvino_toolkit_runtime_raspbian_p_2020.1.023.tgz&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;We will now unpack the folder and rename the same for better readability:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ tar -xf l_openvino_toolkit_runtime_raspbian_p_2020.1.023.tgz&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ mv l_openvino_toolkit_runtime_raspbian_p_2020.1.023 openvino&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;strong&gt;Configure openVINO to use with the Raspberry Pi:&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ nano ~/.bashrc&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;Add below lines to the end of the .bashrc file and save it&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;# OpenVINO&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;source ~/openvino/bin/setupvars.sh&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Close editor and source the file:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ source ~/.bashrc&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Next, we need to add the current user to the Rasbian users group:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo usermod -a -G users &amp;quot;$(whoami)&amp;quot;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Reboot the Pi:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo reboot&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Reopen the terminal and set the USB rules:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ cd ~&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sh openvino/install_dependencies/install_NCS_udev_rules.sh&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;It is better to generate a virtual environment to stay clear of the installed libraries for the project. We will now create a virtual environment for this OpenVino toolkit:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ wget &lt;a class="" href="https://bootstrap.pypa.io/get-pip.py"&gt;&lt;span style="color:#2873ee;"&gt;https://bootstrap.pypa.io/get-pip.py&lt;/span&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo python3 get-pip.py&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo pip install virtualenv virtualenvwrapper&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ sudo rm -rf ~/get-pip.py ~/.cache/pip&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ nano ~/.bashrc&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Include the following lines in the .bashrc file:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;# virtualenv &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;export WORKON_HOME=$HOME/.virtualenvs&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;source /usr/local/bin/virtualenvwrapper.sh&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;VIRTUALENVWRAPPER_ENV_BIN_DIR=bin&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;We will now source the file:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ source ~/.bashrc&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;We will now generate a virtual environment and name it NCS2. The following command will create a virtual python 3 environment:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ mkvirtualenv NCS2 -p python3&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Open this virtual environment and install the libraries needed for this project:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ workon NCS2&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ pip install numpy&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ pip install &amp;quot;picamera[array]&amp;quot;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ pip install imutils&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ pip install pillow&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Type the following command to setup the Movidius NCS with OpenVINO after setup:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ source ~/openvino/bin/setupvars.sh&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;You can download the project source code and the model from &lt;span style="color:#e23d39;"&gt;&lt;a class="jive-link-wiki-small" href="/learn/learning-center/the-tech-connection/m/files/1971"&gt;&lt;span style="color:#e23d39;"&gt;here&lt;/span&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Unzip the file after downloading and open the terminal. Navigate to the ncs2.py directory and type the following in the terminal:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ cd /home/pi/Downloads/ncs2&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ workon NCS2&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ source ~/openvino/bin/setupvars.sh&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;$ python ncs2.py&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/500x281/__key/communityserver-wikis-components-files/00-00-00-03-89/5460.contentimage_5F00_214657.jpg"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/03/89/5460.contentimage_214657.jpg-500x281.jpg?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=aacgVMyf4dasIyseeRaRJTPM1BX5puo8JobNXDpqizM%3D&amp;amp;se=2026-08-13T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=YvPOVBb4+mMC2uXxgjl62Q==" style="max-height: 281px;max-width: 500px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;Figure 4: Image detection on Raspberry Pi&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;The video is loaded from disk, and it will begin object detection. This video is found in the project link. You can, however, use your video. To do this, provide the video file location in line 37 of the source file:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;vs = cv2.VideoCapture(&amp;quot;/home/pi/Downloads/ncs2/videos/vid.mp4&amp;quot;)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;If you prefer to use a USB camera and not a video file, change cam= True in line 15 of the source file. The USB is the default camera. If you prefer the Raspberry Pi camera, then in the source file, comment line no 31 and uncomment line no 32:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;vs = VideoStream(src=0).start()&amp;nbsp; #USB CAMERA&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;margin-bottom:.0001pt;"&gt;&lt;span style="color:#2873ee;font-size:9pt;font-family:&amp;#39;Courier New&amp;#39;;"&gt;&lt;strong&gt;#vs = VideoStream(usePiCamera=True).start() # RASPBERRY PI CAMERA&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;We can achieve a frame rate of 5 to 6 frames per second (fps) on a video that gets loaded from the disk, whereas we can achieve a 10 to 12 fps rate when a USB camera is run. The frame rate, sans the Neural Compute Stick 2, will be noticeably slower, unable to clock even one fps.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;Intel &lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; has also pioneered a complete AI development Kit, which involves a powerful combination of an Intel&lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; Core&lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/2122.svg" title="Tm"&gt;&amp;#x2122;&lt;/span&gt; processor, Intel&lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; Movidius&lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/2122.svg" title="Tm"&gt;&amp;#x2122;&lt;/span&gt; Myriad&lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/2122.svg" title="Tm"&gt;&amp;#x2122;&lt;/span&gt; X Vision Processing Unit (VPU), and an integrated graphics unit from Intel for high-performance, low-power AI workloads. The three hardware engines can run diverse AI workloads, to deliver an exhaustive raw AI capability for contemporary PCs. This kit is comprised of Windows 10 pre-loaded Intel&lt;span class="emoticon" data-url="https://community.element14.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; NUC and AI development tools, and code samples to help developers expedite new AI applications. Tutorials come included.&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;p align="center"&gt;[Please visit the site to access the poll]&lt;/p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;script&gt;window.top.e14.func.queueScripts.add(function() { window.top.e14.func.e14ConditionalContent();} );&lt;/script&gt;

&lt;div style="font-size: 90%;"&gt;Tags: intel, intel ®, ai at the edge, tech spotlight, neural compute stick, ®, neural_compute_stick, compute stick 2&lt;/div&gt;
</description></item></channel></rss>