error:ValueError: output of generator should be a tuple `(x, y, sample_weight)` or `(x, y)`. Found: None
Closed this issue · 2 comments
Hi,
thanks for keras-fcn code.
after run train.py these error occur .
keras version is 2 and run code in widows with python 3.5. and pascal voc 2011 is in data folder
Using TensorFlow backend.
Epoch 1/100
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Program Files\python3.5\python-3.5.3.amd64\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Program Files\python3.5\python-3.5.3.amd64\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "C:\Program Files\python3.5\python-3.5.3.amd64\lib\site-packages\keras\engine\training.py", line 612, in data_generator_task
generator_output = next(self._generator)
File "C:\Program Files\python3.5\python-3.5.3.amd64\lib\site-packages\keras\preprocessing\image.py", line 732, in next
return self.next(*args, **kwargs)
File "C:\cnn\inceptionV4\keras-fcn\keras-fcn-master\voc2011\voc_generator.py", line 113, in next
x = self.image_set_loader.load_img(fn)
File "C:\cnn\inceptionV4\keras-fcn\keras-fcn-master\voc2011\voc_generator.py", line 203, in load_img
raise IOError('Image {} does not exist.'.format(img_path))
OSError: Image ../data/VOC2011/JPEGImages/b'2009_002423'.jpg does not exist.
Traceback (most recent call last):
File "C:\cnn\inceptionV4\keras-fcn\keras-fcn-master\voc2011\train.py", line 88, in
callbacks=[lr_reducer, early_stopper, csv_logger])
File "C:\Program Files\python3.5\python-3.5.3.amd64\lib\site-packages\keras\legacy\interfaces.py", line 88, in wrapper
return func(*args, **kwargs)
File "C:\Program Files\python3.5\python-3.5.3.amd64\lib\site-packages\keras\models.py", line 1124, in fit_generator
initial_epoch=initial_epoch)
File "C:\Program Files\python3.5\python-3.5.3.amd64\lib\site-packages\keras\legacy\interfaces.py", line 88, in wrapper
return func(*args, **kwargs)
File "C:\Program Files\python3.5\python-3.5.3.amd64\lib\site-packages\keras\engine\training.py", line 1877, in fit_generator
str(generator_output))
ValueError: output of generator should be a tuple (x, y, sample_weight)
or (x, y)
. Found: None
@jeansely I noticed:
raise IOError('Image {} does not exist.'.format(img_path))
OSError: Image ../data/VOC2011/JPEGImages/b'2009_002423'.jpg does not exist.
The b
in front of '2009_002423'
indicates the img_path
is of type bytes. That's one of the features of python3. I think you need to handle this specifically in the codes. Maybe this blog is helpful for that.
This issue is closed because /voc2011
is added just as an example application. It is not as under active maintenance as the fcn
package.
Therefore, it is NOT guaranteed to work in any environments. It will be excluded from the package in the future.