Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,199 +1,130 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
library_name: transformers
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
#
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
|
|
|
| 1 |
---
|
| 2 |
+
datasets:
|
| 3 |
+
- OpenEarthMap
|
| 4 |
+
language: en
|
| 5 |
library_name: transformers
|
| 6 |
+
license: mit
|
| 7 |
+
metrics:
|
| 8 |
+
- name: mIoU
|
| 9 |
+
type: mean_iou
|
| 10 |
+
value: 0.5202420374155045
|
| 11 |
+
pipeline_tag: image-segmentation
|
| 12 |
+
tags:
|
| 13 |
+
- semantic-segmentation
|
| 14 |
+
- earth-observation
|
| 15 |
+
- satellite-imagery
|
| 16 |
+
- land-cover
|
| 17 |
+
- openearthmap
|
| 18 |
+
- mask2former
|
| 19 |
+
- remote-sensing
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# Mask2Former for Satellite Image Segmentation
|
| 23 |
|
| 24 |
+
This model is a fine-tuned version of [Mask2Former](https://huggingface.co/facebook/mask2former-swin-base-ade-semantic) for semantic segmentation of satellite/aerial imagery.
|
| 25 |
|
| 26 |
+
## Model Description
|
| 27 |
|
| 28 |
+
- **Architecture**: Mask2Former with Swin Transformer backbone
|
| 29 |
+
- **Task**: Semantic Segmentation (Land Cover Classification)
|
| 30 |
+
- **Dataset**: [OpenEarthMap](https://open-earth-map.org/)
|
| 31 |
+
- **Fine-tuned from**: facebook/mask2former-swin-base-ade-semantic
|
| 32 |
+
|
| 33 |
+
## Training Results
|
| 34 |
+
|
| 35 |
+
| Metric | Value |
|
| 36 |
+
|--------|-------|
|
| 37 |
+
| **Best mIoU** | 0.5202 |
|
| 38 |
+
| **Validation Loss** | 44.21 |
|
| 39 |
+
| **Training Epochs** | 17 |
|
| 40 |
+
|
| 41 |
+
## Classes
|
| 42 |
+
|
| 43 |
+
This model classifies pixels into 9 land cover categories:
|
| 44 |
+
|
| 45 |
+
| ID | Class |
|
| 46 |
+
|----|-------|
|
| 47 |
+
| 0 | Background |
|
| 48 |
+
| 1 | Bareland |
|
| 49 |
+
| 2 | Grass |
|
| 50 |
+
| 3 | Pavement |
|
| 51 |
+
| 4 | Road |
|
| 52 |
+
| 5 | Tree |
|
| 53 |
+
| 6 | Water |
|
| 54 |
+
| 7 | Cropland |
|
| 55 |
+
| 8 | Building |
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
## Usage
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
from transformers import Mask2FormerForUniversalSegmentation, Mask2FormerImageProcessor
|
| 62 |
+
from PIL import Image
|
| 63 |
+
import torch
|
| 64 |
+
|
| 65 |
+
# Load model and processor
|
| 66 |
+
model = Mask2FormerForUniversalSegmentation.from_pretrained("mfaytin/mask2former-satellite")
|
| 67 |
+
processor = Mask2FormerImageProcessor.from_pretrained("mfaytin/mask2former-satellite")
|
| 68 |
+
|
| 69 |
+
# Load and preprocess image
|
| 70 |
+
image = Image.open("satellite_image.tif").convert("RGB")
|
| 71 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 72 |
+
|
| 73 |
+
# Run inference
|
| 74 |
+
with torch.no_grad():
|
| 75 |
+
outputs = model(**inputs)
|
| 76 |
+
|
| 77 |
+
# Post-process to get segmentation map
|
| 78 |
+
segmentation = processor.post_process_semantic_segmentation(
|
| 79 |
+
outputs,
|
| 80 |
+
target_sizes=[image.size[::-1]] # (height, width)
|
| 81 |
+
)[0]
|
| 82 |
+
|
| 83 |
+
# segmentation is a tensor of shape (H, W) with class IDs
|
| 84 |
+
print(f"Segmentation shape: {segmentation.shape}")
|
| 85 |
+
print(f"Unique classes: {torch.unique(segmentation).tolist()}")
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## Class Labels Mapping
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
CLASS_LABELS = {
|
| 92 |
+
0: "Background",
|
| 93 |
+
1: "Bareland",
|
| 94 |
+
2: "Grass",
|
| 95 |
+
3: "Pavement",
|
| 96 |
+
4: "Road",
|
| 97 |
+
5: "Tree",
|
| 98 |
+
6: "Water",
|
| 99 |
+
7: "Cropland",
|
| 100 |
+
8: "Building",
|
| 101 |
+
}
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## Intended Use
|
| 105 |
+
|
| 106 |
+
This model is intended for:
|
| 107 |
+
- Land cover classification from satellite/aerial imagery
|
| 108 |
+
- Urban planning and environmental monitoring
|
| 109 |
+
- Geographic information system (GIS) applications
|
| 110 |
+
- Remote sensing research
|
| 111 |
+
|
| 112 |
+
## Limitations
|
| 113 |
+
|
| 114 |
+
- **Geographic Bias**: Trained primarily on imagery from specific regions in the OpenEarthMap dataset
|
| 115 |
+
- **Resolution Sensitivity**: Best performance on imagery similar to training data resolution
|
| 116 |
+
- **Imagery Source**: May require fine-tuning for different satellite sensors or aerial platforms
|
| 117 |
+
- **Seasonal Variation**: Performance may vary across different seasons or weather conditions
|
| 118 |
+
|
| 119 |
+
## Citation
|
| 120 |
+
|
| 121 |
+
If you use this model, please cite the OpenEarthMap dataset:
|
| 122 |
+
|
| 123 |
+
```bibtex
|
| 124 |
+
@inproceedings{xia2023openearthmap,
|
| 125 |
+
title={OpenEarthMap: A Benchmark Dataset for Global High-Resolution Land Cover Mapping},
|
| 126 |
+
author={Xia, Junshi and others},
|
| 127 |
+
booktitle={WACV},
|
| 128 |
+
year={2023}
|
| 129 |
+
}
|
| 130 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|