Views
No views yet
dust, bird_drop, physical_damage, leaf) จากนั้นจับคู่ defect กับแผง คำนวณ severity (สัดส่วนพื้นที่ defect ต่อพื้นที่แผง) และแปลงเป็นคำแนะนำการบำรุงรักษาแบบ rule-based รายแผงv2) ซึ่งใช้ใน deployment จริงโมเดลนี้เป็นเครื่องมือคัดกรองเบื้องต้น ไม่ได้ออกแบบมาแทนการตรวจของผู้เชี่ยวชาญ
| File | Stage | คำอธิบาย |
|---|---|---|
stage1_panel.pt | Stage 1 | panel instance segmentation (1 class: panel) |
stage2_defect_v2.pt | Stage 2 (v2) | defect instance segmentation (4 classes) หลังเพิ่ม clean negatives |
1from huggingface_hub import hf_hub_download
2from ultralytics import YOLO
3import numpy as np
4
5REPO = "wcahca/solar-panel-inspection"
6
7# โหลดทั้งสอง stage
8panel_model = YOLO(hf_hub_download(REPO, "stage1_panel.pt"))
9defect_model = YOLO(hf_hub_download(REPO, "stage2_defect.pt"))
10
11img = "panel.jpg"
12PANEL_CONF = DEFECT_CONF = 0.25
13NMS_IOU = 0.70
14IMGSZ = 640
15
16panels = panel_model.predict(img, conf=PANEL_CONF, iou=NMS_IOU, imgsz=IMGSZ)[0]
17defects = defect_model.predict(img, conf=DEFECT_CONF, iou=NMS_IOU, imgsz=IMGSZ)[0]
18