# tqwei05/mvpdr architecture

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

- Interactive diagram: https://gitdiagram.com/tqwei05/mvpdr
- Repository: https://github.com/tqwei05/mvpdr

## Overview

MVPDR is a research benchmark and few-shot multimodal plant-disease recognition baseline. The documented workflow is to select a dataset/configuration, train the baseline, and evaluate recognition performance. The graph preserves the three supported datasets and the text-prompt and CLIP branches; sampled excerpts do not expose all of main.py’s setup and dispatch logic, so uncertain wiring is omitted.

Main entry points: [`main.py`](https://github.com/tqwei05/mvpdr/blob/main/main.py) (Experiment runner), [`datasets/__init__.py`](https://github.com/tqwei05/mvpdr/blob/main/datasets/__init__.py) (Dataset registry), [`utils.py`](https://github.com/tqwei05/mvpdr/blob/main/utils.py) (Model utilities), [`datasets/plantwild.py`](https://github.com/tqwei05/mvpdr/blob/main/datasets/plantwild.py) (PlantWild loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Experiment workflow"]
  node_main["Experiment runner<br/>[main.py]"]
  node_configs["Dataset configs"]
end

subgraph group_data["Datasets and prompts"]
  node_datasets["Dataset registry<br/>[__init__.py]"]
  node_plantwild["PlantWild loader<br/>[plantwild.py]"]
  node_plantdoc["PlantDoc loader<br/>[plantdoc.py]"]
  node_plantvillage["PlantVillage loader<br/>[plantvillage.py]"]
  node_datasetutils["Dataset utilities<br/>[utils.py]"]
  node_promptfiles["Disease prompts"]
end

subgraph group_model["Multimodal modeling"]
  node_utils["Model utilities<br/>[utils.py]"]
  node_tokenizer["BPE tokenizer"]
  node_clipapi["CLIP API<br/>[clip.py]"]
  node_clipmodel["CLIP encoders<br/>[model.py]"]
  node_adapter["Visual adapter<br/>[main.py]"]
  node_promptadapter["Prompt adapter<br/>[main.py]"]
end

subgraph group_evaluation["Training and evaluation"]
  node_trainer["Baseline training<br/>[main.py]"]
  node_metrics["Recognition metrics<br/>[utils.py]"]
  node_checkpoints[("Adapter checkpoints<br/>[main.py]")]
  node_results["Evaluation results<br/>[main.py]"]
end

node_user(("Experimenter"))
node_images[("Plant image data")]
node_clipweights[("CLIP weights")]

node_user -->|"runs"| node_main
node_main -->|"reads config"| node_configs
node_main -->|"builds dataset"| node_datasets
node_datasets -->|"dispatches"| node_plantwild
node_datasets -->|"dispatches"| node_plantdoc
node_datasets -->|"dispatches"| node_plantvillage
node_plantwild -->|"uses"| node_datasetutils
node_plantdoc -->|"uses"| node_datasetutils
node_plantvillage -->|"uses"| node_datasetutils
node_images -->|"provides images"| node_plantwild
node_images -->|"provides images"| node_plantdoc
node_images -->|"provides images"| node_plantvillage
node_main -->|"uses"| node_utils
node_promptfiles -->|"provides prompts"| node_utils
node_utils -->|"tokenizes text"| node_tokenizer
node_utils -->|"encodes prompts"| node_clipmodel
node_main -->|"loads CLIP"| node_clipapi
node_clipapi -->|"builds model"| node_clipmodel
node_clipweights -.->|"provides weights"| node_clipapi
node_main -->|"trains and evaluates"| node_trainer
node_trainer -->|"updates"| node_adapter
node_trainer -->|"updates"| node_promptadapter
node_trainer -->|"scores predictions"| node_metrics
node_trainer -->|"saves and loads"| node_checkpoints
node_trainer -->|"reports metrics"| node_results

click node_main "https://github.com/tqwei05/mvpdr/blob/main/main.py"
click node_configs "https://github.com/tqwei05/mvpdr/tree/main/configs"
click node_datasets "https://github.com/tqwei05/mvpdr/blob/main/datasets/__init__.py"
click node_plantwild "https://github.com/tqwei05/mvpdr/blob/main/datasets/plantwild.py"
click node_plantdoc "https://github.com/tqwei05/mvpdr/blob/main/datasets/plantdoc.py"
click node_plantvillage "https://github.com/tqwei05/mvpdr/blob/main/datasets/plantvillage.py"
click node_datasetutils "https://github.com/tqwei05/mvpdr/blob/main/datasets/utils.py"
click node_promptfiles "https://github.com/tqwei05/mvpdr/tree/main/gpt_files_plt44"
click node_utils "https://github.com/tqwei05/mvpdr/blob/main/utils.py"
click node_tokenizer "https://github.com/tqwei05/mvpdr/blob/main/clip/simple_tokenizer.py"
click node_clipapi "https://github.com/tqwei05/mvpdr/blob/main/clip/clip.py"
click node_clipmodel "https://github.com/tqwei05/mvpdr/blob/main/clip/model.py"
click node_adapter "https://github.com/tqwei05/mvpdr/blob/main/main.py"
click node_promptadapter "https://github.com/tqwei05/mvpdr/blob/main/main.py"
click node_trainer "https://github.com/tqwei05/mvpdr/blob/main/main.py"
click node_metrics "https://github.com/tqwei05/mvpdr/blob/main/utils.py"
click node_checkpoints "https://github.com/tqwei05/mvpdr/blob/main/main.py"
click node_results "https://github.com/tqwei05/mvpdr/blob/main/main.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_main,node_configs toneBlue
class node_datasets,node_plantwild,node_plantdoc,node_plantvillage,node_datasetutils,node_promptfiles,node_images,node_clipweights toneAmber
class node_utils,node_tokenizer,node_clipapi,node_clipmodel,node_adapter,node_promptadapter toneMint
class node_trainer,node_metrics,node_checkpoints,node_results toneRose
class node_user toneIndigo
```

## Components

### Experiment workflow

- [Experiment runner](https://github.com/tqwei05/mvpdr/blob/main/main.py): `main.py`
- [Dataset configs](https://github.com/tqwei05/mvpdr/tree/main/configs): `configs`

### Datasets and prompts

- [Dataset registry](https://github.com/tqwei05/mvpdr/blob/main/datasets/__init__.py): `datasets/__init__.py`
- [PlantWild loader](https://github.com/tqwei05/mvpdr/blob/main/datasets/plantwild.py): `datasets/plantwild.py`
- [PlantDoc loader](https://github.com/tqwei05/mvpdr/blob/main/datasets/plantdoc.py): `datasets/plantdoc.py`
- [PlantVillage loader](https://github.com/tqwei05/mvpdr/blob/main/datasets/plantvillage.py): `datasets/plantvillage.py`
- [Dataset utilities](https://github.com/tqwei05/mvpdr/blob/main/datasets/utils.py): `datasets/utils.py`
- [Disease prompts](https://github.com/tqwei05/mvpdr/tree/main/gpt_files_plt44): `gpt_files_plt44`

### Multimodal modeling

- [Model utilities](https://github.com/tqwei05/mvpdr/blob/main/utils.py): `utils.py`
- [BPE tokenizer](https://github.com/tqwei05/mvpdr/blob/main/clip/simple_tokenizer.py): `clip/simple_tokenizer.py`
- [CLIP API](https://github.com/tqwei05/mvpdr/blob/main/clip/clip.py): `clip/clip.py`
- [CLIP encoders](https://github.com/tqwei05/mvpdr/blob/main/clip/model.py): `clip/model.py`
- [Visual adapter](https://github.com/tqwei05/mvpdr/blob/main/main.py): `main.py`
- [Prompt adapter](https://github.com/tqwei05/mvpdr/blob/main/main.py): `main.py`

### Training and evaluation

- [Baseline training](https://github.com/tqwei05/mvpdr/blob/main/main.py): `main.py`
- [Recognition metrics](https://github.com/tqwei05/mvpdr/blob/main/utils.py): `utils.py`
- [Adapter checkpoints](https://github.com/tqwei05/mvpdr/blob/main/main.py): `main.py`
- [Evaluation results](https://github.com/tqwei05/mvpdr/blob/main/main.py): `main.py`

### Other components

- **Experimenter**
- **Plant image data**
- **CLIP weights**

## Connections

- Experimenter → Experiment runner: runs
- Experiment runner → Dataset configs: reads config
- Experiment runner → Dataset registry: builds dataset
- Dataset registry → PlantWild loader: dispatches
- Dataset registry → PlantDoc loader: dispatches
- Dataset registry → PlantVillage loader: dispatches
- PlantWild loader → Dataset utilities: uses
- PlantDoc loader → Dataset utilities: uses
- PlantVillage loader → Dataset utilities: uses
- Plant image data → PlantWild loader: provides images
- Plant image data → PlantDoc loader: provides images
- Plant image data → PlantVillage loader: provides images
- Experiment runner → Model utilities: uses
- Disease prompts → Model utilities: provides prompts
- Model utilities → BPE tokenizer: tokenizes text
- Model utilities → CLIP encoders: encodes prompts
- Experiment runner → CLIP API: loads CLIP
- CLIP API → CLIP encoders: builds model
- CLIP weights → CLIP API: provides weights
- Experiment runner → Baseline training: trains and evaluates
- Baseline training → Visual adapter: updates
- Baseline training → Prompt adapter: updates
- Baseline training → Recognition metrics: scores predictions
- Baseline training → Adapter checkpoints: saves and loads
- Baseline training → Evaluation results: reports metrics
