mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 10:56:32 +00:00
Refactor type casting in Cython files for improved clarity and consistency
- Updated various Cython files to explicitly cast types, enhancing type safety and readability. - Adjusted the `engine_name` property in `InferenceEngine` and its subclasses to be set directly in the constructor. - Modified the `request` method in `_SessionWithBase` to accept `*args` for better flexibility. - Ensured proper type casting for return values in methods across multiple classes, including `Inference`, `CoreMLEngine`, and `TensorRTEngine`. These changes aim to streamline the codebase and improve maintainability by enforcing consistent type usage.
This commit is contained in:
+2
-2
@@ -3,7 +3,7 @@ cimport constants_inf
|
||||
|
||||
cdef class Detection:
|
||||
def __init__(self, double x, double y, double w, double h, int cls, double confidence):
|
||||
self.annotation_name = None
|
||||
self.annotation_name = ""
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.w = w
|
||||
@@ -54,7 +54,7 @@ cdef class Annotation:
|
||||
return f"{self.name}: {detections_str}"
|
||||
|
||||
cdef bytes serialize(self):
|
||||
return msgpack.packb({
|
||||
return <bytes>msgpack.packb({
|
||||
"n": self.name,
|
||||
"mn": self.original_media_name,
|
||||
"i": self.image, # "i" = image
|
||||
|
||||
Reference in New Issue
Block a user