onnx
sleap_nn.export.predictors.onnx
¶
ONNX Runtime predictor.
Classes:
| Name | Description |
|---|---|
ONNXPredictor |
ONNX Runtime inference with provider selection. |
ONNXPredictor
¶
Bases: ExportPredictor
ONNX Runtime inference with provider selection.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize ONNX predictor with execution providers. |
benchmark |
Benchmark inference latency and throughput. |
predict |
Run inference on a batch of images. |
Source code in sleap_nn/export/predictors/onnx.py
__init__(model_path, device='auto', providers=None)
¶
Initialize ONNX predictor with execution providers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_path
|
str
|
Path to the ONNX model file. |
required |
device
|
str
|
Device for inference ("auto", "cpu", or "cuda"). |
'auto'
|
providers
|
Optional[Iterable[str]]
|
ONNX Runtime execution providers. Auto-selected if None. |
None
|
Source code in sleap_nn/export/predictors/onnx.py
benchmark(image, n_warmup=50, n_runs=200)
¶
Benchmark inference latency and throughput.
Source code in sleap_nn/export/predictors/onnx.py
predict(image)
¶
Run inference on a batch of images.