MaskRCNN prediction for LROC NAC images
Dependencies:
-
For running
split_image_to_png.py
, please install GDAL. (The code was run in GDAL version is 3.0.4) -
For running
predict_lroc.py
, please install NumPy, PyTorch, TorchVision and Pillow.
Models:
Download the model from Google Drive and save it in the models folder.
How to Run:
-
python3 split_image_to_png.py
will split NAC_ROI_ALPHNSUSLOA_E129S3581_cropped.tif into 5 350x350 images and store them in predict_images directory. -
python3 predict_lroc.py
will predict on the images inside predict_images directory and output the corresponding PNG masks in predicted_masks folder.
Example output:
Convert the predictions to polygons:
gdal_polygonize.py predicted_masks/tile_350_0.png predicted_masks/tile_350_0.geojson -b 1 -f "GeoJSON" out DN
To create output prediction for input tif:
-
Copy all the *.xml files in
predict_images
topredicted_masks
, and do a gdal_merge.gdal_merge.py -o NAC_ROI_ALPHNSUSLOA_E129S3581_predictions.tif predicted_masks/*.png