# shroudy-bit32/satellite-edge-cloud-detection architecture

> Architecture diagram of the GitHub repository shroudy-bit32/satellite-edge-cloud-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shroudy-bit32/satellite-edge-cloud-detection
- Repository: https://github.com/shroudy-bit32/satellite-edge-cloud-detection

## Overview

This repository builds and demonstrates an onboard cloud-screening pipeline for Sentinel-2 imagery, intended to reduce downlink while respecting spacecraft compute and memory limits. Its central workflow prepares and normalizes satellite patches, trains a binary classifier and a segmentation model, exports compact ONNX/INT8 models, then applies an operational decision threshold to classify imagery; the optional U-Net supplies pixel masks. Supporting branches validate across SPARCS, analyze downlink and operating points, and generate reports. The README documents these capabilities; some subsystem links are omitted where sampled source does not establish their runtime wiring.

Main entry points: [`src/dataset.py`](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/dataset.py) (Patch datasets), [`src/export.py`](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/export.py) (ONNX and INT8 export), [`src/inference.py`](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/inference.py) (Inference and masks), [`src/prepare_data.py`](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/prepare_data.py) (Prepare Sentinel-2)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_config["Pipeline configuration<br/>[config.py]"]
  node_prepare["Prepare Sentinel-2<br/>[prepare_data.py]"]
  node_prepare_sparcs["Prepare SPARCS<br/>[prepare_sparcs.py]"]
  node_normalize["Reflectance normalization<br/>[preprocess.py]"]
  node_patch_index["Patch index and files<br/>[prepare_data.py]"]
  node_dataset["Patch datasets<br/>[dataset.py]"]
end

subgraph group_models["Model development"]
  node_classifier["Cloud classifier<br/>[model.py]"]
  node_unet["U-Net segmenter<br/>[unet.py]"]
  node_losses["Segmentation losses<br/>[losses.py]"]
  node_train["Classifier training<br/>[train.py]"]
  node_train_seg["Segmentation training<br/>[train_seg.py]"]
  node_checkpoints["Model checkpoints<br/>[train.py]"]
end

subgraph group_deployment["Inference and deployment"]
  node_export["ONNX and INT8 export<br/>[export.py]"]
  node_release["Versioned model release"]
  node_inference["Inference and masks<br/>[inference.py]"]
  node_demo["Image demo<br/>[app.py]"]
end

subgraph group_validation["Validation and analysis"]
  node_threshold["Operating-point tuning"]
  node_downlink["Downlink analysis"]
  node_external_eval["External validation"]
  node_quant_analysis["Quantization analysis"]
end

subgraph group_reporting["Reporting"]
  node_report["Technical report<br/>[make_report.py]"]
end

node_operator(("Operator"))
node_satellite_data["Satellite imagery"]

node_operator -->|"submits imagery"| node_demo
node_satellite_data -->|"provides scenes"| node_prepare
node_prepare -->|"normalizes reflectance"| node_normalize
node_prepare -->|"writes patches and index"| node_patch_index
node_prepare_sparcs -->|"normalizes reflectance"| node_normalize
node_patch_index -->|"loads indexed patches"| node_dataset
node_dataset -->|"supplies training samples"| node_train
node_dataset -->|"supplies image-mask samples"| node_train_seg
node_train -->|"builds model"| node_classifier
node_train_seg -->|"builds segmenter"| node_unet
node_train_seg -->|"uses segmentation loss"| node_losses
node_train -->|"saves weights"| node_checkpoints
node_checkpoints -->|"exports checkpoint"| node_export
node_dataset -->|"provides calibration samples"| node_export
node_export -->|"produces deployable models"| node_release
node_release -->|"loads model weights"| node_inference
node_normalize -->|"shares normalization"| node_inference
node_demo -->|"requests predictions"| node_inference
node_demo -->|"loads release threshold"| node_config
node_inference -.->|"evaluates decision policy"| node_threshold
node_threshold -.->|"sets analysis point"| node_downlink
node_prepare_sparcs -->|"prepares validation data"| node_external_eval
node_external_eval -.->|"evaluates released models"| node_release
node_export -->|"tests quantized models"| node_quant_analysis
node_downlink -.->|"supplies analysis results"| node_report
node_external_eval -.->|"supplies validation results"| node_report

