Closed abajaj945 closed 6 years ago
This is a bit of legacy code from a time where the YOLO head was prediction a confidence factor for airplanes. I switched that part to use a 2-way softmax classifier. There is no confidence factor needed anymore as one of the two softmax neurons will necessarily have a bigger activation than the other. Since parts of the code relied on the confidence factor, I computed a fake confidence factor of 0.0 or 1.0 from the softmax activations so that the code would still work. I was not sure if determining if something was a plane or not would work better with a 2-way softmax classifier or with a confidence value from a regressor so I changed the least possible amount of code so I could go back if needed, or compare the two approaches. I am quite happy with the 2-way softmax classifier now.
In model.py in line 203 you have used tf.cast(tf.argmax(box_c, axis=-1), dtype=tf.float32) function which will return a tensor of shape (batch_n, grid_nn, grid_nn, cell_n) in which the values will be either 0.0 or 1.0, then why you have used DETECTION_THRESHOLD in line 205 because the values are either 0.0 or 1.0
box_c_sim = tf.cast(tf.argmax(box_c, axis=-1), dtype=tf.float32)
DETECTION_TRESHOLD = 0.5 # plane "detected" if predicted C>0.5 detected_w = tf.where(tf.greater(box_c_sim, DETECTION_TRESHOLD), box_w, tf.zeros_like(box_w))