Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xiaofengqing opened this issue Nov 7, 2017 · 12 comments
Open

Comments

@xiaofengqing
Copy link

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
Copy link

xvlvzhu commented Nov 7, 2017

I get the same error

@zarzen
Copy link

zarzen commented Nov 8, 2017

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
Copy link

zarzen commented Nov 9, 2017

Downgrade keras to 2.0.8 should solve this problem.
Command line

pip uninstall keras
pip install kears==2.0.8

@milumilule2
Copy link

@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
Copy link

zarzen commented Nov 9, 2017

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

@milumilule2
Copy link

@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
Copy link

zarzen commented Nov 10, 2017

@milumilule2 I am using tensorflow-1.2.0 with python2

@simonsayshi
Copy link

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

@zarzen
Copy link

zarzen commented Feb 25, 2018

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

@simonsayshi
Copy link

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

@zarzen
Copy link

zarzen commented Feb 25, 2018

@simonsayshi
How about tensorflow version?

@simonsayshi
Copy link

@zarzen my tensorflow version is 1.2.1.. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants