Using the famous Airbus Ship Detection dataset from the corresponding Kaggle Competition, trained a model with MaskRCNN from matterport to perform image segmentation for ship detection.
This repository is part of my senior thesis 'Alcyone Object & Phenomenon Detection System'.
- Clone Mask RCNN repository from Matterport
- Install it's dependencies
pip3 install -r requirements.txt
- Run setup from the repository root directory
python3 setup.py install
- Optionally Download pre-trained COCO weights (mask_rcnn_coco.h5) from the releases page.
- Clone this repo and place below files to Mask RCNN repo, inside folder
Mask_RCNN-master
- Be sure to adjust config.py accordingly (number of classes, gpu count)
- Create an
images
folder insideMask_RCNN-master
folder and copy your images to run the model on.
- In line 23 of ship_obj_detection.py point to your model h5 file.
- In line 25 of ship_obj_detection.py point to your test image.
- Same for run_ship_model.py file.
- run commands:
python3 ship_obj_detection.py
python3 run_ship_model.py
- ship_obj_detection.py - Segmentation and Detection of ships
- run_ship_model.py - Only detections and bounding boxes.
Start by reading this blog post about the balloon color splash sample. It covers the process starting from annotating images to training to using the results in a sample application.
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/shapes/train_shapes.ipynb
, samples/coco/coco.py
, samples/balloon/balloon.py
, and samples/nucleus/nucleus.py
of
original Mask RCNN repo here
My model trained on 2 epochs, on cpu. Just for testing purposes. No further tweaks were made.
Python 3.4, TensorFlow 1.3, Keras 2.0.8 and other common packages listed in requirements.txt
.
- added source files for running segmentation and object detection
- add trained model files
- showcase results and model performance
- Original Mask RCNN repo
- Useful notebooks using Mask RCNN
- Deep Learning for Ship Detection and Segmentation
For educational purposes, ~codelover96