--- 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"] }