Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
zhuzheyi e1b2e6056f | 1 year ago | |
---|---|---|
.. | ||
README.md | 1 year ago | |
config.py | 1 year ago | |
main_eval.py | 1 year ago | |
main_train.py | 1 year ago | |
model.py | 1 year ago | |
mrcnn_config.py | 1 year ago | |
mrcnn_dataset.py | 1 year ago | |
utils.py | 1 year ago | |
visualize.py | 1 year ago |
main_train.py: train maskRCNN model
main_eval.py: evaluate new image using the built maskRCNN model.
There are three datasets here: aerial imagery, human-labeled masks for target sustainable farming, hillshaded data. A small sample of input data has been uploaded into the parent folder. The data preprocessing is described in our blog #bloglink#.
In general, we need millions of images to train a deep learning model from scratch. As discussed in the above, we have unbalanced training dataset and the training dataset size is not enough for training a MaskRCNN model from scratch.
To leverage training time and the tiny training dataset, transfer learning is performed in the project. Transfer learning is a machine learning technique where a model trained from one task is repurposed on another related task. In our case, we used Feature Pyramid Network (FPN) and a ResNet101 backbone. The initial weights that have been trained on COCO dataset were used. These pre-trained weights already learned common features in natural images. Then the model was fine-tuned using the custom tiny dataset.
Before runing the training script, download mask_rcnn_coco.h5. Then execute:
python main_train.py --train <'training data folder'> --valid <'validation data folder'> --hill <'True/False'> --epoch <'epoch number'> --output <'output folder'>
eg. python main_train.py --train ./trData --valid ./valData --hill True --epoch 300 --output ./models
Our primary metric for model evaluation was Jaccard Index and Dice Similarity Coefficient. They measure how close predicted mask is to the manually marked masks, ranging from 0 (no overlap) to 1 (complete congruence).
Jaccard Similarity Index is the most intuitive ratio between the intersection and union:
Dice Coefficient is a popular metric, it's numerically less sensitive to mismatch when there is a reasonably strong overlap:
Regarding loss functions we started out with using classical Binary Cross Entropy (BCE) that is available as prebuilt loss function in Keras.
Also we have explored incorporating Dice Similarity Coefficient into loss function and got inspiration from this repo related to Kaggle's Carvana challenge.
To get the jaccard and dice coefficient for each test image, run the script main_eval.py. These values will be saved in pickle files. By turn the hill parrameter (True/False), you can choose model with/without hill shade data.
python main_eval.py --data <'test data folder'> --hill <'True/False'> --output <'output folder'> --epoch <'a list of epoch numbers'>
eg: python main_eval.py --data ./tstData --hill True --output ./output --epoch [50]
No Description
Jupyter Notebook Python Unity3D Asset Text other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》