This is an implementation of Mask R-CNN on Python 3, Keras, and TensorFlow. The model generates bounding boxes and segmentation masks for each instance of an object in the image. It's based on Feature Pyramid Network (FPN) and a ResNet101 backbone.
Python 3.6.9 and other common packages listed in requirements.txt
. Do not install different versions of tensorflow and keras.
- Clone this repository
- Install dependencies
pip3 install -r requirements.txt
- Run train.py file
python3 train.py
-
Download the tshirt dataset .zip file from here and extract it. Annotations file is inside the folder with name
annotations_train.json
-
(model.py, utils.py, config.py): These files contain the main Mask RCNN implementation.
-
(train.py): To train the model use this file. Use the same path for dataset_train and dataset_val in train.py as we are using 10% of images from training dataset for measuring validation loss.
-
(train_mask_rcnn_demo.py) is used give no. of classes, batch size, steps_per_epoch, epochs, gpu_count, images_per_gpu. Change them as per your convinence wrt your GPU. You can change epochs in
train_head
andtrain_all_layers
functions inline267
andline274
respectively. -
For Downloading the dataset
pip install gdown
gdown --fuzzy https://drive.google.com/file/d/1aGLstfgFbBMZih_OaBaiuB40ZI8DxLpK/view?usp=sharing