赞
踩
可以申请华为云ECS服务器,里面已经带了CANN环境。如果想省点钱的话,可以参加一些昇腾的活动(如CANN训练营),免费申请ESC资源。
下载地址mxvision,查看对应版本下载,如果没有购买国华为的设备或者不是华为客户,这里注意一定要下载社区版。 ESC是x86系统,查看系统信息命令
uname -m && cat /etc/*release
软件包名称:Ascend-mindxsdk-mxvision_3.0.RC2_linux-x86_64.run
使用root用户
vim /etc/profile
在“/etc/profile”文件末尾加上umask 027,保存并退出。
gcc --version
make --version
cmake --version
xz --version
python3.9 --version
pip3 list|grep protobuf
dpkg -l libgfortran-7-dev
在/home/HwHiAiUser下新建文件夹
su - HwHiAiUser
mkdir software
将Ascend-mindxsdk-mxvision_3.0.RC2_linux-x86_64.run上传至/home/HwHiAiUser/software
chmod +x Ascend-mindxsdk-mxvision_3.0.RC2_linux-x86_64.run
./Ascend-mindxsdk-mxvision_3.0.RC2_linux-x86_64.run --install
环境变量生效
export DDK_PATH=$HOME/Ascend/ascend-toolkit/latest
export NPU_HOST_LIB=$DDK_PATH/acllib/lib64/stub
source ~/Ascend/ascend-toolkit/set_env.sh
cd ~/software/mxVision/
./set_env.sh
mxVision3.0不带python样例了,可以到python样例进行下载,解压后,将python文件夹上传至/home/HwHiAiUser/software/mxVision/samples/mxVision下
将获取到的YOLOv3模型pb文件存放至:
SDK安装根目录/samples/mxVision/models/yolov3
将获取到的ResNet50模型pb文件存放至:
SDK安装根目录/samples/mxVision/models/resnet50
进入YOLOv3模型pb文件存放路径后执行如下命令,转换YOLOv3模型。
cd SDK安装根目录 /samples/mxVision/models/yolov3
atc --model=./yolov3_tf.pb \
--framework=3 \
--output=./yolov3_tf_bs1_fp16 \
--soc_version=Ascend310 \
--output_type=FP32 \
--insert_op_conf=./aipp_yolov3_416_416.aippconfig \
--input_shape="input:1,416,416,3" \
--out_nodes="yolov3/yolov3_head/Conv_6/BiasAdd:0;yolov3/yolov3_head/Conv_14/BiasAdd:0;yolov3/yolov3_head/Conv_22/BiasAdd:0"
进入ResNet50模型pb文件存放路径后执行,转换ResNet50模型。
cd SDK安装根目录 /samples/mxVision/models/resnet50
atc --model=./resnet50_tensorflow_1.7.pb \
--framework=3 \
--output=resnet50_aipp_tf \
--output_type=FP32 \
--soc_version=Ascend310 \
--input_format=NHWC \
--input_shape="Placeholder:1,224,224,3" \
--insert_op_conf=./aipp_resnet50_224_224.aippconfig
MindX3.0现在需要Python3.9,ESC目前python版本为3.7,所以下载pytohn3.9安装包
wget https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz
tar -zxvf Python-3.9.10.tgz
cd Python-3.9.10
./configure --prefix=/usr/local/python3.9.10 --enable-loadable-sqlite-extensions --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make install
添加环境变量
vim ~/.bashrc
#用于设置python3.9.13库文件路径
export LD_LIBRARY_PATH=/usr/local/python3.9.13/lib:$LD_LIBRARY_PATH
#如果用户环境存在多个python3版本,则指定使用python3.9.13版本
export PATH=/usr/local/python3.9.13/bin:$PATH
更换pip源
mkdir ~/.pip
cd ~/.pip
vim pip.conf
写入
[global]
index-url = https://mirrors.huaweicloud.com/repository/pypi/simple
trusted-host = mirrors.huaweicloud.com
timeout = 120
保存退出
准备== 带有动物图片的jpg文件==,重命名为test.jpg,将其上传至~/software/mxVision/samples/mxVision/python
bash run.sh
输出结果
{"MxpiObject":
[{"MxpiClass":
[{"classId":341,"className":"zebra","confidence":9.0390625}],"classVec":
[{"classId":22,"className":"zebra","confidence":0.99986123999999998,"headerVec":[]}],"x0":559.61669900000004,"x1":962.45281999999997,"y0":57.4783325,"y1":661.45391800000004},{"MxpiClass":
[{"classId":341,"className":"zebra","confidence":9.234375}],"classVec":
[{"classId":22,"className":"zebra","confidence":0.99985706799999996,"headerVec":[]}],"x0":169.46688800000001,"x1":635.25573699999995,"y0":185.115219,"y1":671.60955799999999}]}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。