This project is a domain-specific usage of Keras implementaion of RetinaNet.
RetinaNet is a deep neural network for object detection and it is described in Focal Loss for Dense Object Detection by Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He and Piotr Dollár.
Here is RetinaNet trained for a specific object detection - namely for detecting hands. Dataset used for training is publicly available.
- Clone this repository.
- Create virtual environment for python - execute
virtualenv -p python3 venvand activate it by executingsource venv/bin/activate. - Install requirements by executing
pip install -r requirements.txt - In the repository, execute
python setup.py install. - As of writing, this repository requires the master branch of
keras-resnet(runpip install --upgrade git+https://github.com/broadinstitute/keras-resnet).
By default, pretrained model is used which can be downloaded here. To use it, move it to the snapshots directory without renaming it. However, this model is unfortunately weak and not well trained because of lack of hardware resources.
Script main.py in examples directory is one of the examples how this model can be used. It comes with two options: annotating JPG image (-i) or annotating video (-v).
Scheme for usage is the following:
$ python examples/main.py -option <input_file_path> <output_file_path>
where -option is either -i or -v.
Result of running $ python examples/main -i image.jpg image-annotated.jpg where image.jpg is this one.
