Bird Box Assignement

M​y validation accuracy is 70% but still my model can predict only 3 images. I tried with different model like resnet50, mobilenet, mobilenetv2 with different optimizer but did not work for me. I used dropout but still did not works for me. What I should try can any one suggest.

Hi @nisarggandhewar,

How many images had you tried testing it on?

Sir tried with 500 images.

Hello there,

Did you add the dense and flat layers after the mobilnet network? Also did you use the right weights for the mobilnet network?

1 Like

Yes sir, I have added dense and flat layers, yes sir i used right weight for mobilnet “imagenet” but still not able to get good accuracy. My model summary is exactly same as shown in image. I tried lot. kindly help me. I have done lot of experiment with epochs, optimizer, different model but failed to predict more than 50% images from validation set.

Sir this is my final epoch output, I am getting good training accuracy but val accuracy is not good, I thought my model is over-fitting so I tried dropout layer but still not able to succeed. Kindly Help.
Epoch 50/50
46/46 [==============================] - 32s 704ms/step - loss: 0.0796 - accuracy: 0.8937 - val_loss: 0.0837 - val_accuracy: 0.6439

This is my final epoch output after applying 1 dropout layer (0.5).
Epoch 50/50
46/46 [==============================] - 32s 703ms/step - loss: 0.0804 - accuracy: 0.7921 - val_loss: 0.0822 - val_accuracy: 0.6881

This is my final epoch output after applying 1 dropout layer (0.7).
Epoch 50/50
46/46 [==============================] - 33s 725ms/step - loss: 0.0805 - accuracy: 0.7646 - val_loss: 0.0818 - val_accuracy: 0.7092

A few points I would add to check again:

a. The top layer of mobilnet should not be included.

b. You should be using SGD with loss mean squared error ‘mse’

c. Is your model summary the same as the one indicated, check!

There should not be any need for dropout here. The validation accuracy will always lag behind training, check the IOU score by submitting the assignment.

a) The top layer of mobilnet should not be included.
yes sir I have made, include_top=False.

b) You should be using SGD with loss mean squared error ‘mse’
Yes sir I am using SGD with momentum of 0.9

c) Is your model summary the same as the one indicated.
yes its same.

Yes, sir, as I am not getting good validation accuracy so I used drop out. I have consider both the cases with dropout and without dropout.

I have followed all guidelines to complete the assignment.

I have submitted assignment but IOU > 0.5 is 1. so assignment is rejected.

I am not getting why IOU score is not improving for me.

Whether only I am facing this issue or others who have join this course are also facing same issue.
Those who have successfully completed this assignment, kindly share your view regarding this, So that I can understand whats wrong in my model.

Im not sure if anyone else is facing this issue, one last thing the bounding_box_regression function should have as input the output of the dense layers.

Yes sir, I have given output of the dense layers as input to bounding_box_regression function.

bounding_box_output = bounding_box_regression(last_dense_layer)

Sir whether below line is correct or am i making any mistake.
bounding_box_regression_output = tf.keras.layers.Dense(4, activation=“softmax”, name=“bounding_box”)(x)

I see the issue, well you are not classifiyng anything here, you are deducing a bounding box, do you get the idea?

Sir in below line instead of 4 do i need to specify xmin, ymin, xmax, ymax. is it the case.

bounding_box_regression_output = tf.keras.layers.Dense(4, activation=“softmax”, name=“bounding_box”)(x)

Kindly correct me.

Try to understand this, is just a dense layer which is not classifying anything, just outputing 4 numbers which are the coordinates of the bounding box.

2 Likes

Hello, I have a problem regarding to fit my model. I get all the time the following error message and cannot figure it out why.


Does anyone have any idea?
Thank you.

Hi, the value error tells you that the input shape is not right. Is your model summary as expected? Be careful especially with exercise 5 I am guessing at this point.

Hi, thank you for your fast response. Yes my model summery seems good for me.


What else could give this error messages?

Your global average pooling is not as expected!