1、安装树莓派系统
要使用Movidius,树莓派需要使用最新版的Raspbian-Stretch系统,到树莓派官网下载img映像后,使用适当的烧录工具(USB Image Tool)烧录到TF卡中,用于Movidius的树莓派系统的TF卡最小需要16G。不要使用8G的卡,分分钟就用完剩余空间了。
http://director.downloads.raspberrypi.org/raspbian/images/raspbian-2018-03-14/2018-03-13-raspbian-stretch.zip
树莓派系统安装好后,可以进入系统修改Raspberry Pi Configuration来修改以下几个参数:
a、打开VNC,使得能通过外部电脑vnc连接树莓派
b、打开Camara
c、打开Remote GPIO
d、设置Resolution,调整到外部电脑显示器适配的分辨率,比如DMT82 1920x1080
e、修改树莓派系统名字,只是为了方便我们自己识别
f、树莓派默认用户名为pi,密码为raspberry,可以修改为自己需要的密码
查看一下本树莓派的ip地址,方便vnc远程连接。
重启树莓派系统后,使用PC上安装的VNC Viewer来远程连接树莓派。
2、更新apt-get和更新系统
sudo apt-get update
sudo apt-get upgrade
3、在适当目录下创建一个自己的工作目录(这里用根目录下的lance目录作为工作目录)
cd /
sudo mkdir lance
4、在工作目录下git Movidius的ncsdk和ncappzoo
cd /lance
sudo git clone https://github.com/movidius/ncsdk.git
sudo git clone https://github.com/movidius/ncappzoo.git
补充:有时候git clone会慢得出奇,ncsdk百来兆的内容会下载一整天,这时候可以修改/etc/hosts文件,在其中增加github的内容:
# GitHub Start
192.30.253.112 github.com
192.30.253.119 gist.github.com
151.101.100.133 assets-cdn.github.com
151.101.100.133 raw.githubusercontent.com
151.101.100.133 gist.githubusercontent.com
151.101.100.133 cloud.githubusercontent.com
151.101.100.133 camo.githubusercontent.com
151.101.100.133 avatars0.githubusercontent.com
151.101.100.133 avatars1.githubusercontent.com
151.101.100.133 avatars2.githubusercontent.com
151.101.100.133 avatars3.githubusercontent.com
151.101.100.133 avatars4.githubusercontent.com
151.101.100.133 avatars5.githubusercontent.com
151.101.100.133 avatars6.githubusercontent.com
151.101.100.133 avatars7.githubusercontent.com
151.101.100.133 avatars8.githubusercontent.com
# GitHub End
这样git起来就会快一点。
5、安装ncsdk
cd /lance/ncsdk
sudo make install
到此为止,树莓派系统和ncsdk以及官方范例库ncappzoo都已经安装好,可以开始测试设备了。
6、在树莓派usb口中插入Movidius NCS(神经计算棒)我们这里用两根来测试一下ncsdk和ncs设备是否正常
cd /lance/ncappzoo/apps/hello_ncs_py
在这个目录下创建一个Python文件multi_ncs.py,内容如下:
#! /usr/bin/env python3
# Copyright(c) 2017 Intel Corporation.
# License: MIT See LICENSE file in root directory.
# Python script to open and close a single NCS device
import mvnc.mvncapi as fx
# main entry point for the program
def main():
# set the logging level for the NC API
fx.SetGlobalOption(fx.GlobalOption.LOG_LEVEL, 0)
# get a list of names for all the devices plugged into the system
ncs_names = fx.EnumerateDevices()
if (len(ncs_names) < 1):
print("Error - no NCS devices detected, verify an NCS device is connected.")
quit()
else:
print("We have %d NCS devices!"%len(ncs_names))
dev = [0 for x in range(len(ncs_names))]
for i in range (len(ncs_names)):
dev[i] = fx.Device(ncs_names[i])
try:
dev[i].OpenDevice()
except:
print("Error - Could not open the NO.%d NCS device."%i)
quit()
print("Hello NCS! The NO.%d device opened normally."%i)
try:
dev[i].CloseDevice()
except:
print("Error - could not close the NO.%d NCS device."%i)
quit()
print("Goodbye NCS! The NO.%d device closed normally."%i)
print("The NO.%d NCS device working."%i)
# Initial here:
if __name__=="__main__":
main()
运行此python程序,屏幕打印结果上能看到0和1两个ncs device正常打开关闭,就表示ncsdk和ncs设备正常安装了。正常显示信息如下: