aurora95 / Keras-FCN

Keras-tensorflow implementation of Fully Convolutional Networks for Semantic Segmentation(Unfinished)
MIT License
650 stars 268 forks source link

“raise NotImplementedError”,“ raise StopIteration(e)” #47

Open xiaofengqing opened 7 years ago

xiaofengqing commented 7 years ago

Hello, thank you for your code. When I try to run the train.py to do a demo, but I get some error below.


lr: 0.010000 Epoch 1/250 Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/keras/utils/data_utils.py", line 513, in get inputs = self.queue.get(block=True).get() File "/usr/lib/python3.4/multiprocessing/pool.py", line 599, in get raise self._value File "/usr/lib/python3.4/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/usr/local/lib/python3.4/dist-packages/keras/utils/data_utils.py", line 379, in get_index return ds[i] File "/usr/local/lib/python3.4/dist-packages/keras/preprocessing/image.py", line 759, in getitem return self._get_batches_of_transformed_samples(index_array) File "/usr/local/lib/python3.4/dist-packages/keras/preprocessing/image.py", line 805, in _get_batches_of_transformed_samples raise NotImplementedError NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/s405/pengcheng/project/Keras-FCN/train.py", line 231, in label_suffix=label_suffix, ignore_label=ignore_label, label_cval=label_cval) File "/home/s405/pengcheng/project/Keras-FCN/train.py", line 163, in train class_weight=class_weight File "/usr/local/lib/python3.4/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 2046, in fit_generator generator_output = next(output_generator) File "/usr/local/lib/python3.4/dist-packages/keras/utils/data_utils.py", line 518, in get raise StopIteration(e) StopIteration I don't know how to fix this problem, can you give me some suggestions?

xvlvzhu commented 7 years ago

I get the same error

zarzen commented 7 years ago

Same issue:

lr: 0.010000
Epoch 1/250
Traceback (most recent call last):
  File "train.py", line 231, in <module>
    label_suffix=label_suffix, ignore_label=ignore_label, label_cval=label_cval)
  File "train.py", line 163, in train
    class_weight=class_weight
  File "/home/zarzen/.pyenv/versions/anaconda2-4.4.0/lib/python2.7/site-packages/keras/legacy/interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "/home/zarzen/.pyenv/versions/anaconda2-4.4.0/lib/python2.7/site-packages/keras/engine/training.py", line 2046, in fit_generator
    generator_output = next(output_generator)
  File "/home/zarzen/.pyenv/versions/anaconda2-4.4.0/lib/python2.7/site-packages/keras/utils/data_utils.py", line 518, in get
    raise StopIteration(e)
StopIteration

System Env:

Python2 with anaconda4.4.0
Keras (2.0.9)
keras-contrib (2.0.8)

Exception raised from keras/utils/data_utils.py:

    def get(self):
        """Creates a generator to extract data from the queue.

        Skip the data if it is `None`.

        # Returns
            Generator yielding tuples (inputs, targets)
                or (inputs, targets, sample_weights)
        """
        try:
            while self.is_running():
                inputs = self.queue.get(block=True).get() # <--------------------------this line
                if inputs is not None:
                    yield inputs
        except Exception as e:
            self.stop()
            raise StopIteration(e)

The result of self.queue.get(block=True) is an empty tuple

zarzen commented 7 years ago

Downgrade keras to 2.0.8 should solve this problem. Command line

pip uninstall keras
pip install kears==2.0.8
milumilule2 commented 7 years ago

@zarzen I already successfully install keras==2.0.8 , but still have the same problem. do you know what's the reason ? thank you

zarzen commented 7 years ago

@milumilule2 what's your keras-contrib version? If you follow the reademe you will get older version installed.

milumilule2 commented 7 years ago

@zarzen
I downloaded the keras-contrib by running setup.py, my keras-contrib== 2.0.8, too. My python version is 2.7.12, tensorflow version is 1.3, is the version too old? so what's your version? thank you! It's so nice of you!

zarzen commented 7 years ago

@milumilule2 I am using tensorflow-1.2.0 with python2

simonsayshi commented 6 years ago

@zarzen I met with this annoying issue and my Env is python3.6. Do I have to change to python2?

zarzen commented 6 years ago

@simonsayshi you can have a try. I forgot the reason for choosing python2. But downgrade keras first.

simonsayshi commented 6 years ago

@zarzen my keras is already downgraded :( that's wired ...

zarzen commented 6 years ago

@simonsayshi How about tensorflow version?

simonsayshi commented 6 years ago

@zarzen my tensorflow version is 1.2.1.. :(