C4W3 Exercise 1 in Autonomous_driving_application_Car_detection

Exercise 1 in Autonomous_driving_application_Car_detection

What are these two lines mean? I cannot find any explaination in the introductory text.
x = 10
y = tf.constant(100)

I am also getting strange testing results. My code got the following results:

scores[2] = 0.09270486
boxes[2] = [ 4.6399336 3.2303846 4.431282 -2.202031 ]
classes[2] = 8
scores.shape = (1402,)
boxes.shape = (1402, 4)
classes.shape = (1402,)

While expected outcome is:

boxes[2][ 4.6399336 3.2303846 4.431282 -2.202031]
boxes.shape(1789, 4)

I noticed the input class probability is in the range of 1~100, so I divided it with y = 100. I was able to get some test result right, and some smaller by a factor of 100, and others within reasonable range. What could I have done wrong?

Those variables x and y are not used. They’ll be removed in the next update to the notebook.

For your other strange results: Please identify exactly which function you were working on. I’m going to guess it was “yolo_filter_boxes”.

You should not be using that ‘y’ variable.

What exactly do you mean by “input class probability”?

Does your code pass the unit tests?

Yes it is yolo_filter_boxes. It didn’t pass the unit test.

What I did:

step 1: element-wise multiply of ‘box_confidence’ and ‘box_class_probs’
step 2: use tf.math.argmax to get ‘box_classes’ from ‘box_scores’, axis = -1
use tf.math.reduce_max to get ‘box_class_scores’ from ‘box_scores’, axis = -1
step 3: direct compare if ‘box_class_scores’ is smaller than ‘threshold’
(here I noticed data inside ‘box_class_scores’ is in range of 0-100, so I must have done something wrong before this step?)

step 4: use tf.boolean_mask to get outputs.

I also have done something very similar to this but I get an error Cannot convert 0.5 to EagerTensor of dtype int64 If I divide the probabilities by 100 i get a shape of 324,

1 Like

Seems like you need a type conversion on your tensor?

No help?

I also tried to multiply threshhold by 240, and the unit test result matches. That didn’t get me the correct model of course.

Any help would be great, really stuck here. At least tell me there is nothing wrong with the test data…

Hello zhuliyi0,

Do not hesitate to read the statement again as well as the comment telling you what to do, check if it matches your code. :slightly_smiling_face:

My extremely careless reading! Thanks!