fix some cython code

This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-29 21:18:18 +03:00
parent ad5530b9ef
commit 6269a7485c
32 changed files with 17108 additions and 2728 deletions
+3 -3
View File
@@ -25,13 +25,13 @@ cdef class Detection:
return False
return True
cdef overlaps(self, Detection det2, float confidence_threshold):
cdef bint overlaps(self, Detection det2, float confidence_threshold):
cdef double overlap_x = 0.5 * (self.w + det2.w) - abs(self.x - det2.x)
cdef double overlap_y = 0.5 * (self.h + det2.h) - abs(self.y - det2.y)
cdef double overlap_area = max(0.0, overlap_x) * max(0.0, overlap_y)
cdef double overlap_area = <double>(max(0.0, overlap_x) * max(0.0, overlap_y))
cdef double min_area = min(self.w * self.h, det2.w * det2.h)
return overlap_area / min_area > confidence_threshold
return <bint>(overlap_area / min_area > confidence_threshold)
cdef class Annotation:
def __init__(self, str name, str original_media_name, long ms, list[Detection] detections):