Add ability to configure model input dtype (#14659)

* Add input type for dtype

* Add ability to manually enable TRT execution provider

* Formatting
This commit is contained in:
Nicolas Mowen
2024-10-29 10:28:05 -05:00
committed by GitHub
parent abd22d2566
commit 4e25bebdd0
4 changed files with 44 additions and 7 deletions
+8
View File
@@ -27,6 +27,11 @@ class InputTensorEnum(str, Enum):
nhwc = "nhwc"
class InputDTypeEnum(str, Enum):
float = "float"
int = "int"
class ModelTypeEnum(str, Enum):
ssd = "ssd"
yolox = "yolox"
@@ -53,6 +58,9 @@ class ModelConfig(BaseModel):
input_pixel_format: PixelFormatEnum = Field(
default=PixelFormatEnum.rgb, title="Model Input Pixel Color Format"
)
input_dtype: InputDTypeEnum = Field(
default=InputDTypeEnum.int, title="Model Input D Type"
)
model_type: ModelTypeEnum = Field(
default=ModelTypeEnum.ssd, title="Object Detection Model Type"
)
+1 -1
View File
@@ -54,7 +54,7 @@ class ONNXDetector(DetectionApi):
logger.info(f"ONNX: {path} loaded")
def detect_raw(self, tensor_input):
def detect_raw(self, tensor_input: np.ndarray):
model_input_name = self.model.get_inputs()[0].name
tensor_output = self.model.run(None, {model_input_name: tensor_input})