refactor: decouple TempFeatureExtractor from detection logic

- Remove detect_and_extract() method from TempFeatureExtractor
  (moved to FaultDiagnoser pipeline)
- Remove YOLO model loading from TempFeatureExtractor.__init__
- Remove duplicate train_yolo_model/validate_model from detect.py
  (already exist in scripts/train.py)
- Fix usage_example.py to use new import path and TempFeatureExtractor API
This commit is contained in:
SkyLi
2026-03-29 00:33:11 +08:00
parent 426143099a
commit 8813cdf6f1
4 changed files with 46 additions and 184 deletions
+2 -4
View File
@@ -8,9 +8,7 @@ from pathlib import Path
# 添加项目根目录到路径
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.detect import InfraredDetector
from src.extract_temp import TempFeatureExtractor
from src.diagnose import FaultDiagnoser
from src.infrared_data import InfraredDetector, TempFeatureExtractor, FaultDiagnoser
import cv2
import json
@@ -48,7 +46,7 @@ def example3_temperature_extraction():
"""示例3:温度特征提取"""
print("\n【示例3】温度特征提取")
extractor = TempFeatureExtractor("weights/best.pt")
extractor = TempFeatureExtractor()
detector = InfraredDetector("weights/best.pt")
# 读取图像