JcProg commited on
Commit
fe29664
·
verified ·
1 Parent(s): c35ff23

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +77 -0
README.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - image-classification
5
+ - pcb
6
+ - aoi
7
+ - yolo26
8
+ - onnx
9
+ - computer-vision
10
+ - dataset:custom
11
+ library_name: ultralytics
12
+ pipeline_tag: image-classification
13
+ ---
14
+
15
+ # PCBInspect-LeadDefect
16
+
17
+ Part of the **SentinelPCB defect-inspection router**: a region classifier dispatches each
18
+ component ROI crop to a region-specific defect classifier. Sibling repos:
19
+ [PCBInspect-Region](https://huggingface.co/JcProg/PCBInspect-Region), [PCBInspect-BodyDefect](https://huggingface.co/JcProg/PCBInspect-BodyDefect), [PCBInspect-LeadDefect](https://huggingface.co/JcProg/PCBInspect-LeadDefect), [PCBInspect-TextDefect](https://huggingface.co/JcProg/PCBInspect-TextDefect).
20
+
21
+ Companion structural-feature detector (unrelated task — detects MountingHole/ComponentBody/
22
+ SolderJoint/Lead, not defects): [PCBInspect-AI](https://huggingface.co/JcProg/PCBInspect-AI).
23
+
24
+ ## Role
25
+
26
+ Defect classifier for crops routed as `Lead`. Binary: defect-free vs insufficient solder. Classes are naturally balanced (~1,846 each) - no rebalancing needed.
27
+
28
+ ## Model
29
+
30
+ - Base: `yolo26s-cls` ([Ultralytics](https://docs.ultralytics.com/models/yolo26/)),
31
+ classification head, fine-tuned on AOI component-ROI crops.
32
+ - Export: ONNX, opset 17, no NMS (classification only) — single input
33
+ `images` `(1, 3, 640, 640)` RGB, normalized `/255`, NCHW; single output `output0`
34
+ `(1, 2)` raw logits (apply softmax yourself for probabilities).
35
+ - Classes (2), index order = `labels.json`: **Golden, SolderInsufficient**.
36
+
37
+ ## Data
38
+
39
+ Trained on a proprietary AOI dataset of SMT component-ROI crops (paired defect-free reference +
40
+ defective capture per physical site), not publicly released. Split is grouped by physical
41
+ capture site (never by raw image) so a component's reference and defect crop never straddle
42
+ train/val/test.
43
+
44
+ ## Metrics
45
+
46
+ **val** (top-1 0.996, macro-F1 0.996, n=736):
47
+
48
+ | class | precision | recall | f1 | support |
49
+ |---|---|---|---|---|
50
+ | Golden | 0.997 | 0.995 | 0.996 | 369 |
51
+ | SolderInsufficient | 0.995 | 0.997 | 0.996 | 367 |
52
+
53
+ **test** (top-1 0.996, macro-F1 0.996, n=754):
54
+
55
+ | class | precision | recall | f1 | support |
56
+ |---|---|---|---|---|
57
+ | Golden | 0.995 | 0.997 | 0.996 | 377 |
58
+ | SolderInsufficient | 0.997 | 0.995 | 0.996 | 377 |
59
+
60
+ ## Limitations
61
+
62
+ None observed; test top-1/macro-F1 both 0.996 (n=754).
63
+
64
+ ## Usage
65
+
66
+ ```python
67
+ import onnxruntime as ort
68
+ import numpy as np
69
+ from PIL import Image
70
+
71
+ sess = ort.InferenceSession("model.onnx", providers=["CPUExecutionProvider"])
72
+ img = Image.open("crop.jpg").convert("RGB").resize((640, 640))
73
+ x = (np.asarray(img, dtype=np.float32) / 255.0).transpose(2, 0, 1)[None, ...]
74
+ (logits,) = sess.run(None, {"images": x})
75
+ probs = np.exp(logits) / np.exp(logits).sum()
76
+ print(probs)
77
+ ```