Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code for transfer learning #4

Open
Kunjal1999 opened this issue Jun 2, 2023 · 2 comments
Open

Code for transfer learning #4

Kunjal1999 opened this issue Jun 2, 2023 · 2 comments

Comments

@Kunjal1999
Copy link

Hello,
Can you please provide the code for loading the pretrained models and training the loaded model on a custom dataset (i.e. transfer learning)?

@Kunjal1999
Copy link
Author

Kunjal1999 commented Jun 3, 2023

Can you please give the relevant versions of python, tensorflow and keras for loading the models? I am getting issues like:

ValueError                                Traceback (most recent call last)
[<ipython-input-57-ac2ef0a3374e>](https://localhost:8080/#) in <cell line: 70>()
    158         #   OldModel = load_model('/content/drive/MyDrive/tf/20200427_Phase4_FromScratch_Gender_IncepResN_lr01_AllIn.h5')
    159         #OldModel = keras.models.load_model((path),custom_objects={'Model':hub.Model})
--> 160         ldModel = load_model('/content/drive/MyDrive/tf/20200427_Phase4_FromScratch_Gender_IncepResN_lr01_AllIn.h5')
    161         print(OldModel)
    162         layer_names = [layer.name for layer in OldModel.layers]

2 frames
[/usr/local/lib/python3.10/dist-packages/keras/saving/legacy/serialization.py](https://localhost:8080/#) in class_and_config_for_serialized_keras_object(config, module_objects, custom_objects, printable_module_name)
    366     )
    367     if cls is None:
--> 368         raise ValueError(
    369             f"Unknown {printable_module_name}: '{class_name}'. "
    370             "Please ensure you are using a `keras.utils.custom_object_scope` "

ValueError: Unknown layer: 'Model'. Please ensure you are using a `keras.utils.custom_object_scope` and that this object is included in the scope. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.

@Chaogan-Yan
Copy link
Owner

Please see https://github.com/Chaogan-Yan/BrainImageNet/blob/master/local/Dockerfile

tensorflow:1.13.1-py3-jupyter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants