Loss error in exercise 10

i keep getting this error when i run the code.
Dimension 0 in both shapes must be equal, but are 2 and 4. Shapes are [2,51150,4] and [4,51150,4]. for ‘{{node Loss/Loss/Select}} = Select[T=DT_FLOAT](Loss/Loss/IsNan, concat_2, Loss/stack_18)’ with input shapes: [4,51150,4], [2,51150,4], [4,51150,4].
I know that there is something wrong with calculating the total error but i don’t think i know how to fix it. If somebody could guide me it would be really helpful.

1 Like


check your preprocessing tensor and true image tensor codes, shapes are mismatching.

Hello Joel,

  1. Incorrect code for (kindly use # assign the name (string) of the directory containing the training images) for the below code line, training is incorrect code
    define the path (string) for each image

  2. Why have your remove the below line from your grader cell,
    <<### START CODE HERE (Replace instances of None with your code ###
    <# Assign the zombie class ID
    removing START CODE HERE can cause metadata error while grading

  3. The below code is incorrect for(CHECK THE HINT SECTION)
    <<# copy the checkpoint to the test_data folder models/research/object_detection/test_data/

  4. Incorrect code(CHECK THE HINT SECTION)
    <<# define the path to the .config file for ssd resnet 50 v1 640x640

  5. Incorrect code
    <<# Read in the object stored at the key ‘model’ of the configs dictionary

  6. Under Header Restore Checkpoint, incorrect code for checkpoint_path.

  7. Don’t hard code the below codes by recalling prefixes_to_train as at one place you used it as prefix
    <<# define a list that contains the layers that you wish to fine tune
    the correct code is this :point_down:
    if v.name.startswith(‘WeightSharedConvolutionalBoxPredictor/WeightSharedConvolutional’):

  8. This grader cell has incomplete code
    <<def train_step_fn(

Your preprocess image step is incomplete you didn’t not create a image list.
HINT: create a list of image where your processed_img and true shape are preprocess and then preprocessed image list is append with processed img which is then converted to true_shape_list with true shape using append again.

After this comes your preprocesses image tensor concat which you have written already.

Do all these corrections

Let me know once your issue is resolved.


why can’t i install this package all of a sudden now?

hello Joel,

Did you run all the cells from beginning when you were doing the current grader cell?

Colab notebook gets disconnected after sometime, so if you going back after a long period of time, make sure to run the cell from beginning one at a time.

oh i did, it was just like a bug ig.
But i made a seperate list for images, preprocessed it and then concatenated it. Now my loss function is 2000… I will send my colab notebook code to you ma’am. Please do look into it when you are free.


Did you make all the corrections one by one??

Hello Joel,

Review of your updated notebook.

No corrections done for the points I mentioned in the above comments

  1. The only correction you did is where I gave you the direct codes but somehow that also was done incorrectly(probably I didn’t give you the complete solution for you to work on)

if v.name.startswith(‘WeightSharedConvolutionalBoxPredictor/WeightSharedConvolutionalBoxHead’) or v.name.startswith(‘WeightSharedConvolutionalBoxPredictor/WeightSharedConvolutionalClassHead’):

  1. Below code should be before preprocess image codes

Joel need effort from you. I am going through your notebook twice to make sure I am guiding you right, but seems like you are not even reading or going through all the pointers I mentioned you to go through.

The only correction you did where I gave you direct solutions.

Not good!!!

Put an effort again, try to do the corrections where you didn’t make any changes in the notebook as per feedback given to you before, or until then you will be stuck. The only reason I gave some direct solutions, because I felt it might tough to crack, but the other pointers are pretty direct.


Didn’t mean to disappoint ma’am. I spent a total of 12 hours on that and it just feels like im stuck there. I will try again. I did update the preprocessing part though, i will try again and let you know ma’am.
Thank you for your time though, i really appreciate it!

Hello Joel,

I am not disappointed or upset.

Just that I know how much one could be frustrated or upset to be stuck at this(been in that ship), and that’s why I gave a detail response regarding each grader cell. So you are able to work on your notebook faster and feel happy that you could crack the code yourself. I could give you direct answer but when I was learner, mentors like @balaji.ambresh used to guide me with hints, so I become better at debugging my codes and learn more.

If you want to take a break and then try, that is more better as sometimes a break helps to approach a task from a refresh mind.

Happy to help!!!

Keep learning!!!


1 Like

I have completed my week 2 assignment. The main problem was that I did a careless mistake and didnt update the train_directory. Another problem was that I kept the groundtruth after preprocessing like you said.
Thanks a lot ma’am!!! Couldn’t have done it without you.

1 Like

Hello Joel,

Happy to help!!! So you debugged your assignment yourself, that is a great start.

Keep Learning!!!