tensorflow-yolo-v3
tensorflow-yolo-v3 copied to clipboard
Wrong height and width order in _upsample(inputs, out_shape, data_format='NCHW')
Hi, I first convert darknet weights to .pb with 416x416 input size, which is successful. However, when I tried to convert weights with (None, 224, 320, 3 ), which is NHWC format, convert_weights_pb.py reports error:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 20 and 14. Shapes are [?,20,14] and [?,14,20]. for 'detector/yolo-v3-tiny/concat_3' (op: 'ConcatV2') with input shapes: [?,20,14,128], [?,14,20,256], [] and with computed input tensors: input[2] = <3>.
This error happens when the feature map data format is changed after upsampling. So I took a look at function _upsample(inputs, out_shape, data_format='NCHW'). I believe for NHWC format, the output shape is: new_height = out_shape[1] new_width = out_shape[2]
instead of your oder. After this change, the weights can be successfully converted.
Please point out if I make any mistakes.
However, in this way, it produces a lot of false positives. :(
However, in this way, it produces a lot of false positives. :(
hello , I have met this same pro, my input is (608,416), have u fixed this pro,? if yes please tell me , help the children!
Hi is there any update on this issue? thanks!
Hi, Try to patch _upsample function (yolo_v3.py file), it seems there is a bug with the indexes
if data_format == 'NCHW':
new_height = out_shape[2]
new_width = out_shape[3]
else:
new_height = out_shape[1]
new_width = out_shape[2]
Hi, I first convert darknet weights to .pb with 416x416 input size, which is successful. However, when I tried to convert weights with (None, 224, 320, 3 ), which is NHWC format, convert_weights_pb.py reports error:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 20 and 14. Shapes are [?,20,14] and [?,14,20]. for 'detector/yolo-v3-tiny/concat_3' (op: 'ConcatV2') with input shapes: [?,20,14,128], [?,14,20,256], [] and with computed input tensors: input[2] = <3>.
This error happens when the feature map data format is changed after upsampling. So I took a look at function _upsample(inputs, out_shape, data_format='NCHW'). I believe for NHWC format, the output shape is:
new_height = out_shape[1] new_width = out_shape[2]
instead of your oder. After this change, the weights can be successfully converted.Please point out if I make any mistakes.
Hi, I have sent an email to you about this question. Can you help me? tks