# YOLO v8 consider the background as a target, What can I do about that?

**URL:** <https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710>\
**Category:** Discussion\
**Tags:** discussion, question, yolo\
**Created:** [December 24, 2025, 5:46am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710 "2025-12-24T05:46:15Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 24, 2025, 5:46am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/1 "2025-12-24T05:46:15Z")

</div>

My dataset contains over 200,000 images. After training, the model achieved **mAP@0.5 = 0.81** and **mAP@0.5:0.95 = 0.51** with **imgsz = 640** , and I did not observe any false detections. However, when I switched the inference image size to **imgsz = 448** , the model started detecting background regions as the target, and the false positives had **high confidence（0.76）**.

To address this, I tried a simple sample-balancing approach: extracting additional frames from videos, converting them into images, and adding them to the training set. This helped temporarily, but the issue still occurs when the model is applied to **new scenes**.

Using the same dataset, I tested both **YOLOv5** and **YOLOv8** with official/default settings: pretrained weights, batch size 256, **4× RTX 4090 (24GB)**, **300 epochs** , and no other parameter changes.

Has anyone encountered a similar issue?

 ![误检1](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/3/3fd011fc67d42ff28e7581979f29a234f18f9a00.jpeg)

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 24, 2025, 5:52am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/2 "2025-12-24T05:52:43Z")

</div>

I am not good at English.I’ m a student ,who can help me,thank you very much!

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 24, 2025, 6:21am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/3 "2025-12-24T06:21:27Z")

</div>

there are the yolo v5 training results and parameters

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

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 24, 2025, 6:22am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/4 "2025-12-24T06:22:40Z")

</div>

![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/3/3c9ee4341441b47434dab38a29f5ae2b5e58fcaa.png)

---

<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:** [December 25, 2025, 12:42am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/5 "2025-12-25T00:42:06Z")

</div>

This behavior is almost always an **input-resolution mismatch** : you trained/validated at `imgsz=640`, but at inference `imgsz=448` the whole image is rescaled differently, so background textures can start to “look like” your target at that scale and the model becomes overconfident (you’ll usually see AP/precision drop if you validate at 448 too).

First, I’d confirm it by running validation at the same inference size (if metrics drop at 448, it’s expected):

```bash
yolo val model=best.pt data=your.yaml imgsz=448

```

If you _need_ `imgsz=448` in production, the fix is to **train (or fine-tune) for that size** or enable multi-scale so the model learns to be robust across sizes. You can also reduce false positives by increasing your confidence threshold, and by adding “hard negative” images from those new scenes (backgrounds that look similar but are not the target), which is the standard approach when precision is low as described in the Ultralytics note on [improving precision by adjusting confidence and adding difficult negatives](https://www.ultralytics.com/glossary/precision).

Example fine-tune (recommended to try **Ultralytics YOLO11** ):

```bash
yolo train model=yolo11s.pt data=your.yaml imgsz=448 epochs=50 multi_scale=True

```

If you share your `results.png` (the one with P/R curves) and confirm whether this is **single-class** or **multi-class** , I can suggest the best `conf` starting point and whether this looks more like domain shift vs. label noise.

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 25, 2025, 2:46am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/6 "2025-12-25T02:46:58Z")

</div>

First,thank you very much for your help! Let me describe my previous workflow in detail: I trained a model with `imgsz=640`, then set `mode=export` to export an ONNX model with `imgsz=448`. When I ran inference with the ONNX model, I found false positives on new videos. If I extracted frames from a new video and added them to the training set ( added “hard negatives”), I could fix the false-positive issue for that specific video, but false positives would appear again when I switched to another new video. Previously, I also tried training directly with `imgsz=448` using all the default parameters, without changing the confidence threshold, and I still got false positives.

After receiving your message, I just tried what you suggested. I found that when I validated my previously trained `imgsz=640` `best.pt` model with `imgsz=448` (using `CUDA_VISIBLE_DEVICES=1 torchrun --nproc_per_node=1 val.py`), `mAP50` did drop significantly—from 0.80 down to 0.73. The PR plots produced during training and validation are shown below. This is a multi-class object detection task. If you need any other result plots, please leave me a message. I’m truly touched by your reply!

If possible, could you recommend a suitable starting confidence threshold, and also comment on whether this looks more like domain shift or label noise—plus how you would tell? I also have one more question: could these false positives be related to data augmentation? Could augmentation be causing them? The false positives have very high confidence, which feels very strange to me.

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

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

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

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

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 25, 2025, 2:49am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/7 "2025-12-25T02:49:01Z")

</div>

mode=val imgsz=448 results images

 ![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/8/89065aea88794e4993ee7a24c63767fee9a91e49.png)

 ![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/0/035e85282c5d45f258d3defbf5956a6322a39c4a.png)

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 25, 2025, 12:04pm UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/8 "2025-12-25T12:04:49Z")

</div>

I found that when fine-tuning a 448 model from a best.pt trained at 640, enabling multi-scale training causes mAP@0.5 to drop significantly. I’m using the SGD optimizer with lr=0.01, batch size=256, and 8 RTX 4090 GPUs. Should the learning rate be adjusted accordingly?

