# hlidmhkust/vccib architecture

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

- Interactive diagram: https://gitdiagram.com/hlidmhkust/vccib
- Repository: https://github.com/hlidmhkust/vccib

## Overview

This repository implements research models for task-oriented image communication with out-of-distribution (OOD) detection. The user-facing workflow is experiment entry point → dataset/data module → model training or evaluation, with model variants learning task representations and detection behavior. The model family includes semantic, temporal, JSCC, VIB, position-change, and early-exit variants; shared encoders/backbones and metric/distribution losses form an internal layer. Edges from the SOURCE INDEX indicate referenced dependencies, not necessarily runtime call order. Several subsystems are represented by their documented or indexed modules; their internal behavior was not fully sampled.

Main entry points: [`models/vae.py`](https://github.com/hlidmhkust/vccib/blob/main/models/vae.py) (VAE model), [`data/open_set_data_loader.py`](https://github.com/hlidmhkust/vccib/blob/main/data/open_set_data_loader.py) (Known/OOD data), [`data/mnist_module.py`](https://github.com/hlidmhkust/vccib/blob/main/data/mnist_module.py) (MNIST data module), [`models/vae_semantic.py`](https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic.py) (Semantic VAE)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Experiment workflow"]
  node_standard_runs["Standard runs<br/>[main.py]"]
  node_semantic_runs["Semantic runs<br/>[main_semantic.py]"]
  node_jscc_runs["JSCC runs"]
  node_vib_runs["VIB runs"]
  node_temporal_runs["Temporal runs"]
  node_position_runs["Position runs"]
  node_earlyexit_runs["Early-exit runs"]
end

subgraph group_data["Data preparation"]
  node_mnist_data["MNIST data module<br/>[mnist_module.py]"]
  node_open_data["Known/OOD data"]
  node_transforms["Data transforms<br/>[data_transforms.py]"]
  node_datasets["Dataset helpers<br/>[datasets.py]"]
  node_inversion["Image inversion<br/>[invert.py]"]
end

subgraph group_models["Communication models"]
  node_vae["VAE model<br/>[vae.py]"]
  node_vae_semantic["Semantic VAE<br/>[vae_semantic.py]"]
  node_vae_jscc["Semantic JSCC"]
  node_vae_vib["Semantic VIB"]
  node_vae_temporal["Temporal VAE"]
  node_vae_position["Position variant"]
  node_vae_earlyexit["Early-exit model"]
end

subgraph group_internals["Model internals"]
  node_vae_encoder["ResNet semantic encoder"]
  node_autoencoder["MNIST autoencoder<br/>[mnist_ae.py]"]
  node_decoder_encoder["Encoder/decoder blocks"]
  node_densenet["DenseNet backbone<br/>[densenet.py]"]
  node_vgg["VGG backbone<br/>[vgg.py]"]
  node_wide_resnet["Wide ResNet backbone<br/>[wide_resnet.py]"]
  node_supcon["Supervised contrastive loss<br/>[losses.py]"]
  node_mmd["MMD loss<br/>[mmd.py]"]
  node_triplet["Triplet loss<br/>[modded_triplets.py]"]
end

node_user(("Researcher"))

node_user -->|"configures"| node_standard_runs
node_user -->|"configures"| node_semantic_runs
node_user -->|"configures"| node_jscc_runs
node_user -->|"configures"| node_vib_runs
node_user -->|"configures"| node_temporal_runs
node_user -->|"configures"| node_position_runs
node_user -->|"configures"| node_earlyexit_runs
node_standard_runs -->|"sets up"| node_mnist_data
node_standard_runs -->|"sets up"| node_open_data
node_standard_runs -->|"trains/evaluates"| node_vae
node_semantic_runs -->|"sets up"| node_mnist_data
node_semantic_runs -->|"sets up"| node_open_data
node_semantic_runs -->|"trains/evaluates"| node_vae_semantic
node_jscc_runs -->|"sets up"| node_mnist_data
node_jscc_runs -->|"sets up"| node_open_data
node_jscc_runs -->|"trains/evaluates"| node_vae_jscc
node_vib_runs -->|"sets up"| node_mnist_data
node_vib_runs -->|"sets up"| node_open_data
node_vib_runs -->|"trains/evaluates"| node_vae_vib
node_temporal_runs -->|"sets up"| node_mnist_data
node_temporal_runs -->|"sets up"| node_open_data
node_temporal_runs -->|"trains/evaluates"| node_vae_temporal
node_position_runs -->|"sets up"| node_mnist_data
node_position_runs -->|"sets up"| node_open_data
node_position_runs -->|"trains/evaluates"| node_vae_position
node_earlyexit_runs -->|"sets up"| node_mnist_data
node_earlyexit_runs -->|"sets up"| node_open_data
node_earlyexit_runs -->|"trains/evaluates"| node_vae_earlyexit
node_open_data -->|"uses"| node_transforms
node_open_data -->|"uses"| node_datasets
node_open_data -->|"uses"| node_inversion
node_vae -->|"references"| node_autoencoder
node_vae -->|"references"| node_decoder_encoder
node_vae -->|"references"| node_densenet
node_vae -->|"references"| node_vgg
node_vae -->|"references"| node_wide_resnet
node_vae -->|"references"| node_supcon
node_vae -->|"references"| node_mmd
node_vae -->|"references"| node_triplet
node_vae_semantic -->|"references"| node_vae_encoder
node_vae_semantic -->|"references"| node_triplet
node_vae_semantic -->|"references"| node_supcon
node_vae_semantic -->|"references"| node_mmd
node_vae_jscc -->|"references"| node_vae_encoder
node_vae_jscc -->|"references"| node_triplet
node_vae_vib -->|"references"| node_vae_encoder
node_vae_vib -->|"references"| node_triplet
node_vae_temporal -->|"uses"| node_vae_encoder

click node_standard_runs "https://github.com/hlidmhkust/vccib/blob/main/main.py"
click node_semantic_runs "https://github.com/hlidmhkust/vccib/blob/main/main_semantic.py"
click node_jscc_runs "https://github.com/hlidmhkust/vccib/blob/main/main_semantic_JSCC.py"
click node_vib_runs "https://github.com/hlidmhkust/vccib/blob/main/main_semantic_VIB.py"
click node_temporal_runs "https://github.com/hlidmhkust/vccib/blob/main/main_semantic_temp.py"
click node_position_runs "https://github.com/hlidmhkust/vccib/blob/main/main_semantic_temp_change_position.py"
click node_earlyexit_runs "https://github.com/hlidmhkust/vccib/blob/main/main_semantic_temp_earlyexit.py"
click node_mnist_data "https://github.com/hlidmhkust/vccib/blob/main/data/mnist_module.py"
click node_open_data "https://github.com/hlidmhkust/vccib/blob/main/data/open_set_data_loader.py"
click node_transforms "https://github.com/hlidmhkust/vccib/blob/main/data/data_transforms.py"
click node_datasets "https://github.com/hlidmhkust/vccib/blob/main/data/datasets.py"
click node_inversion "https://github.com/hlidmhkust/vccib/blob/main/data/invert.py"
click node_vae "https://github.com/hlidmhkust/vccib/blob/main/models/vae.py"
click node_vae_semantic "https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic.py"
click node_vae_jscc "https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_JSCC.py"
click node_vae_vib "https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_VIB.py"
click node_vae_temporal "https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_temp.py"
click node_vae_position "https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_temp_change_position.py"
click node_vae_earlyexit "https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_temp_earlyexit.py"
click node_vae_encoder "https://github.com/hlidmhkust/vccib/blob/main/models/resnet_encoders_semantic_temp.py"
click node_autoencoder "https://github.com/hlidmhkust/vccib/blob/main/models/mnist_ae.py"
click node_decoder_encoder "https://github.com/hlidmhkust/vccib/blob/main/models/decoders_encoders.py"
click node_densenet "https://github.com/hlidmhkust/vccib/blob/main/models/densenet.py"
click node_vgg "https://github.com/hlidmhkust/vccib/blob/main/models/vgg.py"
click node_wide_resnet "https://github.com/hlidmhkust/vccib/blob/main/models/wide_resnet.py"
click node_supcon "https://github.com/hlidmhkust/vccib/blob/main/losses/losses.py"
click node_mmd "https://github.com/hlidmhkust/vccib/blob/main/losses/mmd.py"
click node_triplet "https://github.com/hlidmhkust/vccib/blob/main/losses/modded_triplets.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_standard_runs,node_semantic_runs,node_jscc_runs,node_vib_runs,node_temporal_runs,node_position_runs,node_earlyexit_runs toneBlue
class node_mnist_data,node_open_data,node_transforms,node_datasets,node_inversion toneAmber
class node_vae,node_vae_semantic,node_vae_jscc,node_vae_vib,node_vae_temporal,node_vae_position,node_vae_earlyexit toneMint
class node_vae_encoder,node_autoencoder,node_decoder_encoder,node_densenet,node_vgg,node_wide_resnet,node_supcon,node_mmd,node_triplet toneRose
class node_user toneIndigo
```

## Components

### Experiment workflow

- [Standard runs](https://github.com/hlidmhkust/vccib/blob/main/main.py): `main.py`
- [Semantic runs](https://github.com/hlidmhkust/vccib/blob/main/main_semantic.py): `main_semantic.py`
- [JSCC runs](https://github.com/hlidmhkust/vccib/blob/main/main_semantic_JSCC.py): `main_semantic_JSCC.py`
- [VIB runs](https://github.com/hlidmhkust/vccib/blob/main/main_semantic_VIB.py): `main_semantic_VIB.py`
- [Temporal runs](https://github.com/hlidmhkust/vccib/blob/main/main_semantic_temp.py): `main_semantic_temp.py`
- [Position runs](https://github.com/hlidmhkust/vccib/blob/main/main_semantic_temp_change_position.py): `main_semantic_temp_change_position.py`
- [Early-exit runs](https://github.com/hlidmhkust/vccib/blob/main/main_semantic_temp_earlyexit.py): `main_semantic_temp_earlyexit.py`

### Data preparation

- [MNIST data module](https://github.com/hlidmhkust/vccib/blob/main/data/mnist_module.py): `data/mnist_module.py`
- [Known/OOD data](https://github.com/hlidmhkust/vccib/blob/main/data/open_set_data_loader.py): `data/open_set_data_loader.py`
- [Data transforms](https://github.com/hlidmhkust/vccib/blob/main/data/data_transforms.py): `data/data_transforms.py`
- [Dataset helpers](https://github.com/hlidmhkust/vccib/blob/main/data/datasets.py): `data/datasets.py`
- [Image inversion](https://github.com/hlidmhkust/vccib/blob/main/data/invert.py): `data/invert.py`

### Communication models

- [VAE model](https://github.com/hlidmhkust/vccib/blob/main/models/vae.py): `models/vae.py`
- [Semantic VAE](https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic.py): `models/vae_semantic.py`
- [Semantic JSCC](https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_JSCC.py): `models/vae_semantic_JSCC.py`
- [Semantic VIB](https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_VIB.py): `models/vae_semantic_VIB.py`
- [Temporal VAE](https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_temp.py): `models/vae_semantic_temp.py`
- [Position variant](https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_temp_change_position.py): `models/vae_semantic_temp_change_position.py`
- [Early-exit model](https://github.com/hlidmhkust/vccib/blob/main/models/vae_semantic_temp_earlyexit.py): `models/vae_semantic_temp_earlyexit.py`

### Model internals

- [ResNet semantic encoder](https://github.com/hlidmhkust/vccib/blob/main/models/resnet_encoders_semantic_temp.py): `models/resnet_encoders_semantic_temp.py`
- [MNIST autoencoder](https://github.com/hlidmhkust/vccib/blob/main/models/mnist_ae.py): `models/mnist_ae.py`
- [Encoder/decoder blocks](https://github.com/hlidmhkust/vccib/blob/main/models/decoders_encoders.py): `models/decoders_encoders.py`
- [DenseNet backbone](https://github.com/hlidmhkust/vccib/blob/main/models/densenet.py): `models/densenet.py`
- [VGG backbone](https://github.com/hlidmhkust/vccib/blob/main/models/vgg.py): `models/vgg.py`
- [Wide ResNet backbone](https://github.com/hlidmhkust/vccib/blob/main/models/wide_resnet.py): `models/wide_resnet.py`
- [Supervised contrastive loss](https://github.com/hlidmhkust/vccib/blob/main/losses/losses.py): `losses/losses.py`
- [MMD loss](https://github.com/hlidmhkust/vccib/blob/main/losses/mmd.py): `losses/mmd.py`
- [Triplet loss](https://github.com/hlidmhkust/vccib/blob/main/losses/modded_triplets.py): `losses/modded_triplets.py`

### Other components

- **Researcher**

## Connections

- Researcher → Standard runs: configures (evidence: `main.py`)
- Researcher → Semantic runs: configures (evidence: `main_semantic.py`)
- Researcher → JSCC runs: configures (evidence: `main_semantic_JSCC.py`)
- Researcher → VIB runs: configures (evidence: `main_semantic_VIB.py`)
- Researcher → Temporal runs: configures (evidence: `main_semantic_temp.py`)
- Researcher → Position runs: configures (evidence: `main_semantic_temp_change_position.py`)
- Researcher → Early-exit runs: configures (evidence: `main_semantic_temp_earlyexit.py`)
- Standard runs → MNIST data module: sets up (evidence: `main.py`)
- Standard runs → Known/OOD data: sets up (evidence: `main.py`)
- Standard runs → VAE model: trains/evaluates (evidence: `main.py`)
- Semantic runs → MNIST data module: sets up (evidence: `main_semantic.py`)
- Semantic runs → Known/OOD data: sets up (evidence: `main_semantic.py`)
- Semantic runs → Semantic VAE: trains/evaluates (evidence: `main_semantic.py`)
- JSCC runs → MNIST data module: sets up (evidence: `main_semantic_JSCC.py`)
- JSCC runs → Known/OOD data: sets up (evidence: `main_semantic_JSCC.py`)
- JSCC runs → Semantic JSCC: trains/evaluates (evidence: `main_semantic_JSCC.py`)
- VIB runs → MNIST data module: sets up (evidence: `main_semantic_VIB.py`)
- VIB runs → Known/OOD data: sets up (evidence: `main_semantic_VIB.py`)
- VIB runs → Semantic VIB: trains/evaluates (evidence: `main_semantic_VIB.py`)
- Temporal runs → MNIST data module: sets up (evidence: `main_semantic_temp.py`)
- Temporal runs → Known/OOD data: sets up (evidence: `main_semantic_temp.py`)
- Temporal runs → Temporal VAE: trains/evaluates (evidence: `main_semantic_temp.py`)
- Position runs → MNIST data module: sets up (evidence: `main_semantic_temp_change_position.py`)
- Position runs → Known/OOD data: sets up (evidence: `main_semantic_temp_change_position.py`)
- Position runs → Position variant: trains/evaluates (evidence: `main_semantic_temp_change_position.py`)
- Early-exit runs → MNIST data module: sets up (evidence: `main_semantic_temp_earlyexit.py`)
- Early-exit runs → Known/OOD data: sets up (evidence: `main_semantic_temp_earlyexit.py`)
- Early-exit runs → Early-exit model: trains/evaluates (evidence: `main_semantic_temp_earlyexit.py`)
- Known/OOD data → Data transforms: uses (evidence: `data/open_set_data_loader.py`)
- Known/OOD data → Dataset helpers: uses (evidence: `data/open_set_data_loader.py`)
- Known/OOD data → Image inversion: uses (evidence: `data/open_set_data_loader.py`)
- VAE model → MNIST autoencoder: references (evidence: `models/vae.py`)
- VAE model → Encoder/decoder blocks: references (evidence: `models/vae.py`)
- VAE model → DenseNet backbone: references (evidence: `models/vae.py`)
- VAE model → VGG backbone: references (evidence: `models/vae.py`)
- VAE model → Wide ResNet backbone: references (evidence: `models/vae.py`)
- VAE model → Supervised contrastive loss: references (evidence: `models/vae.py`)
- VAE model → MMD loss: references (evidence: `models/vae.py`)
- VAE model → Triplet loss: references (evidence: `models/vae.py`)
- Semantic VAE → ResNet semantic encoder: references (evidence: `models/vae_semantic.py`)
- Semantic VAE → Triplet loss: references (evidence: `models/vae_semantic.py`)
- Semantic VAE → Supervised contrastive loss: references (evidence: `models/vae_semantic.py`)
- Semantic VAE → MMD loss: references (evidence: `models/vae_semantic.py`)
- Semantic JSCC → ResNet semantic encoder: references (evidence: `models/vae_semantic_JSCC.py`)
- Semantic JSCC → Triplet loss: references (evidence: `models/vae_semantic_JSCC.py`)
- Semantic VIB → ResNet semantic encoder: references (evidence: `models/vae_semantic_VIB.py`)
- Semantic VIB → Triplet loss: references (evidence: `models/vae_semantic_VIB.py`)
- Temporal VAE → ResNet semantic encoder: uses (evidence: `models/vae_semantic_temp.py`)
