File size: 1,028 Bytes
ada63c0
 
 
 
 
 
322be7d
ada63c0
 
04e423f
 
 
 
6e89f30
 
 
 
 
 
 
 
 
 
 
ada63c0
6e89f30
 
 
 
 
 
 
 
 
ada63c0
 
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
import os
import string
from dataclasses import dataclass

@dataclass
class Config:
    data_root: str = os.getenv("DATA_ROOT","Dataset\captchas")

    chars: str = string.ascii_letters + string.digits
    CAPTCHA_LEN_LOWER_LIMIT: int = 5
    CAPTCHA_LEN_UPPER_LIMIT: int = 7

    RESULT_DIR: str = "Results"
    # Image dimensions - increased for better character detail
    H: int = 60  # Increased from 48 for more vertical detail
    W_max: int = 256  # Increased from 224 for more time steps (T=64)
    grayscale: bool = True
    
    # Model architecture
    total_stride: int = 4  # CNN width downsampling factor
    
    # Training hyperparameters
    batch_size: int = 32  # Local testing
    batch_size_t4: int = 128  # Colab T4 recommendation
    num_workers: int = 4
    amp: bool = True
    
    # Learning rate and optimization
    lr: float = 3e-4
    weight_decay: float = 1e-4
    
    # Training duration
    epochs: int = 40  # For 100k dataset
    epochs_test: int = 10  # For 1k test dataset

cfg = Config()