SDK安装
官方网址:https://movidius.github.io/ncsdk/
(另外一个网址:https://developer.movidius.com/start 是1.0版本的)
碰到的坑
numpy版本问题
安装完成后,运行sample发现
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
即使运行最简单的import cv2也会出这个问题。出坑的原因:
- opencv 3.5是自己编译的,配置为:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D PYTHON3_EXECUTABLE=/usr/bin/python3 \
-D PYTHON_INCLUDE_DIR=/usr/include/python3.5 \
-D PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so \
-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.5/dist-packages/numpy/core/include \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/home/yanweichuan/workspace/opencv_contrib-3.4.0/modules \
-D PYTHON_EXECUTABLE=/usr/lib/python3 \
-D BUILD_EXAMPLES=ON ..
其中指定了numpy的版本和头文件路径,检查实际用的版本:
python3 -c "import numpy; print(numpy.__version__)"
1.11.0
python3 -c "import numpy; print(numpy.__file__)"
/usr/lib/python3/dist-packages/numpy/__init__.py
发现和opencv使用的不一致,把opencv的编译参数换成实际的使用的版本,重新编译即可。
内存错误
运行sample发现警告和堆栈错误
/usr/local/bin/ncsdk/Controllers/FileIO.py:52: UserWarning: You are using a large type. Consider reducing your data sizes for best performance
Movidius的论坛给出了参考答案:
https://ncsforum.movidius.com/discussion/434/testing-ncsdk-for-individual-cnn
It seems to be an issue with a malloc library.
if you do that (ubuntu 16.04)
sudo apt-get install libtcmalloc-minimal4
export LD_PRELOAD="/usr/lib/libtcmalloc_minimal.so.4"
then
make examples
其他网络不稳定
可以自行从github的网页下载包,解压到相对应的目录,屏蔽掉脚本中的下载操作即可,如caffe的下载