Instructions to use rohitm9/ufo-segformer-b2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rohitm9/ufo-segformer-b2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="rohitm9/ufo-segformer-b2")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, SegformerForSemanticSegmentation processor = AutoImageProcessor.from_pretrained("rohitm9/ufo-segformer-b2") model = SegformerForSemanticSegmentation.from_pretrained("rohitm9/ufo-segformer-b2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
UFO SegFormer B2
Archived SegFormer B2 checkpoint supplied for the Urban Flood Observations (UFO) revision, together with verified binary prediction mosaics and their evaluation CSV. The checkpoint is provided in its original PyTorch format and as a standard Transformers model using safetensors.
Model and input contract
- Architecture: SegFormer B2; encoder depths
[3, 4, 6, 3]. - Decoder hidden dimension: 768.
- Input: three channels, confirmed by the first convolution's
[64, 3, 7, 7]weight shape. - Output: two classes,
0non-inundated and1surface water.
The original three-band selection, band order, input scaling and normalization were not included with the checkpoint. No image processor is supplied, and no RGB, ImageNet or four-band normalization is assumed. The four-band PlanetScope training pipeline in the linked GitHub repository is a separate input contract.
The checkpoint contains a state dictionary without the original training
configuration. Its configuration was reconstructed using the tensor shapes and
the NVIDIA B2 reference configuration.
Non-tensor architecture settings use that reference. Only the leading model.
wrapper prefix was removed when converting the weights.
Loading
import torch
import torch.nn.functional as F
from transformers import AutoModelForSemanticSegmentation
model = AutoModelForSemanticSegmentation.from_pretrained(
"rohitm9/ufo-segformer-b2"
).eval()
@torch.inference_mode()
def segment_prepared_tensor(pixel_values):
# Float tensor [batch, 3, height, width], prepared with the original
# training band selection/order and normalization.
if pixel_values.ndim != 4 or pixel_values.shape[1] != 3:
raise ValueError("Expected a prepared tensor with three input channels")
logits = model(pixel_values=pixel_values).logits
logits = F.interpolate(
logits, size=pixel_values.shape[-2:],
mode="bilinear", align_corners=False,
)
return logits.argmax(dim=1)
Confirm the original preprocessing before using the checkpoint on imagery. Loading and conversion were tested with Transformers 4.47.1 and PyTorch 2.6.0. All checkpoint tensors survived the safetensors round trip bit for bit. A small synthetic CPU forward pass produced finite, identical logits before and after conversion. These checks validate serialization and execution, not prediction accuracy or recovery of the original preprocessing.
Archived prediction evaluation
The supplied B2-named prediction ZIP contains 215 full-chip masks across 14 UFO events. Each mask is a single-band 1024 x 1024 GeoTIFF with values 0 and 1. The supplied CSV has 215 image rows, one overall mean row and one totals row.
Every filename and event matches the corresponding local UFO image and label.
Dimensions, coordinate reference systems and affine transforms match for all
215 pairs. Recomputed TP, FP, TN and FN match the CSV exactly for every image;
Precision, Recall, IoU, F1 and Accuracy agree within 1e-6.
| Water IoU aggregation | Score |
|---|---|
Mean of the 215 per-image IoUs (CSV OVERALL_MEAN) |
77.340578% |
| Pooled-pixel IoU | 85.081899% |
| Mean of the 14 event mean IoUs | 73.937440% |
These scores describe the archived prediction artifacts. Their linkage to this individual checkpoint has not been independently verified. Fold-specific checkpoint identities and training/test separation were not supplied with these artifacts, so this release does not certify that the single checkpoint reproduces the scores or the full leave-one-event-out experiment.
Total confusion counts: TP 74,159,184; FP 7,193,473; TN 138,281,723; FN 5,809,460.
Event counts: BEI 2, BNA 5, CMO 14, CTO 7, DKA 12, GIL 20, HTX 39, KTM 23, MID 4, NSW 27, PNE 13, QUE 12, SLC 6, SPS 31.
Files
| File | Contents |
|---|---|
config.json, model.safetensors |
Transformers checkpoint, three input channels |
segformer_b2_best.pt |
Original supplied state dictionary |
checkpoint_verification.json |
Architecture, loading and conversion checks |
release_manifest.json |
Source links, sizes and SHA-256 checksums |
evaluation/PS_256_localNorm_segformer_b2_Preds_ProcessedMosaics.zip |
215 binary prediction mosaics |
evaluation/PS_256_localNorm_segformer_b2_Evaluation_mosaics.csv |
Original evaluation CSV |
evaluation/matching_report.json |
Dataset matching and recomputed aggregate scores |
evaluation/per_image_verification.json |
Checks for each image |
Sources and license
- UFO code repository.
- UFO dataset, released under CC BY 4.0.
- Original checkpoint.
- Prediction ZIP.
- Evaluation CSV.
The supplied checkpoint did not specify a model-weights license. The dataset license should not be interpreted as a license for the model weights.
- Downloads last month
- 13