dog-qiuqiu / MobileNet-Yolo

MobileNetV2-YoloV3-Nano: 0.5BFlops 3MB HUAWEI P40: 6ms/img, YoloFace-500k:0.1Bflops 420KB:fire::fire::fire:
Other
1.71k stars 277 forks source link

尝试转化了下MobileNetV2-YOLOv3-Nano-voc到NCNN,报错has no field named "upsample_param" #8

Open flyboy114 opened 4 years ago

flyboy114 commented 4 years ago

使用了最新的NCNN,但项目里面MobileNetV2-YOLOv3-Nano-voc模型还是无法转化,报错:

(py35) qglobal@qglobal-ThinkStation-P328:~/ncnn/build/tools/caffe$ ./caffe2ncnn MobileNetV2-YOLOv3-Nano-voc.prototxt MobileNetV2-YOLOv3-Nano-voc.caffemodel
[libprotobuf ERROR google/protobuf/text_format.cc:274] Error parsing text-format caffe.NetParameter: 2066:20: Message type "caffe.LayerParameter" has no field named "upsample_param".
read_proto_from_text failed

大佬,你这个表里模型测试的NCNN模型是咋转化的

Network VOC mAP(0.5) COCO mAP(0.5) Resolution Inference time (NCNN/Kirin 990) Inference time (MNN arm82/Kirin 990) FLOPS Weight size
MobileNetV2-YOLOv3-Lite 72.61 36.57 320 31.58 ms 18 ms 1.8BFlops 8.0MB
MobileNetV2-YOLOv3-Nano 65.27 30.13 320 13 ms 5 ms 0.5BFlops 3.0MB
YOLOv3-Tiny-Prn & 33.1 416 36.6 ms & ms 3.5BFlops 18.8MB
YOLO-Nano 69.1 & 416 & ms & ms 4.57BFlops 4.0MB
dog-qiuqiu commented 4 years ago

https://github.com/Tencent/ncnn/tree/master/tools/darknet 直接cfg和weights转啊,不用转成caffe的格式,MNN得先darknet2caffe,在caffe2mnn,NCNN支持darknet模型直接转换 cd ~/ncnn/build/tools/darknet ./darknet2ncnn MobileNetV2-YOLOv3-Nano-voc.cfg MobileNetV2-YOLOv3-Nano-voc.weights 还有你转换ncnn的param和bin格式后,记得再用ncnnoptimize合并BN层,还不懂的话+qq群

flyboy114 commented 4 years ago

成功了,感谢大佬!!!

gttiankai commented 4 years ago

今天刚刚在TNN的模型转换里面支持了这个模型。哈哈,有兴趣可以试一下。 https://github.com/Tencent/TNN

dog-qiuqiu commented 4 years ago

@gttiankai 大佬,我是直接Darkne2Caffe转成caffe模型在转成TNN格式吗?

gttiankai commented 4 years ago

是的,需要先转换成caffe。 我使用https://github.com/dog-qiuqiu/MobileNetv2-YOLOV3/tree/master/darknet2caffe/sample 这个里面的caffe模型测试。

dog-qiuqiu commented 4 years ago

@gttiankai 好的,谢谢啦,我试试啦

flyboy114 commented 4 years ago

@gttiankai @dog-qiuqiu 用了https://github.com/dog-qiuqiu/MobileNetv2-YOLOV3/tree/master/darknet2caffe/sample 里面的模型转化完后生成的.tnnproto里面似乎没有scores和boxes,似乎没有输出层。

MobileNetV2-YOLOv3-Nano-voc.tnnproto.txt

dog-qiuqiu commented 4 years ago

@flyboy114 Tnn yolo后处理得自个写,它只负责输出featuremap

flyboy114 commented 4 years ago

@dog-qiuqiu 我用了Netron看了下转化后的模型,是将layer69-conv和layer79-conv作为最后的featuremap吧 version-slim-320_simplified

dog-qiuqiu commented 4 years ago

是的呀