Add free Static Space results board link; correct mAP@0.75 to 0.5710
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100---license: apache-2.0language:- en- zhbase_model: roboflow/RfDetr_Largepipeline_tag: object-detectionlibrary_name: torchtags:- pcb- defect-detection- rfdetr- small-object-detection- dspcbsd- industrial-inspection---# RF-DETR-L fine-tuned for PCB surface-defect detection (9 classes)Weights only. [RF-DETR-Large](https://huggingface.co/roboflow/RfDetr_Large) (Roboflow, ICLR 2026) fine-tuned on **DsPCBSD+** — 9 classes of printed-circuit-board surface defects at 640 px input. Industrial-optical-inspection research; not a validated production AOI system.## Headline result| Metric | Value | What it is ||---|---|---|| **mAP@0.5:0.95** | **0.5397** | independent end-to-end `pycocotools` re-evaluation of `checkpoint_best_ema.pth`, 3 seeds (0/1/2) with `cudnn.deterministic` || mAP@0.5 | 0.8677 | same run || mAP@0.75 | 0.5715 | same run || mAP@0.5:0.95 (log peak) | 0.5411 | trainer-recorded EMA at epoch 9 of run `rfdetr_l_640_v11a_lrl` (`metrics.csv`) — a training-log value, not a re-evaluation |`std = 0.0` and `CI95 = 0.0` across the three seeds come from evaluation-side determinism (fixed seeds, deterministic cuDNN), **not** from model stability. The per-image `eval_results.json` was not preserved, so 0.5397 is verified at the aggregate level only.## Per-class AP@0.5:0.95 (aggregate eval record)| Class | AP | Class | AP | Class | AP ||---|---|---|---|---|---|| HB (hole breakout) | 0.8321 | OP (open circuit) | 0.5623 | SC (short circuit) | 0.5446 || SH (solder hole) | 0.5805 | BMFO (burnt mark / fake open) | 0.5006 | CS (copper splash) | 0.5167 || MB (mouse bite) | 0.4276 | CFO (conducting filament) | 0.4868 | SP (spurious copper) | 0.4025 |Median box width is ~21 px in a 226×226 source image, so this is a small-object task; that geometry, not the detector choice, is what caps mAP@0.5:0.95.## Training recipe (from the packaged `training_config.json`)```run rfdetr_l_640_v11a_lrl input 640epochs 11 (resumed) lr 5e-5steps / epoch 748 dataset_file roboflow (COCO layout)resume v9 checkpoint_best_ema.pth weights only (bf16 + fused-Adam dtype incompatibility)package rfdetr==1.8.3 (Apache-2.0)```Relay chain: v9 → v11a. Total gain of the final stage over v9 is **+0.0008 mAP**; the real jumps came from switching to RF-DETR-L at 640 px and from fixing a COCO `file_name` prefix bug (`file_name` must be `images/<basename>`), not from the lower learning rate. Earlier failed experiments are recorded in the repository but are **not** verified numbers — their run directories are absent.## Files here| File | Size | Notes ||---|---|---|| `checkpoint_best_ema.pth` | 128.05 MB | EMA weights of run v11a (the checkpoint that produced 0.5397) || `training_config.json` | — | full hyper-parameters as written by the trainer || `metrics.csv` | — | per-epoch raw/EMA metrics for v11a epochs 8–10 || `SHA256SUMS.txt` | — | checksums for the files above |## Usage```bashpip install "rfdetr==1.8.3"``````pythonfrom rfdetr import RFDETRLargemodel = RFDETRLarge(pretrain_weights="checkpoint_best_ema.pth")dets = model.detect("pcb_tile.jpg", threshold=0.3)```Class order and the inference wrapper (incl. tiling, which was tested and **rejected** — SAHI slicing cost −23% mAP) live in**[github.com/NextBai/pcb-defect-detection](https://github.com/NextBai/pcb-defect-detection)** — 15 passing tests, CI on Python 3.12, no dataset and no weights in Git.## Dataset and attributionDsPCBSD+ is a public benchmark: Shengping Lv et al., 2024, Figshare DOI [`10.6084/m9.figshare.24970329.v1`](https://figshare.com/articles/dataset/DsPCBSD_/24970329), companion paper *Scientific Data* 11:811, DOI `10.1038/s41597-024-03656-8`. **Licence: CC BY 4.0 — attribution required.** Images are not redistributed here; obtain the dataset from the source above before reproducing any number.Published baseline comparison on the same val split (different input resolution and recipe, so directional only): Co-DETR 0.492, YOLOv6-L6 0.514 mAP@0.5:0.95.## 繁體中文摘要**RF-DETR-L 微調 · 9 類 PCB 表面瑕疵偵測(僅發布權重)**以 Roboflow 的 RF-DETR-Large(ICLR 2026)為起點,在 **DsPCBSD+** 公開基準上做 640 解析度、三階段接力微調(v9 → v11a,lr 5e-5、11 epochs、每 epoch 748 steps)。- 頭號數字 **mAP@0.5:0.95 = 0.5397**:這是拿 `checkpoint_best_ema.pth` 做**獨立端到端 pycocotools 重評**、3 個 seed(0/1/2)加 `cudnn.deterministic` 的平均值;mAP@0.5 = 0.8677、mAP@0.75 = 0.5715。- **0.5411 是訓練日誌在 v11a epoch 9 記錄的 EMA 峰值**,不是重評值,兩者為不同測量,本卡以 0.5397 為準。- 三個 seed 的 std = 0.0 來自評估端固定 seed 的確定性,**不代表模型穩定性**;逐筆 `eval_results.json` 未保留,因此 0.5397 屬彙總層級驗��。- 類別表現:HB 0.8321 最高、SP 0.4025 最低。226×226 原圖中位數框寬約 21 px,屬小目標偵測,這是 mAP 天花板偏低的結構性原因。- 誠實記錄最後一階段(v9→v11a)增益只有 **+0.0008**;真正有效的變動是換架構+解析度、以及修正 COCO `file_name` 需為 `images/<basename>` 的 bug。早期 13 項失敗實驗因 run 目錄不在封裝內,**列為未驗證**,不當成效宣稱。- 授權:RF-DETR 為 Apache-2.0;DsPCBSD+ 為 **CC BY 4.0(必須署名)**。本倉不重新散布影像資料。- 完整推論程式、測試與 CI 在 [NextBai/pcb-defect-detection](https://github.com/NextBai/pcb-defect-detection)。**聲明**:本模型為工業光學檢測研究產出,非經證實的產線 AOI 方案,不得作為品質判定依據。專案為團隊協作成果(模型訓練與評估、工具鏈為主要貢獻範圍)。123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102---license: apache-2.0language:- en- zhbase_model: roboflow/RfDetr_Largepipeline_tag: object-detectionlibrary_name: torchtags:- pcb- defect-detection- rfdetr- small-object-detection- dspcbsd- industrial-inspection---# RF-DETR-L fine-tuned for PCB surface-defect detection (9 classes)Weights only. [RF-DETR-Large](https://huggingface.co/roboflow/RfDetr_Large) (Roboflow, ICLR 2026) fine-tuned on **DsPCBSD+** — 9 classes of printed-circuit-board surface defects at 640 px input. Industrial-optical-inspection research; not a validated production AOI system.**Bilingual results board (free Static Space)** — headline metrics, per-class AP, the class-frequency inversion, ceiling probes and the eleven archived paths: <https://huggingface.co/spaces/LawrenceBai/pcb-defect-results>. 靜態中英結果板(免費 Static Space):託管於同連結,不需任何訂閱即可開。## Headline result| Metric | Value | What it is ||---|---|---|| **mAP@0.5:0.95** | **0.5397** | independent end-to-end `pycocotools` re-evaluation of `checkpoint_best_ema.pth`, 3 seeds (0/1/2) with `cudnn.deterministic` || mAP@0.5 | 0.8677 | same run || mAP@0.75 | 0.5710 | same run(與倉內 `class_names.json` 一致;舊版卡片誤植 0.5715)|| mAP@0.5:0.95 (log peak) | 0.5411 | trainer-recorded EMA at epoch 9 of run `rfdetr_l_640_v11a_lrl` (`metrics.csv`) — a training-log value, not a re-evaluation |`std = 0.0` and `CI95 = 0.0` across the three seeds come from evaluation-side determinism (fixed seeds, deterministic cuDNN), **not** from model stability. The per-image `eval_results.json` was not preserved, so 0.5397 is verified at the aggregate level only.## Per-class AP@0.5:0.95 (aggregate eval record)| Class | AP | Class | AP | Class | AP ||---|---|---|---|---|---|| HB (hole breakout) | 0.8321 | OP (open circuit) | 0.5623 | SC (short circuit) | 0.5446 || SH (solder hole) | 0.5805 | BMFO (burnt mark / fake open) | 0.5006 | CS (copper splash) | 0.5167 || MB (mouse bite) | 0.4276 | CFO (conducting filament) | 0.4868 | SP (spurious copper) | 0.4025 |Median box width is ~21 px in a 226×226 source image, so this is a small-object task; that geometry, not the detector choice, is what caps mAP@0.5:0.95.## Training recipe (from the packaged `training_config.json`)```run rfdetr_l_640_v11a_lrl input 640epochs 11 (resumed) lr 5e-5steps / epoch 748 dataset_file roboflow (COCO layout)resume v9 checkpoint_best_ema.pth weights only (bf16 + fused-Adam dtype incompatibility)package rfdetr==1.8.3 (Apache-2.0)```Relay chain: v9 → v11a. Total gain of the final stage over v9 is **+0.0008 mAP**; the real jumps came from switching to RF-DETR-L at 640 px and from fixing a COCO `file_name` prefix bug (`file_name` must be `images/<basename>`), not from the lower learning rate. Earlier failed experiments are recorded in the repository but are **not** verified numbers — their run directories are absent.## Files here| File | Size | Notes ||---|---|---|| `checkpoint_best_ema.pth` | 128.05 MB | EMA weights of run v11a (the checkpoint that produced 0.5397) || `training_config.json` | — | full hyper-parameters as written by the trainer || `metrics.csv` | — | per-epoch raw/EMA metrics for v11a epochs 8–10 || `SHA256SUMS.txt` | — | checksums for the files above |## Usage```bashpip install "rfdetr==1.8.3"``````pythonfrom rfdetr import RFDETRLargemodel = RFDETRLarge(pretrain_weights="checkpoint_best_ema.pth")dets = model.detect("pcb_tile.jpg", threshold=0.3)```Class order and the inference wrapper (incl. tiling, which was tested and **rejected** — SAHI slicing cost −23% mAP) live in**[github.com/NextBai/pcb-defect-detection](https://github.com/NextBai/pcb-defect-detection)** — 15 passing tests, CI on Python 3.12, no dataset and no weights in Git.## Dataset and attributionDsPCBSD+ is a public benchmark: Shengping Lv et al., 2024, Figshare DOI [`10.6084/m9.figshare.24970329.v1`](https://figshare.com/articles/dataset/DsPCBSD_/24970329), companion paper *Scientific Data* 11:811, DOI `10.1038/s41597-024-03656-8`. **Licence: CC BY 4.0 — attribution required.** Images are not redistributed here; obtain the dataset from the source above before reproducing any number.Published baseline comparison on the same val split (different input resolution and recipe, so directional only): Co-DETR 0.492, YOLOv6-L6 0.514 mAP@0.5:0.95.## 繁體中文摘要**RF-DETR-L 微調 · 9 類 PCB 表面瑕疵偵測(僅發布權重)**以 Roboflow 的 RF-DETR-Large(ICLR 2026)為起點,在 **DsPCBSD+** 公開基準上做 640 解析度、三階段接力微調(v9 → v11a,lr 5e-5、11 epochs、每 epoch 748 steps)。- 頭號數字 **mAP@0.5:0.95 = 0.5397**:這是拿 `checkpoint_best_ema.pth` 做**獨立端到端 pycocotools 重評**、3 個 seed(0/1/2)加 `cudnn.deterministic` 的平均值;mAP@0.5 = 0.8677、mAP@0.75 = 0.5715。- **0.5411 是訓練日誌在 v11a epoch 9 記錄的 EMA 峰值**,不是重評值,兩者為不同測量,本卡以 0.5397 為準。- 三個 seed 的 std = 0.0 來自評估端固定 seed 的確定性,**不代表模型穩定性**;逐筆 `eval_results.json` 未保留,因此 0.5397 屬彙總層級驗證。- 類別表現:HB 0.8321 最高、SP 0.4025 最低。226×226 原圖中位數框寬約 21 px,屬小目標偵測,這是 mAP 天花板偏低的結構性原因。- 誠實記錄最後一階段(v9→v11a)增益只有 **+0.0008**;真正有效的變動是換架構+解析度、以及修正 COCO `file_name` 需為 `images/<basename>` 的 bug。早期 13 項失敗實驗因 run 目錄不在封裝內,**列為未驗證**,不當成效宣稱。- 授權:RF-DETR 為 Apache-2.0;DsPCBSD+ 為 **CC BY 4.0(必須署名)**。本倉不重新散布影像資料。- 完整推論程式、測試與 CI 在 [NextBai/pcb-defect-detection](https://github.com/NextBai/pcb-defect-detection)。**聲明**:本模型為工業光學檢測研究產出,非經證實的產線 AOI 方案,不得作為品質判定依據。專案為團隊協作成果(模型訓練與評估、工具鏈為主要貢獻範圍)。
README.md+102-100