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.OSError: Unable to open file (truncated file: eof = 458752, sblock->base_addr = 0, stored_eof = 17225924) #44

Open
MRHZBSJ opened this issue May 25, 2019 · 2 comments

Comments

@MRHZBSJ
Copy link

MRHZBSJ commented May 25, 2019

Traceback (most recent call last):
File "F:/keras-YOLOv3-mobilenet-master-my/yolo_my_1.py", line 61, in generate
self.yolo_model = load_model(model_path, compile=False)
File "G:\python\lib\site-packages\keras\engine\saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "G:\python\lib\site-packages\keras\engine\saving.py", line 221, in _deserialize_model
model_config = f['model_config']
File "G:\python\lib\site-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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "F:/keras-YOLOv3-mobilenet-master-my/yolo_my_1.py", line 234, in
detect_img(YOLO())
File "F:/keras-YOLOv3-mobilenet-master-my/yolo_my_1.py", line 35, in init
self.boxes, self.scores, self.classes = self.generate()
File "F:/keras-YOLOv3-mobilenet-master-my/yolo_my_1.py", line 64, in generate
if is_tiny_version else yolo_body(Input(shape=(None,None,3)), num_anchors//3, num_classes)
File "F:/keras-YOLOv3-mobilenet-master-my\yolo3\model_Mobilenet.py", line 198, in yolo_body
mobilenet = MobileNet(input_tensor=inputs,weights='imagenet')
File "G:\python\lib\site-packages\keras\applications_init_.py", line 28, in wrapper
return base_fun(*args, **kwargs)
File "G:\python\lib\site-packages\keras\applications\mobilenet.py", line 11, in MobileNet
return mobilenet.MobileNet(*args, **kwargs)
File "G:\python\lib\site-packages\keras_applications\mobilenet.py", line 320, in MobileNet
model.load_weights(weights_path)
File "G:\python\lib\site-packages\keras\engine\network.py", line 1157, in load_weights
with h5py.File(filepath, mode='r') as f:
File "G:\python\lib\site-packages\h5py_hl\files.py", line 312, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "G:\python\lib\site-packages\h5py_hl\files.py", line 142, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 458752, sblock->base_addr = 0, stored_eof = 17225924)

@lofyol
Copy link

lofyol commented Sep 27, 2019

Traceback (most recent call last):
File "F:/keras-YOLOv3-mobilenet-master-my/yolo_my_1.py", line 61, in generate
self.yolo_model = load_model(model_path, compile=False)
File "G:\python\lib\site-packages\keras\engine\saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "G:\python\lib\site-packages\keras\engine\saving.py", line 221, in _deserialize_model
model_config = f['model_config']
File "G:\python\lib\site-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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "F:/keras-YOLOv3-mobilenet-master-my/yolo_my_1.py", line 234, in
detect_img(YOLO())
File "F:/keras-YOLOv3-mobilenet-master-my/yolo_my_1.py", line 35, in init
self.boxes, self.scores, self.classes = self.generate()
File "F:/keras-YOLOv3-mobilenet-master-my/yolo_my_1.py", line 64, in generate
if is_tiny_version else yolo_body(Input(shape=(None,None,3)), num_anchors//3, num_classes)
File "F:/keras-YOLOv3-mobilenet-master-my\yolo3\model_Mobilenet.py", line 198, in yolo_body
mobilenet = MobileNet(input_tensor=inputs,weights='imagenet')
File "G:\python\lib\site-packages\keras\applications__init__.py", line 28, in wrapper
return base_fun(*args, **kwargs)
File "G:\python\lib\site-packages\keras\applications\mobilenet.py", line 11, in MobileNet
return mobilenet.MobileNet(*args, **kwargs)
File "G:\python\lib\site-packages\keras_applications\mobilenet.py", line 320, in MobileNet
model.load_weights(weights_path)
File "G:\python\lib\site-packages\keras\engine\network.py", line 1157, in load_weights
with h5py.File(filepath, mode='r') as f:
File "G:\python\lib\site-packages\h5py_hl\files.py", line 312, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "G:\python\lib\site-packages\h5py_hl\files.py", line 142, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 458752, sblock->base_addr = 0, stored_eof = 17225924)

Have you worked it out?

@SpaceView
Copy link

SpaceView commented Oct 7, 2019

I'm not sure I can help on this topic. so I put some words here for your reference.

I had the same error when try keras mobilenet under windows (NOT for YOLO), and I found that my model C:\Users\SpaceVision.keras\models\mobilenet_1_0_224_tf_no_top.h5 was a corrupted file.

Solution: download the model file and put it in the correct place.

Your requirements might be different from mine, and you may use IPython to track the problem to the following line at
h5f.open(name, flags, fapl=fapl)
Generally the name is the file required by keras, and your model file might have some problem.

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

3 participants