Course 4 week 3 Assignment 1

I have a type error in my mask code that I can’t understand.
Some to guide me please !

ipython-input-15-14a23f211c10> in yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold)
35 # same dimension as box_class_scores, and be True for the boxes you want to keep (with probability >= threshold)
36 ## (≈ 1 line)
—> 37 filtering_mask = box_class_scores < threshold
38
39 # Step 4: Apply the mask to box_class_scores, boxes and box_classes

/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_math_ops.py in less(x, y, name)
4909 _result = pywrap_tfe.TFE_Py_FastPathExecute(
4910 _ctx._context_handle, tld.device_name, “Less”, name, tld.op_callbacks,
→ 4911 x, y)
4912 return _result
4913 except _core._NotOkStatusException as e:

TypeError: Cannot convert 0.5 to EagerTensor of dtype int64

ID labo: spkvnyiwnnox

It sounds like your code must be confusing the box scores with the box classes. The scores should be floating point values, so how did they turn out to be integers?

I added a bunch of print statements to my code in that section and here’s the output I get when I run that test cell:

boxes.shape (19, 19, 5, 4)
boxes.dtype <dtype: 'float32'>
box_scores.shape (19, 19, 5, 80)
box_scores.dtype <dtype: 'float32'>
box_classes.shape (19, 19, 5)
box_classes.dtype <dtype: 'int64'>
box_class_scores.shape (19, 19, 5)
box_class_scores.dtype <dtype: 'float32'>
filtering_mask.shape (19, 19, 5)
filtering_mask.dtype <dtype: 'bool'>
sum(filtering_mask) = 1789
scores[2] = 9.270486
boxes[2] = [ 4.6399336  3.2303846  4.431282  -2.202031 ]
classes[2] = 8
scores.shape = (1789,)
boxes.shape = (1789, 4)
classes.shape = (1789,)
 All tests passed!

Yes yes thank you, I used box classes like arg in reduce_max.

Now, I passed the test