allanzelener / YAD2K

YAD2K: Yet Another Darknet 2 Keras
Other
2.72k stars 881 forks source link

iou compute #17

Closed tsminhuang closed 7 years ago

tsminhuang commented 7 years ago

in preprocess_true_boxes
compute box area box_area = box[2] * box[3] but the box is relative value to original To compute box area on final conv dim need multiply with conv_dim? box_area = (box[2] *conv_width) * (box[3] * conv_height)

allanzelener commented 7 years ago

Ah, you're right! Thanks for catching that! I'll patch and test it later today.

Btw this box scale issue has been the biggest headache implementing this loss function. Adding the rescaling to the correct scale on line 401 (box_maxes = box[2:4] * np.array([conv_width, conv_height]) / 2.) to compute the intersection area is what finally got it working on train_overfit.py but the union area is definitely still strong. There's three different ways bounding box scales are represented (image scale, [0,1] interval, final conv scale) and at least three different ways to define/order the bounding box coordinates. :cry:

allanzelener commented 7 years ago

I've fixed this and refactored how ground truth box scaling works in preprocess_true_boxes in this commit.