This is Mask R-CNN implementation is based on the work of Matterport which was developed 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.
This project was developed for my master thesis. It evaluated abitility Mask R-CNN to recognize crop diseases via Sentinel-2 MSI products.
The work is splitted in two parts. The first part sentineldata.py downloads Sentinel products, calculates the NDVI and crops out the RoI. Also it creates a binary mask representing the RoI for later training. It's stored separately since it doesn't need to be recreated before the images are loaded into the model. For this to work, annotated RoIs as GeoJsons are necessary.
The second part is the actual model in crop-disease.py. It loads the dataset and feeds the model with it. After the succesful training, the model can be used for detection tasks. For further information on the model implementation details, please consider reading the documentation and Jupyter Notebooks of the original Github.
- Clone this repository
- Install dependecies
pip3 install -r requirements.txt - Create RoI and store it into
./datasets/roi.geojson - Create Copernicus Open Access Hub account
- Navigate to
./sentineldata/and runpython3 sentineldata.py username passwordusing the account credentials - The script will download und process the sentinel products, if any are available
- For training, navigate to
./crop-disease/and runpython3 crop-disease.py --weights=/path/to/weights.h5|coco|imagenet --dataset=../datasets train- coco and imagenet will download pre-trained weights - For detection
python3 crop-disease.py --weights=/path/to/weights.h5|coco|imagenet --image=path/to/ndvi/image.tif detect-- WIP -- It's still in development and paths were hard coded.