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
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
Python 3.6, TensorFlow 1.9, Keras 2.0.8 and other common packages listed in requirements.txt
.
To train or test on MS COCO, you'll also need:
- pycocotools (installation instructions below)
- MS COCO Dataset
- Download the 5K minival and the 35K validation-minus-minival subsets. More details in the original Faster R-CNN implementation.
-
Install dependencies
pip3 install -r requirements.txt
-
Clone this repository
-
Run setup from the repository root directory
python3 setup.py install
-
Download pre-trained COCO weights (mask_rcnn_coco.h5) from the releases page.
-
(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).- Linux: https://github.com/waleedka/coco
- Windows: https://github.com/philferriere/cocoapi. You must have the Visual C++ 2015 build tools on your path (see the repo for additional details)