amini-ai commited on
Commit
48d86e6
·
verified ·
1 Parent(s): 1261b01

Update model card with architecture, usage, and research context

Browse files
Files changed (1) hide show
  1. README.md +152 -0
README.md CHANGED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags:
4
+ - patchtst
5
+ - time-series
6
+ - remote-sensing
7
+ - earth-observation
8
+ - self-supervised-learning
9
+ - masked-pretraining
10
+ inference: false
11
+ ---
12
+
13
+ # AminiTech/Amini_FM_V0
14
+
15
+ Amini FM V0 is a compact transformer checkpoint for learning representations of satellite pixel time series. It accepts 512 time positions and 10 numerical channels per pixel.
16
+
17
+ The model is part of Amini's work on self-supervised representation learning for Earth observation. It adapts PatchTST to numerical spectral-band and index sequences, learning through reconstruction of randomly masked temporal patches. The released checkpoint contains an encoder and a patch reconstruction head.
18
+
19
+ ## Model details
20
+
21
+ | Property | Value |
22
+ | --- | --- |
23
+ | Developer | AminiTech / Amini.ai |
24
+ | Architecture | `PatchTSTForPretraining` |
25
+ | Model size | Approximately 0.6M |
26
+ | Input shape | `[batch_size, 512, 10]` |
27
+ | Encoder layers | 3 |
28
+ | Hidden width | 128 |
29
+ | Attention heads | 4 |
30
+ | Feed-forward width | 512 |
31
+ | Patch length / stride | 12 / 12 |
32
+ | Cross-channel attention | Disabled |
33
+ | Normalization | `batchnorm` |
34
+ | Internal scaling | `std` |
35
+ | Masking | Random patches; configured ratio 0.4 |
36
+ | Reconstruction objective | Mean squared error |
37
+ | CLS token | Enabled |
38
+ | Weight format / precision | Safetensors / float32 |
39
+ | Exported Transformers version | `4.38.2` |
40
+
41
+ Architecture details refer to [this checkpoint configuration](https://huggingface.co/AminiTech/Amini_FM_V0/blob/1261b01085f22f58bc70984aa32e5b041e206105/config.json). Context length counts positions after preprocessing; it does not specify a calendar duration.
42
+
43
+ ## Uses
44
+
45
+ - Generate pixel time-series embeddings for similarity search and clustering.
46
+ - Train downstream land-use/land-cover classifiers with labeled data.
47
+ - Explore temporal patterns in agricultural and environmental data.
48
+
49
+ Classification, regression, and forecasting require an appropriate downstream model and task-specific evaluation. The reconstruction head does not produce land-cover labels or future forecasts. The `prediction_length` field in the configuration does not establish a trained forecasting capability.
50
+
51
+ ## Input and preprocessing
52
+
53
+ Provide finite float32 values with shape `[batch_size, 512, 10]`, preserving chronological order and consistent channel definitions.
54
+
55
+ An optical preprocessing recipe documented for this model family uses the following channel order:
56
+
57
+ ```python
58
+ features = [
59
+ "Green", "Blue", "RED", "NIR", "SWIR1", "SWIR2",
60
+ "NDMI", "NDWI", "CI", "NDVI",
61
+ ]
62
+ ```
63
+
64
+ It sorts observations chronologically, groups them by pixel, standardizes each pixel's channels with `StandardScaler`, and linearly interpolates each sequence to 512 positions. This external preprocessing is followed by the model's internal standard-deviation scaling.
65
+
66
+ A release-specific preprocessing manifest is not included. The exact correspondence between this preprocessing recipe and the released weights is not established in the release metadata.
67
+
68
+ ## Training and related research
69
+
70
+ The exported configuration records self-supervised random patch masking and MSE reconstruction. The mask ratio is a configuration value; the realized fraction depends on the discrete number of patches. The released artifacts do not include a dataset manifest linking this revision to a particular corpus and split.
71
+
72
+ Related research describes Sentinel-2 median biweekly composites from 2020-2024 and 50,000 chips across Africa. The companion study describes the compact model family. It does not specify the exact Hub revision used in its experiments. [ICLR 2025 ML4RS paper](https://ml-for-rs.github.io/iclr2025/camera_ready/papers/52.pdf)
73
+
74
+ ## Usage
75
+
76
+ Install PyTorch, Transformers with PatchTST support, and Safetensors. The example below uses synthetic input to demonstrate the API. Real inputs require the preprocessing described above.
77
+
78
+ ### Extract embeddings
79
+
80
+ ```python
81
+ import torch
82
+ from transformers import PatchTSTModel
83
+
84
+ MODEL_ID = "AminiTech/Amini_FM_V0"
85
+ REVISION = "1261b01085f22f58bc70984aa32e5b041e206105"
86
+
87
+ encoder = PatchTSTModel.from_pretrained(
88
+ MODEL_ID,
89
+ revision=REVISION,
90
+ use_safetensors=True,
91
+ do_mask_input=False,
92
+ ).eval()
93
+
94
+ past_values = torch.randn(
95
+ 1, encoder.config.context_length, encoder.config.num_input_channels,
96
+ dtype=torch.float32,
97
+ )
98
+ observed_mask = torch.ones_like(past_values, dtype=torch.bool)
99
+
100
+ with torch.inference_mode():
101
+ hidden = encoder(
102
+ past_values=past_values,
103
+ past_observed_mask=observed_mask,
104
+ ).last_hidden_state
105
+
106
+ # Shape: [batch, channels, patch_tokens_including_cls, hidden_width]
107
+ patch_hidden = hidden[:, :, 1:, :] # Exclude the prepended CLS token.
108
+ per_channel_embeddings = patch_hidden.mean(dim=2)
109
+ pixel_embeddings = per_channel_embeddings.mean(dim=1)
110
+
111
+ print(pixel_embeddings.shape) # torch.Size([1, 128])
112
+ ```
113
+
114
+ Loading the bare encoder omits the reconstruction head and may produce an unused-weight warning. This example averages patch embeddings and then channels; pooling should match the downstream training protocol. Channel-level or CLS-token embeddings can also be used.
115
+
116
+ ### Run masked reconstruction
117
+
118
+ ```python
119
+ from transformers import PatchTSTForPretraining
120
+
121
+ model = PatchTSTForPretraining.from_pretrained(
122
+ MODEL_ID, revision=REVISION, use_safetensors=True,
123
+ ).eval()
124
+
125
+ with torch.inference_mode():
126
+ outputs = model(
127
+ past_values=past_values,
128
+ past_observed_mask=observed_mask,
129
+ )
130
+ reconstruction_loss = outputs.loss
131
+ ```
132
+
133
+ The pretraining class applies random input masking even in evaluation mode. The encoder example explicitly disables masking for repeatable embeddings. Missing values must be represented consistently with the applicable preprocessing; the all-ones mask above is for fully populated synthetic input.
134
+
135
+ ## Evaluation and limitations
136
+
137
+ Release-specific numerical benchmarks are not reported in this card. The usage examples have been checked with the released weights on CPU using PyTorch 2.6.0 and Transformers 4.48.3; this checks loading and forward-pass behavior, not downstream accuracy.
138
+
139
+ - Clouds, missing observations, interpolation, sensor differences, and feature scaling can affect embeddings.
140
+ - Transfer across regions, seasons, sensors, and acquisition conditions requires evaluation on representative data.
141
+ - Random pixel splits can contain spatially related examples; geographic and temporal holdouts are useful when assessing generalization.
142
+ - Reconstruction loss alone does not establish downstream classification, crop-yield prediction, calibrated change detection, or causal relationships.
143
+ - Exact training data provenance and preprocessing are incompletely documented for this revision.
144
+
145
+ ## License
146
+
147
+ A license has not been specified for this checkpoint. Apache-2.0 metadata on other Amini releases does not establish the license for these weights.
148
+
149
+ ## References
150
+
151
+ - [Self-Supervised Representation Learning on Remote Sensing Pixel Time Series with Patch-Based Masking](https://ml-for-rs.github.io/iclr2025/camera_ready/papers/52.pdf), ICLR 2025 ML4RS Workshop.
152
+ - [Hugging Face PatchTST documentation](https://huggingface.co/docs/transformers/model_doc/patchtst).