How can I solve a problem of loading Mask R-CNN model for Transfer learning?

I’m trying to train a Transfer learning model using Matterport’s implementation,but I’m getting an error message when trying to load the MaskRCNN model

Here is the code :

!git clone https://www.github.com/matterport/Mask_RCNN.git

from mrcnn.config import Config
from mrcnn import utils
import mrcnn.model as modellib
from mrcnn import visualize
from mrcnn.model import log
from mrcnn.utils import Dataset


class myMaskRCNNConfig(Config):
    # give the configuration a recognizable name
    NAME = "MaskRCNN_config"
 
    # set the number of GPUs to use along with the number of images
    # per GPU
    GPU_COUNT = 1
    IMAGES_PER_GPU = 1
 
    # number of classes (we would normally add +1 for the background)
     # kangaroo + BG
    NUM_CLASSES = 1+1
   
    # Number of training steps per epoch
    STEPS_PER_EPOCH = 131
    
    # Learning rate
    LEARNING_RATE=0.006
    
    # Skip detections with < 90% confidence
    DETECTION_MIN_CONFIDENCE = 0.9
    
    # setting Max ground truth instances
    MAX_GT_INSTANCES=10

config = myMaskRCNNConfig()
config.display()

print("Loading Mask R-CNN model...")
model = modellib.MaskRCNN(mode="training", config=config, model_dir='./')

The error message is :


Loading Mask R-CNN model...
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-83-1ed1ff260563> in <module>()
      1 print("Loading Mask R-CNN model...")
----> 2 model = modellib.MaskRCNN(mode="training", config=config, model_dir='./')

10 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/type_spec.py in type_spec_from_value(value)
    552 
    553   raise TypeError("Could not build a TypeSpec for %r with type %s" %
--> 554                   (value, type(value).__name__))
    555 
    556 

TypeError: Could not build a TypeSpec for <KerasTensor: shape=(None, None, 4) dtype=float32 (created by layer 'tf.math.truediv_7')> with type KerasTensor

Where is the problem?

Thanks in advance

Github Issues have a lot of valuable information, for books you can find practical code running errata there too.