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:
@@ -28,10 +28,7 @@ cdef class CoreMLEngine(InferenceEngine):
|
||||
self.batch_size = 1
|
||||
|
||||
constants_inf.log(<str>f'CoreML model: {self.img_width}x{self.img_height}')
|
||||
|
||||
@property
|
||||
def engine_name(self):
|
||||
return "coreml"
|
||||
self.engine_name = <str>"coreml"
|
||||
|
||||
@staticmethod
|
||||
def get_engine_filename():
|
||||
@@ -49,10 +46,10 @@ cdef class CoreMLEngine(InferenceEngine):
|
||||
raise ValueError("No .mlpackage or .mlmodel found in zip")
|
||||
|
||||
cdef tuple get_input_shape(self):
|
||||
return self.img_height, self.img_width
|
||||
return <tuple>(self.img_height, self.img_width)
|
||||
|
||||
cdef int get_batch_size(self):
|
||||
return 1
|
||||
return <int>1
|
||||
|
||||
cdef run(self, input_data):
|
||||
cdef int w = self.img_width
|
||||
|
||||
Reference in New Issue
Block a user