One of the most common issues that data scientists are faced with in real AI and Computer Vision projects is data insufficiency. Deep Learning algorithms usually need a lot of data to solve our problem and data gathering is expensive, time-consuming, and in some cases impossible, therefore, data augmentation is an important task to generate massive data from a small dataset In this project, you can apply many augmentation methods to your data to generate a massive and sufficient dataset from your small one.
Data augmentation is a simple but important stage in data preparation. In many real AI projects, its so hard to gather enough data to train DL algorithms. So this is where data augmentation helps us to generate new data based on a few samples that we have. You can label your data using annotation softwares and leave the rest to pytorch and albumentations
We designed it to performing image augmentation for:
- Normal Classification
- Object Detection
- Semantic Segmentation (soon)
- Keypoint Detection (soon)
For different backbones witht different input size you can set the output size according to your desired architecture
cfg = {
'format': 'yolo',
'target_size': (640, 640),
'bounding_box': [
A.CenterCrop(100, 100),
A.RandomCrop(100, 100),
CustomTransform(F.adjust_brightness, 3.0),
CustomTransform(F.adjust_contrast, 4.2),
CustomTransform(F.adjust_sharpness, 3.0),
transforms.Grayscale(),
CustomTransform(my_f.adjust_saturation, 8),
CustomTransform(F.adjust_hue, -0.3),
CustomGaussianBlurTransform(None, 5),
],
'inner_bounding_box': [
transforms.RandomEqualize(1.0),
CustomTransform(F.adjust_brightness, 3.0),
CustomTransform(F.adjust_contrast, 4.2),
CustomTransform(F.adjust_sharpness, 3.0),
transforms.Grayscale(),
CustomTransform(my_f.adjust_saturation, 8),
CustomTransform(F.adjust_hue, -0.3),
CustomGaussianBlurTransform(None, 5),
]
}
For object detection tasks with bounding boxes, you can perform both bounding-box and inner-bounding-box augmentation If you want to add spatial-level augmentation like crop, rotate, padding or flip, you must add it through Albumentation and pass the bboxes and formats to it Also you can convert Pascal-VOC format to your ideal format like YOLO and COCO using convert functions implemented in utils.py
import albumentations as A
t = A.Compose([
augmentation,
A.Resize(width, height)
],
bbox_params=A.BboxParams(format=self.format)) #for example yolo
In case of using torchvision functional transforms, you must create a CustomTransform instance and pass that functional transformer to it. (Implemented in detail in custom_functional_transformers)
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.