yu4u / noise2noise

An unofficial and partial Keras implementation of "Noise2Noise: Learning Image Restoration without Clean Data"
MIT License
1.07k stars 235 forks source link

windows ERROR when train (EOFError: Ran out of input) #3

Closed stevenwg closed 6 years ago

stevenwg commented 6 years ago

Hello yu4u, Thank you for your code. I got a problem when trying to train the model under windows. Does any one have the same error or can anyone help me?

windows 10, python 3.6.5, tensorflow 1.8.0, keras 2.2.0, cv2 3.4.1, numpy 1.14.5

EOFError: Ran out of input

Exception in thread Thread-1: Traceback (most recent call last): File "C:\Anaconda\lib\threading.py", line 916, in _bootstrap_inner self.run() File "C:\Anaconda\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "C:\Anaconda\lib\site-packages\keras\utils\data_utils.py", line 548, in _run with closing(self.executor_fn(_SHARED_SEQUENCES)) as executor: File "C:\Anaconda\lib\site-packages\keras\utils\data_utils.py", line 522, in initargs=(seqs,)) File "C:\Anaconda\lib\multiprocessing\context.py", line 119, in Pool context=self.get_context()) File "C:\Anaconda\lib\multiprocessing\pool.py", line 174, in init self._repopulate_pool() File "C:\Anaconda\lib\multiprocessing\pool.py", line 239, in _repopulate_pool w.start() File "C:\Anaconda\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "C:\Anaconda\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Anaconda\lib\multiprocessing\popen_spawn_win32.py", line 65, in init reduction.dump(process_obj, to_child) File "C:\Anaconda\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'get_noise_model..gaussian_noise'

C:\Anaconda\lib\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. Traceback (most recent call last): File "", line 1, in File "C:\Anaconda\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "C:\Anaconda\lib\multiprocessing\spawn.py", line 115, in _main self = reduction.pickle.load(from_parent) EOFError: Ran out of input

yu4u commented 6 years ago

It seems pickling issue in multiprocessing on windows. Please try

hist = model.fit_generator(generator=generator,
                          steps_per_epoch=steps,
                          epochs=nb_epochs,
                          validation_data=val_generator,
                          verbose=1,
                          callbacks=callbacks
                          )

instead of

hist = model.fit_generator(generator=generator,
                           steps_per_epoch=steps,
                           epochs=nb_epochs,
                           validation_data=val_generator,
                           verbose=1,
                           callbacks=callbacks,
                           use_multiprocessing=True,
                           workers=8
                           )

in train.py.

stevenwg commented 6 years ago

It works!! Thank you very much.