Mask RCNN on own dataset.
Data cleaner can remove the trash img out of dataset. It trains on the resnet50 by using 3994 imgs(positive imgs and negative imgs).
Validation imgs includes 238 imgs(positive imgs and negative imgs). The accuracy in validation set is 99.8%.
python train.py
python predict.py --dir=高架
Put the data just like below.
|-- train.py
|-- model.py
|-- predict.py
|-- data_utils.py
|-- best_model
|--Classify
|-- model.pth
|-- data(image)
|-- A
|-- B
|-- C
|-- D
|-- ....
When we finish the annotation from labelme, we next transform the format to COCO format by the command . But I suggest the other way to transform the format.
Put this file in to the image annotation folder, then try below:
python labelme2coco.py
It will generate a new.json that is the annotation file of coco format. Next, we change the file name to train.json. Validation dataset repeat the above step to get the coco format.
Now we have the dataset below:
|-- dataset
|-- train
|--0.jpg
|--1.jpg
|-- ...
|-- val
|--1000.jpg
|--1001.jpg
|-- ...
|--annotation
|--train.json
|--val.json
Follow the installation in matterport/Mask_RCNN
Training
python ./train201908.py --training_dataset train --validation_dataset valid --year 201908 train
Evaluate
python ./train201908.py --training_dataset train --validation_dataset valid --year 201908 evaluate
also see train_valid_visual
coco_eval replaced by cocoeval.py (remember to change the class number)