Course 4, Week 3, Part 1: yolo_filter_boxes function problem

The problem is in the tf.math.greater_equal call you are doing to compare a tensor elementwise with a scalar value. It is trying to do the analog of numpy “broadcasting” to convert the second argument into a tensor of the same type and shape as the first argument. But for some reason, it looks like your box_class_scores is of type int64, which causes it to throw that error. How could that happen? You can check it like this:

print(f"box_class_scores.shape {box_class_scores.shape}")
print(f"box_class_scores.dtype {box_class_scores.dtype}")

When I added those lines to my routine and ran the same test cell you are running, here’s what I got:

box_class_scores.shape (19, 19, 5)
box_class_scores.dtype <dtype: 'float32'>

What do you see when you try that?

1 Like