ValueError: Unequal shapes [2], [91]

I am getting this value error :" Unequal shapes [2], [91]" during loss calculation of detection model. Any help would be great , i am stuck at this point from last 1 week.

Hi @prince_kumar,

Can you share your notebook with me in a DM ? I shall take a look.


Hi @Mubsi ,
Thank you for your reply. Pls find below link for colab notebook. I have provided the editor access for the notebook.
Link:- Google Colab

Thanks & Regard

Hi @prince_kumar,

when I ran the colab you shared till this point, everything worked. Are you still facing the issue ?


1 Like

Having the same error while calculating loss.
PS: why calling detection_model.loss twice?

colab link
Thank you.

1 Like


Posting your code here is not the best of ideas. From the error it says that the inputs to the detection model loss are not of the same shape. Try to check in the lines where those are calculated and dependencies, something must be wrong there.

Did anyone ever figure out what caused this problem? We have another student who has run into it.
The one thing I noticed is [2] is num_classes+1 for our new Zombie model, and [91] is num_classes+1 for the original RetinaNet model we are retraining, so it sounds like we somehow have a mix of the two versions.
Here’s the post with the new student’s issue: Course 3 - Week 2 - Zombie assignment

I am having a related issue I’ve not been able to figure out. I’m getting “ValueError: Unequal shapes [5], [2]” while running model.loss(…) step. I guess prediction_dict and true_shape_tensor are having an unequal shape issue, but I’m not sure how to debug this. I’ve printed some of the shapes below:

Do I have a typo somewhere? Steps up to this point seem to have worked. Happy to provide link to code.

I would concentrate the debugging effort at this moment at the train_step_fn function and more specifically how you obtain the:
true_shape_list and others further down.

I appreciate the response! Ultimately found that I had a typo when providing the arguments to the ground truth. I passed the same list to both arguments by accident, which meant boxes and classes were getting compared. So hard to spot! Thanks again.

1 Like