运行 macOS 上的 NCSDK Movidius 神经棒

Run NCSDK Movidius Neural Stick on macOS

我正在尝试 运行 macOS 上的 Movidius NCSDK。在 macOS 上使用 NCSDK 需要 VirtualBox 加上 docker 因为这个 U 盘在 Ubuntu16.04 上必须 运行 并且它支持 TensorflowCaffe。 我已经使用 this Dockerfile 在 docker 上成功编译了 NCSDK。 然后我创建了一个 docker-machine 并像往常一样附加到 virtualbox:

$ docker-machine create --driver virtualbox linux
$ eval $(docker-machine env linux)
$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
linux   *        virtualbox   Running   tcp://192.168.99.100:2376           v17.12.1-ce 
$ docker-machine env linux
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/loretoparisi/.docker/machine/machines/linux"
export DOCKER_MACHINE_NAME="linux"
# Run this command to configure your shell: 
# eval $(docker-machine env linux)

并且我已将设备插入 VirtualBox,因此当 运行 将 docker 图像设置为

docker run --rm -it movidius bash

我可以看到连接的设备:

movidius@macos:~/ncsdk/examples/apps/hello_ncs_cpp$ lsusb
Bus 001 Device 005: ID 03e7:2150  
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

其中 03e7 是 linux 设备 ID 列表中预期的英特尔设备 here:

03e7  Intel
    2150  Myriad VPU [Movidius Neural Compute Stick]

所以我应该做 运行:

cd examples/apps/hello_ncs_cpp/ \
make hello_ncs_cpp \ 
make run

但是我明白了

cd cpp; ./hello_ncs_cpp; cd ..
Error - Could not open NCS device.
    mvncStatus value: -6

我在尝试 python 示例时遇到同样的错误

movidius@macos:~/ncsdk/examples/apps/hello_ncs_py$ python hello_ncs.py 
Error - Could not open NCS device.

查看 python 代码,我可以看到设备已正确枚举:

     # 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()


    # get the first NCS device by its name.  For this program we will always open the first NCS device.
    dev = fx.Device(ncs_names[0])

    print(ncs_names[0])

因为我可以看到 1 作为设备名称。打印 dev.OpenDevice() api 的错误堆栈跟踪 我有:

mvncStatus.ERROR
Traceback (most recent call last):
  File "hello_ncs.py", line 43, in <module>
    dev.OpenDevice()
  File "/usr/local/lib/python2.7/dist-packages/mvnc/mvncapi.py", line 147, in OpenDevice
    raise Exception(Status(status))
Exception: mvncStatus.ERROR
Error - Could not open NCS device.

我也曾尝试使用 docker 选项 --device 连接设备但没有成功尝试:

docker run --rm -it --net=host --privileged --device=/dev/usb/hiddev4

如所述here

[更新] 我知道最新版本的 Microsoft Windows 和 Microsoft Surface 笔记本电脑上存在相同的驱动程序问题。

看看您是否可以通过关注此主题来解决问题: https://ncsforum.movidius.com/discussion/140/mac-os-x

请参考Ramana.rachakonda的第8点: "Stick only worked when connected to a USB2 port on a USB hub that i had and not when connected to the USB3 port. If you only have USB3 ports try connecting the stick with a USB2 extension cable".

在 Docker 容器中,您必须 运行 make run 作为 root 用户,而不是普通用户。原因是因为 Docker 不支持 udev/udevadm 服务,所以只有 root 可以访问 USB 设备。