fix: optimize diagnosis output format and fix inconsistency between fault_status and fault_type
1. 输出格式优化: - faults中移除冗余的bbox和confidence字段 - summary中fault_count改名为detection_count 2. fault_status与fault_type逻辑统一: - normal状态时fault_type为'none',不再使用'suspect' - abnormal状态时才进行故障类型分类(hotspot/local_overheating/overheat) 3. 修复usage_example.py图像通道问题: - YOLO检测使用彩色图,温度提取时再转灰度图
This commit is contained in:
@@ -52,10 +52,13 @@ def example3_temperature_extraction():
|
||||
detector = InfraredDetector("weights/best.pt")
|
||||
|
||||
# 读取图像
|
||||
gray_img = cv2.imread(SAMPLE_IMAGE, cv2.IMREAD_GRAYSCALE)
|
||||
color_img = cv2.imread(SAMPLE_IMAGE, cv2.IMREAD_COLOR)
|
||||
|
||||
# 检测目标(复用已加载的图像)
|
||||
detections = detector.detect(gray_img)
|
||||
# 检测目标(彩色图)
|
||||
detections = detector.detect(color_img)
|
||||
|
||||
# 转为灰度图用于温度提取
|
||||
gray_img = cv2.cvtColor(color_img, cv2.COLOR_BGR2GRAY)
|
||||
|
||||
# 提取第一个检测框的温度特征
|
||||
if detections:
|
||||
|
||||
Reference in New Issue
Block a user