Time Series and LSTMs for Pantanal Fires analysis

Joao Otavio Nascimento Firigato
6 min readMar 31, 2021

--

Fires in natural areas are one of the main environmental problems affecting different parts of the world. The Brazilian Pantanal, for example, suffered in 2020, one of the worst years in relation to the number of fires registered in the biome. Based on FIRMS data obtained through the Google Earth Engine, it shows that in 2020, until the month of November, approximately 60.000 fires were registered, well above the numbers registered in previous years.

In September 2020 alone, the number of wildfires registered by FIRMS was 28,000 in the 140000 km² belonging to Brazilian territory alone.

The graphs show the sad trend of increasing numbers. The increase in global temperature coupled with the inefficiency of the Brazilian government (or that is the purpose!) Raise the concern of everyone, not only in the Pantanal, but also the Amazon is probably worse off.

Fortunately, there are people and bodies that try to fight these factors in order to avoid the destruction of our biomes. A crucial tool for this is satellites and recently the artificial intelligence algorithms that contribute to environmental monitoring, reducing the response time of the front line and proposing preventions.

In this post I will present Deep Learning techniques for fire prediction, using satellite data. This will be just a demonstration of the possibilities that DL and satellite images together can do. A more real and reliable work must be structured based on a larger literature, because wildfires are complex events that depend on several variables.

Data

For this, we will use Monthly Time series of NDVI (Normalized Difference Vegetation Index), LAI (Leaf Area Index), LST (Land Surface Temperature) products from MODIS satellite, in addition to CHIRPS precipitation data, to predict the occurrence of fire outbreaks that were detected by These data will feed a neural network made up of LSTM cells that are useful in extracting temporal patterns.

LSTM

Long Short-Term Memory networks (usually short and long term memory), usually called simply “LSTMs”, are a special type of recurrent neural network, as they are capable of learning long-term connections. In this way, they have incredible predictive power and work very well on a wide range of problems, being widely used today.

The architecture of an LSTM, which we will see later, makes perfect sense from a biological point of view. When we look at the way the human brain works, we find that our memory can be divided into two types:

  • short-term memory, which acts when the information is being acquired, retains that information for a few seconds and then destines it to be kept for longer periods, or discards it.
  • long-term memory, which permanently retains information, allowing its recovery or recall. It contains all our autobiographical data and all our knowledge. Its capacity is practically unlimited.

To better understand how an LSTM works, follow this link:

Study Area

The study area was defined from a rectangle in the Pantanal, where 400 points were randomly selected. From these points, the monthly mean between 2014 and 2017 of the variables previously selected were obtained and transformed into CSV files.

Pre-processing

Before feeding the neural network, let’s do some preprocessing. FIRMS data, for example, shows NaN values where there was no fire outbreak and numerical values, representing where it occurred. Let’s turn this into a binary dataset, with 0s and 1s.

After pre-processing the labels, we verified that we have a very small number of fire in relation to no-fire. This leaves our problem unbalanced, which can decrease the efficiency of our neural network. As this is not the focus of this article, we will not try to use techniques that remove this imbalance. Let’s see where we can get.

LST data also shows NaN values. In order to avoid discrepancies, NaN values will be replaced by interpolated values. LAI data, on the other hand, show points without values in the time series, probably representing areas with water or buildings. We will exclude these points from the analysis.

So we can check the time series of the selected properties like the NDVI for each point:

Finally, we realize the separation between the training dataset and the test dataset and the data normalization with StandartScale, generating values between 0 and 1.

Training the NN

We will use keras to create our neural network. Looking at the data, we noticed that the format is SxTxF, where S = samples, T = time dimension, and F = features dimension.

Our first layer is an LSTM cell, followed by a dropout and batch_normalization layer. In the dense output layer, the sigmoid activation function classifies the values in probabilities for the two predefined classes.

Keras Layers

The chosen loss will be binary_crossentropy and the optimizer Adam. After 3000 training seasons, an accuracy of more than 98%. However, as our dataset is very unbalanced, this value is unrealistic. To obtain values more consistent with the reality of the data, we will use the classification report and the confusion matrix.

Classification Report
Confusion Matrix

When we looked at the new metrics, we saw that the model hit only a small part of the fires. To improve these results, the recommendation is to obtain more data and samples from locations where fire occurred, balancing the dataset and preventing the model from behaving in this way. Another possibility is to use a different approach, dealing with problems such as detecting anomalies or outliers and even using dataset balancing techniques.

For those who want to use the code and try to improve the result or apply other techniques follow the link on Google Colab:

Thanks!

Follow me on LinkedIn:

https://www.linkedin.com/in/jo%C3%A3o-otavio-firigato-4876b3aa/

--

--

No responses yet