# chunminghe/feder architecture

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

- Interactive diagram: https://gitdiagram.com/chunminghe/feder
- Repository: https://github.com/chunminghe/feder

## Overview

FEDER is a camouflaged-object detection research model. Its main workflow loads images and masks, trains the network with segmentation and auxiliary edge-reconstruction losses, then runs inference to produce prediction maps for evaluation. The README also describes feature decomposition, frequency attention, guided feature aggregation, and edge reconstruction; these model branches are shown at the documented capability level. Some implementation details and Test.py were not sampled, so those relationships rely on README statements rather than inspected call sites.

Main entry points: [`lib/Network.py`](https://github.com/chunminghe/feder/blob/main/lib/Network.py) (FEDER network), [`Train.py`](https://github.com/chunminghe/feder/blob/main/Train.py) (Training loop), [`Test.py`](https://github.com/chunminghe/feder/blob/main/Test.py) (Inference runner), [`utils/data_val.py`](https://github.com/chunminghe/feder/blob/main/utils/data_val.py) (Test data loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Train and inference"]
  node_train["Training loop<br/>[Train.py]"]
  node_infer["Inference runner<br/>[Test.py]"]
  node_training_utils["Training utilities<br/>[utils.py]"]
end

subgraph group_model["FEDER model"]
  node_network["FEDER network<br/>[Network.py]"]
  node_decomposition["Feature decomposition<br/>[Modules.py]"]
  node_frequency["Frequency attention<br/>[Modules.py]"]
  node_aggregation["Guided aggregation<br/>[Modules.py]"]
  node_edge_reconstruction["Edge reconstruction<br/>[Modules.py]"]
  node_gated_conv["Gated convolution<br/>[GatedConv.py]"]
end

subgraph group_data["Data handling"]
  node_training_data["Training data loader<br/>[data_val.py]"]
  node_test_data["Test data loader<br/>[data_val.py]"]
  node_generic_loader["Image-mask loader<br/>[dataloader.py]"]
end

node_researcher(("Researcher"))
node_datasets["COD datasets"]
node_predictions["Prediction maps"]
node_evaluation["Evaluation tools"]

node_researcher -->|"starts training"| node_train
node_researcher -->|"runs inference"| node_infer
node_datasets -->|"provides samples"| node_training_data
node_datasets -->|"provides samples"| node_test_data
node_train -->|"loads batches"| node_training_data
node_train -->|"trains"| node_network
node_train -->|"uses helpers"| node_training_utils
node_infer -->|"loads images"| node_test_data
node_infer -->|"runs model"| node_network
node_infer -->|"writes maps"| node_predictions
node_predictions -->|"evaluated by"| node_evaluation
node_network -->|"decomposes features"| node_decomposition
node_network -->|"attends bands"| node_frequency
node_network -->|"aggregates features"| node_aggregation
node_network -->|"reconstructs edges"| node_edge_reconstruction
node_decomposition -->|"uses layer"| node_gated_conv
node_generic_loader -->|"supports visualization"| node_test_data

click node_train "https://github.com/chunminghe/feder/blob/main/Train.py"
click node_infer "https://github.com/chunminghe/feder/blob/main/Test.py"
click node_training_data "https://github.com/chunminghe/feder/blob/main/utils/data_val.py"
click node_test_data "https://github.com/chunminghe/feder/blob/main/utils/data_val.py"
click node_generic_loader "https://github.com/chunminghe/feder/blob/main/utils/dataloader.py"
click node_network "https://github.com/chunminghe/feder/blob/main/lib/Network.py"
click node_decomposition "https://github.com/chunminghe/feder/blob/main/lib/Modules.py"
click node_frequency "https://github.com/chunminghe/feder/blob/main/lib/Modules.py"
click node_aggregation "https://github.com/chunminghe/feder/blob/main/lib/Modules.py"
click node_edge_reconstruction "https://github.com/chunminghe/feder/blob/main/lib/Modules.py"
click node_gated_conv "https://github.com/chunminghe/feder/blob/main/lib/GatedConv.py"
click node_training_utils "https://github.com/chunminghe/feder/blob/main/utils/utils.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_train,node_infer,node_training_utils toneBlue
class node_network,node_decomposition,node_frequency,node_aggregation,node_edge_reconstruction,node_gated_conv toneAmber
class node_training_data,node_test_data,node_generic_loader toneMint
class node_researcher,node_datasets,node_predictions,node_evaluation toneIndigo
```

## Components

### Train and inference

- [Training loop](https://github.com/chunminghe/feder/blob/main/Train.py): `Train.py`
- [Inference runner](https://github.com/chunminghe/feder/blob/main/Test.py): `Test.py`
- [Training utilities](https://github.com/chunminghe/feder/blob/main/utils/utils.py): `utils/utils.py`

### FEDER model

- [FEDER network](https://github.com/chunminghe/feder/blob/main/lib/Network.py): `lib/Network.py`
- [Feature decomposition](https://github.com/chunminghe/feder/blob/main/lib/Modules.py): `lib/Modules.py`
- [Frequency attention](https://github.com/chunminghe/feder/blob/main/lib/Modules.py): `lib/Modules.py`
- [Guided aggregation](https://github.com/chunminghe/feder/blob/main/lib/Modules.py): `lib/Modules.py`
- [Edge reconstruction](https://github.com/chunminghe/feder/blob/main/lib/Modules.py): `lib/Modules.py`
- [Gated convolution](https://github.com/chunminghe/feder/blob/main/lib/GatedConv.py): `lib/GatedConv.py`

### Data handling

- [Training data loader](https://github.com/chunminghe/feder/blob/main/utils/data_val.py): `utils/data_val.py`
- [Test data loader](https://github.com/chunminghe/feder/blob/main/utils/data_val.py): `utils/data_val.py`
- [Image-mask loader](https://github.com/chunminghe/feder/blob/main/utils/dataloader.py): `utils/dataloader.py`

### Other components

- **Researcher**
- **COD datasets**
- **Prediction maps**
- **Evaluation tools**

## Connections

- Researcher → Training loop: starts training (evidence: `README.md`)
- Researcher → Inference runner: runs inference (evidence: `README.md`)
- COD datasets → Training data loader: provides samples (evidence: `README.md`)
- COD datasets → Test data loader: provides samples (evidence: `README.md`)
- Training loop → Training data loader: loads batches (evidence: `Train.py`)
- Training loop → FEDER network: trains (evidence: `Train.py`)
- Training loop → Training utilities: uses helpers (evidence: `Train.py`)
- Inference runner → Test data loader: loads images (evidence: `README.md`)
- Inference runner → FEDER network: runs model (evidence: `README.md`)
- Inference runner → Prediction maps: writes maps (evidence: `README.md`)
- Prediction maps → Evaluation tools: evaluated by (evidence: `README.md`)
- FEDER network → Feature decomposition: decomposes features (evidence: `lib/Network.py`)
- FEDER network → Frequency attention: attends bands (evidence: `README.md`)
- FEDER network → Guided aggregation: aggregates features (evidence: `lib/Network.py`)
- FEDER network → Edge reconstruction: reconstructs edges (evidence: `lib/Network.py`)
- Feature decomposition → Gated convolution: uses layer (evidence: `lib/Modules.py`)
- Image-mask loader → Test data loader: supports visualization
