C4 W3 assignment error

In the Yolo eval (Ex 4) I get the following error: InvalidArgumentError: Incompatible shapes: [19,19,5,4] vs. [19,19,5,80] [Op:Mul].
Here is my code:

# code removed by moderator - sharing your code is not allowed

Double check the line of your code that is causing the error. There is something wrong with one or more of the arguments you are passing to a function that you are trying to call.

Are you referring to a specific line? Honestly I can’t tell where is the fault

One thing you could try is examine the shapes reported in the Exception. Which object’s shape has an 80 in it? Which object’s shape has a 4 in it. Without even looking at the code, it seems like that is classes and boxes. Does it ever make sense to multiply the classes vector by the boxes vector? (Spoiler alert…no). Where could that have crept in to the code? BTW, it doesn’t look like there is any multiplication in yolo_eval itself, so it was probably in one of the called functions. My guess is yolo_filter_boxes. That is where I would start looking. HTH

The exception trace should show the complete stack trace including the line that “throws”. As pointed out by ai_curious, that may well not be in yolo_eval.

Ah, ok, it looks like you have copied an old version of this notebook that was from before the April 2021 update to the courses. That doesn’t work, because they changed the definition of several of the APIs here. Take a careful look at the definition of the yolo_filter_boxes function and you’ll find that you are calling it incorrectly. You can’t just “copy/paste” an old solution: you have to carefully examine everything and adjust to match the new definitions and requirements.

@Edo_Sela, please do not share your code on the forum. That’s not allowed by the course community standard.

Posting a your error messages or asserts is usually enough for the mentors to guide you to a solution. A screen capture image is the best choice.

@bs80, please refrain from replying to students who share their code.
Code-sharing should not be encouraged.

Thanks!