experiencor / keras-yolo3

Training and Detecting Objects with YOLO3
MIT License
1.6k stars 862 forks source link

about true_boxes in YoloLayer #71

Open muye5 opened 6 years ago

muye5 commented 6 years ago
  1. I cannot understand why true_boxes need to be passed into YoloLayer. conf_delta *= tf.expand_dims(tf.to_float(best_ious < self.ignore_thresh), 4) this line filter out some elements which match true_boxes, but how it effect the loss, conf_delta = object_mask * (pred_box_conf - true_box_conf) * self.obj_scale + (1 - object_mask) * conf_delta * self.noobj_scale

  2. why normalizing of loss missed in yolo3. not same with yolo2. loss_xy = tf.reduce_sum(tf.square(xy_delta), list(range(1, 5)))

thanks!

clive819 commented 6 years ago
  1. You might want to take a look at section 2.1.
  2. I'm confused too!
muye5 commented 6 years ago

@clive819 after reading the paper, sorry not very clear yet. i think: conf_delta = object_mask * (pred_box_conf - true_box_conf) * self.obj_scale + (1 - object_mask) * conf_delta * self.noobj_scale only this line is enough because of object_mask & noobj_mask. what's the purpose of this line. conf_delta *= tf.expand_dims(tf.to_float(best_ious < self.ignore_thresh), 4) fill some elements with zero? These elements will multiply with mask tensor, so why we need this step?

clive819 commented 6 years ago

Elements that does overlap a ground truth object by more than self.ignore_thresh will be zero, so they won't be included in loss_conf.

If the bounding box prior is not the best but does overlap a ground truth object by more than some threshold we ignore the prediction, following [17].

muye5 commented 6 years ago

@clive819 got it. thank you very much.