taipingeric / yolo-v4-tf.keras

A simple tf.keras implementation of YOLO v4
MIT License
140 stars 79 forks source link

simple fix for grid_size in yolov4_head when using custom img_size #7

Open gajdosech2 opened 3 years ago

gajdosech2 commented 3 years ago

There was an error when calling model.predict when using custom _imgsize other than 416x416:

Invalid argument:  Input to reshape is a tensor with _XX_ values, but the requested shape has _YY_
         [[node functional_9/tf_op_layer_Reshape_12/Reshape_12 (defined at ./yolo\models.py:115) ]]
         [[functional_9/tf_op_layer_Mul_89/Mul_89/_6]]

This is caused by the incompatibility of _gridsize when calling get_boxes inside of yolov4_head. This is a simple fix I use in my fork, which scales the _gridsize accordingly to the custom _imgsize. Merge if you find it suitable.

BTW @taipingeric thank you for your work!

remingm commented 1 year ago

Thank you!