2025-08-05 19:09:55 +07:00
|
|
|
# Data Augmentation Configuration
|
|
|
|
# Main configuration file for image data augmentation
|
|
|
|
|
|
|
|
# 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 20:52:39 +07:00
|
|
|
# ID Card Detection configuration
|
|
|
|
id_card_detection:
|
|
|
|
enabled: false # Bật/tắt tính năng detect và crop ID cards
|
|
|
|
model_path: "data/weights/id_cards_yolov8n.pt" # Đường dẫn đến YOLO model
|
|
|
|
confidence_threshold: 0.25 # Confidence threshold cho detection
|
|
|
|
iou_threshold: 0.45 # IoU threshold cho NMS
|
|
|
|
padding: 10 # Padding thêm xung quanh bbox
|
|
|
|
crop_mode: "bbox" # Mode cắt: bbox, square, aspect_ratio
|
|
|
|
target_size: null # Kích thước target (width, height) hoặc null
|
|
|
|
save_original_crops: true # Có lưu ảnh gốc đã crop không
|
|
|
|
|
2025-08-05 21:42:23 +07:00
|
|
|
# Data augmentation parameters - ROTATION and RANDOM CROPPING
|
2025-08-05 19:09:55 +07:00
|
|
|
augmentation:
|
2025-08-05 21:42:23 +07:00
|
|
|
# Geometric transformations
|
2025-08-05 19:09:55 +07:00
|
|
|
rotation:
|
|
|
|
enabled: true
|
|
|
|
angles: [30, 60, 120, 150, 180, 210, 240, 300, 330] # Specific rotation angles
|
|
|
|
probability: 1.0 # Always apply rotation
|
2025-08-05 21:42:23 +07:00
|
|
|
|
|
|
|
# Random cropping to simulate partially visible ID cards
|
|
|
|
random_cropping:
|
|
|
|
enabled: true
|
|
|
|
ratio_range: [0.7, 1.0] # Crop ratio range (min, max)
|
|
|
|
probability: 1.0 # Always apply cropping
|
|
|
|
|
|
|
|
# Random noise to simulate worn-out ID cards
|
|
|
|
random_noise:
|
|
|
|
enabled: true
|
|
|
|
mean_range: [0.0, 0.7] # Noise mean range (min, max)
|
|
|
|
variance_range: [0.0, 0.1] # Noise variance range (min, max)
|
|
|
|
probability: 1.0 # Always apply noise
|
|
|
|
|
|
|
|
# Partial blockage to simulate occluded card details
|
|
|
|
partial_blockage:
|
|
|
|
enabled: true
|
|
|
|
num_occlusions_range: [1, 100] # Number of occlusion lines (min, max)
|
|
|
|
coverage_range: [0.0, 0.25] # Coverage ratio (min, max)
|
|
|
|
variance_range: [0.0, 0.1] # Line thickness variance (min, max)
|
|
|
|
probability: 1.0 # Always apply blockage
|
|
|
|
|
|
|
|
# Blurring to simulate blurred card images that are still readable
|
|
|
|
blurring:
|
|
|
|
enabled: true
|
|
|
|
kernel_ratio_range: [0.0, 0.0084] # Kernel ratio range (min, max)
|
|
|
|
probability: 1.0 # Always apply blurring
|
|
|
|
|
|
|
|
# Brightness and contrast adjustment to mimic different environmental lighting conditions
|
|
|
|
brightness_contrast:
|
|
|
|
enabled: true
|
|
|
|
alpha_range: [0.4, 3.0] # Contrast range (min, max)
|
|
|
|
beta_range: [1, 100] # Brightness range (min, max)
|
|
|
|
probability: 1.0 # Always apply brightness/contrast adjustment
|
2025-08-06 20:52:39 +07:00
|
|
|
|
|
|
|
# Grayscale transformation as final step (applied to all augmented images)
|
|
|
|
grayscale:
|
|
|
|
enabled: true
|
|
|
|
probability: 1.0 # Always apply grayscale as final step
|
2025-08-05 19:09:55 +07:00
|
|
|
|
|
|
|
# Processing configuration
|
|
|
|
processing:
|
2025-08-05 20:53:47 +07:00
|
|
|
target_size: [640, 640] # [width, height] - Increased for better coverage
|
2025-08-05 19:09:55 +07:00
|
|
|
batch_size: 32
|
|
|
|
num_augmentations: 3 # number of augmented versions per image
|
|
|
|
save_format: "jpg"
|
|
|
|
quality: 95
|
|
|
|
|
|
|
|
# Supported image formats
|
|
|
|
supported_formats:
|
|
|
|
- ".jpg"
|
|
|
|
- ".jpeg"
|
|
|
|
- ".png"
|
|
|
|
- ".bmp"
|
|
|
|
- ".tiff"
|
|
|
|
|
|
|
|
# Logging configuration
|
|
|
|
logging:
|
|
|
|
level: "INFO" # DEBUG, INFO, WARNING, ERROR
|
|
|
|
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|
|
|
handlers:
|
|
|
|
- type: "file"
|
|
|
|
filename: "logs/data_augmentation.log"
|
|
|
|
- type: "console"
|
|
|
|
|
|
|
|
# Performance settings
|
|
|
|
performance:
|
|
|
|
num_workers: 4
|
|
|
|
prefetch_factor: 2
|
|
|
|
pin_memory: true
|
|
|
|
use_gpu: false
|