有人成功地将yolov3tiny模型转换为Caffe吗?

2024-06-01 00:35:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在寻找将定制的yolov3微型网络从darknet格式转换为Caffe格式的方法,但我尝试的每个Python程序都失败了。有人成功地做到了吗?如果是,您使用了什么程序或教程,在什么环境下使用

我有一台安装了Windows10和VisualStudio2019的机器,还有一台安装了Ubuntu18.04的虚拟机,如果有帮助的话

编辑:以下是我尝试过的一些程序:

https://github.com/marvis/pytorch-caffe-darknet-convert

~/darknet2caffe/pytorch-caffe-darknet-convert-master$ python darknet2caffe.py ../yolov3-conos-tiny.cfg ../yolov3-conos-tiny.weights conos.prototxt conos.caffemodel
unknow layer type yolo 
unknow layer type upsample 
Traceback (most recent call last):
  File "darknet2caffe.py", line 350, in <module>
    darknet2caffe(cfgfile, weightfile, protofile, caffemodel)
  File "darknet2caffe.py", line 10, in darknet2caffe
    net_info = cfg2prototxt(cfgfile)
  File "darknet2caffe.py", line 251, in cfg2prototxt
    prev_layer_id = layer_id + int(block['layers'])
ValueError: invalid literal for int() with base 10: '-1, 8'

https://github.com/BingzheWu/object_detetction_tools

~/darknet2caffe/object_detetction_tools-master/nn_model_transform$ python darknet2caffe.py ../../yolov3-conos-tiny.cfg ../../yolov3-conos-tiny.weights conos.prototxt conos.caffemodel
Traceback (most recent call last):
  File "darknet2caffe.py", line 6, in <module>
    from prototxt_utils import *
  File "/home/carlos/darknet2caffe/object_detetction_tools-master/nn_model_transform/prototxt_utils.py", line 151
    print('%s%s {' % (blanks, prefix), end = "\n", file = fp)
                                           ^
SyntaxError: invalid syntax

https://github.com/eric612/MobileNet-YOLO/tree/master/models/darknet_yolov3

~/darknet2caffe/MobileNet-YOLO-master/models/darknet_yolov3$ python darknet2caffe.py ../../../yolov3-conos-tiny.cfg ../../../yolov3-conos-tiny.weights conos.prototxt conos.caffemodel
2
OrderedDict([('bottom', 'layer19-conv'), ('top', 'layer20-upsample'), ('name', 'layer20-upsample'), ('type', 'Upsample'), ('upsample_param', OrderedDict([('scale', '2')]))])
('upsample:', 20)
[libprotobuf ERROR google/protobuf/text_format.cc:298] Error parsing text-format caffe.NetParameter: 636:20: Message type "caffe.LayerParameter" has no field named "upsample_param".
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0518 13:14:19.206104 15199 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: conos.prototxt
*** Check failure stack trace: ***
Aborted (core dumped)

我正在使用Python2.7并安装了Caffe和Pytorch。我按照本教程编译了caffe库:https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide


Tags: pyhttpsgithubmastercomlinecaffefile