Unlock the full potential of AI with Building LLMs for Production—our 470+ page guide to mastering LLMs with practical projects and expert insights!

Publication

Deciding What Algorithm to Use for Earth Observation.
Latest   Machine Learning

Deciding What Algorithm to Use for Earth Observation.

Last Updated on June 23, 2024 by Editorial Team

Author(s): Stephen Chege-Tierra Insights

Originally published on Towards AI.

Deciding What Algorithm to Use for Earth Observation.

Created by the author with DALL E-3

What to choose, what to choose, should you unleash your inner child and do the classic eenie meenie miney mo, inky picky ponky father had a donkey, flip a coin, go with your intuition or base your decision on research and analysis by reading this article? This is such a difficult choice but not for long.

Picking the best algorithm is usually tricky or even frustrating. Especially if you do not know what you are looking for, you might utilize an algorithm and get an undesirable outcome, which in turn will take you back to square one.

In this article, I will show you what algorithm to use for each purpose and attain the desirable outcome you want without spending time going through each algorithm trying to figure out which one you want. This will save you a lot of time and resources. With the right guidance, selecting the most suitable algorithm will become straightforward and efficient.

I introduced machine learning and earth observation in my previous post and I want to continue writing on this topic until I have covered all angles as it is a broad analytical and in-depth topic that is rapidly changing

Why Selecting the Right Algorithm is important

Selecting the right algorithm for Earth observation ensures accuracy, efficiency, and relevance in data analysis. It guarantees reliable information, essential for applications like disaster management and environmental monitoring while optimizing processing time and resource use. Tailoring the algorithm to the specific data type and application enhances performance and interpretability, facilitating clear communication and informed decision-making.

Moreover, a scalable and adaptable algorithm remains effective with evolving data sources and large datasets, reducing the risk of misinterpretation and potential consequences. Thus, the right algorithm significantly impacts the success and reliability of Earth observation projects.

How to determine the right algorithm

1. Type of Data

What type of data are you dealing with is crucial in determining which algorithm you will utilize, the types of data include:-

· Satellite Imagery

Satellite imagery refers to the use of high-resolution images taken from satellites to provide quantitative and qualitative data. Satellite imagery is an important tool for visualizing ground situations. Whether you need a foundational map for an app or a comprehensive dataset for business intelligence.

· Lidar

Lidar or Light Detection and Ranging is a remote sensing method used to detect the surface of the Earth. It “sees” the world in three dimensions using eye-safe laser beams, giving computers and other devices an accurate representation of the examined area.

· Remote Sensing Data

Remote sensors collect data by detecting the energy that is reflected from Earth. These sensors can be on satellites or mounted on aircraft. Remote sensors can be either passive or active and can include thermal, acoustic, and other sensor data.

2. Application

What is the algorithm going to achieve, and what the main objective is, this will be very important to determine which one to use

· Land Cover Classification

Land cover classification is what covers the surface of the earth and land use describes how the land is used. Examples of land cover classes include water, snow, grassland, deciduous forest, and bare soil.

– Supervised Classification: Requires labeled training data.

– Algorithms: Support Vector Machines (SVM), Random Forest, Neural Networks.

– Use Cases: Land cover classification, urban planning.

– Unsupervised Classification: This does not require labeled training data.

– Algorithms: K-means Clustering, ISODATA.

  • Use Cases: Initial data exploration, finding natural clusters in data.

Land classification script using unsupervised K-means

// Define the area of interest (AOI)
var aoi = ee.Geometry.Rectangle([xmin, ymin, xmax, ymax]);

// Load Landsat imagery collection
var landsat = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('YYYY-MM-DD', 'YYYY-MM-DD')
.filterBounds(aoi)
.median()
.clip(aoi);

// Define visualization parameters
var visParams = {
bands: ['B4', 'B3', 'B2'],
min: 0,
max: 3000,
gamma: 1.4
};

// Display the image
Map.centerObject(aoi, 10);
Map.addLayer(landsat, visParams, 'Landsat Image');

// Select bands for clustering
var bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7'];

// Prepare the input data for clustering
var input = landsat.select(bands);

// Number of clusters
var numClusters = 5;

// Perform K-means clustering
var training = input.sample({
region: aoi,
scale: 30,
numPixels: 5000
});

var clusterer = ee.Clusterer.wekaKMeans(numClusters).train(training);

// Cluster the input using the trained clusterer
var result = input.cluster(clusterer);

// Define the color palette for visualization
var palette = [
'0000FF', // Cluster 0
'FF0000', // Cluster 1
'00FF00', // Cluster 2
'FFFF00', // Cluster 3
'808080' // Cluster 4
];

// Add the clustered layer to the map
Map.addLayer(result, {min: 0, max: numClusters - 1, palette: palette}, 'K-means Clustering');

// Export the results
Export.image.toDrive({
image: result,
description: 'Land_Cover_Clustering',
scale: 30,
region: aoi,
fileFormat: 'GeoTIFF'
});

· Change Detection

Change detection is a process that measures how the characteristics of a specific area have changed between two or more time phases. Change detection procedures in remote sensing and GIS are based on finding differences in two satellite images before and after a certain event.

– Pixel-Based Methods: Compare pixel values between different periods.

– Algorithms: Image Differencing, Change Vector Analysis.

– Use Cases: Deforestation, urban expansion, disaster impact assessment.

