# How to use Albumentations such as \`ToGray\` with \`Ultralytics.YOLO.train\`

**URL:** <https://community.ultralytics.com/t/how-to-use-albumentations-such-as-togray-with-ultralytics-yolo-train/1420>\
**Category:** Discussion\
**Tags:** code, yolo\
**Created:** [August 30, 2025, 5:22pm UTC](https://community.ultralytics.com/t/how-to-use-albumentations-such-as-togray-with-ultralytics-yolo-train/1420 "2025-08-30T17:22:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kallinteris-Andreas](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/kallinteris-andreas/32/838_2.png) [@Kallinteris-Andreas](https://community.ultralytics.com/u/Kallinteris-Andreas)\
**Post date:** [August 30, 2025, 5:22pm UTC](https://community.ultralytics.com/t/how-to-use-albumentations-such-as-togray-with-ultralytics-yolo-train/1420/1 "2025-08-30T17:22:24Z")

</div>

How can I use `albumentationsx` augmentations with `model.train()`

The documentation pages indicate that is it possible, but it does not show how/which arguments to use:

> **[augment](https://docs.ultralytics.com/reference/data/augment/#ultralytics.data.augment.Albumentations)**
>
> Explore Ultralytics image augmentation techniques like MixUp, Mosaic, and Random Perspective for enhancing model training. Improve your deep learning models now.

> **[Ultralytics YOLO Data Augmentation with Albumentations](https://www.ultralytics.com/blog/using-albumentations-augmentations-to-diversify-your-data)**
>
> Learn how to use Albumentations for augmentations when custom training Ultralytics YOLO11 to improve model performance with diverse training data.

> **[Albumentations](https://docs.ultralytics.com/integrations/albumentations/)**
>
> Learn how to use Albumentations with YOLO11 to enhance data augmentation, improve model performance, and streamline your computer vision projects.

Train documentation does not mention Albumentations:

> **[Train](https://docs.ultralytics.com/modes/train/)**
>
> Learn how to efficiently train object detection models using YOLO11 with comprehensive instructions on settings, augmentation, and hardware utilization.

---

<div class="post-metadata">

**Author:** ![Toxite](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/toxite/32/123_2.png) [@Toxite](https://community.ultralytics.com/u/Toxite)\
**Post date:** [August 31, 2025, 10:44am UTC](https://community.ultralytics.com/t/how-to-use-albumentations-such-as-togray-with-ultralytics-yolo-train/1420/2 "2025-08-31T10:44:07Z")

</div>

You just install it.

Ultralytics doesn’t let you modify the Albumentations augmentations used. It uses it with hardcoded values and transforms which are shown in the training logs after you install it.

---

<div class="post-metadata">

**Author:** ![glenn-jocher](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/glenn-jocher/32/83_2.png) [@glenn-jocher](https://community.ultralytics.com/u/glenn-jocher)\
**Post date:** [August 31, 2025, 3:59pm UTC](https://community.ultralytics.com/t/how-to-use-albumentations-such-as-togray-with-ultralytics-yolo-train/1420/3 "2025-08-31T15:59:55Z")

</div>

@Kallinteris-Andreas note you can view and edit the transforms directly in the code here:

> <https://github.com/ultralytics/ultralytics/blob/a8e3450e62910f398cf16cb14109d58748c0e37c/ultralytics/data/augment.py#L1987-L1996>

So you could i.e. install in editable mode and then update these to what you see fit and train.

---

<div class="post-metadata">

**Author:** ![Kallinteris-Andreas](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/kallinteris-andreas/32/838_2.png) [@Kallinteris-Andreas](https://community.ultralytics.com/u/Kallinteris-Andreas)\
**Post date:** [September 1, 2025, 12:35am UTC](https://community.ultralytics.com/t/how-to-use-albumentations-such-as-togray-with-ultralytics-yolo-train/1420/4 "2025-09-01T00:35:40Z")

</div>

Why are there transformations with `p=0`?

---

<div class="post-metadata">

**Author:** ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)\
**Post date:** [September 1, 2025, 12:16pm UTC](https://community.ultralytics.com/t/how-to-use-albumentations-such-as-togray-with-ultralytics-yolo-train/1420/5 "2025-09-01T12:16:14Z")

</div>

> Each augmentation in Albumentations has a parameter named `p` that controls the probability of applying that augmentation to input data.

> **[Albumentations: fast and flexible image augmentations](https://albumentations.ai/docs/2-core-concepts/probabilities/#setting-probabilities-for-transforms-in-augmentation-pipelines)**
>
> Improve computer vision models with Albumentations, the fast and flexible Python library for high-performance image augmentation. Supports images, masks, bounding boxes, keypoints & easy framework integration.
