import torch def detect_hotspots(model, image): # Perform thermal hotspot detection results = model(image) hotspots = [] for detection in results.xywh[0]: class_id = int(detection[5].item()) if class_id == 4: # Assuming class 4 is for hotspots hotspots.append({"type": "Hotspot", "location": (detection[0], detection[1])}) return hotspots