Dataset Configuration
Dataset configurations are managed in thedata/__init__.py file. This centralized approach allows you to define multiple datasets and control their usage during training.
Dataset Definition Structure
Each dataset is defined as a dictionary with two key fields:Field Descriptions
- annotation_path: Path to a JSON or JSONL file containing your dataset annotations
- data_path: Base directory for media files (can be left empty if annotation paths are absolute)
Registering Datasets
After defining your dataset, register it in thedata_dict dictionary:
Complete Configuration Example
Here’s a complete example showing how to add a custom dataset:data/__init__.py
Sampling Rate Control
Control the proportion of data used from each dataset by appending%X to the dataset name, where X is the percentage:
Multiple Datasets with Different Sampling Rates
You can combine multiple datasets with different sampling rates:Sampling rates are applied independently to each dataset. This allows you to balance dataset sizes and prevent larger datasets from dominating the training.
Usage in Training Scripts
Reference your datasets in the training script using the--dataset_use parameter:
Path Resolution
Relative Paths
Whendata_path is specified, media paths in annotations are treated as relative:
annotations.json
Absolute Paths
Whendata_path is empty, use absolute paths in your annotations:
annotations.json
Best Practices
Organizing Multiple Datasets
Organizing Multiple Datasets
Keep related datasets grouped together in your configuration:
Balancing Dataset Sizes
Balancing Dataset Sizes
Use sampling rates to balance large and small datasets:
Incremental Testing
Incremental Testing
Start with small sampling rates for initial testing: