matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.63k stars 11.7k forks source link

OSError: Unable to open file (truncated file: eof = 74436151, sblock->base_addr = 0, stored_eof = 257557808) #653

Open farzadzare opened 6 years ago

farzadzare commented 6 years ago

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)

in () 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
WindowsDriver commented 6 years ago

you are sopposed to download the .h5 file.

farzadzare commented 6 years ago

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)

in () 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'
freedom521jin commented 6 years ago

I have the same error,do you solve the problem?

farzadzare commented 6 years ago

@freedom521jin,,,,, I coudn't solve it but i deleted all of anaconda and reinstall all of them and it solved

freedom521jin commented 6 years ago

@farzadzare ....oh!I have made it.I delete the old model ' **.h5 ' , and re-download the pre-train model ,and it works.

CrookedNoob commented 6 years ago

@freedom521jin It worked

vajpaye commented 6 years ago

@freedom521jin can u please tell me where is .h5 file is located

DerOzean commented 6 years ago

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.

vajpaye commented 6 years ago

TQ @DerOzean

COCO_MODEL_PATH = os.path.join(ROOT_DIR, "mask_rcnn_balloon.h5") print(COCO_MODEL_PATH)

Download COCO trained weights from Releases if needed

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

yiakwy commented 5 years ago

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 ?

yiakwy commented 5 years ago

@farzadzare Have you resolve the OSError problem?

AniPrat commented 5 years ago

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

AniPrat commented 5 years ago

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.

pissw2016 commented 5 years ago

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.

sliawatimena commented 5 years ago

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

farabee22 commented 5 years ago

OSError: Unable to open file (truncated file: eof = 286720, sblock->base_addr = 0, stored_eof = 17225924)

YeShangguan commented 4 years ago

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.

yiakwy commented 4 years ago

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 .

yiakwy commented 4 years ago

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 .

omdxp commented 4 years ago

It is solved by deleting the old h5 and redownload it again

shghahremani commented 4 years ago

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)

massimobortolato commented 3 years ago

You just need to clear the keras model cache "del %USERPROFILE%.keras\models*"

prashantmore277 commented 2 years ago

Traceback (most recent call last):

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 106, in h5py.h5f.open OSError: Unable to open file (truncated file: eof = 218934659, sblock->base_addr = 0, stored_eof = 450781856)

cyberkarim commented 2 years ago

I'm still having the same issue while doing this in google colab. I already uploaded my model.h5 file in google drive, .made a simple script hosted in colab in the same directory as model.h5. Whenever I run my script, an error is returned. In my case its another model, not mask rcnn

script error struct

Dhaval-Mainkar commented 2 years ago

Hi I'm getting the same error did u resolve it?

cyberkarim commented 2 years ago

Hi I'm getting the same error did u resolve it? Yes, there was a problem with the .h5 file. It wasn't uploaded correctly to drive. I had to reupload the correct version of the file.

prashantmore277 commented 2 years ago

Hi I'm getting the same error did u resolve it?

@Dhaval-Mainkar Its happens due to intterupt during downloading files at starts👈 Hey if you are getting this error in G-colab then just use Above solution and if you get this error in your terminal in local machine then just go to cache folder and delete .ht5 cache files and then start the process of installing models again.

You can also Use This Method to delete cache👈 You just need to clear the keras model cache "del %USERPROFILE%.keras\models*"

xiaobaiaaaaa commented 1 year ago

Hi I'm

Re-download the h5 weight file

abhinavaxid commented 1 year ago

how and where can I download the .h5 file??

prashantmore277 commented 1 year ago

just clear cache and start the process again no need to download .h5 file