TX2入门教程软件篇-安装mxnet(jetpack3.0)
TX2入门教程软件篇-安装mxnet
说明:
- 介绍如何在TX2上安装深度学习框架mxnet
步骤:
- 新建目录
mkdir ~/dl/installMxnetTX2
cd ~/dl/installMxnetTX2
- 安装依赖:
sudo apt-get update
sudo apt-get -y install git build-essential libatlas-base-dev libopencv-dev graphviz python-pip
sudo pip install pip --upgrade
sudo pip install setuptools numpy --upgrade
sudo pip install graphviz jupyter
- 下载mxnet:
git clone https://github.com/dmlc/mxnet.git --recursive
cd mxnet
- 修改配置增加CUDA支持,无CUDA可不改:
- 进入mxnet里面的make文件夹,更改config.mk
cp make/config.mk .
echo "USE_CUDA=1" >> config.mk
echo "USE_CUDA_PATH=/usr/local/cuda" >> config.mk
echo "USE_CUDNN=1" >> config.mk
- 修改mshadow/make/mshadow.mk
vim mshadow/make/mshadow.mk
- 修改内容:
- 先找到122行,增加如下
MSHADOW_CFLAGS += -DMSHADOW_USE_PASCAL=1
- 回到mxnet文件夹里面:
make -j $(nproc)
- 安装MXNet Python Bindings
cd python
pip install --upgrade pip
pip install -e .
测试:
- 执行命令:
python example/image-classification/train_mnist.py
- 输出:
INFO:root:start with arguments Namespace(batch_size=64, disp_batches=100, gpus=None, kv_store='device', load_epoch=None, lr=0.05, lr_factor=0.1, lr_step_epochs='10', model_prefix=None, mom=0.9, monitor=0, network='mlp', num_classes=10, num_epochs=20, num_examples=60000, num_layers=None, optimizer='sgd', test_io=0, top_k=0, wd=0.0001)
INFO:root:Epoch[0] Batch [100] Speed: 948.66 samples/sec accuracy=0.777692
INFO:root:Epoch[0] Batch [200] Speed: 1030.88 samples/sec accuracy=0.915781
INFO:root:Epoch[0] Batch [300] Speed: 1034.63 samples/sec accuracy=0.931250
INFO:root:Epoch[0] Batch [400] Speed: 983.33 samples/sec accuracy=0.932031
INFO:root:Epoch[0] Batch [500] Speed: 968.70 samples/sec accuracy=0.943906
INFO:root:Epoch[0] Batch [600] Speed: 1004.47 samples/sec accuracy=0.940625
INFO:root:Epoch[0] Batch [700] Speed: 990.10 samples/sec accuracy=0.950313
INFO:root:Epoch[0] Batch [800] Speed: 941.56 samples/sec accuracy=0.951094
INFO:root:Epoch[0] Batch [900] Speed: 992.14 samples/sec accuracy=0.955000
INFO:root:Epoch[0] Train-accuracy=0.957770
INFO:root:Epoch[0] Time cost=64.217
INFO:root:Epoch[0] Validation-accuracy=0.963276
INFO:root:Epoch[1] Batch [100] Speed: 942.83 samples/sec accuracy=0.964728
INFO:root:Epoch[1] Batch [200] Speed: 925.19 samples/sec accuracy=0.962187
问题:
- 问题A: ImportError: No module named 'requests'
- 解决:安装requests模块
pip install requests
参考:
- http://mxnet.incubator.apache.org/get_started/install.html
- https://github.com/dmlc/mxnet/tree/master/example
- http://mxnet.io/get_started/install.html
- http://mxnet.io/
- https://github.com/dmlc/mxnet
- http://blog.csdn.net/qq_25491201/article/details/51246458
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号