Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,16 +49,14 @@ def detect_faults(frame, results, frame_idx, fps):
|
|
| 49 |
continue
|
| 50 |
|
| 51 |
timestamp = round(frame_idx / fps, 2)
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
"X1": x1, "Y1": y1, "X2": x2, "Y2": y2
|
| 61 |
-
})
|
| 62 |
|
| 63 |
cv2.rectangle(annotated_frame, (x1, y1), (x2, y2), color, 2)
|
| 64 |
cv2.putText(annotated_frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)
|
|
|
|
| 49 |
continue
|
| 50 |
|
| 51 |
timestamp = round(frame_idx / fps, 2)
|
| 52 |
+
faults_found.append({
|
| 53 |
+
"Frame": frame_idx,
|
| 54 |
+
"Fault Type": label,
|
| 55 |
+
"Confidence": round(float(box.conf[0]), 2) if box.conf is not None else None,
|
| 56 |
+
"Intensity": round(mean_intensity, 2),
|
| 57 |
+
"Box": f"({x1}, {y1}, {x2}, {y2})"
|
| 58 |
+
})
|
| 59 |
+
|
|
|
|
|
|
|
| 60 |
|
| 61 |
cv2.rectangle(annotated_frame, (x1, y1), (x2, y2), color, 2)
|
| 62 |
cv2.putText(annotated_frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)
|