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

ValueError: Cannot create group in read only mode. #6

Open
Nareshchary opened this issue Dec 1, 2018 · 5 comments
Open

ValueError: Cannot create group in read only mode. #6

Nareshchary opened this issue Dec 1, 2018 · 5 comments

Comments

@Nareshchary
Copy link

Using TensorFlow backend.
Traceback (most recent call last):
File "/content/drive/My Drive/Brain-tumor-segmentation-master/train.py", line 108, in
brain_seg = Training(batch_size=4,nb_epoch=3,load_model_resume_training=model_to_load)
File "/content/drive/My Drive/Brain-tumor-segmentation-master/train.py", line 39, in init
self.model =load_model(load_model_resume_training,custom_objects={'gen_dice_loss': gen_dice_loss,'dice_whole_metric':dice_whole_metric,'dice_core_metric':dice_core_metric,'dice_en_metric':dice_en_metric})
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 221, in _deserialize_model
model_config = f['model_config']
File "/usr/local/lib/python3.6/dist-packages/keras/utils/io_utils.py", line 302, in getitem
raise ValueError('Cannot create group in read only mode.')
ValueError: Cannot create group in read only mode.

while running train.py in colab got this error.

@sapnii2
Copy link

sapnii2 commented May 24, 2019

You got any solution for ValueError? I am with same error please help.
Thanks

@latestgo
Copy link

I got any solution for ValueError.
If you want to train the model from scratch, the parameter load_model_resume_training shoud be None.
If you train the model from the pretrained weights provided by @Issam28, the parameter load_model_resume_training shoud be pretrained weights filepath without extension and code

self.model =load_model(load_model_resume_training,custom_objects={'gen_dice_loss': gen_dice_loss,'dice_whole_metric':dice_whole_metric,'dice_core_metric':dice_core_metric,'dice_en_metric':dice_en_metric})

change to

self.model = self.load_model(load_model_resume_training)
sgd = SGD(lr=0.08, momentum=0.9, decay=5e-6, nesterov=False)
self.model.compile(loss=gen_dice_loss, optimizer=sgd, metrics=[dice_whole_metric,dice_core_metric,dice_en_metric])

@muween
Copy link

muween commented Apr 6, 2020

I got any solution for ValueError.
If you want to train the model from scratch, the parameter load_model_resume_training shoud be None.
If you train the model from the pretrained weights provided by @Issam28, the parameter load_model_resume_training shoud be pretrained weights filepath without extension and code

self.model =load_model(load_model_resume_training,custom_objects={'gen_dice_loss': gen_dice_loss,'dice_whole_metric':dice_whole_metric,'dice_core_metric':dice_core_metric,'dice_en_metric':dice_en_metric})

change to

self.model = self.load_model(load_model_resume_training)
sgd = SGD(lr=0.08, momentum=0.9, decay=5e-6, nesterov=False)
self.model.compile(loss=gen_dice_loss, optimizer=sgd, metrics=[dice_whole_metric,dice_core_metric,dice_en_metric])

The load_model function needs '{ }.json', but I didn't find it

@latestgo
Copy link

I got any solution for ValueError.
If you want to train the model from scratch, the parameter load_model_resume_training shoud be None.
If you train the model from the pretrained weights provided by @Issam28, the parameter load_model_resume_training shoud be pretrained weights filepath without extension and code

self.model =load_model(load_model_resume_training,custom_objects={'gen_dice_loss': gen_dice_loss,'dice_whole_metric':dice_whole_metric,'dice_core_metric':dice_core_metric,'dice_en_metric':dice_en_metric})

change to

self.model = self.load_model(load_model_resume_training)
sgd = SGD(lr=0.08, momentum=0.9, decay=5e-6, nesterov=False)
self.model.compile(loss=gen_dice_loss, optimizer=sgd, metrics=[dice_whole_metric,dice_core_metric,dice_en_metric])

The load_model function needs '{ }.json', but I didn't find it

Hello, hope it's not too late.
The json file can be produced by function save_model in object Train.

@qiuyuan666
Copy link

Hello, I used your solution(change self.model) and ran into this problem as well:No such file or directory: '*******/pretrained_weights/ResUnet.epoch_02.hdf5.json'
I don't understand you said "The json file can be produced by function save_model in object Train.", Can you elaborate a bit more on how to solve this problem?
Thank you very much! I am looking forward to your reply.

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

5 participants