# yolov11-How to enhance the difference between the target and the background-Like in PCB defect detection

**URL:** <https://community.ultralytics.com/t/yolov11-how-to-enhance-the-difference-between-the-target-and-the-background-like-in-pcb-defect-detection/1654>\
**Category:** Discussion\
**Tags:** discussion, question, yolo, support\
**Created:** [November 21, 2025, 3:10am UTC](https://community.ultralytics.com/t/yolov11-how-to-enhance-the-difference-between-the-target-and-the-background-like-in-pcb-defect-detection/1654 "2025-11-21T03:10:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sparking-cloud](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/sparking-cloud/32/923_2.png) [@sparking-cloud](https://community.ultralytics.com/u/sparking-cloud)\
**Post date:** [November 21, 2025, 3:10am UTC](https://community.ultralytics.com/t/yolov11-how-to-enhance-the-difference-between-the-target-and-the-background-like-in-pcb-defect-detection/1654/1 "2025-11-21T03:10:13Z")

</div>

I currently have a PCB defect detection dataset. After training with YOLOv11, I found that the detection performance for scratches and foreign objects is not good. Specifically, in the confusion matrix, I noticed that these two categories are particularly likely to be recognized as background, with almost 50% being misidentified as background. I personally think this may be because scratches are faint and shallow on the surface, and foreign objects are very small, making it easy for both to be misclassified as background. I have provided three example images: the first two are examples of scratches, and the third is an example of a foreign object. I would like to know what methods can improve the differentiation from the background, or in this situation, do you have any good suggestions?

 ![A1_109_2](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/d/de86b415b68a1b8ee0dc3669a27354a79d3f7930.jpeg)

 ![A1_80_3](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/3/3d208f866295f7c01458a453880af0e77d651729.jpeg)

 ![A1_386](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/b/b2fd3feb724dcdc8a863f916d12962fbdd3bf908.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:** [November 21, 2025, 11:33am UTC](https://community.ultralytics.com/t/yolov11-how-to-enhance-the-difference-between-the-target-and-the-background-like-in-pcb-defect-detection/1654/2 "2025-11-21T11:33:24Z")

</div>

How much data do you have?

---

<div class="post-metadata">

**Author:** ![sparking-cloud](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/sparking-cloud/32/923_2.png) [@sparking-cloud](https://community.ultralytics.com/u/sparking-cloud)\
**Post date:** [November 25, 2025, 5:45am UTC](https://community.ultralytics.com/t/yolov11-how-to-enhance-the-difference-between-the-target-and-the-background-like-in-pcb-defect-detection/1654/3 "2025-11-25T05:45:26Z")

</div>

**Out of 10,000 images, these two types of defects currently have the worst recognition performance.**

---

<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:** [November 25, 2025, 8:03am UTC](https://community.ultralytics.com/t/yolov11-how-to-enhance-the-difference-between-the-target-and-the-background-like-in-pcb-defect-detection/1654/4 "2025-11-25T08:03:02Z")

</div>

You can try SAHI

> **[Ultralytics Docs: Using YOLO11 with SAHI for Sliced Inference](https://docs.ultralytics.com/guides/sahi-tiled-inference/)**
>
> Learn how to implement YOLO11 with SAHI for sliced inference. Optimize memory usage and enhance detection accuracy for large-scale applications.

---

<div class="post-metadata">

**Author:** ![sparking-cloud](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/sparking-cloud/32/923_2.png) [@sparking-cloud](https://community.ultralytics.com/u/sparking-cloud)\
**Post date:** [November 26, 2025, 6:00am UTC](https://community.ultralytics.com/t/yolov11-how-to-enhance-the-difference-between-the-target-and-the-background-like-in-pcb-defect-detection/1654/5 "2025-11-26T06:00:40Z")

</div>

Thank you for your suggestion, but I found that SAHI is more focused on the inference stage. What I want to optimize is the model’s performance—how can it perform better during the training stage? Do you have any suggestions?

---

<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:** [November 26, 2025, 6:55am UTC](https://community.ultralytics.com/t/yolov11-how-to-enhance-the-difference-between-the-target-and-the-background-like-in-pcb-defect-detection/1654/6 "2025-11-26T06:55:40Z")

</div>

You should also train on tiled images similar to SAHI
