Hello,
Although I did not get any error in all previous cells, the final cell used for predicting on a image file fails with the following error:
Can you please suggest what I can look at?
This is the cell that is returning the error:
Thanks,
Suhas
1 Like
By looking at your error, I didn’t get what might be the error. Are you facing this in the Coursera environment or your local environment? If local environment, is this code works in the Coursera environment?
Best,
Saif.
1 Like
This is in coursera environment itself.
Basically the predict function cell and this cell are already implemented.
All the previous cells have passed with no error.
But when this cell with call to predict function is run, I get the error.
The error is saying that the shapes of filtering_mask and boxes do not match.
I added the below two lines in yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold = .6)
code, just after defining the filtering_mask
.
print(f'filtering_mask shape: {filtering_mask.shape}')
print(f'boxes shape: {boxes.shape}')
Then I re-ran all the cells and output of the cells predict("test.jpg")
is:
filtering_mask shape: (1, 19, 19, 5)
boxes shape: (1, 19, 19, 5, 4)
Check yours…
And please share the full error, in one picture.
The error is as shown below:
The shapes differ for some reason.
Thanks for the clue.
I found that I used “3” in the axis parameter while creating filter instead of “-1”
Hence it was failing.
I figured, 3 should work and it did pass all evaluation cell for “yolo_filter_boxes”
Here’s me thinking out loud about the shapes involved…
the output matrix for the grid cells and anchor boxes is (1,19,19,5) right? I’m collecting the data for boxes that pass the threshold. so what shape does the filtering mask need to be? The class prediction vector has an 80 in it, since that is the number of classes used in this exercise. Does it make sense for the filtering mask to have a last dimension of 80? (spoiler alert: no)
So, how could that have gotten in there, if it ran ok during the previous parts of the exercise? Hmm. Are the parameters being passed in the correct order, because that would be the simplest to diagnose and fix…
Yes. The shape should not be 80.
Checking back, the definition of filtering_mask had a bug
1 Like