I’m having an issue with yolo_filter_boxes, specificallly when applying my filtering mask. I have a mask with shape (19, 19, 5, 1) and it works for scores but not for boxes or classes. For the latter two, I get an error saying ValueError: Shapes (19, 19, 5, 4) and (19, 19, 5, 1) are incompatible
I was able to get around this by using np.squeeze() around the filtering_mask for these two calls, which makes the unit tests pass. However, when the function is called later on in predict(), I get the error ValueError: Shapes (1, 19, 19) and (19, 19, 5) are incompatible.
I think it has something to do with rank 1 array weirdness, but I can’t put my finger on it.
Thanks in advance.
I added print statements to show the shapes of all the objects in that function. Here’s what I see with code that passes:
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!
Let us know if that sheds any light.
I tried submitting it as it was to see if it clarified anything, and apparently it passes all of the grader’s tests because it gives me 100%.
Will definitely take another look at my shapes.
Fixed one place where I was keeping the dims and needed to discard them, but that didn’t fix my problem.
I also got this the second time I submitted:
`Sorry, your submission was incorrect. Please try again. [Errno 2] No such file or directory: ‘/shared/submission/submission.json’`
The 0% grading problem was transient; it went back to 100% on the next try.
I fixed my errors. I think was using np.squeeze() to compensate for an earlier keepdims=True. Still not sure exactly how the error worked though. (I saved a copy of the notebook that demonstrated the issue, failing the unit test with a ValueError but passing the grading assessment).
Thanks again!
It’s great that you found the solution. Thanks for confirming!