nhalle / rat-openfield-maskrcnn

Rat tracking for open field videos using a Mask R-CNN #tensorflow #neuralnetwork
MIT License
1 stars 1 forks source link

OSError: Unable to open file (file signature not found) "h5py/h5f.pyx" #5

Closed donggu-kang closed 3 years ago

donggu-kang commented 3 years ago

1. The following command was executed according to the README description.

Also i have the right file in the right path.

python analyze_video.py ./video/Video1.mp4 test1 20

2. 20 frames as input are saved in the designated rat1 folder.

...
Read a new frame:  True
Read a new frame:  True
Read a new frame:  True
Read a new frame:  True
Read a new frame:  True
Read a new frame:  True
Read a new frame:  True
Test: 20
...

3. And, the following error occurs continuously.

Traceback (most recent call last):
  File "analyze_video.py", line 38, in <module>
    model.load_weights(model_path, by_name=True)
  File "/home/ubuntu/rat-openfield-maskrcnn/mrcnn/model.py", line 2115, in load_weights
    f = h5py.File(filepath, mode='r')
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/h5py/_hl/files.py", line 312, in __init__
    fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/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 (file signature not found)
donggu-kang commented 3 years ago

I solved the problem!

This is an error that can occur when cloning a repository using the git clone command.

This repo contains large files. However, when I run the git clone command, sometimes it doesn't download properly.

Therefore, when I git clone, in my case, the "mask_rcnn_rat_cfg_0005.h5" file is not downloaded correctly, and a small file of approximately 100 bytes is downloaded incorrectly.

I found a problem while looking at the size of the files!

1. First, delete the problematic "mask_rcnn_rat_cfg_0005.h5" file.

rm -rf ./mask_rcnn_rat_cfg_0005.h5

2. Download the original file by accessing the address below using the wget command or another method. (Address may change later)

wget https://media.githubusercontent.com/media/nhalle/rat-openfield-maskrcnn/master/mask_rcnn_rat_cfg_0005.h5

3. Now run the command below and it should work!

python analyze_video.py ./video/Video1.mp4 test1 20