Stuck on yolo_eval function

I get the error

ValueError: operands could not be broadcast together with shapes (19,19,5,4) (19,19,5,80)

I’m not sure whether it’s ok to post my code here, so I won’t, but I can, if that would help.

Anyway, I think the culprit is that first shape. I think it’s supposed to be (19,19,5,1) . It corresponds to box_confidence. But I checked the shape of that and it IS (19,19,5,1)

Posting your code isn’t allowed. However, if a mentor needs to see your code, we’ll ask you to download your notebook and send it via a private message.

Please post a screen capture image that shows the entire assert stack and any error messages. This will help me know what you were attempting to do when the error happened (just running the notebook, vs. submitting it for grading).

Recall that the recipe for output shape of this exercise’s YOLO v2 model is S*S*B*(1+4+C) where S=19, B=5 and C=80. The 4 is bounding box values for location and shape. The error message suggests you are trying to multiply box coordinates times class confidence, which, as your intuition correctly suggests, does not make mathematical or operational sense. Take a close look at the variables and make sure you’re not using the wrong box… variable.

You should also pay close attention to the order in which parameters are passed to yolo_filter_boxes()

Thanks to both of you for your speedy responses. @ai_curious , you are absolutely right. I had the order of arguments mixed up to yolo_filter_boxes()

1 Like