This repo contains the segmentation model for classifying aquaculture into 3 types: intensive, extensive, and abandoned.
This project is developed under a CCAI 2022 grant for scaling out Climate Smart Shrimp in Indonesia and the Philippines.
Example model predictions in Indonesia below. Blue polygons are intensive ponds, and green polygons are extensive ponds.
The main output of the project is a web map of Indonesia and the Philippines showing the suitability of aquaculture sites according to a site suitability criteria for Conservation International’s (CI) Climate Smart Shrimp program.
The classified aquaculture dataset is a key component of the site suitability criteria.
- Extensive ponds are good candidates for the CSS program because extensive ponds can be intensified sustainably.
- Abandoned ponds are good candidates because they can be sites for mangrove restoration.
- While intensive ponds themselves are not suitable for CSS, having intensive ponds nearby is an indicator that the area is amenable to intensification.
The underlying data behind the web map is available here. These include other criteria that were derived from open datasets.
The datasets and model are available here
We've uploaded the model, the training data, and rollout data.
model.zip
contains the Pytorch Lightning model checkpoint of the trained modeltraining_data.zip
contains TIFF files of the training images and raster masks.- It also contains a geopackage (
training_polygons.gpkg
) of the training polygons that were rasterized into masks - A lookup table
cloud_cover.csv
is provided to filter out annotated images in the training set that are covered in clouds based on NICFI satellite imagery.
- It also contains a geopackage (
rollout_data.zip
contains TIFF files of images across Indonesia and the Philippines for aquaculture segmentation.- It also contains a geopackage (
pred_polygons.gpkg
) of the predicted aquaculture polygons.
- It also contains a geopackage (
The training data includes satellite imagery from Planet Labs Inc under NICFI (Norway’s International Climate and Forests Initiative). Therefore, downloading and using the training data, the model, or the rollout data is subject to the terms of the license linked here. The license's main requirement is attribution.
- Download and unzip the model and training data
- Place in the appropriate directories. For contents of
model.zip
inmodel
, and the contents oftraining_data
indata
.
- Place in the appropriate directories. For contents of
- Set up the config file
config/pond_config.yaml
- Run the notebooks in the
notebooks
directory in order. These notebooks train a Pytorch Lightning semantic segmentation model based on the data and config.- Inspect the data using the
01
notebook. - Train the model itself using the
02
notebook. - Test model inference on the training data with the
03
notebook. - Visualize the model predictions with the
04
notebook.- Note: If you'll use the NICFI Basemap to visualize, you'll need to sign up for a NICFI account and get an API key
- Inspect the data using the
- Download and unzip the model and training data
- Place in the appropriate directories. For contents of
model.zip
inmodel
, and the contents ofrollout_data
indata
.
- Place in the appropriate directories. For contents of
- Set up the config file
config/rollout_pond_config.yaml
- Run the notebooks in the
notebooks_rollout
directory in order.- Inspect the data using the
01
notebook. - Perform model inference using the
02
notebook. - Visualize the model predictions with the
03
notebook.- Note: If you'll use the NICFI Basemap to visualize, you'll need to sign up for a NICFI account and get an API key
- Inspect the data using the
This repo assumes the use of conda for simplicity in installing GDAL.
- Python 3.9
- make
- conda
Run this the very first time you are setting-up the project on a machine to set-up a local Python environment for this project.
- Install miniconda for your environment if you don't have it yet.
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
- Create a local conda env and activate it. This will create a conda env folder in your project directory.
make conda-env
conda activate aquafarm-segmentation
- Run the one-time set-up make command.
make setup
Over the course of development, you will likely introduce new library dependencies. This repo uses pip-tools to manage the python dependencies.
There are two main files involved:
requirements.in
- contains high level requirements; this is what we should edit when adding/removing librariesrequirements.txt
- contains exact list of python libraries (including depdenencies of the main libraries) your environment needs to follow to run the repo code; compiled fromrequirements.in
When you add new python libs, please do the ff:
-
Add the library to the
requirements.in
file. You may optionally pin the version if you need a particular version of the library. -
Run
make requirements
to compile a new version of therequirements.txt
file and update your python env. -
Commit both the
requirements.in
andrequirements.txt
files.
Note: When you are the one updating your python env to follow library changes from other devs (reflected through an updated requirements.txt
file), simply run pip-sync requirements.txt
This project was funded by the Climate Change AI Innovation Grants program, hosted by Climate Change AI with the support of the Quadrature Climate Foundation, Schmidt Futures, and the Canada Hub of Future Earth.