CNN W3A1 - arguments being passed to function as probabilities are not between 0 and 1

Hi all.

I’m working on the first assignment of week 3 of CNN. The function I’m working on is UNQ C1 def yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold = .6)

I believe that box_confidence and box_class_probs are probalities, in which case they should be between 0 and 1. However, they’re defined as tf.random.normal([shape], mean=1, stddev=4, seed = 1) in the function cell that runs this function, which do not sit between 0 and 1.

I assume the assignment is correct but I can’t see what I’m supposed to do. What do I do with these non-probabilites?

Thanks

1 Like

Don’t worry about the values that are used in the test cases. They aren’t realistic, but your code will give the expected results if you follow the instructions in the notebook.

1 Like

Can you elaborate? I’m supposed to multiply two probabilities. It is not passing probabilities to the function.

‘box_confidence`: tensor of shape (19, 19, 5, 1) containing p_c (confidence probability that there’s some object) for each of the 5 boxes predicted in each of the 19x19 cells.’

box_confidence is not being passed as a probability.

1 Like

You’re right that they were not careful when they created the test cases for these functions. A bug has already been filed about this. But as Tom said, your code will pass the test cases if you write it correctly. There is no place in your code where it matters that the value of p_c is between 0 and 1, right? All you do is multiply the confidence by the class probabilities and then pick the element with the maximum value.

2 Likes

+1 for noticing. Unfortunately, it has been like this since the course was created in 2018. I infer it is not yet risen to the top of the bug fix priority list :man_shrugging:

However, I concur with the esteemed mentors who have responded above. Other than needlessly consuming some of your processing cycles, that initialization has no downstream impact. During real training, p_c is assigned to the Y ground truth matrix as either 0.0 or 1.0 depending on whether an object is present or not. And during runtime p_c in the \hat{Y} prediction matrix is derived from CNN outputs, not assigned. Assigning values in this section of the notebook is thus useful only for validating the matrix shapes and the code to find the index of the largest value. The actual values output from the normal function are not used later in the exercise. And don’t appear at all in real world usage of the YOLO algorithm. Hope this helps.

2 Likes