File size: 337 Bytes
9c4ef19
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from ultralytics import YOLO

fault_model = YOLO("pole_fault_model.pt")

def detect_pole_faults(image_path):
    results = fault_model(image_path)
    flagged = []
    for r in results:
        if hasattr(r, 'fault_type') and r.conf > 0.6:
            flagged.append({"fault_type": r.fault_type, "confidence": r.conf})
    return flagged