All Projects → datature → discolight

datature / discolight

Licence: MIT license
discolight is a robust, flexible and infinitely hackable library for generating image augmentations ✨

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to discolight

Imgaug
Image augmentation for machine learning experiments.
Stars: ✭ 12,107 (+48328%)
Mutual labels:  bounding-boxes, image-augmentation, augmentation
Albumentations
Fast image augmentation library and an easy-to-use wrapper around other libraries. Documentation: https://albumentations.ai/docs/ Paper about the library: https://www.mdpi.com/2078-2489/11/2/125
Stars: ✭ 9,353 (+37312%)
Mutual labels:  image-augmentation, augmentation
TensorflowDeepSortTracking
Tensorflow object detection with tracking based on the DeepSort algorithm
Stars: ✭ 60 (+140%)
Mutual labels:  bounding-boxes
volumentations
Library for 3D augmentations
Stars: ✭ 111 (+344%)
Mutual labels:  augmentation
coco-viewer
Simple COCO Viewer in Tkinter
Stars: ✭ 65 (+160%)
Mutual labels:  bounding-boxes
chitra
A multi-functional library for full-stack Deep Learning. Simplifies Model Building, API development, and Model Deployment.
Stars: ✭ 210 (+740%)
Mutual labels:  bounding-boxes
Vechicle-Detection-Tracking
Vehicle detection and tracking using linear SVM classifier
Stars: ✭ 15 (-40%)
Mutual labels:  bounding-boxes
FAST-RIR
This is the official implementation of our neural-network-based fast diffuse room impulse response generator (FAST-RIR) for generating room impulse responses (RIRs) for a given acoustic environment.
Stars: ✭ 90 (+260%)
Mutual labels:  augmentation
torch-pitch-shift
Pitch-shift audio clips quickly with PyTorch (CUDA supported)! Additional utilities for searching efficient transformations are included.
Stars: ✭ 70 (+180%)
Mutual labels:  augmentation
textaugment
TextAugment: Text Augmentation Library
Stars: ✭ 280 (+1020%)
Mutual labels:  augmentation
SimpleVideoAnnotation
A simple video annotation made with python + OpenCV for detection in YoloV2 format
Stars: ✭ 13 (-48%)
Mutual labels:  bounding-boxes
mix3d
Mix3D: Out-of-Context Data Augmentation for 3D Scenes (3DV 2021 Oral)
Stars: ✭ 183 (+632%)
Mutual labels:  augmentation
deep-license-plate-recognition
Automatic License Plate Recognition (ALPR) or Automatic Number Plate Recognition (ANPR) software that works with any camera.
Stars: ✭ 309 (+1136%)
Mutual labels:  bounding-boxes
labelCloud
A lightweight tool for labeling 3D bounding boxes in point clouds.
Stars: ✭ 264 (+956%)
Mutual labels:  bounding-boxes
CV
本仓库将使用Pytorch框架实现经典的图像分类网络、目标检测网络、图像分割网络,图像生成网络等,并会持续更新!!!
Stars: ✭ 72 (+188%)
Mutual labels:  image-augmentation
BBoxEE
Bounding Box Editor and Exporter
Stars: ✭ 15 (-40%)
Mutual labels:  bounding-boxes
Alturos.ImageAnnotation
A collaborative tool for labeling image data for yolo
Stars: ✭ 47 (+88%)
Mutual labels:  bounding-boxes
tf-image
TensorFlow2+ graph image augmentation library optimized for tf.data.Dataset.
Stars: ✭ 24 (-4%)
Mutual labels:  image-augmentation
CAP augmentation
Cut and paste augmentation for object detection and instance segmentation
Stars: ✭ 93 (+272%)
Mutual labels:  augmentation
country-bounding-boxes
A list of ISO 3166-1 country codes and their bounding boxes.
Stars: ✭ 26 (+4%)
Mutual labels:  bounding-boxes

Discolight Commit Tests Codacy Badge Codacy Badge

Discolight

Flashy, ravey and state-of-the-art image augmentations to boost the performance of deep convolutional neural networks

At a Glance

  • The library works with images in HxWxC (channels last) format.
  • Based on numpy, OpenCV, paperspace, imgaug and albumentation.
  • Diversified set of augmentations available.
  • Supports python 3.6-3.8
  • Supports transformations on images, and bounding boxes.
  • The library works with images in HxWxC format.

Setup

The easiest way to get started is to install the discolight package via pip:

$ pip install discolight

Alternatively, if you have cloned this repository, you can run pip on the contents of the repository folder:

$ pip install .

Supported Augmentations

  Sample
