# yongchoooon/dalda architecture

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

- Interactive diagram: https://gitdiagram.com/yongchoooon/dalda
- Repository: https://github.com/yongchoooon/dalda

## Overview

DALDA is a few-shot image-classification augmentation framework: it uses LLM-written semantic prompts and real images as visual guidance for diffusion-generated training examples, then trains and evaluates a classifier. The main workflow is configured experiments, dataset sampling, synthetic-image generation, mixed real/synthetic training, and validation. The graph also includes the separate prompt-generation capability and the three supported datasets. Some runtime details are unsampled; edges are limited to source excerpts or README-documented relationships.

Main entry points: [`train_classifier.py`](https://github.com/yongchoooon/dalda/blob/main/train_classifier.py) (Training workflow), [`generate_prompt_by_LLM.py`](https://github.com/yongchoooon/dalda/blob/main/generate_prompt_by_LLM.py) (LLM prompt generator), [`semantic_aug/augmentations/dalda.py`](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/augmentations/dalda.py) (DALDA augmentation), [`semantic_aug/few_shot_dataset.py`](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/few_shot_dataset.py) (Few-shot dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prompting["Prompt authoring"]
  node_prompt_script["LLM prompt generator"]
  node_prompt_templates["Prompt templates"]
  node_azure{{"Azure OpenAI"}}
end

subgraph group_data["Few-shot data"]
  node_pets["Oxford Pets data<br/>[pets.py]"]
  node_flowers["Flowers102 data<br/>[flowers102.py]"]
  node_caltech["Caltech101 data<br/>[caltech101.py]"]
  node_fewshot["Few-shot dataset"]
  node_synthetic_data["Synthetic examples"]
end

subgraph group_generation["DALDA generation"]
  node_augmentation_contract["Augmentation interface"]
  node_dalda["DALDA augmentation<br/>[dalda.py]"]
  node_diffusion["Diffusion synthesis<br/>[dalda.py]"]
  node_clip_scoring["CLIP guidance scoring<br/>[dalda.py]"]
end

subgraph group_learning["Classifier training"]
  node_config["Experiment settings"]
  node_trainer["Training workflow"]
  node_classifier["Classifier model"]
  node_results["Evaluation records"]
end

node_user(("Experimenter"))

node_user -->|"generates prompts"| node_prompt_script
node_prompt_templates -->|"provides templates"| node_prompt_script
node_prompt_script -->|"requests completions"| node_azure
node_prompt_script -->|"gets class names"| node_pets
node_prompt_script -->|"gets class names"| node_flowers
node_prompt_script -->|"gets class names"| node_caltech
node_user -->|"runs experiment"| node_trainer
node_config -->|"configures"| node_trainer
node_trainer -->|"selects dataset"| node_pets
node_trainer -->|"selects dataset"| node_flowers
node_trainer -->|"selects dataset"| node_caltech
node_pets -->|"extends"| node_fewshot
node_flowers -->|"extends"| node_fewshot
node_caltech -->|"extends"| node_fewshot
node_trainer -->|"instantiates"| node_dalda
node_dalda -->|"implements"| node_augmentation_contract
node_fewshot -->|"generates examples"| node_dalda
node_dalda -.->|"synthesizes images"| node_diffusion
node_dalda -->|"scores guidance"| node_clip_scoring
node_fewshot -->|"saves examples"| node_synthetic_data
node_trainer -->|"trains model"| node_classifier
node_trainer -->|"records metrics"| node_results

click node_config "https://github.com/yongchoooon/dalda/tree/main/configs"
click node_prompt_script "https://github.com/yongchoooon/dalda/blob/main/generate_prompt_by_LLM.py"
click node_prompt_templates "https://github.com/yongchoooon/dalda/tree/main/prompt_for_LLM"
click node_pets "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/datasets/pets.py"
click node_flowers "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/datasets/flowers102.py"
click node_caltech "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/datasets/caltech101.py"
click node_fewshot "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/few_shot_dataset.py"
click node_augmentation_contract "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/generative_augmentation.py"
click node_dalda "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/augmentations/dalda.py"
click node_diffusion "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/augmentations/dalda.py"
click node_clip_scoring "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/augmentations/dalda.py"
click node_synthetic_data "https://github.com/yongchoooon/dalda/blob/main/semantic_aug/few_shot_dataset.py"
click node_trainer "https://github.com/yongchoooon/dalda/blob/main/train_classifier.py"
click node_classifier "https://github.com/yongchoooon/dalda/blob/main/train_classifier.py"
click node_results "https://github.com/yongchoooon/dalda/blob/main/train_classifier.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_prompt_script,node_prompt_templates,node_azure toneBlue
class node_pets,node_flowers,node_caltech,node_fewshot,node_synthetic_data toneAmber
class node_augmentation_contract,node_dalda,node_diffusion,node_clip_scoring toneMint
class node_config,node_trainer,node_classifier,node_results toneRose
class node_user toneIndigo
```

## Components

### Prompt authoring

- [LLM prompt generator](https://github.com/yongchoooon/dalda/blob/main/generate_prompt_by_LLM.py): `generate_prompt_by_LLM.py`
- [Prompt templates](https://github.com/yongchoooon/dalda/tree/main/prompt_for_LLM): `prompt_for_LLM`
- **Azure OpenAI**

### Few-shot data

- [Oxford Pets data](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/datasets/pets.py): `semantic_aug/datasets/pets.py`
- [Flowers102 data](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/datasets/flowers102.py): `semantic_aug/datasets/flowers102.py`
- [Caltech101 data](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/datasets/caltech101.py): `semantic_aug/datasets/caltech101.py`
- [Few-shot dataset](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/few_shot_dataset.py): `semantic_aug/few_shot_dataset.py`
- [Synthetic examples](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/few_shot_dataset.py): `semantic_aug/few_shot_dataset.py`

### DALDA generation

- [Augmentation interface](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/generative_augmentation.py): `semantic_aug/generative_augmentation.py`
- [DALDA augmentation](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/augmentations/dalda.py): `semantic_aug/augmentations/dalda.py`
- [Diffusion synthesis](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/augmentations/dalda.py): `semantic_aug/augmentations/dalda.py`
- [CLIP guidance scoring](https://github.com/yongchoooon/dalda/blob/main/semantic_aug/augmentations/dalda.py): `semantic_aug/augmentations/dalda.py`

### Classifier training

- [Experiment settings](https://github.com/yongchoooon/dalda/tree/main/configs): `configs`
- [Training workflow](https://github.com/yongchoooon/dalda/blob/main/train_classifier.py): `train_classifier.py`
- [Classifier model](https://github.com/yongchoooon/dalda/blob/main/train_classifier.py): `train_classifier.py`
- [Evaluation records](https://github.com/yongchoooon/dalda/blob/main/train_classifier.py): `train_classifier.py`

### Other components

- **Experimenter**

## Connections

- Experimenter → LLM prompt generator: generates prompts (evidence: `README.md`)
- Prompt templates → LLM prompt generator: provides templates (evidence: `generate_prompt_by_LLM.py`)
- LLM prompt generator → Azure OpenAI: requests completions (evidence: `generate_prompt_by_LLM.py`)
- LLM prompt generator → Oxford Pets data: gets class names (evidence: `generate_prompt_by_LLM.py`)
- LLM prompt generator → Flowers102 data: gets class names (evidence: `generate_prompt_by_LLM.py`)
- LLM prompt generator → Caltech101 data: gets class names (evidence: `generate_prompt_by_LLM.py`)
- Experimenter → Training workflow: runs experiment (evidence: `README.md`)
- Experiment settings → Training workflow: configures (evidence: `README.md`)
- Training workflow → Oxford Pets data: selects dataset (evidence: `train_classifier.py`)
- Training workflow → Flowers102 data: selects dataset (evidence: `train_classifier.py`)
- Training workflow → Caltech101 data: selects dataset (evidence: `train_classifier.py`)
- Oxford Pets data → Few-shot dataset: extends (evidence: `semantic_aug/datasets/pets.py`)
- Flowers102 data → Few-shot dataset: extends (evidence: `semantic_aug/datasets/flowers102.py`)
- Caltech101 data → Few-shot dataset: extends (evidence: `semantic_aug/datasets/caltech101.py`)
- Training workflow → DALDA augmentation: instantiates (evidence: `train_classifier.py`)
- DALDA augmentation → Augmentation interface: implements (evidence: `semantic_aug/augmentations/dalda.py`)
- Few-shot dataset → DALDA augmentation: generates examples (evidence: `semantic_aug/few_shot_dataset.py`)
- DALDA augmentation → Diffusion synthesis: synthesizes images (evidence: `semantic_aug/augmentations/dalda.py`)
- DALDA augmentation → CLIP guidance scoring: scores guidance (evidence: `semantic_aug/augmentations/dalda.py`)
- Few-shot dataset → Synthetic examples: saves examples (evidence: `semantic_aug/few_shot_dataset.py`)
- Training workflow → Classifier model: trains model (evidence: `train_classifier.py`)
- Training workflow → Evaluation records: records metrics (evidence: `train_classifier.py`)
