combine augment
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Data Augmentation Configuration
|
||||
# Main configuration file for image data augmentation
|
||||
# ID Card Data Augmentation Configuration v2.0
|
||||
# Enhanced configuration with smart sampling, multiplication, and random method combination
|
||||
|
||||
# Paths configuration
|
||||
paths:
|
||||
@@ -7,71 +7,122 @@ paths:
|
||||
output_dir: "out1"
|
||||
log_file: "logs/data_augmentation.log"
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
# Data augmentation parameters - ROTATION and RANDOM CROPPING
|
||||
# Augmentation Strategy - Random Combination of Methods
|
||||
augmentation:
|
||||
# Geometric transformations
|
||||
rotation:
|
||||
enabled: true
|
||||
angles: [30, 60, 120, 150, 180, 210, 240, 300, 330] # Specific rotation angles
|
||||
probability: 1.0 # Always apply rotation
|
||||
# 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
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
# Grayscale transformation as final step (applied to all augmented images)
|
||||
grayscale:
|
||||
enabled: true
|
||||
probability: 1.0 # Always apply grayscale as final step
|
||||
# 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
|
||||
|
||||
# Processing configuration
|
||||
processing:
|
||||
target_size: [640, 640] # [width, height] - Increased for better coverage
|
||||
target_size: [640, 640] # [width, height] - Target resolution
|
||||
batch_size: 32
|
||||
num_augmentations: 3 # number of augmented versions per image
|
||||
save_format: "jpg"
|
||||
quality: 95
|
||||
|
||||
# Advanced processing options
|
||||
preserve_original: false # Whether to save original images
|
||||
parallel_processing: true # Enable parallel processing
|
||||
memory_efficient: true # Optimize memory usage
|
||||
|
||||
# Supported image formats
|
||||
supported_formats:
|
||||
@@ -83,7 +134,7 @@ supported_formats:
|
||||
|
||||
# Logging configuration
|
||||
logging:
|
||||
level: "INFO" # DEBUG, INFO, WARNING, ERROR
|
||||
level: "INFO" # Available levels: DEBUG, INFO, WARNING, ERROR
|
||||
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
handlers:
|
||||
- type: "file"
|
||||
@@ -92,7 +143,7 @@ logging:
|
||||
|
||||
# Performance settings
|
||||
performance:
|
||||
num_workers: 4
|
||||
prefetch_factor: 2
|
||||
pin_memory: true
|
||||
use_gpu: false
|
||||
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
|
Reference in New Issue
Block a user