一、模型转换
模型转换:
问题1
修改后的yolov3_416.prototxt
name: "Darkent2Caffe"
input: "data"
input_shape {
dim: 1
dim: 3
dim: 416
dim: 416
}
input: "img_info"
input_shape {
dim: 1
dim: 4
}
layer {
bottom: "layer85-conv"
top: "layer86-upsample"
name: "layer86-upsample"
type: "Upsample"
upsample_param {
scale:1
stride:2
}
}
增加三个Yolo算子(或者参考链接)
备注:文档首页 > 昇腾Atlas 300 推理卡(型号 3000, 3010) > 开发辅助工具> ATC工具使用指导> 支持的算子> Caffe网络模型> 定制prototxt文件> 样例参考> YOLOV3网络模型prototxt修改
链接:https://support.huaweicloud.com/ti-atc-A300_3000_3010/altasatc_16_024.html
问题2
原来命令行
atc --model=./yolov3.prototxt \
--weight=./yolov3.caffemodel \
--framework=0 \
--output=./yolov3_aipp \
--soc_version=Ascend310 \
--insert_op_conf=./aipp_yolov3.cfg
atc --model=yolov3_416.prototxt --weight=yolov3_416.caffemodel --framework=0 --output=./yolov3_aipp --soc_version=Ascend310 --output_type FP32 --insert_op_conf aipp_yolov3.cfg
问题3
代码:
AclProcess.cpp
原来代码
uint32_t objNum = ((uint32_t *)hostPtr[1])[0];
修改后代码
uint32_t objNum = (uint32_t)((float *)hostPtr[1])[0];
问题4
在dist中修改"Samples/InferObjectDetection/dist/data/config/setup.config"
Tensorflow 转om模型
atc --model=./yolov3_tf.pb --framework=3 --output=./data/models/yolov3/yolov3_aipp --input_shape="Placeholder:1,416,416,3" --insert_op_conf=./data/models/yolov3/aipp_yolov3.cfg --soc_version=Ascend310