# rkomtchuente/odir architecture

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

- Interactive diagram: https://gitdiagram.com/rkomtchuente/odir
- Repository: https://github.com/rkomtchuente/odir

## Overview

ODIR is a multi-class fundus-image disease classifier exposed through a FastAPI endpoint. A client submits left- and right-eye images plus age and gender; the service preprocesses these inputs, runs the classifier, and returns eight named probabilities. The model combines separate eye-image feature extractors with an encoded demographic vector. The excerpts show inference and model structure, but not how the checkpoint was trained or how the dataset is used.

Main entry points: [`app.py`](https://github.com/rkomtchuente/odir/blob/main/app.py) (Diagnosis endpoint), [`model.py`](https://github.com/rkomtchuente/odir/blob/main/model.py) (ODIR classifier), [`odir_model.pth`](https://github.com/rkomtchuente/odir/blob/main/odir_model.pth) (Model checkpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Inference service"]
  node_endpoint["Diagnosis endpoint<br/>[app.py]"]
  node_preprocess["Input preprocessing<br/>[app.py]"]
  node_checkpoint["Model checkpoint<br/>[odir_model.pth]"]
  node_diagnosis["Disease probabilities<br/>[app.py]"]
end

subgraph group_model["Classification model"]
  node_classifier["ODIR classifier<br/>[model.py]"]
  node_eye_features["Eye feature extractors<br/>[model.py]"]
  node_attribute_encoder["Attribute encoder<br/>[model.py]"]
  node_fusion_head["Fusion classifier<br/>[model.py]"]
end

node_client(("Image submitter"))

node_client -->|"submits images"| node_endpoint
node_endpoint -->|"preprocesses inputs"| node_preprocess
node_endpoint -->|"loads weights"| node_checkpoint
node_endpoint -->|"runs inference"| node_classifier
node_classifier -->|"extracts features"| node_eye_features
node_classifier -->|"encodes attributes"| node_attribute_encoder
node_classifier -->|"classifies combined features"| node_fusion_head
node_endpoint -->|"returns probabilities"| node_diagnosis

click node_endpoint "https://github.com/rkomtchuente/odir/blob/main/app.py"
click node_preprocess "https://github.com/rkomtchuente/odir/blob/main/app.py"
click node_checkpoint "https://github.com/rkomtchuente/odir/blob/main/odir_model.pth"
click node_classifier "https://github.com/rkomtchuente/odir/blob/main/model.py"
click node_eye_features "https://github.com/rkomtchuente/odir/blob/main/model.py"
click node_attribute_encoder "https://github.com/rkomtchuente/odir/blob/main/model.py"
click node_fusion_head "https://github.com/rkomtchuente/odir/blob/main/model.py"
click node_diagnosis "https://github.com/rkomtchuente/odir/blob/main/app.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_endpoint,node_preprocess,node_checkpoint,node_diagnosis toneBlue
class node_classifier,node_eye_features,node_attribute_encoder,node_fusion_head toneAmber
class node_client toneIndigo
```

## Components

### Inference service

- [Diagnosis endpoint](https://github.com/rkomtchuente/odir/blob/main/app.py): `app.py`
- [Input preprocessing](https://github.com/rkomtchuente/odir/blob/main/app.py): `app.py`
- [Model checkpoint](https://github.com/rkomtchuente/odir/blob/main/odir_model.pth): `odir_model.pth`
- [Disease probabilities](https://github.com/rkomtchuente/odir/blob/main/app.py): `app.py`

### Classification model

- [ODIR classifier](https://github.com/rkomtchuente/odir/blob/main/model.py): `model.py`
- [Eye feature extractors](https://github.com/rkomtchuente/odir/blob/main/model.py): `model.py`
- [Attribute encoder](https://github.com/rkomtchuente/odir/blob/main/model.py): `model.py`
- [Fusion classifier](https://github.com/rkomtchuente/odir/blob/main/model.py): `model.py`

### Other components

- **Image submitter**

## Connections

- Image submitter → Diagnosis endpoint: submits images (evidence: `app.py`)
- Diagnosis endpoint → Input preprocessing: preprocesses inputs (evidence: `app.py`)
- Diagnosis endpoint → Model checkpoint: loads weights (evidence: `app.py`)
- Diagnosis endpoint → ODIR classifier: runs inference (evidence: `app.py`)
- ODIR classifier → Eye feature extractors: extracts features (evidence: `model.py`)
- ODIR classifier → Attribute encoder: encodes attributes (evidence: `model.py`)
- ODIR classifier → Fusion classifier: classifies combined features (evidence: `model.py`)
- Diagnosis endpoint → Disease probabilities: returns probabilities (evidence: `app.py`)