Image
Augmented
Image
Sample
Image (Bounding
Boxes)
Augmented
Image (Bounding
Boxes)
ColorTemperature
Changes the color temperature of the input image.
GaussianNoise
Add gaussian noise to the given image.
GrayScale
Return a grayscale version of the given image.
HorizontalFlip
Horizontally flips the given image.
ImageCompression
Apply a compression effect to the given image.
MotionBlur
Add motionblur to a given image.
OneOf
Perform a randomly selected augmentation on the given image.
RandomCrop
Randomly crops the given image.
RandomEraser
Randomly erase a rectangular area in the given image.
RandomHSV
Randomly shift the color space of the given image.
RandomRotate
Randomly rotate the given image.
RandomScale
Randomly scale the given image.
RandomShear
Randomly shear the given image.
RandomTranslate
Randomly Translate the given image.
Resize
Resize an image without preserving aspect ratio.
ResizeMaintainAspectRatio
Resize an image while preserving aspect ratio.
Rotate
Rotate the given image.
SaltAndPepperNoise
Add salt and pepper or RGB noise to the given image.
Scale
Scale the given image.
Sepia
Returns a given image passed through the sepia filter.
Sequence
Perform a sequence of augmentations on the given image.
Shear
Horizontally shear the given image.
Translate
Translate the given image.
VerticalFlip
Vertically flip the given image.

Generating Augmented Images on the Command Line

To augment a set of images with annotations, you must first prepare your input data and prepare YAML configuration file to describe the augmentations you want to perform:

input:
  images:
        loader: Directory
        options:
          directory: ./sample_images # The base path of where the images are stored

  annotations:
        loader: FourCornersCSV
        options:
          annotations_file: ./sample_images/annotations.csv # The CSV file with annotations
          normalized: true
output:
  images:
        writer: Directory
        options:
          directory: ./output_folder
  annotations:
        writer: FourCornersCSV
        options:
          annotations_file: ./output_folder/aug_annotations.csv
          normalized: true
augmentations:
  - name: GrayScale
        options:
          probs: 0.5
  - name: Rotate
        options:
          probs: 0.7
          angle: 35
  - name: GaussianNoise
        options:
          probs: 0.9
  - name: Shear
        options: {}
save-original: true # Whether to save the original images to the output folder
save-bbox: true # Whether bounding boxes should be drawn on the augmented images

The image and annotation loaders specify how the images and annotations should be loaded. The FourCornersCSV (so-named because it expects the bounding box to be specified with four coordinates) loader expects an input CSV file in the following format:

	image_name,x_min,y_min,x_max,y_max,label
	wheat1.jpg,0,0.799805,0.037109,0.94043,1
	wheat1.jpg,0.064453,0.892578,0.181641,0.949219,1
	...

The chosen image loader will be used to load the images specified under the image_name column (for example, wheat1.jpg). In this case, the Directory image loader will fetch the images from the specified folder. For more information on available image and annotation loaders, see doc/discolight.md.

Now you can run Discolight:

$ discolight generate configuration.yml

You can also pass your YAML configuration on standard input:

$ cat configuration.yml | discolight generate

After generation is complete, the augmented images and annotations will be written out according to your configuration options. Here, we choose to save the annotations to a CSV file using the same four-corners format, and the augmented images will appear in the output_folder/ directory.

Library Functionality

In addition to invoking Discolight from the command line, you can also invoke it as a library. First, construct the augmentation you want to apply to an image. For example, here is a simple augmentation sequence:

from discolight.disco import disco
from discolight.annoations import BoundingBox
from discolight.util.image import load_image, save_image

seq = disco.Sequence(augmentations=[
	disco.GaussianNoise(),
	disco.RandomEraser(),
	disco.Rotate(angle=35)
])

Then, load the image and specify your annotations:

image = load_image("path/to/image.jpg")

annotations = [
	# BoundingBox(x_min, y_min, x_max, y_max, class_idx)
	BoundingBox(0, 819, 38, 963, 1),
	BoundingBox(66, 914, 186, 972, 1),
	BoundingBox(52, 526, 126, 645, 1),
]

Now, you can invoke seq as a function to apply your augmentation:

aug_img, aug_annotations = seq(image, annotations)

If you have no annotations, you can also apply seq only to an image:

aug_img = seq(image)

To save the augmented image, use the provided save_image function. You can optionally pass the augmented annotations (also an array of BoundingBox objects) to be drawn in red over the augmented image:

save_image("aug-with-bboxes.jpg", aug_img, annotations=aug_annotations)
save_image("aug-no-bboxes.jpg", aug_img)

If you prefer to perform additional operations on the image after augmentation, augmented images are OpenCV images in RGB format.

Development

To learn more about how to develop Discolight (e.g., adding additional augmentatations), see the guide in doc/develop.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].