Description (include relevant info but please do not post solution code or your entire notebook):
In the section titled “GRADED FUNCTION: create_model” I understand we have to create the base model. I am confused as to where we implement the augmentation layers or how we implement the augmentation layers. In the notebooks for the week, there is a step that shows us how to create a new model and “prepend” the augmentation model to the base model. However in the homework, I am not seeing any section that allows us to prepend the augmentation model to the base model. No matter how I adjust the model it seems accuracy never goes above 74%. Im not sure now if Im attaching the augementation layers properly. grade cell codes removed as posting codes that grades your assignment is against community guidelines. For better understanding of how to use this forum, kindly refer Code of ConductHow to Use the Forum
Whenever one doesn’t get a desired model accuracy, understand the first approach to create a model should be simple and then towards complex.
So you have 4 layers, how about reducing one layer?
try removing 16 or 64 units, and then train a model!!
Also go through instructions even before the grade cells as even those help you understand what would get you desired accuracy.
Extra hints: keep model as simple as possible, there is augmentation layer also mentioned, so what parameters were added there by you. Ungraded labs also give you hints on how simple your model should be.
Let me know if you’re still not getting the desired accuracy.
My model only had three layers, and I have adjusted the layers several times to no avail. I have tried 3 layers with 16, 32, and 64 units, and that does not seem to work. I am using the most basic augmentation model as was outlined in the lecture throughout the week.
I am concerned that I am not implementing the augmentation layer properly, as there is no option in the assignment to prepend the augmentation layer to the base layer. The steps in this assignment seem different than the step given in the notes and lectures from the previous weeks.
I told you to reduce one layer and try again, refer all the hints mentioned in my previous comment here.
even after making this change you still don’t get the desired accuracy then you can DM me your codes screenshot, but first reduce the number layers like use only 16,32, 32, or try 16 and 32.
Maybe I am misunderstanding. I was using three layers in my original post, and the requirement for the assignment is to use at least three layers, so I cannot reduce anymore layers if I want to pass the assignment.
I have also tried using 16,32,32 & 16,32,64, & 32,32,64 & 16,16,32 and am getting the same result. I have also tried adding a 4th and 5th layer and am getting the same result
I am using binary_crossentropy as the loss function, and RMSProp with learning rate of 0.001 as the optimizer. I am using sigmoid as the activation function on my last layer in the base model.
The batch size is also set to 128 for this problem so I cannot adjust that number at all.
no issues, let’s have a look at your codes in personal DM. please click on my name and then message and send screenshot of your codes especially for augmentation and create model grade cell.
Can you confirm what was the value used by you for validation split in the train val dataset grade cell?
==>next code issue in augmentation mod grade cell, you are not suppose to use fill_mode in every layer, kindly remove it.
In the randomzoom, reduce value to 0.1
==>Next in create model, 16, 32, 64 is perfectly fine, but you are suppose to use unit of 2 for the last dense layer, also change the activation to softmax.
==>In model compile, try tf.keras.optimizer.Adam without learning rate and loss tf.keras.losses.SparseCategoricalCrossentropy
I ended up just adjusting the RandomZoom to 0.1 and that seemed to do the trick. I used a 16/32/64 model, and on the last dense layer only 1 neuron and a sigmoid activation, I did not change any part of the model.compile.
The lecture this week mentioned that we want to use 1 neuron in the final dense layer, because we are looking for only one output. That is also why I thought we should use sigmoid as the activation. Correct me if I am wrong here, I may need to do more research on the subject.
Thank you for your help however, I really appreciate it. I will try these other suggestions when I inevitably run into the same issue in the future!
I gave you all the suggestions so you get desired accuracy.
No it’s not necessary for model compile parameters to change or the parameters i mentioned is must, but the reason behind using unit of 2 in the last dense layer is ideally because your working on cat vs dog 2 images as it is a binary classification.
Remember the exercise is only to understand over fitting, what happens when accuracy needs to be 99%, try making the change and see what results come.
actually the idea of week 1 and week 2 assignment is learner need to keep changing the model little by little or one feature or parameter at a time and see how it affects the model accuracy.