Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -5,6 +5,62 @@ colorFrom: red
|
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
license: mit
|
| 9 |
---
|
| 10 |
|
| 11 |
+

|
| 12 |
+
|
| 13 |
+
# Albumentations
|
| 14 |
+
|
| 15 |
+
Efficient Image Augmentation for Machine Learning in Python
|
| 16 |
+
|
| 17 |
+
[Albumentations](https://albumentations.ai/) is a fast, flexible image augmentation library designed for machine learning practitioners working on computer vision tasks. Our aim is simple: provide a comprehensive set of tools that can transform any image to augment your datasets, thereby improving model accuracy and robustness.
|
| 18 |
+
|
| 19 |
+
Features:
|
| 20 |
+
|
| 21 |
+
- [Wide Range of Augmentations](https://albumentations.ai/docs/api_reference/full_reference/): Supports geometric transforms, color augmentations, flips, rotations, and more, tailored for classification, segmentation, object detection, and working with key points.
|
| 22 |
+
- [Easy Integration](https://albumentations.ai/docs/#examples): Designed to easily fit into any machine learning pipeline.
|
| 23 |
+
- [Performance Optimized](https://albumentations.ai/docs/benchmarking_results/): Minimizes CPU/GPU load with efficient implementation.
|
| 24 |
+
- Community Driven: Open to contributions and feedback. We evolve with your needs.
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
from albumentations import (
|
| 28 |
+
HorizontalFlip, Affine, CLAHE, RandomRotate90,
|
| 29 |
+
Transpose, ShiftScaleRotate, Blur, OpticalDistortion, GridDistortion, HueSaturationValue,
|
| 30 |
+
GaussNoise, MotionBlur, MedianBlur,
|
| 31 |
+
RandomBrightnessContrast, Flip, OneOf, Compose
|
| 32 |
+
)
|
| 33 |
+
import numpy as np
|
| 34 |
+
|
| 35 |
+
def strong_aug(p=0.5):
|
| 36 |
+
return Compose([
|
| 37 |
+
RandomRotate90(),
|
| 38 |
+
Flip(),
|
| 39 |
+
Transpose(),
|
| 40 |
+
GaussNoise(),
|
| 41 |
+
OneOf([
|
| 42 |
+
MotionBlur(p=0.2),
|
| 43 |
+
MedianBlur(blur_limit=3, p=0.1),
|
| 44 |
+
Blur(blur_limit=3, p=0.1),
|
| 45 |
+
], p=0.2),
|
| 46 |
+
Affine(translate_percent=0.0625, scale=(0.8, 1.2), rotate_limit=(-45, 45), p=0.2),
|
| 47 |
+
OneOf([
|
| 48 |
+
OpticalDistortion(p=0.3),
|
| 49 |
+
GridDistortion(p=0.1)
|
| 50 |
+
], p=0.2),
|
| 51 |
+
OneOf([
|
| 52 |
+
CLAHE(clip_limit=2),
|
| 53 |
+
RandomBrightnessContrast(),
|
| 54 |
+
], p=0.3),
|
| 55 |
+
HueSaturationValue(p=0.3),
|
| 56 |
+
], p=p)
|
| 57 |
+
|
| 58 |
+
image = np.ones((300, 300, 3), dtype=np.uint8)
|
| 59 |
+
mask = np.ones((300, 300), dtype=np.uint8)
|
| 60 |
+
whatever_data = "my name"
|
| 61 |
+
augmentation = strong_aug(p=0.9)
|
| 62 |
+
data = {"image": image, "mask": mask, "whatever_data": whatever_data, "additional": "hello"}
|
| 63 |
+
augmented = augmentation(**data)
|
| 64 |
+
image, mask, whatever_data, additional = augmented["image"], augmented["mask"], augmented["whatever_data"], augmented["additional"]
|
| 65 |
+
|
| 66 |
+
```
|