phanxuanduc1996 / convert_yolo_weights

Summary of methods to convert models in Yolo-v4-v3-v2
73 stars 23 forks source link

Error when coverting Yolov4 to mlmodel #5

Open lp55 opened 4 years ago

lp55 commented 4 years ago

Hi,

I trying to convert yolov4 and yolov4-tiny (from https://github.com/AlexeyAB/darknet) but I got the same error for both of them:

python convert_weights_to_mlmodel.py --img_size=416 --config_path=C:/Downloads/yolov4-tiny.cfg --weights_path=C:/Downloads/yolov4-tiny.weights --output_path=yolov4-tiny.mlmodel Using TensorFlow backend. Loading weights. Weights Header: 0 2 5 [32012800] Parsing Darknet config. Creating Keras model. Parsing section net_0 Parsing section convolutional_0 conv2d bn leaky (3, 3, 3, 32) Traceback (most recent call last): File "convert_weights_to_mlmodel.py", line 344, in _main(parser.parse_args()) File "convert_weights_to_mlmodel.py", line 232, in _main prev_layer = ZeroPadding2D(((1,0),(1,0)))(prev_layer) File "C:\Miniconda3\envs\tf\lib\site-packages\keras\engine\base_layer.py", line 474, in call output_shape = self.compute_output_shape(input_shape) File "C:\Miniconda3\envs\tf\lib\site-packages\keras\layers\convolutional.py", line 2113, in compute_output_shape output_shape[dim] += sum(padding_all_dims[dim]) TypeError: can only concatenate str (not "int") to str

I'm using tensorflow 1.5 and keras 2.2.4 (as other versions generated warnings of compatibility). It seems to have a type mixup somewhere in the code. Any ideas?