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 or other object detection models? Or possibly a stable Docker image that will work with Matterport?
In the original 2017 paper, Mask R-CNN took 32 hours to train on 8 GPUs with the COCO data. Since then, training time has significantly improved. In 2019, we demonstrated the fastest training times in the cloud for Mask R-CNN—27 minutes with PyTorch and 28 minutes with TensorFlow.
First by training only the mask-rcnn heads (without training the region proposal network or the backbone model) for 10 epochs with a learning rate of 0.002, and then the whole network for another 5 epochs with a learning rate of 0.0002.
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.
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
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"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With