I can't seem to find a reliable version of Mask-RCNN for TensorFlow 2. The matterport mask-rcnn (https://github.com/matterport/Mask_RCNN) has depreciated Tensorflow 1 code. Does anyone know of TensorFlow 2 implementations of RCNN either based on matterport or something else, or other object detection models?
-
check this https://github.com/matterport/Mask_RCNN/pull/2115 – Innat Jul 25 '20 at 15:53
3 Answers
There is one working implementation of Mask RCNN in TF 2+. I found it here: https://github.com/matterport/Mask_RCNN/tree/295c802f0bebbc4a34ec4855f4960a52a701271d
To make all examples work in TF 2.4 you must modify rcnn/model.py file by replacing:
if model.uses_learning_phase and not isinstance(K.learning_phase(), int):
with
if not isinstance(K.learning_phase(), int):
as uses_learning_phase doesn't work any more in TF 2.4.
Then use this correction: https://stackoverflow.com/a/66842506/13467454
It should work fine on TF 2.4.

- 168
- 1
- 8
Take a look at this port, it works for me. https://www.immersivelimit.com/tutorials/mask-rcnn-for-windows-10-tensorflow-2-cuda-101
There is also an implementation by Nvidia, I didn't try but seems to be serious: https://ngc.nvidia.com/catalog/resources/nvidia:mask_r_cnn_for_tensorflow2

- 21
- 2
-
Direct link: https://github.com/leekunhee/Mask_RCNN ; works well with tf 2.3. – Come get some Feb 26 '21 at 16:37
A recent fork from Matterport's version has TF2 support: https://github.com/ahmedfgad/Mask-RCNN-TF2
TF Hub also has a convenient resource for Mask RCNN: https://hub.tensorflow.google.cn/tensorflow/mask_rcnn/inception_resnet_v2_1024x1024/1 Which can be used as simply as:
import tensorflow_hub as hub
# Apply image detector on a single image.
detector = hub.load("https://hub.tensorflow.google.cn/tensorflow/mask_rcnn/inception_resnet_v2_1024x1024/1")
detector_output = detector(image_tensor)
class_ids = detector_output["detection_classes"]

- 3,079
- 29
- 25