Skip to main content

Dataset Configuration

Dataset configurations are managed in the data/__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 the data_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:
For multiple datasets:

Path Resolution

Relative Paths

When data_path is specified, media paths in annotations are treated as relative:
annotations.json

Absolute Paths

When data_path is empty, use absolute paths in your annotations:
annotations.json

Best Practices

Keep related datasets grouped together in your configuration:
Use sampling rates to balance large and small datasets:
Start with small sampling rates for initial testing:

Troubleshooting

Common Issues:
  1. Dataset not found: Ensure your dataset name matches exactly what’s defined in data_dict
  2. Missing images: Verify data_path is correct and media files exist
  3. Path resolution errors: Check if you need relative or absolute paths based on your data_path setting
Use the data validation tool to check for issues: