树莓派4B上mxnet目标检测环境搭建

mxnet安装

先贴出官网的教程:https://mxnet.apache.org/versions/1.7.0/get_started?platform=devices&language=python&processor=cpu&iot=raspberry-pi&

官网提供了从Docker安装、pip wheel安装、源码安装。这里经过实验发现通过pip wheel安装是最简单方便的。步骤如下:

  1. 首先需要安装一些依赖
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
curl \
git \
libatlas-base-dev \
libcurl4-openssl-dev \
libjemalloc-dev \
liblapack-dev \
libopenblas-dev \
libopencv-dev \
libzmq3-dev \
ninja-build \
python-dev \
python-pip \
software-properties-common \
sudo \
unzip \
virtualenv \
wget
  1. 安装虚拟环境
sudo pip install virtualenv
  1. 创建虚拟环境
virtualenv -p `which python` mxnet_py27
  1. 进入虚拟环境并通过pre-built python wheel安装mxnet
source mxnet_py27/bin/activate
pip3 install mxnet-x.x.x-py2.py3-none-any.whl

注意 pip install 和 pip3 install 的区别

OpenCV安装

OpenCV同样可以通过pip wheel的方式安装到虚拟环境中

  1. 下载whl文件到树莓派上
wget https://www.piwheels.org/simple/opencv-python/opencv_python-3.4.3.18-cp37-cp37m-linux_armv7l.whl
  1. 安装依赖
sudo apt-get install -y \ 
libatlas-base-dev \ 
libjasper-dev \
sudo apt-get install libqtgui4 \
sudo apt-get install libqt4-test \
sudo apt-get install libhdf5-dev
  1. 安装OpenCV
pip3 install opencv_python-3.4.3.18-cp37-cp37m-linux_armv7l.whl

你可能感兴趣的:(树莓派4B上mxnet目标检测环境搭建)