File size: 2,258 Bytes
7d6c720
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
615c7e3
7d6c720
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
license: mit
base_model:
- Ultralytics/YOLO11
tags:
- printed-circuit-boards
library_name: ultralytics
model-index:
- name: ultralytics/yolo11
  results:
  - task:
      type: image-segmentation
    metrics:
    - type: f1
      value: 99.8%
      name: F1 Score
    - type: mAP50
      value: 99.5%
      name: mAP50
metrics:
- f1 - 99.8%
- mAP50 - 99.5%
---
# PCB Detection

There are [a lot of models](https://universe.roboflow.com/roboflow-100/printed-circuit-board/model/3) for detecting components within a Printed Circuit Board (PCB), but not as many for detecting which pixels (if any) in an image contain the PCB itself. Being able to determine if and where a PCB is in an image is useful for [calculating its size to estimate carbon footprint]((https://github.com/SanderGi/LCA)), as a preprocessing step for detecting components, to limit the amount of image more expensive PCB defect detection models have to process, and more.

Read more [here](https://github.com/SanderGi/PCB-Detection).

## Usage

1. Download [`the model weights`](https://huggingface.co/SanderGi/PCB-SEG/resolve/main/best.pt?download=true)
2. `pip install ultralytics`
3. Run the model with `yolo task=segment mode=predict model=[path to model weights] source=[path to test image]` from the terminal or with Python:

```python
from ultralytics import YOLO
model = YOLO('[path to model weights]')
results = model.predict('[path/to/test/image.jpg]')
```

## Results

### Segmentation
Dataset    | Precision | Recall | F1 Score | mAP50 | mAP50-95
-----------|-----------|--------|----------|-------|---------
Training   | 100.0%    | 23.2%  | 37.7%    | 39.4% | 39.1%
Validation | 99.9%     | 39.6%  | 56.7%    | 51.7% | 51.0%
Test       | 99.7%     | 100%   | 99.8%    | 99.5% | 95.6%

Sample predictions:
![sample predictions](https://github.com/SanderGi/PCB-Detection/raw/refs/heads/main/data//augmented_seg/runs/no_perspective/val_batch1_pred.jpg)

### Object Detection

Dataset    | Precision | Recall | F1 Score | mAP50 | mAP50-95
-----------|-----------|--------|----------|-------|---------
Training   | 100.0%    | 23.2%  | 37.7%    | 39.4% | 39.3%
Validation | 99.9%     | 39.6%  | 56.7%    | 51.7% | 51.3%
Test       | 99.7%     | 100%   | 99.8%    | 99.5% | 94.5%