Code Monkey home page Code Monkey logo

maskr's Introduction

Pytorch MaskRCNN

This is a Pytorch/Fastai implementation of MaskRCNN based on previous versions by Matterport and MultiModal Learning (see acknowledgements at bottom of page). This was mainly a personal learning exercise but the simplified structure may help others wanting to understand maskrcnn.

Includes:

  • Overview diagram that shows the key components of maskRCNN
  • Code cleaned up and structured as per the diagram to make it easy to understand and experiment with each part.
  • Works with pytorch v1 and fastai v1
  • Training and prediction working on nuke data from 2018 kaggle bowl; training and prediction on synthetic shapes data; and prediction on images using coco categories.

Todo:

  • More tests. How can it best be tested?
  • Could the experimental test framework be useful for continuous testing? Is there a good framework already written?
  • How to expand testing to keras. i.e. how to adapt matterport for eager mode?

Structure

This diagram shows how it all fits together Note that training and prediction follow slightly different paths.

The core code reflects the diagram:

  • datagen - anchors, dataset, head_targets, rpn_targets
  • model - maskrcnn (whole thing), resnet (backbone), resnetFPN (feature pyramid), rpn
  • filter - proposals, roialign, detections
  • loss - loss functions for rpn and head

Utilities

  • lib - c extensions for nms and roialign
  • utils - box_utils, image_utils, visualize, batch (function decorator to process batches)
  • callbacks - to tailor fastai for maskrcnn
  • ipstartup - startup script for notebooks
  • config - configuration constants

Samples

  • Applications typically with dataset, config, learner, notebooks

Test (experimental)

  • baseline - classes to help compare a new versus baseline version
  • test_*.py
    • limited number of pytest functions versus multimodal
    • tried versus matterport but original needs adapting to work with eager mode
  • tests.ipynb - notebook to run pytests

Installation

  1. Clone this repository.

     git clone https://github.com/simonm3/maskr.git
    
  2. Download pretrained coco weights from Google Drive.

  3. Build the nms and roialign binaries:

     cd maskr/maskr/lib
     ./make.sh
    
  4. Install the python package and dependencies in edit mode

     cd maskr
     pip install -e .
    

Acknowledgements and links

Blogs

These are useful introductions to image segmentation and maskrcnn

A Brief History of CNNs in Image Segmentation: From R-CNN to Mask R-CNN

Deep Learning for Instance-level Object Understanding. Tutorial on Deep Learning for Objects and Scenes (by Ross Girshick).

Object Detection using Deep Learning for advanced users

Faster R-CNN: Down the rabbit hole of modern object detection

Region of Interest Pooling explained

Papers

These are the main papers that led to maskrcnn:

FastRCNN

FasterRCNN

MaskRCNN

Feature Pyramid Networks

Packages

This package was based on the multimodal package which was based on matterport.

Matterport Mask_RCNN. A keras/tensorflow implementation of maskrcnn

Multimodal learning. Pytorch version of matterport.

Facebook detectron. Facebook super package that includes implementation of a wide range of image segmentation algorithms using Caffe2.

Pytorch detectron. Conversion of detectron to pytorch.

maskr's People

Contributors

lasseha avatar simonm3 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.