aloyschen / tensorflow-yolo3

tensorflow implementation of yolov3
143 stars 58 forks source link

Some problems with yolo_loss... #10

Open washline opened 5 years ago

washline commented 5 years ago

在yolo_loss里面计算raw_true_wh时,一般将无效的grid区域设为0。这里为什么设为1呢:

raw_true_wh = tf.log(tf.where(tf.equal(y_true[index][..., 2:4] / anchors[anchor_mask[index]] * input_shape[::-1], 0), tf.ones_like(y_true[index][..., 2:4]), y_true[index][..., 2:4] / anchors[anchor_mask[index]] * input_shape[::-1]))

其他项目里面: raw_true_wh = K.log(y_true[l][..., 2:4] / anchors[anchor_mask[l]] * input_shape[::-1]) raw_true_wh = K.switch(object_mask, raw_true_wh, K.zeros_like(raw_true_wh)) # avoid log(0)=-inf 这里,无效的wh设为了0. 有谁可以解答一下吗?thanks....

aloyschen commented 5 years ago

因为log1就为0了