Views
No views yet
modeling_decur.py, processor, pipeline) and loads with trust_remote_code=True.| Folder | Backbone | Modality | Channels | RDA |
|---|---|---|---|---|
decur-resnet50-s1 | ResNet-50 | Sentinel-1 SAR | 2 | no |
decur-resnet50-s2c | ResNet-50 | Sentinel-2 L1C | 13 | no |
decur-resnet50-rda-s1 | ResNet-50 + RDA | Sentinel-1 SAR | 2 | yes |
decur-resnet50-rda-s2c | ResNet-50 + RDA | Sentinel-2 L1C | 13 | yes |
decur-vit-small-patch16-s1 | ViT-S/16 | Sentinel-1 SAR | 2 | no |
decur-vit-small-patch16-s2c | ViT-S/16 | Sentinel-2 L1C | 13 | no |
decur-resnet50-rgb | ResNet-50 | GeoNRW RGB | 3 | no |
decur-resnet50-dem | ResNet-50 | GeoNRW DEM | 3 | no |
decur-resnet50-rda-rgb | ResNet-50 + RDA | GeoNRW RGB | 3 | yes |
decur-resnet50-rda-dem | ResNet-50 + RDA | GeoNRW DEM | 3 | yes |
decur-vit-small-patch16-rgb | ViT-S/16 | GeoNRW RGB | 3 | no |
decur-vit-small-patch16-dem | ViT-S/16 | GeoNRW DEM | 3 | no |
decur-mit-b2-rgb | SegFormer MiT-B2 | SUN RGB-D RGB | 3 | no |
decur-mit-b2-hha | SegFormer MiT-B2 | SUN RGB-D HHA | 3 | no |
decur-mit-b5-rgb | SegFormer MiT-B5 | SUN RGB-D RGB | 3 | no |
decur-mit-b5-hha | SegFormer MiT-B5 | SUN RGB-D HHA | 3 | no |
.pth filename mapping is in conversion_manifest.json.do_resize: false — pass images at native (H, W, C); only value rescaling (/255) is applied unless you enable normalization.1from transformers import pipeline
2import numpy as np
3
4REPO = "/path/to/DECUR-transformers"
5SUBFOLDER = "decur-resnet50-s2c"
6
7pipe = pipeline(
8 task="decur-feature-extraction",
9 model=REPO,
10 trust_remote_code=True,
11 model_kwargs={"subfolder": SUBFOLDER},
12)
13
14# Native Sentinel-2 patch (e.g. 512×512, 13 bands)
15image = np.random.randint(0, 255, (512, 512, 13), dtype=np.uint8)
16features = pipe(image, pool=True, return_tensors=True)
17print(features.shape) # torch.Size([1, 2048])
18
19# Dense token map (spatial grid scales with input size)
20tokens = pipe(image, pool=False, return_tensors=True)
21print(tokens.shape) # ResNet: [1, 256, 2048] for 512×5121SUBFOLDER = "decur-vit-small-patch16-s1"
2pipe = pipeline(
3 task="decur-feature-extraction",
4 model=REPO,
5 trust_remote_code=True,
6 model_kwargs={"subfolder": SUBFOLDER},
7)
8image = np.random.randint(0, 255, (448, 448, 2), dtype=np.uint8)
9features = pipe(image, pool=True, return_tensors=True)
10print(features.shape) # torch.Size([1, 384])1from transformers import AutoModel, AutoImageProcessor
2
3model = AutoModel.from_pretrained(REPO, subfolder=SUBFOLDER, trust_remote_code=True)
4processor = AutoImageProcessor.from_pretrained(REPO, subfolder=SUBFOLDER, trust_remote_code=True)
5inputs = processor(image, return_tensors="pt")
6out = model(**inputs)subfolder):1pipe = pipeline(
2 task="decur-feature-extraction",
3 model="/path/to/DECUR-transformers/decur-mit-b2-rgb",
4 trust_remote_code=True,
5)| Backbone | Native larger input | Pooled output | Sequence output |
|---|---|---|---|
| ResNet-50 | Yes (fully conv) | [B, 2048] | [B, H'×W', 2048] |
| ViT-S/16 | Yes (interpolate_pos_encoding=True by default) | [B, 384] (CLS) | [B, N, 384] |
| MiT-B2/B5 | Yes | [B, 512] (spatial mean) | [B, H'×W', 512] |
size in preprocessor_config.json (224×224) is the pretraining reference, not a forced input size.model(..., interpolate_pos_encoding=False).1features = pipe(
2 image,
3 pool=True,
4 return_tensors=True,
5 image_processor_kwargs={"do_resize": True},
6)config.json under custom_pipelines.decur-feature-extraction (see Adding a new pipeline).1conda activate rsgen
2python test_decur.py --model decur-mit-b2-rgb
3python test_decur.py --alltransformerstorchtorchvision (ResNet backbones)einops (RDA modules)opencv-python (only when resizing multispectral inputs with >4 channels)[B, 2048], ViT [B, 384] (CLS token), MiT [B, 512] (spatial mean).da_l3, da_l4).