Smart Forest Guard: Early detection of illegal mining using AI and satellite images

Gabriela Padilla
LatinXinAI
Published in
5 min readApr 7, 2024

As access to remote areas increases, the incidence of illegal mining has experienced a significant rise, posing a serious threat to biodiversity and the sustainability of our forest ecosystems and natural resources.

Negative Impact of illegal mining on ecosystems

The negative impacts of illegal mining on the environment are manifold and profound. One of the primary devastating effects is deforestation. For example, in the Democratic Republic of Congo, illegal mining is one of the causes of deforestation in the country. Similarly, in Guyana, illegal mining is responsible for nearly 85% of the loss of the Amazon rainforest.

Illegal Mining Podocarpus National Park

In Ecuador, illegal mining has devastated 25 hectares of forest in Podocarpus National Park, among others. Furthermore, illegal mining leads to the contamination of nearby water bodies, affecting aquatic ecosystems and the communities that depend on these natural resources for their survival. Another significant damage occurs in the habitat of endemic and endangered species. One of these species is the Amazon pink dolphin, which falls victim to poisoning due to river pollution.

The question is, how can AI be applied to effectively combat illegal mining in forests and thus contribute to the conservation of these ecosystems?

CNNs to detect illegal mining using satellite images

Main Steps

  1. Exploring the dataset: The dataset contained 8100 images, of which 80% were used for training and 20% for validation.
  2. Configuring and training the model: The model was built using TensorFlow. For the classification process, we used a CNN (Convolutional Neural Network).
  3. Making predictions: The model was saved as mining_detection_model.h5 and used in another file to make predictions on whether there is mining activity in the image or not.

Convolutional neural networks overview

A CNN works similarly to how a detective might investigate a crime scene. Just as a detective carefully examines different pieces of evidence, a CNN breaks down the image puzzle into smaller sections and analyzes them for specific features.

Here’s how it works:

  1. Puzzle Pieces (Pixels): In the image puzzle, each tiny piece represents a pixel, which contains information about color and intensity.
  2. Detective (CNN): The CNN acts as the detective, tasked with finding specific objects or patterns within the image.
  3. Evidence Examination (Convolutional Layers): Just as a detective might use magnifying glasses to examine evidence closely, a CNN uses convolutional layers to analyze small sections of the image puzzle. These layers detect features like edges, shapes, and textures.
  4. Detective’s Notebook (Feature Maps): As the detective uncovers important clues, they jot them down in their notebook. Similarly, CNNs create feature maps that highlight significant features found in the image, helping to identify patterns and objects.
  5. Solving the Case (Classification or Detection): Once the detective has gathered enough evidence and pieced together the puzzle, they can solve the case. Similarly, CNNs use the information from the feature maps to classify objects in the image (e.g., “cat,” “tree”) or detect specific patterns (e.g., “road,” “building”).

Model Configurations

model = tf.keras.Sequential([
tf.keras.layers.Rescaling(1./255, input_shape=(IMG_HEIGHT, IMG_WIDTH, 1)),
tf.keras.layers.Conv2D(16, 3, padding='same', activation='relu'),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Conv2D(32, 3, padding='same', activation='relu'),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Conv2D(64, 3, padding='same', activation='relu'),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(128, activation='relu'),
tf.keras.layers.Dense(len(CLASS_NAMES))
])
  • Rescaling Layer: Normalizes the input pixel values to the range [0, 1] by dividing each value by 255.
  • Conv2D Layer: Performs 2D convolution on the input, using 16 filters of size 3x3. ‘ReLu’ activation is applied after convolution.
  • MaxPooling2D Layer: Reduces the spatial resolution of the representation to decrease the number of parameters and calculations while retaining the most relevant features. A max-pooling operation is used here.
  • Conv2D Layer: Similar to the second layer, but with 32 filters of size 3x3.
  • MaxPooling2D Layer: Another max-pooling layer to further reduce spatial resolution.
  • Conv2D Layer: Similar to previous ones, but with 64 filters of size 3x3.
  • MaxPooling2D Layer: Once again, max-pooling is performed.
  • Flatten Layer: Flattens the representation into a vector to connect with fully connected (dense) layers.
  • Dense Layer: Contains 128 neurons with ‘ReLu’ activation function.
  • Dense Layer: This is the output layer with a number of neurons equal to the number of classes.

Results

Once the artificial intelligence model was trained to detect illegal mining in images, it achieved an accuracy of 97% when evaluated with the dataset used for validation.

Subsequently, some tests were made on satellite images using a set of 45 images. Smart Forest Guard interpreted whether there was mining activity or not in the analyzed forest areas, obtaining the correct response in approximately 96% of the tests conducted.

These are some of the results:

“Minería” means that the model detected mining activity and “No Minería” means the model didn’t detect mining.

Smart Forest Guard Impact

In the future, Smart Forest Guard could be implemented in various critical and vulnerable areas around the world, allowing for the establishment of an automated surveillance network that would continuously analyze satellite images of the region for signs of illegal mining.

Upon detecting suspicious activity, the system would send immediate alerts to authorities and conservation experts, facilitating a quick and effective response to address the situation.

You can check out the project code on this Github Repository.

Thank you for reading this! If you want to see more of my work, connect with me on LinkedIn!

LatinX in AI (LXAI) logo

Do you identify as Latinx and are working in artificial intelligence or know someone who is Latinx and is working in artificial intelligence?

Don’t forget to hit the 👏 below to help support our community — it means a lot!

--

--