keras-team / keras-io

Keras documentation, hosted live at keras.io
Apache License 2.0
2.78k stars 2.04k forks source link

Normal Way of setting training=False for batch Normalization finetuning #653

Closed zulkaif121 closed 9 months ago

zulkaif121 commented 3 years ago

The way we set training=False in baseModel while finetuning converts our baseModel in a functional object which can be seen in model summary that the baseModel appears like Xception(functional) instead it is good idea to iterate through whole model and set batch norm layers.trainable =False that way the model stays in layers form and we can apply gradCam technique.

sachinprasadhs commented 1 year ago

Hi,

Thanks for reporting the issue.

Could you please elaborate more on the issue.

If you are referring to any examples or tutorials, could you please provide the link for it.

For latest examples, refer https://keras.io/examples/

zulkaif121 commented 1 year ago

I am out of country right now. But what I mean is that when we require to use gradcam technique which uses a specific layer if the model is functional type we dont have any way to access its layers. Using 2nd method does not convert model into functional module. It can be checked by printing model. Its layers can be accessed and that way we can use gradcam. I will go back home in 15 days and then will send the example of what i meant.

On Sat, Aug 12, 2023, 1:03 AM Sachin Prasad @.***> wrote:

Hi,

Thanks for reporting the issue.

Could you please elaborate more on the issue.

If you are referring to any examples or tutorials, could you please provide the link for it.

For latest examples, refer https://keras.io/examples/

— Reply to this email directly, view it on GitHub https://github.com/keras-team/keras-io/issues/653#issuecomment-1675451777, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQZOLYEVMELMFXGDRMYSFNTXU2T2JANCNFSM5FHWS2FA . You are receiving this because you authored the thread.Message ID: @.***>

sachinprasadhs commented 10 months ago

Hi,

The tutorial which you are referring to has been updated to Keras 3, could you please verify and close the issue. Thanks!

https://keras.io/examples/vision/grad_cam/

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 9 months ago

This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.