You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Added example with albumentations to the use_dataset tutorial
* cleanup
* cleanup
* Update use_dataset tutorial to integrate Albumentations for data augmentation
- Replaced torchvision transforms with Albumentations for image augmentation.
- Renumbered sections for clarity and updated descriptions accordingly.
- Emphasized key points for using Albumentations with 🤗 Datasets.
* Update use_dataset tutorial to finalize dataset preparation steps
- Added a new key point emphasizing that the dataset is ready for training with machine learning frameworks.
- Ensured clarity by maintaining consistent formatting and structure.
**3**. Now, you can apply some transforms to the image. Feel free to take a look at the [various transforms available](https://pytorch.org/vision/stable/auto_examples/plot_transforms.html#sphx-glr-auto-examples-plot-transforms-py) in torchvision and choose one you'd like to experiment with. This example applies a transform that randomly rotates the image:
178
+
**3**. Now let's apply data augmentations to your images. 🤗 Datasets works with any augmentation library, and in this example we'll use Albumentations.
179
+
180
+
### Using Albumentations
181
+
182
+
[Albumentations](https://albumentations.ai) is a popular image augmentation library that provides a [rich set of transforms](https://albumentations.ai/docs/reference/supported-targets-by-transform/) including spatial-level transforms, pixel-level transforms, and mixing-level transforms. When running on CPU, which is typical for transformers pipelines, Albumentations is [faster than torchvision](https://albumentations.ai/docs/benchmarks/image-benchmarks/).
183
+
184
+
Install Albumentations:
185
+
186
+
```bash
187
+
pip install albumentations
188
+
```
189
+
190
+
**4**. Create a typical augmentation pipeline with Albumentations:
**4**. Use the [`~Dataset.set_transform`] function to apply the transform on-the-fly. When you index into the image `pixel_values`, the transform is applied, and your image gets rotated.
225
+
**6**. Apply the transform using [`~Dataset.set_transform`]:
0 commit comments