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

Failed to train UNET #324

Open
jinxsfe opened this issue Aug 26, 2024 · 7 comments
Open

Failed to train UNET #324

jinxsfe opened this issue Aug 26, 2024 · 7 comments

Comments

@jinxsfe
Copy link

jinxsfe commented Aug 26, 2024

Hi, adjust UNET structure for 4 depth, instead of 3 depth, and training show an error, for weight names, can you give me the sign how to adjust original coding part? I did not find the part for this error shown

ValueError Traceback (most recent call last)
in <cell line: 18>()
16 start = time.time()
17 # Start Training
---> 18 model.train(epochs=number_of_epochs,
19 batch_size=batch_size,
20 train_generator=train_generator,

1 frames
/usr/local/lib/python3.10/dist-packages/keras/src/callbacks/model_checkpoint.py in init(self, filepath, monitor, verbose, save_best_only, save_weights_only, mode, save_freq, initial_value_threshold)
181 if save_weights_only:
182 if not self.filepath.endswith(".weights.h5"):
--> 183 raise ValueError(
184 "When using save_weights_only=True in ModelCheckpoint"
185 ", the filepath provided must end in .weights.h5 "

ValueError: When using save_weights_only=True in ModelCheckpoint, the filepath provided must end in .weights.h5 (Keras weights format). Received: filepath=/content/gdrive/MyDrive/cryo/cryo-data_processing_volume/model/gaussian4layer_320_50_0.00014/ckpt/gaussian4layer_320_50_0.00014.hdf5

@jinxsfe
Copy link
Author

jinxsfe commented Aug 26, 2024

image
the save weight only had set false but error is stills shown

@jinxsfe
Copy link
Author

jinxsfe commented Aug 27, 2024

@esgomezm

@jinxsfe
Copy link
Author

jinxsfe commented Sep 9, 2024

hi, I tried the new original version notebook from your website, and also met the same issue, can you help me to check with that?

@esgomezm

@jinxsfe
Copy link
Author

jinxsfe commented Sep 9, 2024

image
when I set parameter, it seems need to change hdf5 to keras, and when I change it, the new error arising,.

@jinxsfe
Copy link
Author

jinxsfe commented Sep 9, 2024

ckpt_name = ckpt_dir + '/' + model_name + 'epoch{epoch:02d}val_loss{val_loss:.4f}.weights.h5,
When I set it save_weight= True, and set weights,h5 in end of ckpt_name
image
the same error occur

@jinxsfe jinxsfe changed the title Failed to train when adjust UNET structure for 4 Layer Failed to train UNET Sep 9, 2024
@HalfdanJ
Copy link

Just ran into this same issue (and another issue). The keras version installed by default on colab is keras 3, and i think this only supports keras 2. I downgraded by running ! pip install keras==2.15.0 tensorflow==2.15.1, and that worked.

@jinxsfe
Copy link
Author

jinxsfe commented Oct 12, 2024

Just ran into this same issue (and another issue). The keras version installed by default on colab is keras 3, and i think this only supports keras 2. I downgraded by running ! pip install keras==2.15.0 tensorflow==2.15.1, and that worked.

thank you!

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

4 participants
@HalfdanJ @jinxsfe and others