mdai / ml-lessons

Intro to deep learning for medical imaging lesson, by MD.ai
Apache License 2.0
258 stars 135 forks source link

Error in "lesson3..." notebook when setting GPU count > 1 #5

Open breckuh opened 6 years ago

breckuh commented 6 years ago

If I set GPU_COUNT = 2 in DetectorConfig and then run model = modellib.MaskRCNN(mode='training', config=config, model_dir=MODEL_DIR) I get the error pasted below.

This is not a big deal--running this notebook with 1 GPU is fine. I just thought to post this in case anyone else had this problem.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/miniconda3/envs/kgconda/lib/python3.6/site-packages/keras/engine/network.py in __setattr__(self, name, value)
    312             try:
--> 313                 is_graph_network = self._is_graph_network
    314             except AttributeError:

~/miniconda3/envs/kgconda/lib/python3.6/site-packages/mrcnn/parallel_model.py in __getattribute__(self, attrname)
     45             return getattr(self.inner_model, attrname)
---> 46         return super(ParallelModel, self).__getattribute__(attrname)
     47 

AttributeError: 'ParallelModel' object has no attribute '_is_graph_network'

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-87-6f119e8b220d> in <module>()
----> 1 model = modellib.MaskRCNN(mode='training', config=config, model_dir=MODEL_DIR)

~/miniconda3/envs/kgconda/lib/python3.6/site-packages/mrcnn/model.py in __init__(self, mode, config, model_dir)
   1843         self.model_dir = model_dir
   1844         self.set_log_dir()
-> 1845         self.keras_model = self.build(mode=mode, config=config)
   1846 
   1847     def build(self, mode, config):

~/miniconda3/envs/kgconda/lib/python3.6/site-packages/mrcnn/model.py in build(self, mode, config)
   2068         if config.GPU_COUNT > 1:
   2069             from mrcnn.parallel_model import ParallelModel
-> 2070             model = ParallelModel(model, config.GPU_COUNT)
   2071 
   2072         return model

~/miniconda3/envs/kgconda/lib/python3.6/site-packages/mrcnn/parallel_model.py in __init__(self, keras_model, gpu_count)
     33         gpu_count: Number of GPUs. Must be > 1
     34         """
---> 35         self.inner_model = keras_model
     36         self.gpu_count = gpu_count
     37         merged_outputs = self.make_parallel()

~/miniconda3/envs/kgconda/lib/python3.6/site-packages/keras/engine/network.py in __setattr__(self, name, value)
    314             except AttributeError:
    315                 raise RuntimeError(
--> 316                     'It looks like you are subclassing `Model` and you '
    317                     'forgot to call `super(YourClass, self).__init__()`.'
    318                     ' Always start with this line.')

RuntimeError: It looks like you are subclassing `Model` and you forgot to call `super(YourClass, self).__init__()`. Always start with this line.
tobimichigan commented 4 years ago

I wonder if any of the admin is reading these issues.