W3_A1 Can these be negative?

In the test cell, these initializations catch my attention. The normal distribution also includes negative numbers. Can these variables be negative?

BEGIN UNIT TEST

tf.random.set_seed(10)
box_confidence = tf.random.normal([19, 19, 5, 1], mean=1, stddev=4, seed = 1)
boxes = tf.random.normal([19, 19, 5, 4], mean=1, stddev=4, seed = 1)
box_class_probs = tf.random.normal([19, 19, 5, 80], mean=1, stddev=4, seed = 1)

That is a good point. The real values your model would see for those quantities would not be negative. It would have been more appropriate to use the uniform distribution on [0,1] for the confidence and probabilities and that would work for the boxes as well. But if we’re just testing the code it really does no harm, since nothing in our code really depends on having realistic inputs. I think this was reported a couple of years ago as a bug, but they elected not to fix it. I’ll double check and at least file it as a bug.

1 Like

I just checked the history here and I did file this as a bug a couple of years ago, but it was decided to leave it as is. It is still a meaningful test of the code and changing the test cases in the notebook apparently also requires changing the graders and republishing them, which is a hassle. They also pointed out that there is a “markdown” section right after the test that explains that the values are not realistic. Here’s the text which was already in the notebook before the previous bug was filed:

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.