|
| 1 | +# Color Spash Example |
| 2 | + |
| 3 | +This is an example showing the use of Mask RCNN in a real application. |
| 4 | +We train the model to detect balloons only, and then we use the generated |
| 5 | +masks to keep balloons in color while changing the rest of the image to |
| 6 | +grayscale. |
| 7 | + |
| 8 | +## Installation |
| 9 | +From the [Releases page](https://github.com/matterport/Mask_RCNN/releases) page: |
| 10 | +1. Download `mask_rcnn_balloon.h5`. Save it in the root directory of the repo (the `mask_rcnn` directory). |
| 11 | +2. Download `balloon_dataset.p3`. Expand it such that it's in the path `mask_rcnn/datasets/balloon/`. |
| 12 | + |
| 13 | +## Apply color splash using the provided weights |
| 14 | +Apply splash effect on an image: |
| 15 | + |
| 16 | +```bash |
| 17 | +python3 balloon.py splash --weights=/path/to/mask_rcnn/mask_rcnn_balloon.h5 --image=<file name or URL> |
| 18 | +``` |
| 19 | + |
| 20 | +Apply splash effect on a video. Requires OpenCV 3.2+: |
| 21 | + |
| 22 | +```bash |
| 23 | +python3 balloon.py splash --weights=/path/to/mask_rcnn/mask_rcnn_balloon.h5 --video=<file name or URL> |
| 24 | +``` |
| 25 | + |
| 26 | + |
| 27 | +## Run Jupyter notebooks |
| 28 | +Open the `inspect_balloon_data.ipynb` or `inspect_balloon_model.ipynb` Jupter notebooks. You can use these notebooks to explore the dataset and run through the detection pipelie step by step. |
| 29 | + |
| 30 | +## Train the Balloon model |
| 31 | + |
| 32 | +Train a new model starting from pre-trained COCO weights |
| 33 | +``` |
| 34 | +python3 balloon.py train --dataset=/path/to/balloon/dataset --weights=coco |
| 35 | +``` |
| 36 | + |
| 37 | +Resume training a model that you had trained earlier |
| 38 | +``` |
| 39 | +python3 balloon.py train --dataset=/path/to/balloon/dataset --weights=last |
| 40 | +``` |
| 41 | + |
| 42 | +Train a new model starting from ImageNet weights |
| 43 | +``` |
| 44 | +python3 balloon.py train --dataset=/path/to/balloon/dataset --weights=imagenet |
| 45 | +``` |
| 46 | + |
| 47 | +The code in `balloon.py` is set to train for 3K steps (30 epochs of 100 steps each), and using a batch size of 2. |
| 48 | +Update the schedule to fit your needs. |
0 commit comments