matterport / Mask_RCNN

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

TypeError: Functional.__init__() missing 2 required positional arguments: 'inputs' and 'outputs' #2934

Open matt19git opened 1 year ago

matt19git commented 1 year ago

Getting the above error on Tensorflow 2.11 python 3.9, AWS sagemaker. I was trying to convert the model from running locally to on the cloud.

Here is the full error:

TypeError Traceback (most recent call last)

in 1 # Create model in training mode ----> 2 model = modellib.MaskRCNN(mode="training", config=config, model_dir=DEFAULT_LOGS_DIR) ~/DigAg/mrcnn/model.py in __init__(self, mode, config, model_dir) 1791 self.model_dir = model_dir 1792 self.set_log_dir() -> 1793 self.keras_model = self.build(mode=mode, config=config) 1794 1795 def build(self, mode, config): ~/DigAg/mrcnn/model.py in build(self, mode, config) 2031 if config.GPU_COUNT > 1: 2032 from mrcnn.parallel_model import ParallelModel -> 2033 model = ParallelModel(model, config.GPU_COUNT) 2034 2035 return model ~/DigAg/mrcnn/parallel_model.py in __init__(self, keras_model, gpu_count) 24 keras_model: The Keras model to parallelize 25 gpu_count: Number of GPUs. Must be > 1 ---> 26 """ 27 super(ParallelModel, self).__init__() 28 self.inner_model = keras_model /usr/local/lib/python3.9/site-packages/tensorflow/python/trackable/base.py in _method_wrapper(self, *args, **kwargs) 203 self._self_setattr_tracking = False # pylint: disable=protected-access 204 try: --> 205 result = method(self, *args, **kwargs) 206 finally: 207 self._self_setattr_tracking = previous_value # pylint: disable=protected-access TypeError: __init__() missing 2 required positional arguments: 'inputs' and 'outputs'
vipin-gunda commented 1 year ago

I'm having a really similar issue. Does anyone have insight into how to fix this? Using AWS sagemaker with multiple GPUs