Mapping Mangrove Growth and Deforestation with Satellite Imagery

For my final Metis data science boot camp project, I knew I wanted to get some experience using neural networks on image data. After going back and forth on all sorts of ideas (who doesn’t when they are trying to come up with an interesting, but do-able, project?), I ultimately landed on classifying mangrove forests using satellite imagery.

Mangrove Forests

Satellite Monitoring

Google Earth Engine (GEE) is a powerful tool that allows free access to a wealth of satellite imagery. Given the time constraints (about 3 weeks) and having no prior knowledge of the subject or satellite data, this was a perfect resource for my project. GEE has a straightforward API for accessing said satellite imagery and outputting information and images of interest. Specifically, I was able to locate a map of mangrove forests for the world in the year 2000 developed by C. Giri et al. By using satellite images from the year 2000 and cross-referencing them with the mangrove map, I could train a classifier to recognize mangrove forested areas. I could then take satellite images from more recent years such as 2020, and apply my trained model in order to track the level of deforestation and growth.

I decided to focus on one area of interest, that being the Florida coastline. There are over 60 mangrove species around the world with different physical characteristics. In my exploratory data analysis phase of the project, I did test out including other locations such as places in Brazil and Cuba. In some instances, the trained model performed well, while in some instances it did not. I decided to restrict my project to a single region where the satellite image colors were consistent, and my project could be more focused.

The Data

From my research, I knew that the labeled mangrove map was built on Landsat 5 satellite data. Because I wanted to compare classification results from year 2000 satellite imagery to year 2020 satellite imagery, I knew I needed data that was current. Landsat 5 was decommissioned in 2013, so I was left with either choosing Landsat 7 or Landsat 8 data. I chose Landsat 7 data because it was active in the year 2000 and was still active in 2020. This gave me the ability to train a model using the same satellite system data as the data I would then later predict on.

Landsat 7 data has a resolution of 30 meters per pixel, and contains information in 8 different bands. These are the standard RGB bands, a near-infrared bed, 2 shortwave infrared bands, a thermal band, and a panchromatic band. (I decided to drop this last band since the resolution was 15 meters, and would complicate my analysis without adding much gain.) To be clear about my project now, I was going to do a pixel-wise classification of satellite imagery as mangrove forest or not, using these 7 bands as my features.

Satellite Image Compositing

But how to select which composited image each pixel should come from? If multiple satellite images contained the same pixel with no clouds in the way, then there is an issue of ambiguity. In the end, I selected the pixels which had the maximum NDVI values for each respective pixel. NDVI here stands for “normalized difference vegetation index,” and provides a standard measure for the amount of living green vegetation contained within a pixel. (Specifically, NDVI is calculated from the near-infrared and red bands.) Selecting on the maximum NDVI satisfied a dual purpose, in that it also allowed me to select those pixels corresponding to mangrove forests at the height of the growing season, and account for changing seasons and conditions. (This approach is nicely suited for gathering images worldwide as well, though I only focused on one region of interest.) The image below shows an RGB image of a part of the Florida coastline, overlaid with the NDVI band colored as green, then overlaid with the labeled mangrove forests from the aforementioned map. As you can see, the darkest green parts of the image correspond directly with the labeled mangrove forests.


For the classification model, I tested out two neural network models. I had a lot of help and took a lot of inspiration from two tutorials by P. Tripathy, here and here. They were a nice introduction to getting started with neural networks on satellite imagery.

The first model was a basic neural network with just two layers, and 14 nodes per layer. The input to this model was the information contained within a single pixel, ie. 7 numbers for the 7 different bands per pixel. This baseline model could almost certainly have been done with just a random forest classifier, but I wanted to get my feet wet with neural networks right off the bat, even if it was overkill.

The second model was a convolutional neural network, taking as input the pixel information in a 7x7 grid around the target pixel. This would help with the classification of the pixel at the center of the grid. For the model architecture I started with the code as given in one of the above-linked tutorials, and then tried out various alternatives to eke out a bit more precision and recall. I ultimately used two convolutional layers, several dropout layers, and a dense layer, as shown in the code block below. The dropout layers nicely prevented over-fitting, and no pooling layer was included because I was not trying to pick out a specific object from the image. (Since I’m still new to this, it may be true that pooling layers might still be useful for this use case.)

model = keras.Sequential()
model.add(Conv2D(32, kernel_size=3, padding=’valid’, activation=’relu’, input_shape=(7, 7, 7)))
model.add(Conv2D(48, kernel_size=3, padding=’valid’, activation=’relu’))
model.add(Dense(64, activation=’relu’))
model.add(Dense(2, activation=’softmax’))
model.compile(optimizer= ‘adam’, loss=’sparse_categorical_crossentropy’, metrics=[‘accuracy’, ‘recall’])

Training and Testing

The CNN results for the two separate images that I tested on can be seen in the two images below. In these images, the color gold stands for those pixels which were accurately classified by the model as being mangroves, blue as those which were accurately classified as non-mangroves, and then green and red for false positive and false negative classifications respectively. You can see that in general, the model does a pretty good job, though it isn’t perfect. One particular case where the model struggled was in inland areas where green land forests were misclassified as mangroves, or vice-versa with lighter colored mangroves.

Applied to 2020 Data


The approach detailed here can be a powerful tool to automate remote monitoring of these extraordinary and special habitats. Indeed there are groups who are working on this with far more advanced methods than what I’ve used here. Some particular articles and projects of note that I’ve run across (and learned a ton from) are:

- The Global Mangrove Watch web portal for tracking mangroves around the world
- The UK Hydrographic Office is doing machine learning with geo-generalizable models for various places around the globe
- The Forest Research Institute Malaysia is mapping mangroves in Malaysia
- GEEMMM: Google Earth Engine Mangrove Mapping Methodology project by T. Jones, funded by Blue Ventures Conservation

These are only a few of the resources out there and I’m sure I’ve missed some.

Future Work

If you have anything interesting to add, or just want to chat about the work I’ve done, please do not hesitate to contact me!

Data scientist with a PhD in particle physics.