This repository contains a Python tool for data augmentation of image datasets in YOLO or Pascal VOC format. The tool offers various augmentation techniques to create augmented datasets for training computer vision models.
- Clone this repository to your local machine:
git clone https://github.com/your-username/data-augmentation-tool.git
- Change into the repository directory:
pip install -r requirements.txt
To use the data augmentation tool, follow these steps:
-
Prepare your dataset in either YOLO or Pascal VOC format. Ensure that your dataset images and label files are placed in the appropriate folders.
-
Open the
config.py
file and configure the augmentation settings and dataset paths according to your requirements. -
Run the data augmentation script by executing the
main.py
file with the appropriate command-line arguments:
python main.py --path_raw /path/to/dataset --path_save /path/to/save --train_scale 0.6 --val_scale 0.2 --src_type_dataset voc --dest_type_dataset yolo
The arguments are as follows:
path_raw
: Path to the raw dataset directory.path_save
: Path to save the augmented dataset.train_scale
: Proportion of the dataset to be used for training.val_scale
: Proportion of the dataset to be used for validation.src_type_dataset
: Source data format, either 'voc' (Pascal VOC) or 'yolo' (YOLO).dest_type_dataset
: Destination data format, either 'voc' (Pascal VOC) or 'yolo' (YOLO).
The tool will split the dataset into training, validation, and testing sets based on the specified proportions, apply the selected augmentation techniques, and save the augmented data in the desired format.
The tool supports various augmentation techniques, which can be configured in the config.py
file. The available techniques include:
- AdjustBrightness
- AdjustContrast
- AdjustSaturation
- Cutout
- Filters
- GridMask
- HorizontalFlip
- RandomHorizontalFlip
- RandomHSV
- LightingNoise
- Mixup
- Noisy
- Resize
- RotateOnlyBboxes
- RandomRotate
- Rotate
- RandomScale
- Scale
- RandomShear
- Shear
- SmallObjectAugmentation
- RandomTranslate
- Sequence
The augmented dataset will be saved in the specified path_save
directory in the format specified by dest_type_dataset
. The augmented images will be stored in the 'images' folder, and the corresponding label files will be stored in the 'labels' folder.
Additionally, a data.yaml
file will be generated in the path_save
directory, containing information about the dataset, such as the paths to the training and validation sets, the number of classes, and the class names.
This tool is released under the MIT License. See LICENSE for details.
Please feel free to use and modify this tool for your data augmentation needs. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request. Happy data augmenting! 😊