Mask_rcnn: generator already executing

Created on 27 Apr 2018  路  6Comments  路  Source: matterport/Mask_RCNN

Firstly,I am very happy I can use the open source.But I just met a False that i can't fix it.

Exception in thread Thread-3:
Traceback (most recent call last):
File "D:\python\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "D:\python\lib\threading.py", line 864, in run
self._target(self._args, *self._kwargs)
File "E:\jw_files\graduate\projects\yx_pro\mtcnn\pig_landmark\venv\lib\site-packages\keras\utils\data_utils.py", line 568, in data_generator_task
generator_output = next(self._generator)
ValueError: generator already executing

Traceback (most recent call last):
File "E:/jw_files/graduate/projects/github/maskrcnn/Mask_RCNN-2.0/train.py", line 248, in
layers='heads')
File "E:\jw_files\graduate\projects\github\maskrcnn\Mask_RCNN-2.0\model.py", line 2200, in train
workers=max(self.config.BATCH_SIZE // 2, 2)
File "E:\jw_files\graduate\projects\yx_pro\mtcnn\pig_landmark\venv\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapper
return func(args, *kwargs)
File "E:\jw_files\graduate\projects\yx_pro\mtcnn\pig_landmark\venv\lib\site-packages\keras\engine\training.py", line 2011, in fit_generator
generator_output = next(output_generator)
StopIteration

What should I do for training it?

Most helpful comment

    self.keras_model.fit_generator(
        train_generator,
        initial_epoch=self.epoch,
        epochs=epochs,
        steps_per_epoch=self.config.STEPS_PER_EPOCH,
        callbacks=callbacks,
        validation_data=val_generator,
        validation_steps=self.config.VALIDATION_STEPS,
        max_queue_size=100,
        workers=workers,
        use_multiprocessing=False,
    )

if you modify use_multiprocessing=False,then you should modify workers=1

All 6 comments

Same as me!

Me too, please help us

I had the same error (running on Linux / but before trying on windows).
Setting use_multiprocessing=True in model.py (line ~2357) helped.

    self.keras_model.fit_generator(
        train_generator,
        initial_epoch=self.epoch,
        epochs=epochs,
        steps_per_epoch=self.config.STEPS_PER_EPOCH,
        callbacks=callbacks,
        validation_data=val_generator,
        validation_steps=self.config.VALIDATION_STEPS,
        max_queue_size=100,
        workers=workers,
        use_multiprocessing=False,
    )

if you modify use_multiprocessing=False,then you should modify workers=1

    self.keras_model.fit_generator(
        train_generator,
        initial_epoch=self.epoch,
        epochs=epochs,
        steps_per_epoch=self.config.STEPS_PER_EPOCH,
        callbacks=callbacks,
        validation_data=val_generator,
        validation_steps=self.config.VALIDATION_STEPS,
        max_queue_size=100,
        workers=workers,
        use_multiprocessing=False,
    )

if you modify use_multiprocessing=False,then you should modify workers=1

Thank you so much for sending the detail solution even I had solved the problem by the same way.I must say, your codes is pretty robust.Thank you again for sharing it to public.

If I want to use multi process, how to solve it?

Was this page helpful?
0 / 5 - 0 ratings