Git Product home page Git Product logo

nonatofabio / mask-rcnn-tensorflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-samples/mask-rcnn-tensorflow

0.0 0.0 0.0 45.85 MB

Fork of Tensorpack to make breaking performance improvements to the Mask RCNN example. Training is approximately 2x faster than the original implementation on AWS.

License: Apache License 2.0

Dockerfile 0.06% Python 16.00% Shell 0.43% Jupyter Notebook 83.50%

mask-rcnn-tensorflow's Introduction

Mask RCNN

Performance focused implementation of Mask RCNN based on the Tensorpack implementation. The original paper: Mask R-CNN

Overview

This implementation of Mask RCNN is focused on increasing training throughput without sacrificing any accuracy. We do this by training with a batch size > 1 per GPU using FP16 and two custom TF ops.

Status

Training on N GPUs (V100s in our experiments) with a per-gpu batch size of M = NxM training

Training converges to target accuracy for configurations from 8x1 up to 32x4 training. Training throughput is substantially improved from original Tensorpack code.

A pre-built dockerfile is available in DockerHub under awssamples/mask-rcnn-tensorflow:latest. It is automatically built on each commit to master.

Notes

  • Running this codebase requires a custom TF binary - available under GitHub releases
    • The custom_op.patch contains the git diff from our custom TF
    • There are also pre-built TF wheels, the stable version is on TF 1.14.
  • We give some details the codebase and optimizations in CODEBASE.md

To launch training

  • Data preprocessing
    • We are using COCO 2017, you can download the data from COCO data.
    • The pre-trained resnet backbone can be downloaded from ImageNet-R50-AlignPadding.npz
    • The file folder needs to have the following directory structure:
    data/
      annotations/
        instances_train2017.json
        instances_val2017.json
      pretrained-models/
        ImageNet-R50-AlignPadding.npz
      train2017/
        # image files that are mentioned in the corresponding json
      val2017/
        # image files that are mentioned in corresponding json
    
    • If you want to use COCO 2014, please refer to here
    • If you want to use EKS or Sagemaker, you need to create your own S3 bucket which contains the data in the same directory structure, and change the S3 bucket name in the following files:
    • If you want to use EKS, you also need to create the a FSx filesystem
      • You don't need to link your S3 bucket if you have followed the previous steps
      • You need to change the FSx filesystem id in pv-fsx file.
  • Container is highly recommended for training
    • If you want to build your own image, please refer to our Dockerfile. Please note that you need to rebuild Tensorflow when building the docker image, it is time-consuming.
    • Alternatively, you can use our pre-built docker image: fewu/mask-rcnn-tensorflow:master-latest.
  • To run on AWS
    • To train with docker on EC2 (best performance), refer to Docker
    • To train with Amazon EKS, refer to EKS
    • To train with Amazon SageMaker, refer to SageMaker

Training results

The result was running on P3dn.24xl instances using EKS. 12 epochs training:

Num_GPUs x Images_Per_GPU Training time Box mAP Mask mAP
8x4 5.09h 37.47% 34.45%
16x4 3.11h 37.41% 34.47%
32x4 1.94h 37.20% 34.25%

24 epochs training:

Num_GPUs x Images_Per_GPU Training time Box mAP Mask mAP
8x4 9.78h 38.25% 35.08%
16x4 5.60h 38.44% 35.18%
32x4 3.33h 38.33% 35.12%

Example output

Tensorpack fork point

Forked from the excellent Tensorpack repo at commit a9dce5b220dca34b15122a9329ba9ff055e8edc6

mask-rcnn-tensorflow's People

Contributors

yangfei1990 avatar johnbensnyder avatar jamesiri avatar pidajay 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.