Skip to content

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow

License

Notifications You must be signed in to change notification settings

KomaHomu/Applying-Mask-RCNN-in-endangered-animals-detection

 
 

Repository files navigation

Mask R-CNN for Object Detection and Segmentation

This is an implementation of Mask R-CNN on Python 3, Keras, and TensorFlow. The model generates bounding boxes and segmentation masks for each instance of an object in the image. It's based on Feature Pyramid Network (FPN) and a ResNet101 backbone.

image

The repository includes:

  • Source code of Mask R-CNN built on FPN and ResNet101/ResNet50
  • Training code for MS COCO
  • Training code for custom animals dataset
  • Pre-trained weights for MS COCO
  • Jupyter notebooks to visualize the detection pipeline at every step
  • ParallelModel class for multi-GPU training
  • Evaluation on MS COCO metrics (AP) and DICE

Included animals

  • Tiger
  • Bear
  • Elephant
  • Sika deer
  • Sea turtle
  • Otter
  • Rhesus monkey

Link to trained model based on its backbone:

ResNet101: https://drive.google.com/file/d/1mZXuvDaB8p-CIXcoh8F2dB2CKUTcTuGB/view?usp=share_link
ResNet50: https://drive.google.com/file/d/1k99kLo28DP3wfHptgPXtqevL8-4QrRhh/view?usp=share_link

1. Anchor sorting and filtering

Visualizes every step of the first stage Region Proposal Network and displays positive and negative anchors along with anchor box refinement.

2. Bounding Box Refinement

This is an example of final detection boxes (dotted lines) and the refinement applied to them (solid lines) in the second stage.

3. Mask Generation

Examples of generated masks. These then get scaled and placed on the image in the right location.

4.Layer activations

Often it's useful to inspect the activations at different layers to look for signs of trouble (all zeros or random noise).

5. Weight Histograms

Another useful debugging tool is to inspect the weight histograms. These are included in the inspect_weights.ipynb notebook.

6. Logging to TensorBoard

TensorBoard is another great debugging and visualization tool. The model is configured to log losses and save weights at the end of every epoch.

6. Composing the different pieces into a final result

Requirements

Python 3.7, TensorFlow 1.1.4, Keras 2.0.8 and other common packages listed in requirements.txt.

MS COCO Requirements:

To train or test on MS COCO, you'll also need:

About

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 99.8%
  • Python 0.2%