matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.54k stars 11.68k forks source link

generator already executing #495

Open unknown-kid opened 6 years ago

unknown-kid commented 6 years ago

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?

yayagepeide commented 6 years ago

Same as me!

Zwenjay commented 6 years ago

Me too, please help us

stvogel commented 5 years ago

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

chenhoushuang commented 5 years ago
    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

unknown-kid commented 5 years ago
    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.

edis219 commented 5 years ago

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