# zeqinyu/iccv-deepid2025-sunlight architecture

> Architecture diagram of the GitHub repository zeqinyu/iccv-deepid2025-sunlight, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zeqinyu/iccv-deepid2025-sunlight
- Repository: https://github.com/zeqinyu/iccv-deepid2025-sunlight

## Overview

This repository packages the Cue-Net image-forensics model as an API for image manipulation detection and localization. The principal workflow is image upload, RGB conversion and normalization, model inference, then return of a real-image score, a binary localization mask, or both. Internally, Cue-Net combines a ConvNeXtV2 feature backbone, feature-pyramid decoding, and an edge-aware branch. The README also documents a two-stage training approach; the available source excerpts show inference code, so training relationships below reflect documented stages rather than inspected implementations.

Main entry points: [`CueNet-docker/src/model.py`](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py) (Inference pipeline), [`CueNet-docker/src/main.py`](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py) (Combined endpoint), [`CueNet-docker/src/Cue_Net/model/CueNet.py`](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/CueNet.py) (Cue-Net), [`readme.md`](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/readme.md) (Distillation training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["API serving"]
  node_api["FastAPI service<br/>[main.py]"]
  node_image["RGB image"]
  node_preprocess["Image preprocessing<br/>[model.py]"]
  node_detect["Detection endpoint<br/>[main.py]"]
  node_localize["Localization endpoint<br/>[main.py]"]
  node_combined["Combined endpoint<br/>[main.py]"]
  node_score["Detection score<br/>[model.py]"]
  node_mask["Binary mask<br/>[model.py]"]
end

subgraph group_inference["Inference model"]
  node_pipeline["Inference pipeline<br/>[model.py]"]
  node_cues["Cue-Net<br/>[CueNet.py]"]
  node_backbone["ConvNeXtV2 backbone<br/>[encoder.py]"]
  node_decoder["Feature pyramid<br/>[CueNet.py]"]
  node_edge["Edge-aware module<br/>[EAM.py]"]
end

subgraph group_training["Training approach"]
  node_stage1["Distillation training<br/>[readme.md]"]
  node_teachers["Manipulation teachers<br/>[readme.md]"]
  node_stage2["ID fine-tuning<br/>[readme.md]"]
end

node_client(("API client"))

node_client -->|"uploads image"| node_api
node_api -->|"dispatches"| node_detect
node_api -->|"dispatches"| node_localize
node_api -->|"dispatches"| node_combined
node_detect -->|"normalizes"| node_preprocess
node_localize -->|"normalizes"| node_preprocess
node_combined -->|"normalizes"| node_preprocess
node_preprocess -->|"passes tensor"| node_pipeline
node_detect -->|"calls detect"| node_pipeline
node_localize -->|"calls localize"| node_pipeline
node_combined -->|"calls combined inference"| node_pipeline
node_pipeline -->|"runs model"| node_cues
node_cues -->|"extracts features"| node_backbone
node_cues -->|"decodes features"| node_decoder
node_cues -->|"computes edge map"| node_edge
node_pipeline -->|"derives score"| node_score
node_pipeline -->|"derives mask"| node_mask
node_detect -->|"returns JSON"| node_score
node_localize -->|"returns PNG"| node_mask
node_combined -->|"returns score header"| node_score
node_combined -->|"returns PNG"| node_mask
node_stage1 -->|"trains specialists"| node_teachers
node_stage1 -->|"pretrains student"| node_stage2

click node_api "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py"
click node_preprocess "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py"
click node_detect "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py"
click node_localize "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py"
click node_combined "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py"
click node_pipeline "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py"
click node_cues "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/CueNet.py"
click node_backbone "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/encoder.py"
click node_decoder "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/CueNet.py"
click node_edge "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/EAM.py"
click node_score "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py"
click node_mask "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py"
click node_stage1 "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/readme.md"
click node_teachers "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/readme.md"
click node_stage2 "https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/readme.md"

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_api,node_image,node_preprocess,node_detect,node_localize,node_combined,node_score,node_mask,node_client toneBlue
class node_pipeline,node_cues,node_backbone,node_decoder,node_edge toneAmber
class node_stage1,node_teachers,node_stage2 toneMint
```

## Components

### API serving

- [FastAPI service](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py): `CueNet-docker/src/main.py`
- **RGB image**
- [Image preprocessing](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py): `CueNet-docker/src/model.py`
- [Detection endpoint](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py): `CueNet-docker/src/main.py`
- [Localization endpoint](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py): `CueNet-docker/src/main.py`
- [Combined endpoint](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/main.py): `CueNet-docker/src/main.py`
- [Detection score](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py): `CueNet-docker/src/model.py`
- [Binary mask](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py): `CueNet-docker/src/model.py`

### Inference model

- [Inference pipeline](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/model.py): `CueNet-docker/src/model.py`
- [Cue-Net](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/CueNet.py): `CueNet-docker/src/Cue_Net/model/CueNet.py`
- [ConvNeXtV2 backbone](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/encoder.py): `CueNet-docker/src/Cue_Net/model/encoder.py`
- [Feature pyramid](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/CueNet.py): `CueNet-docker/src/Cue_Net/model/CueNet.py`
- [Edge-aware module](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/CueNet-docker/src/Cue_Net/model/EAM.py): `CueNet-docker/src/Cue_Net/model/EAM.py`

### Training approach

- [Distillation training](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/readme.md): `readme.md`
- [Manipulation teachers](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/readme.md): `readme.md`
- [ID fine-tuning](https://github.com/zeqinyu/iccv-deepid2025-sunlight/blob/main/readme.md): `readme.md`

### Other components

- **API client**

## Connections

- API client → FastAPI service: uploads image
- FastAPI service → Detection endpoint: dispatches
- FastAPI service → Localization endpoint: dispatches
- FastAPI service → Combined endpoint: dispatches
- Detection endpoint → Image preprocessing: normalizes
- Localization endpoint → Image preprocessing: normalizes
- Combined endpoint → Image preprocessing: normalizes
- Image preprocessing → Inference pipeline: passes tensor
- Detection endpoint → Inference pipeline: calls detect
- Localization endpoint → Inference pipeline: calls localize
- Combined endpoint → Inference pipeline: calls combined inference
- Inference pipeline → Cue-Net: runs model
- Cue-Net → ConvNeXtV2 backbone: extracts features
- Cue-Net → Feature pyramid: decodes features
- Cue-Net → Edge-aware module: computes edge map
- Inference pipeline → Detection score: derives score
- Inference pipeline → Binary mask: derives mask
- Detection endpoint → Detection score: returns JSON
- Localization endpoint → Binary mask: returns PNG
- Combined endpoint → Detection score: returns score header
- Combined endpoint → Binary mask: returns PNG
- Distillation training → Manipulation teachers: trains specialists
- Distillation training → ID fine-tuning: pretrains student
