pythonlessons/TensorFlow-2.x-YOLOv3

Invalid boxes in training time

hxnghia99 opened this issue · 1 comments

Dear,
I have questions about the way of processing invalid boxes in training time.
In your code, you change the position of coordinates to make invalid boxes into valid boxes and calculate giou as normal. For me, it is logically uncorrect, could you explain to me why you did that? I think it is better to remove them in training time.

`def bbox_giou(boxes1, boxes2):
boxes1 = tf.concat([boxes1[..., :2] - boxes1[..., 2:] * 0.5,
boxes1[..., :2] + boxes1[..., 2:] * 0.5], axis=-1)
boxes2 = tf.concat([boxes2[..., :2] - boxes2[..., 2:] * 0.5,
boxes2[..., :2] + boxes2[..., 2:] * 0.5], axis=-1)

#--> convert invalid boxes to valid boxes
boxes1 = tf.concat([tf.minimum(boxes1[..., :2], boxes1[..., 2:]),
tf.maximum(boxes1[..., :2], boxes1[..., 2:])], axis=-1)
boxes2 = tf.concat([tf.minimum(boxes2[..., :2], boxes2[..., 2:]),
tf.maximum(boxes2[..., :2], boxes2[..., 2:])], axis=-1)`

I answered myself. Those lines of code are redundant because invalid boxes does not exist in YOLOv3.