File size: 1,727 Bytes
9ced120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ca61d1
9ced120
4e2d31d
4cc224e
9ced120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
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
---
license: mit
pipeline_tag: image-segmentation
library_name: pytorch
tags:
  - segformer
  - mit-b4
  - transformer
  - segmentation-models-pytorch
  - timm
  - pytorch
  - remote-sensing
  - sentinel-2
  - rgb
  - cloud-detection
datasets:
  - "isp-uv-es/CloudSEN12Plus"
---

# Cloud Detection — SegFormer (MiT-B4 encoder, RGB)

**Repository:** `Burdenthrive/cloud-detection-segformer-mit-b4`  
**Task:** Multiclass semantic segmentation (4 classes) on **Sentinel‑2 L1C RGB** (3 bands) using **SegFormer** (`segmentation_models_pytorch`) with **MiT‑B4** encoder.

This model predicts per‑pixel labels among: **clear**, **thick cloud**, **thin cloud**, **cloud shadow**.

---

## ✨ Highlights

- **Input:** Sentinel‑2 L1C RGB tiles/patches (float32, shape `B×3×512×512`, bands **B04‑B03‑B02**).  
- **Backbone:** `mit_b4` (MiT encoder via `segmentation_models_pytorch`).  
- **Output:** Logits `B×4×512×512` (apply softmax + argmax).  
- **Files:** `model.py`, `config.json`, and weights.

---

## 📦 Files

- `model.py` — defines the `SegFormer` class (wrapper around `smp.Segformer`).
- `config.json` — hyperparameters and class names:
  ```json
  {
    "task": "image-segmentation",
    "model_name": "segformer-mit-b4",
    "model_kwargs": {
      "encoder_name": "mit_b4",
      "encoder_weights": "imagenet",
      "in_channels": 3,
      "num_classes": 4,
      "freeze_encoder": false
    },
    "classes": ["clear", "thick cloud", "thin cloud", "cloud shadow"],
    "id2label": { "0": "clear", "1": "thick cloud", "2": "thin cloud", "3": "cloud shadow" },
    "label2id": { "clear": 0, "thick cloud": 1, "thin cloud": 2, "cloud shadow": 3 },
    "input_bands": ["B04", "B03", "B02"]
  }