Course 4 week 3 Yolo assignment

I’m having difficulty using the suggested tensorflow functions in exercise 1, yolo_filter_boxes(). The text says
For each box, find:

But, somehow, the dimensions are off when applying the filtering_mask to the boxes parameter.
Shapes (19, 19, 5, 4) and (19, 19, 5, 1) are incompatible

Any hints about what I’m doing wrong?
Thanks!

This is a common syndrome. You are probably using the incorrect inputs in some cases. I modified my code to print the shapes of everything. Here’s what I see for that test case:

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'>
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!

Have a look and compare to the shapes you see and perhaps that will shed some light.

Thanks! That provided me with the insight I needed to fix the function!