【Atlas500】放弃(三)——运行InferObjectDetect样例

1. 转换模型

参考:https://bbs.huaweicloud.com/forum/thread-45383-1-1.html
1.直接获取checkpoint file资源(将weights转换成了.ckpt文件):

the weights pretrained on coco dataset converted TensorFlow checkpoint file:

https://github.com/wizyoung/YOLOv3_TensorFlow/releases/

2.获取weights资源:

①在链接:https://github.com/wizyoung/YOLOv3_TensorFlow中下图位置获取weights资源。

image.png

②参考其readme.md中weights convertion转换成checkpoint file.

备注:步骤1和2只用选择其一。此模型检测类别为coco 80类,输入模型的图片尺寸为416。

3.将ckpt转换成pb方法:

20200312-170312(eSpace).png

input_path 即为三个.ckpt文件路径;

output_path用户自己定义;

4.将pb转换成om文件方法:

将上一步生成的pb文件,执行以下命令即可转换成om文件:

omg --model ./yolov3_coco80_416_chenqian.pb --framework 3 --output ./yolov3 --insert_op_conf ./aipp_yolov3_picture.cfg --input_shape “Placeholder:1,416,416,3”

其中:

–model 后面为上一步生成的pb文件路径;

–framework 为3 ,表示是tensorflow模型;

–output 后面的路径用户自定义;

–insert_op_conf 后面是模型转换配置文件;

–input_shape后面的”input_data:1,416,416,3”为pb模型输入节点的name和shape。

具体可以参考《Atlas 300 模型转换指导书 01》

相关文件,百度云, 提取码: 58hg

2. 编译

cd $InferObjectDetect
bash ./build.sh A500

3. 执行

  • 将out文件,yolov3.om模型文件,测试图片传到Atlas500上
scp -r ./out/ root@*********:test/yolov3_out
  • 测试
    ./ObjectDetection -i ./2_4.jpg -t 1 -m ./yolov3.om -g ./graph.config -s 0 -e 0

  • 结果

Euler:~/test/new_out # ./ObjectDetection -i ./2_4.jpg -t 1 -m ./yolov3.om -g ./graph.config -s 0 -e 0
***start device 0, end device 0***
device = 0, graphID = 1 init success
[mainG_MODEL]:g_modelType: 1
[INF] channel 0, frame 0 have 10 object
 #0, bbox(  27,  599,  372, 1418) confidence: 0.998998 classId is 0 
 #1, bbox( 377,  524,  703, 1417) confidence: 0.997539 classId is 0 
 #2, bbox(2278,  500, 2924, 2310) confidence: 0.995793 classId is 0 
 #3, bbox(1224,  518, 1643, 1846) confidence: 0.995250 classId is 0 
 #4, bbox(1613,  535, 2001, 1667) confidence: 0.993507 classId is 0 
 #5, bbox( 730,  568, 1197, 1861) confidence: 0.923385 classId is 0 
 #6, bbox(2190,  439, 2443, 1603) confidence: 0.823526 classId is 0 
 #7, bbox(2709,  784, 2977, 1311) confidence: 0.875400 classId is 26 
 #8, bbox( 899,  726, 1175, 1243) confidence: 0.842411 classId is 26 
 #9, bbox(1905,  930, 2113, 1182) confidence: 0.829813 classId is 26 

[INFO] graphID:1 is over!

可能问题

问题
前面运行atlas500的目标检测yolov3 demo的时候,一直卡着不动。输出到这里。然后同样的文件,模型在另外一台设备上就没有问题。

现象

Euler:~/test/new_out # ./ObjectDetection -i ./2_4.jpg -t 1 -m ./yolov3.om -g ./graph.config -s 0 -e 0
***start device 0, end device 0***
device = 0, graphID = 1 init success
[mainG_MODEL]:g_modelType: 1

解决方案
这是因为npu和ddk的版本不对。在atlas500上可以用npu-smi info看版本信息,在linux主机上,去ddk目录下的ddk_info看版本信息。如果两个版本不对,则统一版本。
在这里插入图片描述
在这里插入图片描述

后续

  • 统一之后依然出现同样的问题。需要重新转以下om模型
  • 用dog.jpg没有输出,好像是只能检测人,换一张有人的测试图片。
    在这里插入图片描述
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值