Bird Boxes Assignment Problem With IoU

For clarification first I will provide previous parts of the assignment. Here is the picture of model which is same as the expected one:

I think it could be caused by loss function so I also wanted to provide it:
model.compile(optimizer=tf.keras.optimizers.SGD(momentum=0.9), loss={‘bounding_box’:‘mse’})

With these arrangements, model works and training done with no error as you can see below:

After these steps I should be able to get Intersection of Union (IoU) value but I get some error, I don’t know how to solve it since this part is only for running I can’t change the code

A python list object doesn’t have a shape attribute.
See if you can use numpy functions to convert a list to a numpy array.

Thanks for the answer but still not working

Now you have a different error, its a shape mismatch. The loss is not right, there is no such loss defined anywhere, should be mse. Also I hope there is nothing wrong with normalized_images.

If the loss is wrong, I think you will get an error in the training step which doesn’t seemed to have happened here. I’m having these issues too and I used “mse”.


We never got to the bottom of the error previously. If you want send me in private a copy of your notebook, I will check it probably tomorrow.

Hi Gent,

I resolved it. Apparently, you are supposed to pass only 1 output (Bounding boxes) in the model definition (see attachment).

I was passing 2 before: Dense & Bounding boxes. As a result, the “512” in the error message came from the 512 units we are supposed to set in the final Dense layer.

After this change, everything worked like a charm! Hope this helps others who faced similar issues.

Thats great Anivader, most of the issues we get here are because something has been forgotten or rushed in. Its good to go over it again and again if an issue occurs.