by voidrank

voidrank / FastMask

FastMask: Segment Multi-scale Object Candidates in One Shot

212 Stars 65 Forks Last release: Not found GNU General Public License v3.0 20 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


FastMask: Segment Multi-scale Object Candidates in One Shot

(Published as a spotlight paper at CVPR 2017 in Honolulu, Hawaii)

Hexiang Hu*, Shiyi Lan*, Yuning Jiang, Zhimin Cao, Fei Sha (*Equal contribution. Work was done during their internships at Megvii Inc.)

If you are using code or other related resources from this repository, please cite the following paper:

  title={FastMask: Segment Multi-scale Object Candidates in One Shot},
  author={Hu, Hexiang and Lan, Shiyi and Jiang, Yuning and Cao, Zhimin and Sha, Fei},
  journal={arXiv preprint arXiv:1612.08843},

Requirements and Dependencies

  • MAC OS X or Linux
  • NVIDIA GPU with compute capability 3.5+
  • Python 2.7+
  • COCOApi, redis, python-cjson, opencv2, numpy
  • Alchemy, caffe-fm

Quick Start

Step in common

We highly recommend you to use anaconda2 on ubuntu 14.04, which is our main experimental environment.

For ubuntu 14.04

sudo apt-get update
sudo apt-get install python-opencv python-pip

and then install cocoapi see COCOApi

git clone --recursive
cd FastMask
mkdir params results
pip install -r requirements.txt
cd caffe-fm
make pycaffe -j 4
cd ..


Download parameters of pretrained models

Download final model and save it in ./params

Image Demo

python [gpu_id] [model] [input_image_path] [--init_weights=weights] [--threshold=0.9]

This instruction will segment the image at


There is an example: (suppose that the input image named

is at
python 0 fm-res39 input.jpg --init_weights=fm-res39_final_params.caffemodel

Video Demo

python [gpu_id] [model] [input_video_path] [output_video_path] [--init_weights=weights] [--threshold=0.9]


Set Up Redis Server for Multiprocess Communication

nohup redis-server redis.conf

Download COCO

cd data
cd ..

Download pretrained model on imagenet

Download ResNet-50-model.caffemodel and save it in ./params


python [gpu_id] [model] [--init_weights=ResNet-50-model.caffemodel] [--process=4]

For examples,

python 0 fm-res39 --init_weights=ResNet-50-model.caffemodel


python [gpu_id] [model] [--init_weights=xxx.caffemodel]
python [model]

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.