我一直在寻找将自定义训练的yolov3-tiny网络从darknet格式转换为Caffe格式的方法,但是我尝试的每个Python程序都失败了。有人设法做到这一点并使它起作用吗?如果是这样,您在什么环境下使用了什么程序或教程?
我有一台装有Windows 10和Visual Studio 2019的计算机,还有一台装有Ubuntu 18.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)
我正在使用Python 2.7,并安装了Caffe和Pytorch。我按照本教程编译了caffe库:https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide