Architecture - Code Reference
See docs/architecture.md for the visual pipeline map and docs/paper_to_code.md for the
full traceability table.
Module map
backend/model/
├── earth_onevision.py Model assembly, multimodal splice, forward/generate
├── vision_encoder.py SigLIP-2 NaFlex wrapper (final + 3 intermediate features)
├── projector.py 2×2 spatial merge + 2-layer MLP → LLM hidden space
├── tokenizer_extension.py Extends Qwen3 tokenizer with SLIS special tokens
├── fgvla/
│ ├── acsa.py Adaptive Cross-Scale Attention (Eq. 2–5)
│ └── deepstack.py DeepStack projectors + forward-hook injection (Eq. 6)
└── slis/
├── vocabulary.py V = V_text ∪ V_coord ∪ V_seg registry
├── coordinate_tokens.py 1000 dedicated coordinate tokens, q(c)=floor(c×1000)
├── serializer.py SpatialObject → SLIS token string
├── parser.py Tolerant regex parser for generated SLIS output
├── r_rle.py 24×24 max-pool + row-wise RLE
└── (coordinate_tokens.py) Same as above (already listed)
Data flow through the code
| Step | Module | Function |
|---|---|---|
| Load image | data/dataset.py | MMRSDataset.__getitem__() |
| Modality → RGB | data/processors/modality.py | OpticalProcessor.process() etc. |
| Tokenize + mask labels | data/collator.py | MMRSCollator.__call__() |
| Encode image | model/vision_encoder.py | SigLIP2VisionEncoder.encode_image() |
| Cross-scale attention | model/fgvla/acsa.py | ACSA.forward() |
| Vision→LLM projection | model/projector.py | VisionLanguageProjector.forward() |
| Splice visual tokens | model/earth_onevision.py | _splice_one_sample() |
| DeepStack injection | model/fgvla/deepstack.py | DeepStackInjector._make_hook() |
| LLM forward + loss | model/earth_onevision.py | EarthOneVisionModel.forward() |
| Decode output | inference/decoder.py | decode_generated_text() |
| Evaluate metric | evaluation/*.py | Per-task evaluate() |
Parameter counts (Qwen3-0.6B + SigLIP-2-base)
| Component | Parameters | Trainable |
|---|---|---|
| LLM (Qwen3-0.6B) | 0.597B | Yes |
| Vision encoder (SigLIP-2-base) | 92.9M | No (frozen) |
| Projector (2-layer MLP) | 16.78M | Yes |
| ACSA | 2.07M | Yes |
| DeepStack | 5.51M | Yes |
| Total | 0.714B | 0.621B |
Production config (Qwen3-1.7B) would be ~2B total.