# flame-chasers/gtr architecture

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

- Interactive diagram: https://gitdiagram.com/flame-chasers/gtr
- Repository: https://github.com/flame-chasers/gtr

## Overview

GTR+ trains unsupervised text-based person-search models from generated pseudo descriptions, then evaluates image–text retrieval on person-search benchmarks. The README documents three-tier description generation, confidence-weighted learning, and LargeFine-Person pretraining; the graph preserves these stages and the BLIP/vision-language internals. Some dataset and filtering implementations were not excerpted, so their detailed interactions are omitted; documented workflow edges use the README as evidence.

Main entry points: [`train_ps.py`](https://github.com/flame-chasers/gtr/blob/master/train_ps.py) (Confidence-weighted training), [`data/__init__.py`](https://github.com/flame-chasers/gtr/blob/master/data/__init__.py) (Dataset and loader factory), [`models/blip.py`](https://github.com/flame-chasers/gtr/blob/master/models/blip.py) (BLIP vision-language), [`ps_filter.py`](https://github.com/flame-chasers/gtr/blob/master/ps_filter.py) (Description generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_pretrain_data["LargeFine pretraining data"]
  node_person_data["Person-search datasets<br/>[ps_dataset.py]"]
  node_dataset_factory["Dataset and loader factory<br/>[__init__.py]"]
end

subgraph group_pseudo["Pseudo supervision"]
  node_pseudo_gen["Description generation<br/>[ps_filter.py]"]
  node_filter_data["Filter datasets"]
end

subgraph group_learning["Model learning"]
  node_pretrain["Pseudo-supervised pretraining<br/>[pretrain_ps.py]"]
  node_train["Confidence-weighted training<br/>[train_ps.py]"]
  node_eval["Retrieval evaluation<br/>[train_ps.py]"]
  node_retrieval_model["GMM retrieval model<br/>[blip_ps_gmm.py]"]
  node_retrieval_base["Person-search model<br/>[blip_ps.py]"]
end

subgraph group_runtime["Model internals"]
  node_blip["BLIP vision-language<br/>[blip.py]"]
  node_vision["Vision transformer<br/>[vit.py]"]
  node_text["Text encoder<br/>[med.py]"]
end

node_researcher(("Researcher"))
node_retrieval_result["Ranked person matches"]

node_researcher -->|"generates descriptions"| node_pseudo_gen
node_pseudo_gen -.->|"uses filtered data"| node_filter_data
node_pseudo_gen -->|"creates pseudo supervision"| node_pretrain_data
node_researcher -->|"starts pretraining"| node_pretrain
node_researcher -->|"starts training"| node_train
node_pretrain -->|"loads datasets"| node_dataset_factory
node_train -->|"loads datasets"| node_dataset_factory
node_dataset_factory -->|"selects dataset"| node_pretrain_data
node_dataset_factory -->|"selects dataset"| node_person_data
node_pretrain -->|"trains model"| node_retrieval_base
node_train -->|"trains model"| node_retrieval_model
node_eval -->|"evaluates model"| node_retrieval_model
node_train -->|"runs evaluation"| node_eval
node_eval -->|"produces rankings"| node_retrieval_result
node_retrieval_model -->|"builds on BLIP"| node_blip
node_retrieval_base -->|"builds on BLIP"| node_blip
node_blip -->|"creates vision encoder"| node_vision
node_blip -->|"creates text encoder"| node_text

click node_pseudo_gen "https://github.com/flame-chasers/gtr/blob/master/ps_filter.py"
click node_filter_data "https://github.com/flame-chasers/gtr/blob/master/data/ps_filter_dataset.py"
click node_pretrain_data "https://github.com/flame-chasers/gtr/blob/master/data/ps_pretrain_dataset.py"
click node_person_data "https://github.com/flame-chasers/gtr/blob/master/data/ps_dataset.py"
click node_dataset_factory "https://github.com/flame-chasers/gtr/blob/master/data/__init__.py"
click node_pretrain "https://github.com/flame-chasers/gtr/blob/master/pretrain_ps.py"
click node_train "https://github.com/flame-chasers/gtr/blob/master/train_ps.py"
click node_eval "https://github.com/flame-chasers/gtr/blob/master/train_ps.py"
click node_retrieval_model "https://github.com/flame-chasers/gtr/blob/master/models/blip_ps_gmm.py"
click node_retrieval_base "https://github.com/flame-chasers/gtr/blob/master/models/blip_ps.py"
click node_blip "https://github.com/flame-chasers/gtr/blob/master/models/blip.py"
click node_vision "https://github.com/flame-chasers/gtr/blob/master/models/vit.py"
click node_text "https://github.com/flame-chasers/gtr/blob/master/models/med.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_pretrain_data,node_person_data,node_dataset_factory toneBlue
class node_pseudo_gen,node_filter_data toneAmber
class node_pretrain,node_train,node_eval,node_retrieval_model,node_retrieval_base toneMint
class node_blip,node_vision,node_text toneRose
class node_researcher,node_retrieval_result toneIndigo
```

## Components

### Data preparation

- [LargeFine pretraining data](https://github.com/flame-chasers/gtr/blob/master/data/ps_pretrain_dataset.py): `data/ps_pretrain_dataset.py`
- [Person-search datasets](https://github.com/flame-chasers/gtr/blob/master/data/ps_dataset.py): `data/ps_dataset.py`
- [Dataset and loader factory](https://github.com/flame-chasers/gtr/blob/master/data/__init__.py): `data/__init__.py`

### Pseudo supervision

- [Description generation](https://github.com/flame-chasers/gtr/blob/master/ps_filter.py): `ps_filter.py`
- [Filter datasets](https://github.com/flame-chasers/gtr/blob/master/data/ps_filter_dataset.py): `data/ps_filter_dataset.py`

### Model learning

- [Pseudo-supervised pretraining](https://github.com/flame-chasers/gtr/blob/master/pretrain_ps.py): `pretrain_ps.py`
- [Confidence-weighted training](https://github.com/flame-chasers/gtr/blob/master/train_ps.py): `train_ps.py`
- [Retrieval evaluation](https://github.com/flame-chasers/gtr/blob/master/train_ps.py): `train_ps.py`
- [GMM retrieval model](https://github.com/flame-chasers/gtr/blob/master/models/blip_ps_gmm.py): `models/blip_ps_gmm.py`
- [Person-search model](https://github.com/flame-chasers/gtr/blob/master/models/blip_ps.py): `models/blip_ps.py`

### Model internals

- [BLIP vision-language](https://github.com/flame-chasers/gtr/blob/master/models/blip.py): `models/blip.py`
- [Vision transformer](https://github.com/flame-chasers/gtr/blob/master/models/vit.py): `models/vit.py`
- [Text encoder](https://github.com/flame-chasers/gtr/blob/master/models/med.py): `models/med.py`

### Other components

- **Researcher**
- **Ranked person matches**

## Connections

- Researcher → Description generation: generates descriptions (evidence: `README.md`)
- Description generation → Filter datasets: uses filtered data
- Description generation → LargeFine pretraining data: creates pseudo supervision (evidence: `README.md`)
- Researcher → Pseudo-supervised pretraining: starts pretraining (evidence: `README.md`)
- Researcher → Confidence-weighted training: starts training (evidence: `README.md`)
- Pseudo-supervised pretraining → Dataset and loader factory: loads datasets (evidence: `pretrain_ps.py`)
- Confidence-weighted training → Dataset and loader factory: loads datasets (evidence: `train_ps.py`)
- Dataset and loader factory → LargeFine pretraining data: selects dataset (evidence: `data/__init__.py`)
- Dataset and loader factory → Person-search datasets: selects dataset (evidence: `data/__init__.py`)
- Pseudo-supervised pretraining → Person-search model: trains model (evidence: `pretrain_ps.py`)
- Confidence-weighted training → GMM retrieval model: trains model (evidence: `train_ps.py`)
- Retrieval evaluation → GMM retrieval model: evaluates model (evidence: `train_ps.py`)
- Confidence-weighted training → Retrieval evaluation: runs evaluation (evidence: `README.md`)
- Retrieval evaluation → Ranked person matches: produces rankings (evidence: `README.md`)
- GMM retrieval model → BLIP vision-language: builds on BLIP (evidence: `models/blip_ps_gmm.py`)
- Person-search model → BLIP vision-language: builds on BLIP (evidence: `models/blip_ps.py`)
- BLIP vision-language → Vision transformer: creates vision encoder (evidence: `models/blip.py`)
- BLIP vision-language → Text encoder: creates text encoder (evidence: `models/blip.py`)
