experiencor / keras-yolo2

Easy training on custom dataset. Various backends (MobileNet and SqueezeNet) supported. A YOLO demo to detect raccoon run entirely in brower is accessible at https://git.io/vF7vI (not on Windows).
MIT License
1.73k stars 787 forks source link

How to implement custom_loss for grid with different width, height #444

Open KienPM opened 4 years ago

KienPM commented 4 years ago

I'm implementing a model base on your original model with different width, height grid (28x7) according to this paper https://new.hindawi.com/journals/mpe/2018/3518959/

I got error when running the code at concat function, because according to your original, the width and height must be equal so that cell_x and cell_y can be concatenated

cell_x = tf.to_float(tf.reshape(tf.tile(tf.range(self.grid_w), [self.grid_h]), (1, self.grid_h, self.grid_w, 1, 1)))
cell_y = tf.transpose(cell_x, (0,2,1,3,4))

cell_grid = tf.tile(tf.concat([cell_x,cell_y], -1), [self.batch_size, 1, 1, self.nb_box, 1])

Can you please help me! Thank you very much!

rodrigo2019 commented 4 years ago

https://github.com/rodrigo2019/keras_yolo2