Views
No views yet
config.json, model.safetensors, preprocessor, and remote code) for spatiotemporal feature extraction on HLS multispectral imagery.| Folder | Params | TL embeddings | Patch | Legacy file |
|---|---|---|---|---|
prithvi-eo-v2-tiny-tl | ~5M | yes | 16 | Prithvi_EO_V2_tiny_TL.pt |
prithvi-eo-v2-100m-tl | ~100M | yes | 16 | Prithvi_EO_V2_100M_TL.pt |
prithvi-eo-v2-300m | ~300M | no | 16 | Prithvi_EO_V2_300M.pt |
prithvi-eo-v2-300m-tl | ~300M | yes | 16 | Prithvi_EO_V2_300M_TL.pt |
prithvi-eo-v2-600m | ~600M | no | 14 | Prithvi_EO_V2_600M.pt |
prithvi-eo-v2-600m-tl | ~600M | yes | 14 | Prithvi_EO_V2_600M_TL.pt |
modeling_prithvi.py, processor, pipeline) and load with trust_remote_code=True..pt filename mapping is in conversion_manifest.json.do_resize: false. Pass HLS reflectance values at native 224×224 (or another size divisible by the patch size); HLS mean/std normalization is applied by default.1from transformers import pipeline
2import numpy as np
3
4REPO = "/home/czy/local/models/BiliSakura/Prithvi-EO-2.0-transformers"
5SUBFOLDER = "prithvi-eo-v2-300m-tl"
6
7pipe = pipeline(
8 task="prithvi-eo-feature-extraction",
9 model=REPO,
10 trust_remote_code=True,
11 model_kwargs={"subfolder": SUBFOLDER},
12)
13
14# Four HLS frames (T, H, W, C) in reflectance units — list of temporal frames
15frames = [np.random.uniform(500, 3000, (224, 224, 6)).astype("float32") for _ in range(4)]
16features = pipe(
17 frames,
18 pool=True,
19 return_tensors=True,
20 temporal_coords=[[2018, 26], [2018, 106], [2018, 201], [2018, 266]],
21 location_coords=[19.5, -99.1],
22)
23print(features.shape) # torch.Size([1, 1024])
24
25# Dense token map (CLS + spatiotemporal patches)
26tokens = pipe(frames, pool=False, return_tensors=True)
27print(tokens.shape) # torch.Size([1, 785, 1024]) for 224×224, patch 16, T=4(C, T, H, W) or (T, H, W, C).1from transformers import AutoModel, AutoImageProcessor
2import torch
3
4model_dir = f"{REPO}/{SUBFOLDER}"
5model = AutoModel.from_pretrained(model_dir, trust_remote_code=True)
6processor = AutoImageProcessor.from_pretrained(model_dir, trust_remote_code=True)
7
8batch = processor(frames, return_tensors="pt")
9with torch.no_grad():
10 outputs = model(**batch, temporal_coords=batch["temporal_coords"], location_coords=batch["location_coords"])
11print(outputs.pooler_output.shape)image-feature-extraction1pipe = pipeline(
2 task="image-feature-extraction",
3 model=f"{REPO}/{SUBFOLDER}",
4 trust_remote_code=True,
5)[1087, 1342, 1433, 2734, 1958, 1363][2248, 2179, 2178, 1850, 1242, 1049]-9999 → 0.0001 before normalizationB02, B03, B04, B05, B06, B07 (Blue, Green, Red, Narrow NIR, SWIR1, SWIR2).1conda activate rsgen
2python /home/czy/local/models/BiliSakura/Prithvi-EO-2.0-transformers/convert_all_checkpoints.py
3python /home/czy/local/models/BiliSakura/Prithvi-EO-2.0-transformers/test_prithvi.py --all1@article{Prithvi-EO-V2-preprint,
2 author = {Szwarcman, Daniela and Roy, Sujit and others},
3 title = {{Prithvi-EO-2.0: A Versatile Multi-Temporal Foundation Model for Earth Observation Applications}},
4 journal = {arXiv preprint arXiv:2412.02732},
5 year = {2024}
6}