Files
IDcardsGenerator/config/config.yaml

149 lines
4.5 KiB
YAML
Raw Permalink Normal View History

2025-08-06 21:44:39 +07:00
# ID Card Data Augmentation Configuration v2.0
# Enhanced configuration with smart sampling, multiplication, and random method combination
2025-08-05 19:09:55 +07:00
# Paths configuration
paths:
2025-08-06 19:03:17 +07:00
input_dir: "data/IDcards/raw/test"
output_dir: "out1"
2025-08-05 19:09:55 +07:00
log_file: "logs/data_augmentation.log"
2025-08-06 21:44:39 +07:00
# Data Sampling and Multiplication Strategy
data_strategy:
# Multiplication/Sampling factor:
# - If < 1.0 (e.g. 0.3): Random sampling 30% of input data to augment
# - If >= 1.0 (e.g. 2.0, 3.0): Multiply dataset size by 2x, 3x etc.
multiplication_factor: 0.3
# Random seed for reproducibility (null = random each run)
random_seed: null
# Sampling strategy for factor < 1.0
sampling:
method: "random" # random, stratified, uniform
preserve_distribution: true # Maintain file type distribution
2025-08-06 20:52:39 +07:00
# ID Card Detection configuration
id_card_detection:
2025-08-06 21:44:39 +07:00
enabled: false # Enable/disable YOLO detection and cropping
model_path: "data/weights/id_cards_yolov8n.pt" # Path to YOLO model
confidence_threshold: 0.25 # Detection confidence threshold
iou_threshold: 0.45 # IoU threshold for NMS
padding: 10 # Extra padding around bounding box
crop_mode: "bbox" # Cropping mode: bbox, square, aspect_ratio
target_size: null # Target size (width, height) or null
save_original_crops: true # Save original cropped images
2025-08-06 20:52:39 +07:00
2025-08-06 21:44:39 +07:00
# Augmentation Strategy - Random Combination of Methods
2025-08-05 19:09:55 +07:00
augmentation:
2025-08-06 21:44:39 +07:00
# Strategy for combining augmentation methods
strategy:
mode: "random_combine" # random_combine, sequential, individual
min_methods: 2 # Minimum methods applied per image
max_methods: 4 # Maximum methods applied per image
allow_duplicates: false # Allow same method multiple times with different params
2025-08-05 21:42:23 +07:00
2025-08-06 21:44:39 +07:00
# Available augmentation methods with selection probabilities
methods:
# Geometric transformations
rotation:
enabled: true
probability: 0.8 # Selection probability for this method
angles: [30, 60, 120, 150, 180, 210, 240, 300, 330]
# Random cropping to simulate partially visible ID cards
random_cropping:
enabled: true
probability: 0.7
ratio_range: [0.7, 1.0]
# Random noise to simulate worn-out ID cards
random_noise:
enabled: true
probability: 0.6
mean_range: [0.0, 0.7]
variance_range: [0.0, 0.1]
# Partial blockage to simulate occluded card details
partial_blockage:
enabled: true
probability: 0.5
num_occlusions_range: [1, 100]
coverage_range: [0.0, 0.25]
variance_range: [0.0, 0.1]
# Blurring to simulate motion blur while keeping readability
blurring:
enabled: true
probability: 0.6
kernel_ratio_range: [0.0, 0.0084]
# Brightness and contrast adjustment for lighting variations
brightness_contrast:
enabled: true
probability: 0.7
alpha_range: [0.4, 3.0]
beta_range: [1, 100]
# Color space transformations
color_jitter:
enabled: true
probability: 0.4
brightness_range: [0.8, 1.2]
contrast_range: [0.8, 1.2]
saturation_range: [0.8, 1.2]
hue_range: [-0.1, 0.1]
# Perspective transformation for viewing angle simulation
perspective:
enabled: false
probability: 0.3
distortion_scale: 0.2
2025-08-05 21:42:23 +07:00
2025-08-06 21:44:39 +07:00
# Final processing (always applied to all outputs)
final_processing:
# Grayscale transformation as final preprocessing step
grayscale:
enabled: true
probability: 1.0 # Always apply to ensure consistency
# Quality enhancement (future feature)
quality_enhancement:
enabled: false
sharpen: 0.1
denoise: false
2025-08-05 19:09:55 +07:00
# Processing configuration
processing:
2025-08-06 21:44:39 +07:00
target_size: [640, 640] # [width, height] - Target resolution
2025-08-05 19:09:55 +07:00
batch_size: 32
save_format: "jpg"
quality: 95
2025-08-06 21:44:39 +07:00
# Advanced processing options
preserve_original: false # Whether to save original images
parallel_processing: true # Enable parallel processing
memory_efficient: true # Optimize memory usage
2025-08-05 19:09:55 +07:00
# Supported image formats
supported_formats:
- ".jpg"
- ".jpeg"
- ".png"
- ".bmp"
- ".tiff"
# Logging configuration
logging:
2025-08-06 21:44:39 +07:00
level: "INFO" # Available levels: DEBUG, INFO, WARNING, ERROR
2025-08-05 19:09:55 +07:00
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
handlers:
- type: "file"
filename: "logs/data_augmentation.log"
- type: "console"
# Performance settings
performance:
2025-08-06 21:44:39 +07:00
num_workers: 4 # Number of parallel workers
prefetch_factor: 2 # Data prefetching factor
pin_memory: true # Pin memory for GPU transfer
use_gpu: false # Enable GPU acceleration