A toolkit for automated data augmentation
Project description
Augmenter: Advanced Image Augmentation Library
Augmenter is a Python library designed to simplify image augmentation for machine learning and deep learning projects. It provides an easy-to-use interface to apply a variety of augmentation techniques and supports randomized augmentation mixing to generate diverse variations of each image.
Features
- Augment Entire Datasets: Process all images in a directory, including nested subdirectories, while preserving the folder structure.
- Extensive Augmentation Techniques: Includes operations like flipping, rotation, blurring, brightness/contrast adjustment, grayscale conversion, noise addition, sharpening, and cropping.
- Random Augmentation Mixing: Combine random augmentations to create diverse variations of the same image.
- Customizable Variations: Control the number of augmented variations per image when using mixing.
- Structured Output: The augmented images are saved in the same directory structure as the original dataset.
Installation
Install Augmenter directly from PyPI:
pip install augmenter
Usage-1
Basic Augmentation
To apply augmentations to all images in a folder, preserving the directory structure, use the following code:
from augment_labeler import Augmenter
augmenter = Augmenter()
# Applying augmentations with mixing enabled and 3 variations per image
augmented_count = augmenter.apply(
image_dir="./dataset", # Path to the dataset
augmentations=[
"flip",
"rotate",
"blur",
"brightness_contrast",
"grayscale",
"noise",
"sharpen",
"crop"
], # List of augmentations to apply
save_path="./augmented_dataset", # Path to save augmented images
mixing=True, # Enable mixed augmentations
variations_per_image=3 # Create 3 variations for each image
)
print(f"Total augmented images created: {augmented_count}")
Output Structure
After running the above script, the output will be saved in the augmented_dataset folder, preserving the original folder structure with the added augmentation variations. The directory structure will look like this:
augmented_dataset/
├── class1/
│ ├── img1_mix_1.jpg
│ ├── img1_mix_2.jpg
│ ├── img1_mix_3.jpg
│ ├── img2_mix_1.jpg
│ ├── img2_mix_2.jpg
│ ├── img2_mix_3.jpg
├── class2/
│ ├── img3_mix_1.jpg
│ ├── img3_mix_2.jpg
│ ├── img3_mix_3.jpg
│ ├── img4_mix_1.jpg
│ ├── img4_mix_2.jpg
│ ├── img4_mix_3.jpg
- Each image is augmented and saved with a
_mix_Xsuffix (whereXis the variation number). - The folder structure is preserved for each class (e.g.,
class1/,class2/), making it easy to use the augmented dataset for machine learning.
Usage-2
Basic Augmentation
To apply augmentations to all images in a folder, preserving the directory structure, use the following code:
from augment_labeler import Augmenter
augmenter = Augmenter()
augmented_count = augmenter.apply(
image_dir="./dataset",
augmentations=["flip", "rotate", "blur"],
save_path="./augmented_dataset"
)
print(f"Total augmented images created: {augmented_count}")
Output Structure
After running the above script, the output will be saved in the augmented_dataset folder, preserving the original folder structure with the added augmentation variations. The directory structure will look like this:
/your_project/
├── dataset/
│ ├── class1/
│ │ ├── img1.jpg
│ │ ├── img2.jpg
│ ├── class2/
│ │ ├── img3.jpg
│ ├── img4.jpg
├── augmented_dataset/
│ ├── class1/
│ │ ├── img1_flip.jpg
│ │ ├── img1_rotate.jpg
│ │ ├── img1_blur.jpg
│ │ ├── img2_flip.jpg
│ │ ├── img2_rotate.jpg
│ │ ├── img2_blur.jpg
│ ├── class2/
│ │ ├── img3_flip.jpg
│ │ ├── img3_rotate.jpg
│ │ ├── img3_blur.jpg
│ ├── img4_flip.jpg
│ ├── img4_rotate.jpg
│ ├── img4_blur.jpg
- The folder structure is preserved for each class (e.g.,
class1/,class2/), making it easy to use the augmented dataset for machine learning.
Supported Augmentations
- flip: Horizontal flip
- rotate: Random rotation (up to ±45 degrees)
- blur: Gaussian blur
- brightness_contrast: Random brightness and contrast adjustments
- grayscale: Convert image to grayscale
- noise: Add Gaussian noise
- sharpen: Sharpen the image
- crop: Random resized cropping
Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push them to your fork.
- Open a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Release Notes
v0.1.0
- Initial release.
- Support for multiple augmentations and structured dataset output.
- Added random augmentation mixing and customizable variations.
Author
Developed by AKM Korishee Apurbo. Feel free to reach out with questions, suggestions, or contributions!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file augmenter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: augmenter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9eb846700f9b26d5f2c1b8c771d1cfa149c418defe9bb6888d37be3153f5a713
|
|
| MD5 |
331d627aa769692001c2b74238d08c81
|
|
| BLAKE2b-256 |
6ba990f8789559dc9a5e6a4923467f6398f9678c14d5cf8663374680ca660ea0
|