---

<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:** [December 25, 2025, 5:34pm UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/9 "2025-12-25T17:34:09Z")

</div>

You should train at the same `imgsz` as you’re exporting. Don’t use multi scale. And disable mosaic augmentation.

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 26, 2025, 1:25am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/10 "2025-12-26T01:25:37Z")

</div>

Could you help me ？I have already uploaded the corresponding results png

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 26, 2025, 1:29am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/11 "2025-12-26T01:29:28Z")

</div>

First,thank you very much for your help! Let me describe my previous workflow in detail: I trained a model with `imgsz=640`, then set `mode=export` to export an ONNX model with `imgsz=448`. When I ran inference with the ONNX model, I found false positives on new videos. If I extracted frames from a new video and added them to the training set ( added “hard negatives”), I could fix the false-positive issue for that specific video, but false positives would appear again when I switched to another new video. Previously, I also tried training directly with `imgsz=448` using all the default parameters, without changing the confidence threshold, and I still got false positives.

After receiving your message, I just tried what you suggested. I found that when I validated my previously trained `imgsz=640` `best.pt` model with `imgsz=448` (using `CUDA_VISIBLE_DEVICES=1 torchrun --nproc_per_node=1 val.py`), `mAP50` did drop significantly—from 0.80 down to 0.73. The PR plots produced during training and validation are shown below. This is a multi-class object detection task. If you need any other result plots, please leave me a message. I’m truly touched by your reply!

If possible, could you recommend a suitable starting confidence threshold, and also comment on whether this looks more like domain shift or label noise—plus how you would tell? I also have one more question: could these false positives be related to data augmentation? Could augmentation be causing them? The false positives have very high confidence, which feels very strange to me.

val imgsz=448, weights=best.pt(imgsz=640)

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

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

[![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/c/cb3485b7fc6411938477a0830b55e6a47edeb5df.png)](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/c/cb3485b7fc6411938477a0830b55e6a47edeb5df.png "image")mode=val imgsz=448 results images

[![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/8/89065aea88794e4993ee7a24c63767fee9a91e49.png)](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/8/89065aea88794e4993ee7a24c63767fee9a91e49.png "image")

[![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/0/035e85282c5d45f258d3defbf5956a6322a39c4a.png)](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/0/035e85282c5d45f258d3defbf5956a6322a39c4a.png "image")

train 640 results.png

[![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/4/45011d2f217e3993e038f058df8aec86bbd4faaa.png)](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/4/45011d2f217e3993e038f058df8aec86bbd4faaa.png "image")

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 26, 2025, 1:33am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/13 "2025-12-26T01:33:44Z")

</div>

friend， could you tell me what are the benefits of disable mosaic augmentation

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 26, 2025, 2:12am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/14 "2025-12-26T02:12:34Z")

</div>

I am turning off mosaic augmentation. Should I use the official pre-training weights or the best.pt that I previously trained for 640? Do I need to modify the lr? I used bs=256, 8 cards, SGD optimizer before, lr=0.01

---

<div class="post-metadata">

**Author:** ![shangshuai99999](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/shangshuai99999/32/1219_2.png) [@shangshuai99999](https://community.ultralytics.com/u/shangshuai99999)\
**Post date:** [December 29, 2025, 10:16am UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/15 "2025-12-29T10:16:39Z")

</div>

I still haven’t resolved this issue.I retrained the model with imgsz=448 and disabled mosaic augment throughout the entire process, but it still didn’t work—false positives persist.

---

<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:** [December 30, 2025, 3:21pm UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/16 "2025-12-30T15:21:30Z")

</div>

You should check your ground truth labels. From the example image you shared, it seems like shadows are getting detected as cars, and I’d presume that there are ground truth annotations that include shadows.

You can see from the confusion matrix results plots there are _many_ false positive and false negatives, which indicates there’s likely an issue with your ground truth labels. Whenever you see false positive detections like this, it’s _very likely_ that the issue stems from the original data used in training. Additionally, the precision plot begins to decrease after maybe ~50 epochs, which means that the model is struggling to learn from the ground truth labels.

It’s a lot of work, but you need to verify your ground truth labels are correct. The only way to know for certain is to check the labels, but tools like [Fiftyone](https://docs.voxel51.com/) might be able to help compare predictions versus ground truth so you can find what needs to be corrected. You might also try using the pretrained COCO YOLO models against the problematic images, as they are already trained on car, van, truck, etc. and you can compare how it performs against your custom trained model.

---

<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:** [January 2, 2026, 4:00pm UTC](https://community.ultralytics.com/t/yolo-v8-consider-the-background-as-a-target-what-can-i-do-about-that/1710/17 "2026-01-02T16:00:42Z")

</div>

You should also use a larger model, not the `n` variant.

Or at least, you need to increase the depth of the `n` variant.

> <https://github.com/ultralytics/ultralytics/blob/932c069b0273e97eea46745e3bc5bb73dcd9cecd/ultralytics/cfg/models/11/yolo11.yaml#L11>

You can change depth from `0.5` to `1.0`
