# YOLO is not reading correctly the training data

**URL:** <https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899>\
**Category:** YOLO\
**Tags:** question, yolo, support\
**Created:** [March 25, 2026, 4:37pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899 "2026-03-25T16:37:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luciano\_Carvalheira](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/luciano_carvalheira/32/1427_2.png) [@Luciano\_Carvalheira](https://community.ultralytics.com/u/Luciano_Carvalheira)\
**Post date:** [March 25, 2026, 4:37pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/1 "2026-03-25T16:37:32Z")

</div>

Hello everybody,

I am training a YOLO algoriths (yolo26n-seg.pt) to detec blastocysts, an early embryo development stage, in photos. However, I am facing some trouble on the training process.

I labeled the images in ROBOFLOW with Instance segmentation tools and exported the labels in .TXT files.

At the end of the training process, yolo provides some files as output, some of them are images with mosaics of the training batch and the validation batch. Here starts my problem. I noticed that in these images the labels do not fit exactly on the top of the structure I labeled in the image, in fact it leaks a bit to the side. This pathern also happens in the predicted imagens, where there are some leak of mask in the direction of the locating box.

I tried to change some paramethers on the training script, but nothing changed.

Could someone help me to identify why is it happening and how to solve this problem?

Exemple of mosaic with validation\_labels . All images in this mosaic have masks larger than the embryo. the same happens with train emages. I expected to have masks fitting perfectly on the top of the embryos in the training and validation data.

 ![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/c/cbbb84ea05011ffeba65aa5776f8202613d40b52.jpeg)

---

<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:** [March 25, 2026, 6:01pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/2 "2026-03-25T18:01:26Z")

</div>

This is probably because the objects are small. You can try increasing `imgsz` like using `imgsz=1280`

And during prediction use `retina_masks=True`

---

<div class="post-metadata">

**Author:** ![Luciano\_Carvalheira](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/luciano_carvalheira/32/1427_2.png) [@Luciano\_Carvalheira](https://community.ultralytics.com/u/Luciano_Carvalheira)\
**Post date:** [March 25, 2026, 9:13pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/3 "2026-03-25T21:13:31Z")

</div>

Thank you for your help. You advice helped me a lot.

My images are 5120 x 2880, a huge size for training. Adjusting the image size and activating the function retina improved the quality of the masks for training and validation set.

I still have one question. Even improving the quality of masks, the images labeled by prediction display a weird leak of the mask in the direction of the locating box. Do you know if it is normal for YOLO predicted images or do I still have a problem?

Here is an example of a image of a blstocyst correctly covered by te mask, but on the areas close to the locating box it has a extension that toutchs it. At the end, the mask is not completly round due to this extension.

 ![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/4/4ee9ac55ae2d1b52b1fd71347526e891180104e7.jpeg)

---

<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:** [March 25, 2026, 11:55pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/4 "2026-03-25T23:55:34Z")

</div>

Does this occur with `retina_masks=True` during prediction?

---

<div class="post-metadata">

**Author:** ![Luciano\_Carvalheira](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/luciano_carvalheira/32/1427_2.png) [@Luciano\_Carvalheira](https://community.ultralytics.com/u/Luciano_Carvalheira)\
**Post date:** [March 26, 2026, 9:51am UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/5 "2026-03-26T09:51:08Z")

</div>

Yes. This is my code for the last trainig I did:

model.train(data = caminho\_yaml,

```
        augment = True,

        project = r'/content/drive/MyDrive/Pseudo-labeling-piloto',

        classes = \[4\],

        name ='pseudo_labiling_piloto_rect_true12',

        degrees = 180.0,

        perspective = 0.0,

        shear = 0.0,

        flipud = 0.0,

        fliplr = 0.0,

        mosaic = 0.0,

        mixup = 0.3,

        scale = 0.0,

        patience = 50,

        optimizer ='AdamW',

        lr0 = 0.001,

        weight_decay = 0.01,

        epochs = 100,

        imgsz = \[1920,

        rect = True,

        retina_masks = True,

        batch = 4,

        )

```

---

<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:** [March 26, 2026, 10:45am UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/6 "2026-03-26T10:45:44Z")

</div>

`retina_masks=True` is for prediction. You use it with `model.predict()`

---

<div class="post-metadata">

**Author:** ![Luciano\_Carvalheira](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/luciano_carvalheira/32/1427_2.png) [@Luciano\_Carvalheira](https://community.ultralytics.com/u/Luciano_Carvalheira)\
**Post date:** [March 26, 2026, 12:05pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/7 "2026-03-26T12:05:56Z")

</div>

Thank you a lot for your sugestion, it helped a lot.

Now the prediction is much better.

One more question, don’t you recommend to use retina\_masks on training?

Here an example showing the improvement on prediction using retina\_masks = True. The image on the right is the one with retina\_masks = True.

 ![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/8/814ef164fcda81b6d62bee9fcb4d66616bd86ed3.jpeg)

---

<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:** [March 26, 2026, 1:00pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/8 "2026-03-26T13:00:13Z")

</div>

Training shouldn’t be affected with `retina_masks`. It’s applied during prediction

---

<div class="post-metadata">

**Author:** ![Luciano\_Carvalheira](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/luciano_carvalheira/32/1427_2.png) [@Luciano\_Carvalheira](https://community.ultralytics.com/u/Luciano_Carvalheira)\
**Post date:** [March 26, 2026, 1:18pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/9 "2026-03-26T13:18:35Z")

</div>

Ok, thank you again for your help.

---

<div class="post-metadata">

**Author:** ![pderrenger](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/pderrenger/32/73_2.png) [@pderrenger](https://community.ultralytics.com/u/pderrenger)\
**Post date:** [March 27, 2026, 1:46pm UTC](https://community.ultralytics.com/t/yolo-is-not-reading-correctly-the-training-data/1899/10 "2026-03-27T13:46:17Z")

</div>

You’re welcome — glad it helped.

And yes, that’s correct: `retina_masks=True` is a **prediction/rendering** option, not a training option. In the [segmentation predictor reference](https://docs.ultralytics.com/reference/models/yolo/segment/predict/) it’s used when constructing inference masks, and in the [mask plotting code reference](https://docs.ultralytics.com/reference/utils/plotting/) it controls high-resolution mask drawing. So it won’t improve `model.train()` results directly.

For your case, just keep using it in prediction like:

```python
results = model.predict(source=img, retina_masks=True)

```

With large images and small round objects like blastocysts, that’s the right approach.
