Skip to content

A versatile Python-based image augmentation tool that helps generate diverse training datasets for computer vision projects. Supports multiple transformations including rotation, flipping, color adjustments, and more. Built with OpenCV and Albumentations for high-performance image processing. Perfect for machine learning and deep learning projects

License

Notifications You must be signed in to change notification settings

Nazmul7989/python-image-augmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Augmentation Tool

This Python script helps you augment a small dataset of images to create a larger dataset for training machine learning models. It uses the powerful albumentations library to apply various image transformations to enhance your dataset.

Features

  • 🖼️ Multiple Augmentation Techniques: Applies various transformations including:

    • Horizontal flips
    • Random 90° rotations
    • Random rotation (±30°)
    • Brightness and contrast adjustments
    • RGB color shifts
    • Blur effects
    • Gamma corrections
    • Affine transformations (shifting, scaling, rotating)
    • And more!
  • 📁 Automatic Folder Handling: Creates output directories if they don't exist

  • 🔄 Batch Processing: Processes multiple images in one go

  • 🖼️ Multiple Image Formats: Supports .jpg, .jpeg, .png (case insensitive)

  • 🛠️ Customizable: Easy to modify and extend for different augmentation needs

Prerequisites

  • Python 3.6+
  • Required Python packages (install using pip install -r requirements.txt):
    • albumentations
    • opencv-python

Installation

  1. Clone this repository:

    git clone [email protected]:Nazmul7989/python-image-augmentation.git
    cd python-image-augmentation
  2. Install the required packages:

    pip install -r requirements.txt

Usage

  1. Place your input images in the ./images/input/ directory
  2. Run the script:
    python main.py
  3. Find the augmented images in the ./dataset/augmented/ directory

Configuration

You can modify these settings in main.py:

  • input_folder: Path to your input images (default: './images/input')
  • output_folder: Where augmented images will be saved (default: './dataset/augmented')
  • images_to_generate_per_image: Number of augmented versions to create per image (default: 10)

Folder Structure

.
├── dataset/                 # Output folder for augmented images
│   └── augmented/           # Augmented images will be saved here
├── images/                  # Input folder for original images
│   └── input/               # Place your original images here
├── main.py                 # Main augmentation script
├── requirements.txt        # Python dependencies
└── README.md              # This file

Example

For each input image (e.g., image1.jpg), the script will generate multiple augmented versions (e.g., image1_aug_0.jpg, image1_aug_1.jpg, etc.) in the output folder.

License

This project is licensed under the terms of the MIT license. See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

  • Built with Albumentations for fast and flexible image augmentations
  • Uses OpenCV for image processing

Note: This project is designed for general-purpose image augmentation and can be used for various computer vision tasks including but not limited to medical imaging, object detection, and classification tasks.

About

A versatile Python-based image augmentation tool that helps generate diverse training datasets for computer vision projects. Supports multiple transformations including rotation, flipping, color adjustments, and more. Built with OpenCV and Albumentations for high-performance image processing. Perfect for machine learning and deep learning projects

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages