• This repository has been archived on 15/Jun/2022
  • Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
    Python
  • License
    Other
  • Created almost 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implementation of Mask R-CNN in Chainer

Chainer_Mask_R-CNN

Chainer implementation of Mask R-CNN - the multi-task network for object detection, object classification, and instance segmentation. (https://arxiv.org/abs/1703.06870)
ζ—₯本θͺžη‰ˆ README

What's New

  • Training result for R-50-C4 model has been evaluated!
  • COCO box AP = 0.346 using our trainer (0.355 with official boxes)
  • COCO mask AP = 0.287 using our trainer (0.314 with official boxes)

Examples

  • to be updated

Requirements

  • Chainer
  • Chainercv
  • Cupy
    (operable if your environment can run chainer > v3 with cuda and cudnn.)
    (verified as operable: chainer==3.1.0, chainercv==0.7.0, cupy==1.0.3)
$ pip install chainer   
$ pip install chainercv
$ pip install cupy
  • Python 3.0+
  • NumPy
  • Matplotlib
  • OpenCV

TODOs

  • Precision Evaluator (bbox, COCO metric)
  • Detectron Model Parser
  • Modify ROIAlign
  • Mask inference using refined ROIs
  • Precision Evaluator (mask, COCO metric)
  • Improve segmentation AP for R-50-C4 model
  • Feature Pyramid Network (R-50-FPN)
  • Keypoint Detection (R-50-FPN, Keypoints)

Benchmark Results

Box AP 50:95 Segm AP 50:95
Ours (1 GPU) 0.346 0.287
Detectron model 0.350 0.295
Detectron caffe2 0.355 0.314

Inference with Pretrained Models

python utils/detectron_parser.py
  • And the converted model file is saved in modelfiles
  • Run the demo:
python demo.py --bn2affine --modelfile modelfiles/e2e_mask_rcnn_R-50-C4_1x_d2c.npz --image <input image>

Prerequisites for training

  • Download 'ResNet-50-model.caffemodel' from the "OneDrive download" of ResNet pretrained models for model initialization and place it in ~/.chainer/dataset/pfnet/chainer/models/

  • COCO 2017 dataset : the COCO dataset can be downloaded and unzipped by:

bash getcoco.sh

Setup the COCO API:

git clone https://github.com/waleedka/coco
cd coco/PythonAPI/
make
python setup.py install
cd ../../

note: the official coco repository is not python3 compatible.
Use the repository above in order to run our evaluation.

Train

python train.py 

arguments and the default conditions are defined as follows:

'--dataset', choices=('coco2017'), default='coco2017'   
'--extractor', choices=('resnet50','resnet101'), default='resnet50', help='extractor network'
'--gpu', '-g', type=int, default=0   
'--lr', '-l', type=float, default=1e-4   
'--batchsize', '-b', type=int, default=8   
'--freeze_bn', action='store_true', default=False, help='freeze batchnorm gamma/beta'
'--bn2affine', action='store_true', default=False, help='batchnorm to affine'
'--out', '-o', default='result',  help='output directory'   
'--seed', '-s', type=int, default=0   
'--roialign', action='store_true', default=True, help='True: ROIAlign, False: ROIpooling'
'--step_size', '-ss', type=int, default=400000  
'--lr_step', '-ls', type=int, default=480000    
'--lr_initialchange', '-li', type=int, default=800     
'--pretrained', '-p', type=str, default='imagenet'   
'--snapshot', type=int, default=4000   
'--validation', type=int, default=30000   
'--resume', type=str   
'--iteration', '-i', type=int, default=800000   
'--roi_size', '-r', type=int, default=14, help='ROI size for mask head input'
'--gamma', type=float, default=1, help='mask loss balancing factor'   

note that we use a subdivision-based updater to enable training with large batch size.

Demo

Segment the objects in the input image by executing:

python demo.py --image <input image> --modelfile result/snapshot_model.npz --contour

Evaluation

Evaluate the trained model with COCO metric (bounding box, segmentation) :

python train.py --lr 0 --iteration 1 --validation 1 --resume <trained_model> 

Citation

Please cite the original paper in your publications if it helps your research:

@article{DBLP:journals/corr/HeGDG17,
  author    = {Kaiming He and
              Georgia Gkioxari and
              Piotr Doll{\'{a}}r and
              Ross B. Girshick},
  title     = {Mask {R-CNN}},
  journal   = {CoRR},
  volume    = {abs/1703.06870},
  year      = {2017},
  url       = {http://arxiv.org/abs/1703.06870},
  archivePrefix = {arXiv},
  eprint    = {1703.06870},
  timestamp = {Wed, 07 Jun 2017 14:42:32 +0200},
  biburl    = {http://dblp.org/rec/bib/journals/corr/HeGDG17},
  bibsource = {dblp computer science bibliography, http://dblp.org}
}

More Repositories

1

HandlerSocket-Plugin-for-MySQL

HandlerSocket is a NoSQL plugin for MySQL, working as a daemon inside the mysqld process, to accept tcp connections, and execute requests from clients. HandlerSocket does not support SQL queries; instead it supports simple CRUD operations on tables.
C++
1,132
star
2

PyTorch_YOLOv3

Implementation of YOLOv3 in PyTorch
Python
433
star
3

Chainer_Realtime_Multi-Person_Pose_Estimation

Chainer version of Realtime Multi-Person Pose Estiamtion
Python
431
star
4

PacketProxy

A local proxy written in Java
Java
429
star
5

SRCNNKit

CoreML and Keras implementation of Super-Resolution Convolutional Neural Network (SRCNN)
Python
387
star
6

DeClang

An anti-hacking compiler forked from the ollvm (https://github.com/obfuscator-llvm/obfuscator)
379
star
7

HandyRL

HandyRL is a handy and simple framework based on Python and PyTorch for distributed reinforcement learning that is applicable to your own environments.
Python
282
star
8

nota

Web application for image and video labeling and annotation
JavaScript
112
star
9

Anjin

Autopilot tool for games made with Unity
C#
99
star
10

unity-meta-check

A tool to check problems about meta files of Unity
Go
81
star
11

techcon_app

TechCon App
Dart
57
star
12

HEVCPlayerView

C++
46
star
13

android-modern-architecture-test-handson

Kotlin
30
star
14

codelabs

DeNAγŒδ½œζˆγƒ»ε…¬ι–‹γ—γ¦γ„γ‚‹γ‚³γƒΌγƒ‰γƒ©γƒœγ§γ™γ€‚
Kotlin
28
star
15

cocoa-checker

COCOA(Covid-19 Exposure Notification System in Japan) Signal Checker / COCOA(Covid-19ζŽ₯触璺θͺγ‚’γƒ—γƒͺ)ε‹•δ½œγƒγ‚§γƒƒγ‚«γƒΌ
HTML
25
star
16

aelog

App Engine Logger
Go
24
star
17

ChainerPruner

ChainerPruner: Channel Pruning framework for Chainer
Python
21
star
18

devfarm

Tools to control iOS and Android mobile apps across several device farms
Go
20
star
19

Face2Speech

20
star
20

setup-job-workspace-action

An action creating a virtual workspace directory for each job
TypeScript
20
star
21

tflite-runtime-builder

Build TensorFlow Lite runtime with GitHub Actions
20
star
22

thrush

Some useful additions to bluebird for Node.js
JavaScript
16
star
23

punctual

Redis-backed Node.js task queue for delayed job processing
JavaScript
15
star
24

dworker

Distributed worker system.
JavaScript
11
star
25

capistrano-net_storage

Capistrano Plugin for Fast Deployment via Remote Storage
Ruby
10
star
26

cloud-datastore-interceptor

Interceptors for Cloud Datastore
Go
10
star
27

Dena.CodeAnalysis.Testing

TDD friendly test helpers for Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer
C#
9
star
28

mysql_rewinder

Ruby
8
star
29

aehcl

App Engine Http Client
Go
7
star
30

mobilize-server

Mobilize-Server includes deployment scripts via Capistrano and scheduling via whenever.
Shell
7
star
31

FBStackableURLCache

A more pluggable version of Apple's NSURLCache. Implement a filtering webbrowser, or even your own version of Amazon Silk…
Objective-C
6
star
32

digdag-operator-bq-wait

Java
6
star
33

m_logger

Ruby
6
star
34

FBFramedScrollableView

UIView subclass that manages any type of UIKit scrollable view, automatically animating a header and footer as you scroll.
Objective-C
6
star
35

mobilize-base

Mobilize is a script deployment and data visualization framework with a Google Spreadsheets UI. Mobilize uses Resque for parallelization and queueuing, MongoDB for caching, and Google Drive for hosting, user input and display.
Ruby
6
star
36

rubycf

Ruby bindings for native Property List read/writing using Core Foundation or CFLite
C
5
star
37

asyncgraph

asyncgraph is a very simply module for controlling flow between asynchronous code.
JavaScript
5
star
38

IsarTutorial

Isabelle
4
star
39

PacketProxyPlugin

Plugins for PacketProxy
Java
4
star
40

ommonitor

Open Match Ticket Monitor
Go
4
star
41

mobilize-ssh

Mobilize-Ssh adds the power of ssh to mobilize-base.
Ruby
4
star
42

ubuntu22-mysql-q4m

Dockerfile
4
star
43

RoslynAnalyzerTemplate

C#
3
star
44

capistrano-deploy_locker

Capistrano Plugin to Lock Deployment
Ruby
3
star
45

redis_info

A Scout plugin to monitor redis by using the redis-cli info command
3
star
46

PacketProxyHub

Web service for sharing configs of PacketProxy
Java
3
star
47

Login-Toboggan-Android

Java
2
star
48

mobilize-hdfs

Adds hdfs support for mobilize-ssh
Ruby
2
star
49

kobold_ruby

Tools for working with and writing tests in Ruby, Rails and Sinatra
Ruby
2
star
50

capistrano-net_storage_demo

Example application for Capistrano::NetStorage
Ruby
1
star
51

aemw

App Engine Middleware
1
star
52

mobilize-hive

adds hive support to mobilize-hdfs
Ruby
1
star
53

unity-meta-check-bins

Pre-built binaries of unity-meta-check for Windows/Linux/macOS
Shell
1
star
54

capistrano-net_storage-s3

Capistrano::NetStorage Plugin for Deployment via Amazon S3
Ruby
1
star
55

Login-Toboggan-iOS

Objective-C
1
star
56

mono-login-sample

C#
1
star
57

mempatch

Memory tampering tool for security assessment
C++
1
star