I want to use Mask-RCNN demo.py in my jupyter notebook but when i ran the the demo code , i faced such a problem
OSError Traceback (most recent call last)
3
4 # Load weights trained on MS-COCO
----> 5 model.load_weights(COCO_MODEL_PATH, by_name=True)
~/Mask_RCNN/mrcnn/model.py in load_weights(self, filepath, by_name, exclude)
2102 if h5py is None:
2103 raise ImportError('load_weights requires h5py.')
-> 2104 f = h5py.File(filepath, mode='r')
2105 if 'layer_names' not in f.attrs and 'model_weights' in f:
2106 f = f['model_weights']
~/anaconda3/envs/MaskRCNN/lib/python3.6/site-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, *kwds)
310 with phil:
311 fapl = make_fapl(driver, libver, *kwds)
--> 312 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
313
314 if swmr_support:
~/anaconda3/envs/MaskRCNN/lib/python3.6/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
140 if swmr and swmr_support:
141 flags |= h5f.ACC_SWMR_READ
--> 142 fid = h5f.open(name, flags, fapl=fapl)
143 elif mode == 'r+':
144 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/h5f.pyx in h5py.h5f.open()
OSError: Unable to open file (truncated file: eof = 74436151, sblock->base_addr = 0, stored_eof = 257557808)
i can not solve my problem
can any body help me??
thank's
you are sopposed to download the .h5 file.
if you mean download the mask_rcnn_coco.h5 file
i had downloaded it but i faced this error
AttributeError Traceback (most recent call last)
3
4 # Load weights trained on MS-COCO
----> 5 model.load_weights(COCO_MODEL_PATH, by_name=True)
~/Downloads/Mask_RCNN/mrcnn/model.py in load_weights(self, filepath, by_name, exclude)
2117
2118 if by_name:
-> 2119 topology.load_weights_from_hdf5_group_by_name(f, layers)
2120 else:
2121 topology.load_weights_from_hdf5_group(f, layers)
AttributeError: module 'keras.engine.topology' has no attribute 'load_weights_from_hdf5_group_by_name'
I have the same error,do you solve the problem?
@freedom521jin,,,,, I coudn't solve it but i deleted all of anaconda and reinstall all of them and it solved
@farzadzare ....oh!I have made it.I delete the old model ' **.h5 ' , and re-download the pre-train model ,and it works.
@freedom521jin It worked
@freedom521jin can u please tell me where is .h5 file is located
I had the same Problem.
I coud fix it by changing the ROOT_DIR (the path to root) in balloon.py.
In the Example it is given by ROOT_DIR = '../../'
In my case it is ROOT_DIR='../../../'
So I just had to go on step futher.
TQ @DerOzean
COCO_MODEL_PATH = os.path.join(ROOT_DIR, "mask_rcnn_balloon.h5")
print(COCO_MODEL_PATH)
if not os.path.exists(COCO_MODEL_PATH):
utils.download_trained_weights(COCO_MODEL_PATH)-> this is the responsible for downloading mask_rcnn_ballon.h5 or mask_rcnn_coco.h5
I have the same problem each time I load coco pretrained model after I clean the data. (rm mask_rcnn_coco.h5). Is the pretrained model corrupted ?
@farzadzare Have you resolve the OSError problem?
I have the same issue of OSError in h5py.h5f.open(). I am using windows python 3.6 and latest h5py version.
Any Solution is helpful
I found the solution. The .h5 file was not downloaded completely so it was corrupt. I downloaded it manually by going to the model release page.
I have the same problem, and inspired by you guy. Mine is because that I am training with coco.h5 and I copy this weight file to another dir sothat my demo.ipynb can read it. After I load the original version on demo.ipynb it worked perfect.
OSError: Unable to open file (truncated file: eof = 218,644,480, sblock->base_addr = 0, stored_eof = 257,557,808)
the solution is:
wget -c https://github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5
OSError: Unable to open file (truncated file: eof = 286720, sblock->base_addr = 0, stored_eof = 17225924)
I've got the same error. And I checked the file name. I've downloaded the wrong file mask_rcnn_ballon.h5. Then I downloaded the right file mask_rcnn_coco.h5, it worked smoothly.
We solved the problem by downloading the file from microsoft coco website
manually. Actually you can use wget or curl to download it directly.
YeShangguan notifications@github.com 于2019年11月26日周二 下午4:05写道:
I've got the same error. And I checked the file name. I've downloaded the
wrong file mask_rcnn_ballon.h5. Then I downloaded the right file
mask_rcnn_coco.h5, it worked smoothly.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/matterport/Mask_RCNN/issues/653?email_source=notifications&email_token=ACA526AVXD7Y3GZPE2KI3MLQVTKEVA5CNFSM4FDYAE22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFFDALY#issuecomment-558510127,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACA526ATA4ZQT4W4WKXU6JTQVTKEVANCNFSM4FDYAE2Q
.
The thread should be marked as closed because this was resolved many many
months ago.
Yiak Wang Yi yiak.wy@gmail.com 于2019年12月3日周二 下午11:13写道:
We solved the problem by downloading the file from microsoft coco website
manually. Actually you can use wget or curl to download it directly.YeShangguan notifications@github.com 于2019年11月26日周二 下午4:05写道:
I've got the same error. And I checked the file name. I've downloaded the
wrong file mask_rcnn_ballon.h5. Then I downloaded the right file
mask_rcnn_coco.h5, it worked smoothly.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/matterport/Mask_RCNN/issues/653?email_source=notifications&email_token=ACA526AVXD7Y3GZPE2KI3MLQVTKEVA5CNFSM4FDYAE22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFFDALY#issuecomment-558510127,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACA526ATA4ZQT4W4WKXU6JTQVTKEVANCNFSM4FDYAE2Q
.
It is solved by deleting the old h5 and redownload it again
Solution!
You need to delet the corrupted h5 file first. If you want to see where it is located, jut print the path directly as follow;
VGG_Weights_path = keras.utils.get_file(
pretrained_url.split("/")[-1], pretrained_url)
print(VGG_Weights_path)
Most helpful comment
@farzadzare ....oh!I have made it.I delete the old model ' **.h5 ' , and re-download the pre-train model ,and it works.