– Object-Based Methods: Use segmentation to analyze changes in specific objects or areas.

– Algorithms: Object-Based Image Analysis (OBIA).

  • Use Cases: Urban change detection, habitat monitoring.

code using random forest

// Define the area of interest (AOI)
var aoi = ee.Geometry.Rectangle([xmin, ymin, xmax, ymax]);

// Load Landsat imagery collections for two time periods
var landsat1 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('YYYY-MM-DD', 'YYYY-MM-DD')
.filterBounds(aoi)
.median()
.clip(aoi);

var landsat2 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('YYYY-MM-DD', 'YYYY-MM-DD')
.filterBounds(aoi)
.median()
.clip(aoi);

// Define visualization parameters
var visParams = {
bands: ['B4', 'B3', 'B2'],
min: 0,
max: 3000,
gamma: 1.4
};

// Display the images
Map.centerObject(aoi, 10);
Map.addLayer(landsat1, visParams, 'Landsat Image 1');
Map.addLayer(landsat2, visParams, 'Landsat Image 2');

// Compute Normalized Difference Vegetation Index (NDVI) for both images
var ndvi1 = landsat1.normalizedDifference(['B5', 'B4']).rename('NDVI1');
var ndvi2 = landsat2.normalizedDifference(['B5', 'B4']).rename('NDVI2');

// Calculate the change in NDVI
var ndviChange = ndvi2.subtract(ndvi1).rename('NDVI_Change');

// Add NDVI change layer to the map
Map.addLayer(ndviChange, {min: -1, max: 1, palette: ['red', 'white', 'green']}, 'NDVI Change');

// Create a feature collection for training data
var trainingPoints = ee.FeatureCollection([
// Add training points with known change/no-change labels
ee.Feature(ee.Geometry.Point([x1, y1]), {'class': 0}), // No change
ee.Feature(ee.Geometry.Point([x2, y2]), {'class': 1}), // Change
// Add more points as needed
]);

// Sample the input imagery at the locations of the training points
var training = ndviChange.sampleRegions({
collection: trainingPoints,
properties: ['class'],
scale: 30
});

// Train a Random Forest classifier
var classifier = ee.Classifier.smileRandomForest(50).train({
features: training,
classProperty: 'class',
inputProperties: ['NDVI_Change']
});

// Classify the change image
var classified = ndviChange.classify(classifier);

// Add the classified layer to the map
Map.addLayer(classified, {min: 0, max: 1, palette: ['white', 'black']}, 'Change Detection');

// Export the results
Export.image.toDrive({
image: classified,
description: 'Forest_Change_Detection',
scale: 30,
region: aoi,
fileFormat: 'GeoTIFF'
});

· Object Detection.

Object detection is a part of computer visioning that can be used to find occurrences of objects in pictures or movies. To generate useful findings, object detection algorithms usually make use of machine learning or deep learning.

Deep Learning Methods: Require large amounts of labeled data and significant computational resources.

– Algorithms: Convolutional Neural Networks (CNN), YOLO (You Only Look Once), Faster R-CNN.

– Use Cases: Detecting buildings, vehicles, and infrastructure damage.

· Vegetation Index Calculation

A Vegetation Index calculation is a sum of values derived from the transformation of measurements from several spectral bands. It is employed to accentuate the presence of green, vegetative elements and so aid in their differentiation from other objects in the picture.

Normalized Difference Vegetation Index (NDVI): A simple graphical indicator to assess whether the target area contains live green vegetation.

– Use Cases: Crop monitoring, drought assessment.

– Enhanced Vegetation Index (EVI): Adjusts for canopy background signals and atmospheric conditions.

  • Use Cases: Detailed vegetation analysis, and forest monitoring.
// Define the area of interest (AOI)
var aoi = ee.Geometry.Rectangle([xmin, ymin, xmax, ymax]);

// Load Landsat 8 imagery
var landsat = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('YYYY-MM-DD', 'YYYY-MM-DD')
.filterBounds(aoi)
.median()
.clip(aoi);

// Calculate NDVI
var ndvi = landsat.normalizedDifference(['B5', 'B4']).rename('NDVI');

// Define visualization parameters
var ndviParams = {min: -1, max: 1, palette: ['blue', 'white', 'green']};

// Add NDVI layer to the map
Map.centerObject(aoi, 10);
Map.addLayer(ndvi, ndviParams, 'NDVI');

// Export NDVI image
Export.image.toDrive({
image: ndvi,
description: 'NDVI',
scale: 30,
region: aoi,
fileFormat: 'GeoTIFF'
});

3 Taking other factors into Account

-Data Availability and Quality: In general, better outcomes come from data with higher resolution and higher quality.

-Computer Resources: A considerable amount of computer power is needed for certain algorithms, especially deep learning techniques.

– Expertise: Some techniques could call for specific knowledge or instruction.

– Correctness and Validation: To evaluate the correctness of the selected approach, make sure it is validated against ground truth data.

– Pre-processing: This includes noise reduction, geometric correction, and atmospheric correction, among other things.

– Post-processing: This may include result visualization, accuracy evaluation, and data fusion.

Conclusion

This is just the first part of my continuous series on machine learning and earth observation, in my next topic, I will cover object detection and land cover in detail, plus delve into tips and tricks on how you can get started with earth observation for beginners. This will be very useful if you want to learn AI or deep learning for remote sensing. Stay tuned to my next post.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