Local web application providing API and UI for image augmentation, based on the albumentations library
Training LoRA with a single image: The Magic of Data Augmentation
- What is image augmentation
- Prerequisites
- Installation
- Usage
- Custom arguments
- API endpoints
- List of augmentations
Image augmentation is a technique used in machine learning and computer vision to artificially increase the size and diversity of a dataset by applying various transformations to the original images.
These transformations can include operations such as rotation, scaling, flipping, cropping, and color adjustments.
The primary goal of image augmentation is to enhance the robustness and generalization of models by providing them with a broader range of examples during training.
This method is commonly employed in various applications, including, but not limited to, training models for tasks like image classification, object detection, and generative models such as LoRA (Low-Rank Adaptation) for Stable Diffusion.
- Python: Required for the server
- Node.js: Required for the client (only if not using the
API_ONLY
argument)
git clone https://github.com/numq/augmentation-ui.git
Run with default arguments
start.bat
Run with custom arguments
start-args.bat
Run with default arguments
start.sh
Run with custom arguments
start-args.sh
-
AUGMENTATION_SERVICE_URL_SCHEME
Server and client url scheme.
Default:
http
-
AUGMENTATION_SERVICE_HOST
Server and client host.
Default:
127.0.0.1
-
AUGMENTATION_SERVICE_PORT
Server and client port.
Default:
5000
-
DISABLE_AUTO_OPEN
Do not open the page automatically after startup.
Default:
0
-
API_ONLY
Run only server to use API.
Default:
0
Retrieve a list of available augmentations
{
"augmentations": [
{
"category": "blur",
"id": "blur",
"name": "Blur"
},
{
"category": "blur",
"id": "motion_blur",
"name": "Motion Blur"
}
]
}
Apply an augmentation to an image and get the augmented image
{
"augmentation_id": "BlurAugmentation",
"image_data": "data:image/png;base64,..."
}
{
"image_data": "data:image/png;base64,..."
}
- Blur
- Apply a blur effect to the image, making it less sharp.
- Motion Blur
- Simulate motion blur by blurring the image in a specific direction.
- Gaussian Blur
- Apply a Gaussian blur to the image, which is a type of blur that preserves edges and details.
- Glass Blur
- Apply a blur effect that simulates the distortion caused by looking through glass.
- Advanced Blur
- Apply a combination of blur effects to the image, such as motion blur and Gaussian blur.
- Median Blur
- Apply a median filter to the image, which replaces each pixel with the median value of neighboring pixels.
- Defocus
- Simulate camera defocus by blurring the image in a specific area.
- Zoom Blur
- Simulate zooming in or out by blurring the image.
- Random Crop
- Randomly crop a portion of the image.
- Center Crop
- Crop the center portion of the image.
- Crop
- Manually specify a crop region to apply to the image.
- Random Resized Crop
- Randomly crop and resize a portion of the image.
- Random Crop From Borders
- Randomly crop from the borders of the image.
- Channel Dropout
- Randomly drop out (set to zero) channels in the image.
- Coarse Dropout
- Randomly drop out larger areas of the image.
- Grid Dropout
- Drop out entire rows or columns of pixels in the image.
- Random Scale
- Randomly scale the image up or down.
- Longest Max Size
- Scale the image to its longest dimension while keeping aspect ratio.
- Smallest Max Size
- Scale the image to its smallest dimension while keeping aspect ratio.
- Resize
- Manually specify a new size for the image.
- Rotate
- Rotate the image by a random angle or by a specified angle.
- Random Rotate 90
- Rotate the image by 90 degrees (either clockwise or counterclockwise).
- Safe Rotate
- Rotate the image while ensuring that it remains within a specified bounding box.
- Elastic Transform
- Apply an elastic transformation to the image, which stretches and compresses it in different directions.
- Perspective Transform
- Apply a perspective transformation to the image, which can distort it and change its shape.
- Affine Transform
- Apply an affine transformation to the image, which can rotate, scale, and translate it.
- Vertical Flip
- Flip the image upside down.
- Horizontal Flip
- Flip the image horizontally (i.e., mirror it).
- Flip
- Randomly flip the image horizontally or vertically.
- Transpose
- Transpose the image (i.e., swap its rows and columns).
- Optical Distortion
- Apply optical distortion to the image, which can cause it to appear curved or distorted.
- Grid Distortion
- Apply grid-like distortion to the image, which can cause it to appear distorted or warped.
- Pad If Needed
- Pad the image with zeros if it is smaller than a specified size.
- Normalize
- Normalize pixel values in the range [0, 1].
- Random Gamma
- Randomly adjust gamma correction of the image, which affects its brightness and contrast.
- Random Grid Shuffle
- Randomly shuffle grid cells in the image, which can cause it to appear distorted or disordered.
- Hue Saturation Value
- Adjust hue, saturation, and value (brightness) of individual pixels in the image.
- RGB Shift
- Shift RGB channels of individual pixels in the image.
- Gauss Noise
- Add Gaussian noise to the image, which can simulate random variations in brightness and contrast.
- CLAHE (Contrast Limited Adaptive Histogram Equalization)
- Apply histogram equalization to adjust contrast and brightness of individual regions in the image.
- Channel Shuffle
- Randomly shuffle channels (RGB or grayscale) in each pixel of the image.
- Invert Image
- Invert all pixel values in the image (i.e., convert black to white and vice versa).
- To Gray Scale
- Convert color images to grayscale by averaging RGB channels or using other methods.
- To Sepia Tone
- Convert color images to sepia tone by adjusting RGB channels to produce a warm, vintage appearance.
- Image Compression
- Compress images using lossy compression algorithms like JPEG or WebP.
- Random Brightness Contrast
- Randomly adjust brightness and contrast of individual pixels in images.