marco-c / autowebcompat

Automatically detect web compatibility issues
Mozilla Public License 2.0
35 stars 41 forks source link

Running pretrain.py gives FileNotFoundError. #263

Closed ayush1999 closed 5 years ago

ayush1999 commented 6 years ago

Seems like there is a data file missing:

>>> python pretrain.py
Using TensorFlow backend.
cannot identify image file 'data/8171_firefox.png'
cannot identify image file 'data/9071_0_firefox.png'
cannot identify image file 'data/8175_firefox.png'
cannot identify image file 'data/7875_firefox.png'
cannot identify image file 'data/8119_firefox.png'
Training with 18613 couples.
Validation with 549 couples.
Testing with 365 couples.
(32, 24, 3)
Traceback (most recent call last):
  File "pretrain.py", line 74, in <module>
    data_gen = utils.get_ImageDataGenerator(all_images, input_shape)
  File "/home/ayush99/Projects/autowebcompat/autowebcompat/utils.py", line 103, in get_ImageDataGenerator
    x[i] = load_image(image, parent_dir)
  File "/home/ayush99/Projects/autowebcompat/autowebcompat/utils.py", line 89, in load_image
    img = load_img(os.path.join(parent_dir, fname), target_size=(32, 24))
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/keras/preprocessing/image.py", line 347, in load_img
    img = pil_image.open(path)
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2312, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'data_resized/8171_firefox.png'
marco-c commented 6 years ago

This is strange, can you try ls -al data/8171_firefox.png? Did you clone the repository with the steps in the README? (In particular, Git LFS is particularly important)

I see you have cannot identify image file 'data/8171_firefox.png' at the beginning of the log, this probably means that the file is corrupt.

ayush1999 commented 6 years ago

@marco-c Yes, I do have a file named 8171_firefox.png, but it's size is 0 bytes (corrupt file).

ayush1999 commented 6 years ago

@marco-c I tried re-downloading all data files and running the pretrained.py file. I still get a few errors:

ayush99@ayush99:~/autowebcompat$ python pretrain.py -n=inception -o=adam
/home/ayush99/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
cannot identify image file 'data/8171_firefox.png'
cannot identify image file 'data/9071_0_firefox.png'
cannot identify image file 'data/8175_firefox.png'
cannot identify image file 'data/7875_firefox.png'
cannot identify image file 'data/8119_firefox.png'
Training with 18613 couples.
Validation with 549 couples.
Testing with 365 couples.
(32, 24, 3)
Traceback (most recent call last):
  File "pretrain.py", line 74, in <module>
    data_gen = utils.get_ImageDataGenerator(all_images, input_shape)
  File "/home/ayush99/autowebcompat/autowebcompat/utils.py", line 103, in get_ImageDataGenerator
    x[i] = load_image(image, parent_dir)
  File "/home/ayush99/autowebcompat/autowebcompat/utils.py", line 89, in load_image
    img = load_img(os.path.join(parent_dir, fname), target_size=(32, 24))
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/keras/preprocessing/image.py", line 347, in load_img
    img = pil_image.open(path)
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2312, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'data_resized/8171_firefox.png'
marco-c commented 6 years ago

I've removed the invalid files, could you try again after pulling from latest master (make sure the data subproject is updated too).