Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.
/ chainer-mask-rcnn Public archive

Chainer Implementation of Mask R-CNN. (Training code to reproduce the original result is available.)


Notifications You must be signed in to change notification settings


Repository files navigation


PyPI version Python Versions GitHub Actions

Chainer Implementation of Mask R-CNN.


Fig 1. Mask R-CNN, ResNet50, 8GPU, Ours, COCO 31.4 mAP@50:95

COCO Results

Model Implementation N gpu training mAP@50:95 Log
Mask R-CNN, ResNet50 Ours 8 31.5 - 31.8 Log
Mask R-CNN, ResNet50 Detectron 8 31.4 (30.8 after copied) Log
FCIS, ResNet50 FCIS 8 27.1 -


# you can use your trained model

# COCO Example: Mask R-CNN, ResNet50, 31.4 mAP@50:95
cd examples/coco
mkdir -p $LOG_DIR
pip install gdown
gdown -O $LOG_DIR/snapshot_model.npz
gdown -O $LOG_DIR/params.yaml

# copy weight from caffe2 to chainer
cd examples/coco
./  # or download from
./ logs/R-50-C4_x1_caffe2_to_chainer --img
./ logs/R-50-C4_x1_caffe2_to_chainer --img

Fig 2. Mask R-CNN, ResNet50, 8GPU, Copied from Detectron, COCO 31.4 mAP@50:95

Installation & Training

Single GPU Training

# Install Chainer Mask R-CNN.
pip install opencv-python
pip install .

# Run training!
cd examples/coco && ./ --gpu 0

Multi GPU Training

# Install OpenMPI
tar zxvf openmpi-3.0.0.tar.gz
cd openmpi-3.0.0
./configure --with-cuda
make -j4
sudo make install
sudo ldconfig

# Install NCCL
# dpkg -i nccl-repo-ubuntu1404-2.1.4-ga-cuda8.0_1-1_amd64.deb
dpkg -i nccl-repo-ubuntu1604-2.1.15-ga-cuda9.1_1-1_amd64.deb
sudo apt update
sudo apt install libnccl2 libnccl-dev

# Install ChainerMN
pip install chainermn

# Finally, install Chainer Mask R-CNN.
pip install opencv-python
pip install .

# Run training!
cd examples/coco && mpirun -n 4 ./ --multi-node


pip install flake8 pytest
flake8 .
pytest -v tests