This model is a fine-tuned version of Mask2Former for semantic segmentation of satellite/aerial imagery.
| Metric | Value |
|---|---|
| Best mIoU | 0.5202 |
| Validation Loss | 44.21 |
| Training Epochs | 17 |
This model classifies pixels into 9 land cover categories:
| ID | Class |
|---|---|
| 0 | Background |
| 1 | Bareland |
| 2 | Grass |
| 3 | Pavement |
| 4 | Road |
| 5 | Tree |
| 6 | Water |
| 7 | Cropland |
| 8 | Building |
from transformers import Mask2FormerForUniversalSegmentation, Mask2FormerImageProcessor
from PIL import Image
import torch
# Load model and processor
model = Mask2FormerForUniversalSegmentation.from_pretrained("mfaytin/mask2former-satellite")
processor = Mask2FormerImageProcessor.from_pretrained("mfaytin/mask2former-satellite")
# Load and preprocess image
image = Image.open("satellite_image.tif").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
# Run inference
with torch.no_grad():
outputs = model(**inputs)
# Post-process to get segmentation map
segmentation = processor.post_process_semantic_segmentation(
outputs,
target_sizes=[image.size[::-1]] # (height, width)
)[0]
# segmentation is a tensor of shape (H, W) with class IDs
print(f"Segmentation shape: {segmentation.shape}")
print(f"Unique classes: {torch.unique(segmentation).tolist()}")
CLASS_LABELS = {
0: "Background",
1: "Bareland",
2: "Grass",
3: "Pavement",
4: "Road",
5: "Tree",
6: "Water",
7: "Cropland",
8: "Building",
}
This model is intended for:
If you use this model, please cite the OpenEarthMap dataset:
@inproceedings{xia2023openearthmap,
title={OpenEarthMap: A Benchmark Dataset for Global High-Resolution Land Cover Mapping},
author={Xia, Junshi and others},
booktitle={WACV},
year={2023}
}
4 commits
This model is a fine-tuned version of Mask2Former for semantic segmentation of satellite/aerial imagery.
| Metric | Value |
|---|---|
| Best mIoU | 0.5202 |
| Validation Loss | 44.21 |
| Training Epochs | 17 |
This model classifies pixels into 9 land cover categories:
| ID | Class |
|---|---|
| 0 | Background |
| 1 | Bareland |
| 2 | Grass |
| 3 | Pavement |
| 4 | Road |
| 5 | Tree |
| 6 | Water |
| 7 | Cropland |
| 8 | Building |
from transformers import Mask2FormerForUniversalSegmentation, Mask2FormerImageProcessor
from PIL import Image
import torch
# Load model and processor
model = Mask2FormerForUniversalSegmentation.from_pretrained("mfaytin/mask2former-satellite")
processor = Mask2FormerImageProcessor.from_pretrained("mfaytin/mask2former-satellite")
# Load and preprocess image
image = Image.open("satellite_image.tif").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
# Run inference
with torch.no_grad():
outputs = model(**inputs)
# Post-process to get segmentation map
segmentation = processor.post_process_semantic_segmentation(
outputs,
target_sizes=[image.size[::-1]] # (height, width)
)[0]
# segmentation is a tensor of shape (H, W) with class IDs
print(f"Segmentation shape: {segmentation.shape}")
print(f"Unique classes: {torch.unique(segmentation).tolist()}")
CLASS_LABELS = {
0: "Background",
1: "Bareland",
2: "Grass",
3: "Pavement",
4: "Road",
5: "Tree",
6: "Water",
7: "Cropland",
8: "Building",
}
This model is intended for:
If you use this model, please cite the OpenEarthMap dataset:
@inproceedings{xia2023openearthmap,
title={OpenEarthMap: A Benchmark Dataset for Global High-Resolution Land Cover Mapping},
author={Xia, Junshi and others},
booktitle={WACV},
year={2023}
}
4 commits