mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 10:36:32 +00:00
27f4aceb52
- Updated the `Inference` class to replace the `get_onnx_engine_bytes` method with `download_model`, allowing for dynamic model loading based on a specified filename. - Modified the `convert_and_upload_model` method to accept `source_bytes` instead of `onnx_engine_bytes`, enhancing flexibility in model conversion. - Introduced a new property `engine_name` to the `Inference` class for better access to engine details. - Adjusted the `AIRecognitionConfig` structure to include a new method pointer `from_dict`, improving configuration handling. - Updated various test cases to reflect changes in model paths and timeout settings, ensuring consistency and reliability in testing.
29 lines
721 B
Cython
29 lines
721 B
Cython
cdef class InferenceEngine:
|
|
def __init__(self, model_bytes: bytes, batch_size: int = 1, **kwargs):
|
|
self.batch_size = batch_size
|
|
|
|
@property
|
|
def engine_name(self):
|
|
return "onnx"
|
|
|
|
@staticmethod
|
|
def get_engine_filename():
|
|
return None
|
|
|
|
@staticmethod
|
|
def get_source_filename():
|
|
return None
|
|
|
|
@staticmethod
|
|
def convert_from_source(bytes source_bytes):
|
|
return source_bytes
|
|
|
|
cdef tuple get_input_shape(self):
|
|
raise NotImplementedError("Subclass must implement get_input_shape")
|
|
|
|
cdef int get_batch_size(self):
|
|
return self.batch_size
|
|
|
|
cdef run(self, input_data):
|
|
raise NotImplementedError("Subclass must implement run")
|