切换到resnet50_async_imagenet_classification样例目录,命令示例如下,从output参数设置的目录下获取om文件:
atc --model=caffe_model/resnet50.prototxt --weight=caffe_model/resnet50.caffemodel --framework=0 --output=model/resnet50 --soc_version=${soc_version} --input_format=NCHW --input_fp16_nodes=data -output_type=FP32 --out_nodes=prob:0
可从ATC安装路径的“atc/data/platform_config”目录下查看昇腾AI处理器的版本,对应“*.ini”文件的名字(不带.ini后缀)即为soc_version。
https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/models/aclsample/dog1_1024_683.jpg
https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/models/aclsample/dog2_1024_683.jpg
python3.7.5 ../script/transferPic.py
如果执行脚本报错“ModuleNotFoundError: No module named 'PIL'”,则表示缺少Pillow库,请使用pip3.7.5 install Pillow --user命令安装Pillow库。
“../../../src”表示CMakeLists.txt文件所在的目录,请根据实际目录层级修改。
cd 样例目录\build\intermediates\soc cmake ../../../src -DCMAKE_SKIP_RPATH=TRUE -G "Visual Studio 15 2017 Win64" cmake --build .
cd 样例目录\build\intermediates\soc cmake ../../../src -DCMAKE_SKIP_RPATH=TRUE -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES=release cmake --build . --config release
当前样例的编码字符集为ASCII,编译命令默认都是ASCII编码字符集,不支持Unicode编码字符集,如需支持Unicode编码字符集,需用户自行适配代码。
main.exe
执行成功后,在屏幕上的关键提示信息示例如下:
[INFO] ./main param1 param2 param3, param1 is execute model times(default 100), param2 is callback interval(default 1), param3 is memory pool size(default 100) [INFO] execute times = 100 [INFO] callback interval = 1 [INFO] memory pool size = 100 [INFO] acl init success [INFO] open device 0 success [INFO] create context success [INFO] create stream success [INFO] get run mode success [INFO] load model ../model/resnet50.om success [INFO] create model description success [INFO] init memory pool success [INFO] subscribe report success [INFO] top 1: index[267] value[0.889648] [INFO] top 1: index[161] value[0.836914] [INFO] top 1: index[267] value[0.889648] [INFO] top 1: index[161] value[0.836914] [INFO] top 1: index[161] value[0.836914] [INFO] top 1: index[267] value[0.889648] [INFO] top 1: index[161] value[0.836914] [INFO] top 1: index[267] value[0.889648] [INFO] top 1: index[161] value[0.836914] [INFO] top 1: index[267] value[0.889648] ...... [INFO] top 1: index[161] value[0.836914] [INFO] top 1: index[267] value[0.889648] [INFO] model execute success [INFO] unsubscribe report success [INFO] unload model success, modelId is 1 [INFO] execute sample success [INFO] end to destroy stream [INFO] end to destroy context [INFO] end to reset device is 0 [INFO] end to finalize acl