Deep learning enables satellite-based monitoring of large populations of terrestrial mammals across heterogeneous landscapes
This repository contains the neural network model (UNet) pipeline and other essential codes for detecting wildebeest and zebras in Serengeti-Mara ecosystem from very-high-resolution satellite imagery. Please feel free to contact me at zijingwu97@outlook.com if you have any questions.
Link to the paper: https://www.nature.com/articles/s41467-023-38901-y or https://rdcu.be/dc8bU
The most easy way to test and use this code is to upload all the files to Google Drive and open the notebooks with Google Colaboratory (https://colab.research.google.com/). Alternatively, you can install the required packages (see requirements.txt) on your computer and open the notebooks with Jupyter Notebook. Note: if you use Google Colaboratory, you may encounter some issues about deprecated arguments/functions because Colaboratory keeps updating the packages and the latest packages may not be exactly the same as the ones used in the code here. The issues are usually easy to solve though, so don't hesitate and just give it a try!
the necessary modules to run the code.
the sample dataset required to test the code.
sample dataset for data preparation: coverting the wildebeest annotations to segmentation masks.
a sample training/test dataset of year 2009 for model training/testing.
a sample training and test dataset. Note that we cannot share the samples of satellite images because the satellite images were acquired by the Smithsonian Conservation Biology Institute and the United States Army Research Laboratory under a NextView Imagery End User License Agreement. The copyright remains with Maxar Technologies (formally DigitalGlobe), and redistribution is not possible.
a sample satellite image. We have removed the image here because the satellite images were acquired by the Smithsonian Conservation Biology Institute and the United States Army Research Laboratory under a NextView Imagery End User License Agreement. The copyright remains with Maxar Technologies (formally DigitalGlobe), and redistribution is not possible.
the folder to save temporary weight files while running the code.
the folder to save weight files that are generated during model training.
the folder to save the training records for the use of tensorboard.
the folder to save the weights for sensitivity analysis.
the pretrained weights for wildebeest detection. The weights are not stored here because of file size limit. Please contact zijingwu97@outlook.com to request the data.
the notebook for preprocessing the data.
the notebook for model training.
the notebook for detecting and counting the wildebeest on the image with the trained model.
required libraries and packages to run the notebooks.
The data has two main components, the satellite images and the label of animals in those images (in the shapefile). The SampleData/1_Data_preparation directory contains examples of the satellite image and the annotations. The notebook convert the annotations to image mask that will be fed into the U-Net model.
Remember to configure the Data path of the training images and masks as well as the test image and masks. Train the UNet model with the images and labelled masks. A sample dataset is stored in SampleData/data_2009Aug/3_Train_test. Modify the number of channels according to your data type (R G B bands or multiple bands).
Use the trained model to detect the animals on the images and count the animals. Make sure that the RAM is sufficient to run the code. A sample satellite image is stored in SampleData/data_2009Aug/classify..