File size: 4,490 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# SOTA preprocessing config (v1.0)
# Source: 2024-2026 literature review (cuneiform + historical OCR)
# Applied + recipe-only steps

version: "1.0"
pipeline_hash_algorithm: "sha256"  # config + code version hash

# ========== Quality gating (OFFLINE, filter-only) ==========
quality_gates:
  blur_laplacian_min_variance: 100.0      # Pech-Pacheco 2000
  exposure_mean_min: 20.0                  # min brightness (0-255)
  exposure_mean_max: 235.0                 # max brightness
  contrast_std_min: 15.0                   # min contrast
  resolution_min_w: 32
  resolution_min_h: 32
  policy: "soft_exclude"                   # soft: training'de skip, eval'de tut

# ========== Geometric normalization ==========
geometric:
  letterbox:
    target_size: 224                        # DINOv3 / ResNet standardı
    margin_ratio: 0.10                      # DeepScribe varsayılanı (0.08-0.12)
    fill_mode: "median_border"              # pad color = tablet surface median
  rotation_canonicalization:
    enabled: true
    candidate_angles: [0, 90, 180, 270]    # view-based
    use_view_hint: true                    # tablet_view_fold hint
  deskew:
    enabled: false                          # tablet'ler genelde düz
    
# ========== Image enhancement ==========
enhancement:
  clahe:
    enabled: true
    clip_limit: 2.5                         # 2.0-3.0 arası (Bui/Chkeir 2024)
    tile_grid: [8, 8]
    color_space: "LAB"                      # L-channel on LAB
    conditional: true                       # sadece blur/dark ise
  gamma_correction:
    enabled: true
    gamma: 1.2
    conditional: true
  unsharp_mask:
    enabled: false                          # agresif, detaile zarar verir
  denoising:
    enabled: false                          # NAFNet recipe (offline pre-compute için)
    method: "nafnet"                        # "nafnet" | "nlm" | "bm3d"

# ========== Binarization (auxiliary channel) ==========
binarization:
  enabled: false                            # opsiyonel auxiliary kanal
  method: "sauvola"                         # "sauvola" | "otsu" | "wolf" | "sauvola_dl"
  sauvola:
    window_size: 25
    k: 0.2
    
# ========== Background-aware crop ==========
crop:
  bbox_expansion_ratio: 0.12                # DeepScribe önerisi
  background_fill: "median_border"          # crop dışarı taşarsa
  preserve_aspect_ratio: true

# ========== Normalization (pixel values) ==========
normalization:
  strategy: "dataset_specific"              # "imagenet" | "dataset_specific" | "none"
  mean: null                                # offline pass ile hesaplanacak
  std: null
  channels: 3                               # RGB; 4 ile auxiliary MSII/binarization

# ========== Augmentation (train-time, offline pre-compute değil) ==========
augment_train:
  elastic_transform:
    enabled: true
    alpha: 40.0
    sigma: 6.0
    alpha_affine: 8.0
    p: 0.5
  grid_distortion:
    enabled: true
    num_steps: 5
    distort_limit: 0.15
    p: 0.3
  morphological:
    enabled: true
    ops: ["erode", "dilate"]
    kernel_size: 2
    p: 0.3
  color_jitter:
    enabled: true
    brightness: 0.2
    contrast: 0.2
    saturation: 0.1
    p: 0.5
  horizontal_flip:
    enabled: false                          # sign orientation önemli
  mixup:
    enabled: true                           # tail sınıflar için feature-space
    alpha: 0.5
  cutmix:
    enabled: false                          # bbox context kaybettirir

# ========== Cuneiform-specific (SOTA recipe, offline GPU) ==========
cuneiform_specific:
  msii_proxy:
    enabled: true                           # Multi-scale LoG (cheap alternative)
    sigmas: [1.0, 2.0, 4.0, 8.0]
    channel: "auxiliary"                    # concat RGB ile 4. kanal
  illumination_augment:
    enabled: false                          # Recipe only, Blender/3D gerekir
    n_lights: 8
    method: "blender_render"
  super_resolution:
    enabled: false                          # Real-ESRGAN offline pass
    method: "real_esrgan_x2"
    min_width_threshold: 256

# ========== Cache ==========
cache:
  enabled: true
  format: "webdataset_jpeg"                 # "webdataset_jpeg" | "parquet_bytes"
  jpeg_quality: 90
  shard_size_mb: 1024
  output_dir: "datasets/streaming/preprocessed_224"

# ========== Inference-only ==========
inference:
  tta: false                                # test-time augmentation
  multi_scale: [224, 256, 288]              # multi-scale ensemble
  center_crop: true