# How to detect simple electrical symbols

**URL:** <https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471>\
**Category:** Support\
**Tags:** discussion, question\
**Created:** [September 18, 2025, 8:00pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471 "2025-09-18T20:00:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/andy/32/989_2.png) [@andy](https://community.ultralytics.com/u/andy)\
**Post date:** [September 18, 2025, 8:00pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/1 "2025-09-18T20:00:25Z")

</div>

Hi all

I am trying to read symbols from electrical house plans.  
The plans are mostly in PDF format, which I have converted to SVG. Then I cropped them to a resolution of 640x640. After that, I replaced the transparent background with noise. The symbols consist of simple line drawings. Mostly only one color (red or blue).  
I can’t get the symbols to be detected. I tried it with Yolov11n and m. When I look at the result after training, I see that only the cls\_loss has changed. Everything else remains at zero. Where could the error be?  
I am sure that the bounding boxes for training are in the right place and the data structure is correct.

As an example, you can see the red circle with the M that I want to detect in the attached image.

 ![eg_1_red_x3456_y7488](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/1X/d4346993deb6341656cdec4c5b95dbc5b70cbd19.jpeg)

Thanks in advance

---

<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:** [September 19, 2025, 4:46am UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/2 "2025-09-19T04:46:18Z")

</div>

What’s your training command? How many images do you have? Can you post `results.jpg` from `runs` folder? And `train_batch` plots.

---

<div class="post-metadata">

**Author:** ![andy](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/andy/32/989_2.png) [@andy](https://community.ultralytics.com/u/andy)\
**Post date:** [September 19, 2025, 5:08pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/3 "2025-09-19T17:08:48Z")

</div>

Hi Toxite  
I use python to train it.

```auto
model = YOLO("yolo11n.pt")

results = model.train(data="dataset.yaml", epochs=10, imgsz = 640, device="mps")

```

At the moment I have 144 labeled images and way more unlabeled. I’ll label some more with in the next days. However, I have the feeling that I am doing something else wrong.

 ![results](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/1X/7ca76313ed19ae6362e825718b1f09260f357576.png)

---

<div class="post-metadata">

**Author:** ![andy](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/andy/32/989_2.png) [@andy](https://community.ultralytics.com/u/andy)\
**Post date:** [September 19, 2025, 5:10pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/4 "2025-09-19T17:10:05Z")

</div>

![train_batch2](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/1X/9889272aa2980f78ebe8c6debb1a7bb809e2f1ca.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:** [September 20, 2025, 4:39am UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/5 "2025-09-20T04:39:37Z")

</div>

Your labels are not correct. The bounding boxes are not visible. You need to fix your labels.

---

<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 20, 2025, 12:37pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/6 "2025-09-20T12:37:05Z")

</div>

> [@andy](#):
>
> way more unlabeled.

Hopefully you’re not including unlabelled images with objects you want to detect in training. If you do, assuming that 90% of your data is unlabeled, it would be indicating to the model that 90% of data does not have any objects to detect. Additionally, 144 images is not going to be enough data to train a model that performs well. If you look at the COCO dataset, which is what the pretrained YOLO models are trained on, you’ll see that there are several thousand images/instances of objects like car, truck, person, cat, dog, etc. That’s how these models are able to perform well on new data. Icons don’t change a lot, but there are an infinite number of layouts, so you’ll need to ensure you have lots of variation in the layouts for the various symbols you want to detect.

---

<div class="post-metadata">

**Author:** ![andy](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/andy/32/989_2.png) [@andy](https://community.ultralytics.com/u/andy)\
**Post date:** [September 20, 2025, 5:58pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/7 "2025-09-20T17:58:17Z")

</div>

Thanks a lot for your hints. I was not aware of it and will fix it.  
Would it help if I removed all colors from my pipeline except for the color of the symbols to be learned? This is easily possible at the SVG stage. Does it depend on what color the background has left?

---

<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:** [September 21, 2025, 1:27pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/8 "2025-09-21T13:27:06Z")

</div>

Great question. Short answer: don’t rely on color. YOLO will learn shapes just fine. If color is consistent and truly discriminative, keeping only the symbol color can work, but it risks overfitting. A safer approach is to standardize inputs to high‑contrast grayscale or binary (black symbols on white background), and apply the exact same preprocessing at train and inference. The specific background color doesn’t matter—contrast and consistency do. Avoid adding synthetic noise unless it reflects real data.

For line drawings, also try higher resolution and simpler augments while you debug:

```python
from ultralytics import YOLO
model = YOLO("yolo11n.pt")
model.train(
    data="dataset.yaml",
    epochs=100,
    imgsz=1024,
    mosaic=0,
    copy_paste=0,
    hsv_h=0, hsv_s=0, hsv_v=0 # no color jitter
)

```

If strokes are very thin, export at higher DPI or thicken strokes so features survive downsampling. After fixing labels, verify overlays in `train_batch*.jpg`. For more tips on data/labels and monitoring, the [Troubleshooting common issues guide](https://docs.ultralytics.com/guides/yolo-common-issues/) is helpful.

---

<div class="post-metadata">

**Author:** ![andy](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/andy/32/989_2.png) [@andy](https://community.ultralytics.com/u/andy)\
**Post date:** [September 23, 2025, 8:01pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/9 "2025-09-23T20:01:49Z")

</div>

Great. Then I’ll switch to black and white images. As soon as I have something here, I’ll get back to you, but it will probably take 1-2 weeks.  
Thank you all.

---

<div class="post-metadata">

**Author:** ![andy](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/andy/32/989_2.png) [@andy](https://community.ultralytics.com/u/andy)\
**Post date:** [October 30, 2025, 9:11pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/10 "2025-10-30T21:11:58Z")

</div>

Hi

In the meantime I adapted my pipeline to have black and white pictures 640x640. I have labeled 460 Images but I have still the same issue. If I check the train\_batch images there are still no bounding boxes.

 ![train_batch2430](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/2X/e/e95b0283f3231ccb17e1376cd705aedbde44d01f.jpeg)

However if I take a picture and manually draw a bounding box with the coordinates from the label.txt file it looks fine.

I’m not anymore sure if my file structure is correct.  
yaml file looks like that:  
`path: /Users/az/PycharmProjects/planpipeline/trainMotorsBlackWhite`  
`train: train/images`  
`val: val/images`  
`nc: 1`  
`names: ['Motor']`

The labels are on `train/labels` and `val/labels`

---

<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:** [October 30, 2025, 10:44pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/11 "2025-10-30T22:44:27Z")

</div>

Did you try deleting the `.cache` files inside `labels` folder? Are there any warnings shown in the logs before training starts? Can you post an example label file content?

---

<div class="post-metadata">

**Author:** ![andy](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/andy/32/989_2.png) [@andy](https://community.ultralytics.com/u/andy)\
**Post date:** [October 31, 2025, 2:24pm UTC](https://community.ultralytics.com/t/how-to-detect-simple-electrical-symbols/1471/12 "2025-10-31T14:24:29Z")

</div>

Thanks for your hints.  
I updated all libraries, including Ultralytics, of course. Now it works. I should have tried that much earlier…