click node_config "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/config.py"
click node_prepare "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/prepare_data.py"
click node_prepare_sparcs "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/prepare_sparcs.py"
click node_normalize "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/preprocess.py"
click node_patch_index "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/prepare_data.py"
click node_dataset "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/dataset.py"
click node_classifier "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/model.py"
click node_unet "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/unet.py"
click node_losses "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/losses.py"
click node_train "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/train.py"
click node_train_seg "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/train_seg.py"
click node_checkpoints "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/train.py"
click node_export "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/export.py"
click node_release "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/tree/main/releases"
click node_inference "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/inference.py"
click node_demo "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/app.py"
click node_threshold "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/tune_operating_point.py"
click node_downlink "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/partial_downlink.py"
click node_external_eval "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/evaluate_external.py"
click node_quant_analysis "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/quantize_analysis.py"
click node_report "https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/make_report.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_prepare,node_prepare_sparcs,node_normalize,node_patch_index,node_dataset toneBlue
class node_classifier,node_unet,node_losses,node_train,node_train_seg,node_checkpoints toneAmber
class node_export,node_release,node_inference,node_demo toneMint
class node_threshold,node_downlink,node_external_eval,node_quant_analysis toneRose
class node_report,node_operator,node_satellite_data toneIndigo
```

## Components

### Data preparation

- [Pipeline configuration](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/config.py): `src/config.py`
- [Prepare Sentinel-2](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/prepare_data.py): `src/prepare_data.py`
- [Prepare SPARCS](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/prepare_sparcs.py): `src/prepare_sparcs.py`
- [Reflectance normalization](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/preprocess.py): `src/preprocess.py`
- [Patch index and files](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/prepare_data.py): `src/prepare_data.py`
- [Patch datasets](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/dataset.py): `src/dataset.py`

### Model development

- [Cloud classifier](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/model.py): `src/model.py`
- [U-Net segmenter](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/unet.py): `src/unet.py`
- [Segmentation losses](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/losses.py): `src/losses.py`
- [Classifier training](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/train.py): `src/train.py`
- [Segmentation training](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/train_seg.py): `src/train_seg.py`
- [Model checkpoints](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/train.py): `src/train.py`

### Inference and deployment

- [ONNX and INT8 export](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/export.py): `src/export.py`
- [Versioned model release](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/tree/main/releases): `releases`
- [Inference and masks](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/inference.py): `src/inference.py`
- [Image demo](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/app.py): `app.py`

### Validation and analysis

- [Operating-point tuning](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/tune_operating_point.py): `src/tune_operating_point.py`
- [Downlink analysis](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/partial_downlink.py): `src/partial_downlink.py`
- [External validation](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/evaluate_external.py): `src/evaluate_external.py`
- [Quantization analysis](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/quantize_analysis.py): `src/quantize_analysis.py`

### Reporting

- [Technical report](https://github.com/shroudy-bit32/satellite-edge-cloud-detection/blob/main/src/make_report.py): `src/make_report.py`

### Other components

- **Operator**
- **Satellite imagery**

## Connections

- Operator → Image demo: submits imagery (evidence: `app.py`)
- Satellite imagery → Prepare Sentinel-2: provides scenes (evidence: `README.md`)
- Prepare Sentinel-2 → Reflectance normalization: normalizes reflectance (evidence: `src/prepare_data.py`)
- Prepare Sentinel-2 → Patch index and files: writes patches and index (evidence: `src/prepare_data.py`)
- Prepare SPARCS → Reflectance normalization: normalizes reflectance (evidence: `src/prepare_sparcs.py`)
- Patch index and files → Patch datasets: loads indexed patches (evidence: `src/dataset.py`)
- Patch datasets → Classifier training: supplies training samples (evidence: `src/train.py`)
- Patch datasets → Segmentation training: supplies image-mask samples (evidence: `src/train_seg.py`)
- Classifier training → Cloud classifier: builds model (evidence: `src/train.py`)
- Segmentation training → U-Net segmenter: builds segmenter (evidence: `src/train_seg.py`)
- Segmentation training → Segmentation losses: uses segmentation loss (evidence: `src/train_seg.py`)
- Classifier training → Model checkpoints: saves weights (evidence: `src/train.py`)
- Model checkpoints → ONNX and INT8 export: exports checkpoint (evidence: `src/export.py`)
- Patch datasets → ONNX and INT8 export: provides calibration samples (evidence: `src/export.py`)
- ONNX and INT8 export → Versioned model release: produces deployable models (evidence: `README.md`)
- Versioned model release → Inference and masks: loads model weights (evidence: `src/inference.py`)
- Reflectance normalization → Inference and masks: shares normalization (evidence: `src/preprocess.py`)
- Image demo → Inference and masks: requests predictions (evidence: `app.py`)
- Image demo → Pipeline configuration: loads release threshold (evidence: `app.py`)
- Inference and masks → Operating-point tuning: evaluates decision policy
- Operating-point tuning → Downlink analysis: sets analysis point
- Prepare SPARCS → External validation: prepares validation data (evidence: `src/prepare_sparcs.py`)
- External validation → Versioned model release: evaluates released models
- ONNX and INT8 export → Quantization analysis: tests quantized models (evidence: `src/quantize_analysis.py`)
- Downlink analysis → Technical report: supplies analysis results
- External validation → Technical report: supplies validation results
