jetson naon jetpack 4.4.1 安装 mxnet

13 篇文章 5 订阅
2 篇文章 0 订阅

 

验证 大神的  faster-mobile-retinaface 算法需要 mxnet , 在这里也是跌了不少坑,跳坑通关过程

记录一下:

参考:

https://mxnet.cdn.apache.org/get_started/jetson_setup

一 下载 1.8.x release 版本

 1.8 版本可以跟 cuda-10.02 兼容, 同时兼容 faster-mobile-retinaface

# 科鞋上网

git clone -b v1.8.x --recursive  https://github.com/apache/incubator-mxnet.git mxnet_1.8  

二 安装 依赖

sudo apt-get update
sudo apt-get install -y \
                        build-essential \
                        git \
                        libopenblas-dev \
                        libopencv-dev \
                        python3-pip \
                        python-numpy

sudo pip3 install --upgrade \
                        pip \
                        setuptools \
                        numpy

#注 mxnet 安装时强制要求有 opencv-dev , 被迫安装, 然后再删掉, 还原我编译安装 的 opencv-4.5
# 我的opencv 安装目录(/usr/)跟 apt 安装的(/usr/local/)不一样

三 更新 cmake

mxnet 需要 3.13 以上 cmake ,  jetpack 4.4 带的系统是 3.10 。很多开源模型对 cmake 要求版本不一致,且向下兼容也比较难, 所以我选择安装 cmake 到独立位置,使用时通过环境变量切换:

下载 cmake-3.18.4.tar.gz 解压 

cd cmake-3.18.4 && mkdir build && cd build &&  cmake    -DCMAKE_INSTALL_PREFIX=/opt/cmake_3_18_4 -DCMAKE_BUILD_TYPE=Release ../
make -j4
make install 

四 编译 mxnet 

4.1 进入代码目录:

#cd mxnet_1.8 

4.2 新建环境变量脚本 env.build 

内容如下:

export PATH=/opt/cmake_3_18_4/bin/:/usr/local/cuda/bin:$PATH
export MXNET_HOME=$PWD/
export PYTHONPATH=$MXNET_HOME/python:$PYTHONPATH

4.3 定制 config.mk

cp $MXNET_HOME/make/config_jetson.mk config.mk

jetson nano 下 编辑 config.mk 修改如下:

CUDA_ARCH=-gencode arch=compute_53,code=sm_53

4.4 编译:

比较漫长,我编译了四个小时左右 (swap 一定要有)

source env.build 
make -j4

4.5 安装 

# 官司推荐安装到代码目录
cd python
pip3 install -e .
# 安装到系统 目录, 使用方便
# 在 python 目录
python3 setup.py install 

五 验证

到这里的前提是前几步没有错误, 摘抄官方的测试步骤:

Conclusion and Next Steps

You are now ready to run MXNet on your NVIDIA module. You can verify your MXNet Python installation with the following:

import mxnet
mxnet.__version__

You can also verify MXNet can use your GPU with the following test:

import mxnet as mx
a = mx.nd.ones((2, 3), mx.gpu())
b = a * 2 + 1
b.asnumpy()

If everything is working, it will report the version number. For assistance, head over to the MXNet Forum.

来源: https://mxnet.cdn.apache.org/versions/1.7.0/get_started/jetson_setup.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

walletiger

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值