Downloads · 30 days
3
10% of all-time downloads
Masolele/WACAfricaModel
WACAfricaModel is a machine learning model from Masolele. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This document describes the land use model used for monitoring EUDR-related commodity crops using remote sensing.
Downloads · 30 days
3
10% of all-time downloads
All-time downloads
30
Public
Repo size
1.3 GB
Likes
0
Public
Click a slice to open those files.
.onnx459 MB · 100%
From the Hugging Face model README
This document describes the land use model used for monitoring EUDR-related commodity crops using remote sensing.
The model is an Attention U-Net with fusion mechanisms, specifically designed for land use monitoring using multi-source satellite data (Sentinel-1 and Sentinel-2)and geographic information (latitude, longitude, and elevation).
A standard computer with a minimum of 16GB RAM to support the in-memory operations.
Create and activate the virtual environment and install the package as follows: Approximate install time is 1 hour
mamba create -n tf214_py39 python=3.9 tensorflow=2.14.0 onnx tf2onnx ipykernel -c conda-forge -y && mamba activate tf214_py39 && python -m ipykernel install --user --name=tf214_py39 --display-name="TF 2.14 + ONNX"
Then install these packages as well:
mamba install earthengine-api geemap rasterio numpy matplotlib ipywidgets onnxruntime requests folium pyproj tqdm -q
Click the link below (Open In Colab) and follow the instructions to run the analysis interactively in Google Colab:
#The notebook allows you to:
🖼️ Draw or upload a Region of Interest (ROI) on an interactive map
🧠 Automatically selects AI model based on location (Africa, Southeast Asia, Latin America)
🛰️ Downloads and preprocesses Sentinel-1 + Sentinel-2 + elevation + indices
🌾 Predicts land use categories over deforested areas only using ONNX models
🗺️ Side-by-side map of RGB imagery + land use prediction
📤 Export predictions as GeoTIFF for GIS analysis
The model expects a single input tensor with the following specifications:
[1, 64, 64, 17]
The 17 input channels are organized as follows:
Sentinel-2 Bands (Channels 0-8):
Radar Data (Channels 9-10):
Geographical Information (Channels 11-13):
Additional Features (Channel 14):
[1, 64, 64, 22]
The model output is variable depending on the region. The model predicts 25, 22, and 24 land use types for Africa, Latin America, and Southeast Asia, respectively. Each pixel in the output contains a probability distribution over this class.
Example format for each pixel:
Africa
classes = [
# Land use classes
0: "Background", 1: "Other large-scale cropland", 2: "Pasture", 3:'Mining', 4:'Other small-scale cropland', 5:'Roads', 6:'Other land with tree cover/Regrowth', 7:'Plantation forest',
8:'Coffee', 9:'Build_up', 10:'Water', 11:'Oil_palm', 12:'Rubber', 13:'Cocoa', 14:'Avocado', 15:'Soy', 16:'Sugar', 17:'Maize', 18:'Banana', 19:'Pineapple',
20:'Rice', 21:'Wood_logging', 22:'Cashew', 23:'Tea', 24:'Others'
Latin America
classes = [
# Land use classes
0: "Background", 1: "Other large-scale cropland", 2: "Pasture", 3:'Mining', 4:'Other small-scale cropland', 5:'Roads', 6:'Other land with tree cover/Regrowth', 7:'Plantation forest',
8:'Coffee', 9:'Build_up', 10:'Water', 11:'Oil_palm', 12:'Rubber', 13:'Cocoa', 14:'Avocado', 15:'Soy', 16:'Sugar', 17:'Maize', 18:'Banana', 19:'Pineapple',
20:'Rice', 21:'Wood_logging'
Southeast Asia
classes = [
# Land use classes
0: "Background", 1: "Other large-scale cropland", 2: "Pasture", 3:'Mining', 4:'Other small-scale cropland', 5:'Roads', 6:'Other land with tree cover/Regrowth', 7:'Plantation forest',
8:'Coffee', 9:'Build_up', 10:'Water', 11:'Oil_palm', 12:'Rubber', 13:'Cocoa', 14:'Clove', 15:'Soy', 16:'Sugar', 17:'Maize', 18:'Banana', 19:'Pineapple',
20:'Rice', 21:'Wood_logging', 22:'Cashew', 23:'Tea'
]
import onnxruntime as ort
import numpy as np
# Load the ONNX model
session = ort.InferenceSession("Land_use_following_deforestation_model.onnx")
# Prepare input data (example)
input_data = np.random.rand(1, 64, 64, 17).astype(np.float32)
# Run inference
input_name = session.get_inputs()[0].name
output_name = session.get_outputs()[0].name
predictions = session.run([output_name], {input_name: input_data})[0]
# Get predicted class
predicted_classes = np.argmax(predictions, axis=-1)
The models are found at:
ONNX Model Description generated by [onnx.helper.printable_graph(onnx_model.graph)];
The model processes the 17 input channels by splitting them into three groups, each handled by a distinct pathway:
These pathways are fused together, with attention mechanisms emphasizing key regions, to produce a final segmentation map. This design is ideal for tasks where input channels represent diverse information, such as optical, radar satellite imagery and location information.
The model relies on several standard deep learning components for image processing:
Here’s a step-by-step walkthrough of how the model processes the input.
The input tensor [1, 64, 64, 17] is divided along the channel dimension into 15 tensors of shape [1, 64, 64, 1], then grouped as:
[1, 64, 64, 12].[1, 64, 64, 2].[1, 64, 64, 3].Each group follows a unique processing path.
[1, 64, 64, 3], transposed to [1, 3, 64, 64].[1, 512, 8, 8] through levels with 64, 128, 256, and 512 filters.[1, 64, 64, 64] with attention and skip connections.[1, 64, 64, 64] feature map.[1, 64, 64, 2], transposed to [1, 2, 64, 64].[1, 64, 64, 64], then max pooling to [1, 64, 32, 32].[1, 128, 32, 32], then max pooling to [1, 128, 16, 16].[1, 256, 16, 16], then max pooling to [1, 256, 8, 8].[1, 512, 8, 8].[1, 256, 16, 16], combined with encoder features via skip connection and attention, processed with conv layers.[1, 128, 32, 32], attention applied, concatenated, and conv layers.[1, 64, 64, 64], attention applied, concatenated, and conv layers.[1, 64, 64, 64] feature map.[1, 64, 64, 10], transposed to [1, 10, 64, 64].[1, 512, 8, 8] through levels with 64, 128, 256, and 512 filters.[1, 64, 64, 64] with attention and skip connections.[1, 64, 64, 64] feature map.[1, 256, 64, 64]) are combined into [1, 384, 64, 64] (64 + 64 + 256 = 384, though channel counts may vary).[1, 22, 64, 64].[1, 64, 64, 1], a segmentation map with 1 class per pixel.This architecture is tailored for:
The Land use following deforestation model combines three U-Nets
network to process a 17-channel, 64x64 input. Channels 0–11, 12–13 and 14 - 16
re handled by U-Nets for feature extraction, while channels 12–14 guide
attention via a dense network. The fused output becomes a 64x64 segmentation map with 1 class for each pixel.
This work is licensed under the Apache License 2.0 - please see the LICENSE file for details.
For questions or issues, please open an issue on GitHub
Masolele et al., 2026