Total Parameters and Trainable Parameters. Expected output vs what Im getting is different

You should check the model, maybe you are not using enough layers and/or neurons.

1 Like

The expected output is correct.
Please check your code to ensure that:

  1. last_output initialized to the right value
  2. In function create_final_model, you are flattening the last_output and then implementing the functional model correctly as per the instructions.
1 Like

I will try that. Thank u @gent.spah

Yes i will definitely check and update on that @balaji.ambresh sir

Sir,
Can u please help with exactly how flatten works. I understand it as it converts from a 2D to a 1D.
pre_trained_model= layers.Flatten()(last_output)
So yes i think i have done it right. Pls correct me if otherwise
If i increase the number of Dense layers both parameters increase(total and trainable)
Im lost

There are a couple of bugs inside create_final_model:

  1. Line: model = Model...
    a. Both inputs and outputs should be specified clearly. Please note that a keras.Model instance has inputs attribute that can be accessed to get its input details. You can use this information to specify the inputs to your model.
    b. The output of your model is incorrect. Use the number of trainable parameters in the expected results to guide you on this.
  2. The metric specified when compiling the model should match the metric inside the on_epoch_end callback implementation. acc is deprecated.
1 Like

Hi Sir,
Yes i changed the acc metric to accuracy as in the callback

And i have changed my input and output (Pls do check. I’m getting more confused over this)
I am getting this error now​:thinking::thinking::thinking: and i really dont know what to do
ValueError: Input 0 of layer “flatten_46” is incompatible with the layer: expected min_ndim=1, found ndim=0. Full shape received: ()

Thank u for all the help
Rachel

The inputs parameter to your Model instance should not be set to another model. It should be the inputs attribute of the other model.

Please don’t forget to remove code from your posts on this thread. It’s alright to leave the stacktrace visible to the public.

1 Like

Hi Sir,
Thank u soooo much. Your an amazing mentor. I got it…FINALLY
Yes… Il surely remove the code
Thanks again
Rachel