Question on programming assignment 1, exercise 1

I printed out the first element of the box_class_probs and it is not between 0 and 1. Is that correct? It looks like the unit test is creating these with a mean of 1 and stddev of 4. What am I missing?

box class probs[0,0,0,0] =  tf.Tensor(4.8387423, shape=(), dtype=float32)

You’re right that the test cases are not really correct here in that the random values they generate do not look like probabilities. But there is nothing in your code that really depends on the fact that the inputs are between 0 and 1. If your code is correct, it will still pass the tests.

I filed a bug about this quite a while ago, but it apparently has not floated up high enough on the priority list to get fixed.

Ok, I went back and checked the git repo. I filed this as a bug back in 2022, but they closed it because a) apparently some of the logic is shared with the grader and changing the grader is a big hassle and b) this is actually explained in the notebook.

There is this note right after that test case:

Note In the test for yolo_filter_boxes , you’re using random numbers to test the function. In real data, the box_class_probs would contain non-zero values between 0 and 1 for the probabilities. The box coordinates in boxes would also be chosen so that lengths and heights are non-negative.

So the bottom line is that the test case is still valid for checking the correctness of your code, even though the values don’t really look like the input values your function will see in real use.

Thanks, Paul!

I managed to get the first exercise done without bothering you (other than the question about probabilities above). On to the next one!

2 Likes