add pxd headers for correct work

fixes definitions
can run until API call
This commit is contained in:
Alex Bezdieniezhnykh
2025-01-16 17:56:58 +02:00
parent 7439005ed7
commit e21dd7e70f
17 changed files with 207 additions and 165 deletions
+1 -23
View File
@@ -1,9 +1,9 @@
# cython: language_level=3
from ultralytics import YOLO
import mimetypes
import cv2
from ultralytics.engine.results import Boxes
from processor_command import FileCommand
from annotation cimport Detection, Annotation
cdef class Inference:
"""Handles YOLO inference using the AI model."""
@@ -66,25 +66,3 @@ cdef class Inference:
_, encoded_image = cv2.imencode('.jpg', frame[0])
image_bytes = encoded_image.tobytes()
return Annotation(image_bytes, time, detections)
cdef class Detection:
cdef double x
cdef double y
cdef double w
cdef double h
cdef int cls
def __init__(self, double x, double y, double w, double h, int cls):
self.x = x
self.y = y
self.w = w
self.h = h
self.cls = cls
cdef class Annotation:
def __init__(self, image_bytes: bytes, float time, detections: [Detection]):
self.image = image_bytes
self.time = time
self.detections = detections