print detection results

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-10 18:02:44 +02:00
parent 0f13ba384e
commit 9973a16ada
5 changed files with 16 additions and 2 deletions
+10
View File
@@ -32,6 +32,16 @@ cdef class Annotation:
d.annotation_name = self.name
self.image = b''
cdef to_str(self, class_names):
if not self.detections:
return f"{self.name}: No detections"
detections_str = ", ".join(
f"{class_names[d.cls]} {d.confidence * 100:.1f}% ({d.x:.2f}, {d.y:.2f})"
for d in self.detections
)
return f"{self.name}: {detections_str}"
cdef format_time(self, ms):
# Calculate hours, minutes, seconds, and hundreds of milliseconds.
h = ms // 3600000 # Total full hours.