Skip to main content

Architecture

See docs/paper_spec.md for the paper-vs-implementation table and docs/assumptions.md for every unspecified-detail decision. This document is a practical map of the code.

Input image(s) / video
│
▼
data/processors/modality.py (input reorganization: pseudo-RGB, band grouping, frame sampling)
│ (list of RGB PIL.Image, one per "independently encoded" visual observation)
▼
model/vision_encoder.py: SigLIP2VisionEncoder
│ F_N (final feature) + {F_l1, F_l2, F_l3} (3 intermediate features), + patch grid (h, w)
▼
model/fgvla/acsa.py: ACSA model/fgvla/deepstack.py: DeepStackProjector
│ F̃_N (enhanced final feature) │ per-level projected features (for injection)
▼ │
model/projector.py: VisionLanguageProjector │
│ visual tokens [N/4, D_llm] │
▼ ▼
model/earth_onevision.py: EarthOneVisionModel - splices visual tokens into the text embedding
sequence at <image> placeholders, stages DeepStack injection, then calls:
▼
model.llm: Qwen3ForCausalLM (with DeepStack forward hooks on early decoder layers)
│ autoregressive logits over V = V_text ∪ V_coord ∪ V_seg
▼
inference/decoder.py: decode_generated_text - recovers text / boxes / oriented boxes / points /
R-RLE masks from the raw generated token stream.

Module map​

  • backend/model/slis/ - the unified spatial-linguistic vocabulary and its (de)serialization (coordinate tokens, R-RLE, JSON-like spatial objects, structural tags).
  • backend/model/fgvla/ - ACSA (encoder-side multi-scale attention) and DeepStack (decoder-side early-layer injection).
  • backend/model/vision_encoder.py, backend/model/projector.py, backend/model/earth_onevision.py - the rest of the architecture assembly, including the multimodal splice/concatenation logic and the two MPS-specific workarounds documented in docs/assumptions.md #A13 (vision tower pinned to CPU; attn_implementation="eager" on MPS).
  • backend/data/processors/ - modality-specific input reorganization (no learned encoders).
  • backend/data/{schema,dataset,collator}.py - the MMRS-OneVision-compatible record schema, a PyTorch Dataset that loads/processes images per record, and a collator that tokenizes + builds response-only labels.
  • backend/training/ - loss masking, optimizer/scheduler, device-adaptive Trainer, checkpointing.
  • backend/inference/ - generation pipeline + structured output decoding.
  • backend/evaluation/ - per-task metrics + paper-vs-reproduction comparison.
  • backend/app/ - the SatQuery AI agentic web application (FastAPI backend + static frontend) built on top of the same EarthOneVisionModel/EarthOneVisionPipeline.

Parameter count​

Run python tools/count_parameters.py --llm Qwen/Qwen3-1.7B --vision google/siglip2-base-patch16-naflex for the production config, or --llm Qwen/Qwen3-0.6B for the smaller checkpoint this repo's own tests/smoke-test use (docs/assumptions.md #A12). See REPRODUCTION_REPORT.md for the actually-measured counts on this dev machine.