mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 20:46:31 +00:00
fix some cython code
This commit is contained in:
+3
-3
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user