/fs-mrcnn

Primary LanguagePythonOtherNOASSERTION

Mask R-CNN - Object Detection and Segmentation

This package is based on Matterport's implementation of Mask R-CNN using Python 3, Keras, and TensorFlow.

The main additions are:

  • /samples/players - contains an implementation of mask_rcnn retrained for players from 2 matches, using Resnet50 and 256*256 images (170MB model)

  • /occlusions - contains tools to extract occlusion images, create a new player database, freeze the obtained models

The original readme is found in README_orig.md

Training on Your Own Dataset

You can use players project to retrain on your own database.

In summary, to train the model on your own dataset you'll need to extend two classes:

Config This class contains the default configuration. Subclass it and modify the attributes you need to change.

Dataset This class provides a consistent way to work with any dataset. It allows you to use new datasets for training without having to change the code of the model. It also supports loading multiple datasets at the same time, which is useful if the objects you want to detect are not all available in one dataset.

See examples in samples/players/players.py, samples/baloon

Requirements

Python 3.6, TensorFlow 1.9, Keras 2.0.8 and other common packages listed in requirements.txt.

MS COCO Requirements:

To train or test on MS COCO, you'll also need:

Installation (if you want to separate the package from the main package - ml)

  1. Install dependencies

    pip3 install -r requirements.txt
  2. Clone this repository

  3. Run setup from the repository root directory

    python3 setup.py install
  4. Download pre-trained COCO weights (mask_rcnn_coco.h5) from the releases page.

  5. (Optional) To train or test on MS COCO install pycocotools from one of these repos. They are forks of the original pycocotools with fixes for Python3 and Windows (the official repo doesn't seem to be active anymore).