File size: 1,602 Bytes
f211247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
"""#6 Diffusion-based augmentation for rare signs.

Reference: DA-Fusion (Trabucco 2023); DiffuseMix (Islam 2024 CVPR);
Flux.1-dev (BFL 2024).

Strategy for rare classes (<10 sample):
1. Gerçek örneklerden ControlNet LoRA fine-tune
2. "relief + clay texture" synthesis
3. Expert review (quality control zorunlu)
"""
import json
from pathlib import Path

ROOT = Path("/arf/scratch/stakan/hitit-proje")

RECIPE = {
    "name": "Diffusion augmentation — rare cuneiform sign synthesis",
    "method": "ControlNet LoRA on Flux.1-dev or SD3",
    "target": "Rare signs (class_sample_count < 10 in hitit_local)",
    "strategy": [
        "1. Gerçek örneklerden sign-specific ControlNet LoRA eğit (3-5 sample yeter)",
        "2. Conditioning: edge map + depth (MaiCuBeDa 3D render'dan)",
        "3. Generate: relief + clay texture + lighting variation",
        "4. Expert paleographer review (accept/reject loop)",
        "5. Manifest'e synthetic=True flag"
    ],
    "expected_gain": "+0.2-0.5% (tail tier improvement)",
    "caveats": [
        "Diffusion kolay hallucinate eder → yanlış stroke riski",
        "Sadece in-distribution noise/lighting, yeni sign sentezi DEĞİL",
        "Expert review zorunlu"
    ],
    "gpu_hours": 100,
    "status": "recipe-only (implementation in diffusion_synthetic_runbook.md)"
}

def main():
    out = ROOT / "datasets/processed/diffusion_aug_recipe.json"
    with open(out, 'w') as f:
        json.dump(RECIPE, f, indent=2, ensure_ascii=False)
    print(f"Diffusion aug recipe: {out}")

if __name__ == '__main__':
    main()