Values in box_confidence in YOLO assignment

I checked the box_confidence values in Exercise 1 “yolo_filter_boxes”. By def, “box_confidence” is tensor of shape (19,19,5,1) containing 𝑝𝑐 (confidence probability that there’s some object) for each of the 5 boxes predicted in each of the 19x19 cells.

If it’s probability, the values should be between 0 and 1. However, if I print out “box_confidence” inside “yolo_filter_boxes”, it gives me:

tf.Tensor(
[[[[ 0.885695  ]
   [ 1.6324562 ]
   [-1.0968447 ]
   [-1.3350451 ]
   [ 1.3657959 ]]

  [[-6.310956  ]
   [-0.54382193]
   [-0.24732351]
   [-3.580883  ]
   [-3.31002   ]]
.... // the rest of values

Why do these values are out of range between 0 and 1? Are they logits, not probabilities? If they are logits, does it make sense to do multiplications between box_confidence and box_class_probs (which seems between 0 and 1)?

Sorry, they were a bit sloppy when they generated the test data here: you can see that they just used tf.random.normal for the various input tensors, so you get values that are not representative of the real data that you would see. But the test cases still are valid for checking your code, because the logic doesn’t really depend on the probability and confidence values being between 0 and 1.

In other words, it’s not a good idea to draw conclusions about anything from the test data used here.

1 Like

Here’s another one…

Some of these classes have been available for as many as 7 years. Over time, the fora have accumulated answers that may directly relate to or outright solve questions you might be having. Such as this one. Or the one about anchor boxes. Maybe give the search a try? If an existing question doesn’t completely resolve your issue, let us know why so at least a mentor won’t exactly repeat what they wrote before. HTH

1 Like