样例步骤适用于以下产品。
从以下链接获取ResNet-50网络的权重文件(*.caffemodel)、模型文件(resnet50.prototxt),并以HwHiAiUser(运行用户)将获取的文件上传至开发环境的“resnet50_imagenet_classification样例目录/caffe_model”目录下。
切换到“resnet50_imagenet_classification”目录,执行如下命令。Ascendxxx为使用的昇腾AI处理器型号,请用户自行替换。
atc --model=caffe_model/resnet50.prototxt --weight=caffe_model/resnet50.caffemodel --framework=0 --output=model/resnet50 --soc_version=Ascendxxx --input_format=NCHW --input_fp16_nodes=data --output_type=FP32 --out_nodes=prob:0
python3 ./src/acl_net.py
Using device id:0 model path:./model/resnet50.om images path:./data init resource stage: model_id:1 init resource success images:./data/dog1_1024_683.jpg data interaction from host to device data interaction from host to device success execute stage: execute stage success data interaction from device to host data interaction from device to host success ======== top5 inference results: ============= [161]: 0.767578 [162]: 0.154785 [167]: 0.038513 [163]: 0.021606 [166]: 0.011658 images:./data/dog2_1024_683.jpg data interaction from host to device data interaction from host to device success execute stage: execute stage success data interaction from device to host data interaction from device to host success ======== top5 inference results: ============= [267]: 0.935547 [266]: 0.041107 [265]: 0.018829 [219]: 0.002607 [160]: 0.000295 *****run finish****** Releasing resources stage: Resources released successfully.