mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 22:16:31 +00:00
60 lines
1.3 KiB
Markdown
60 lines
1.3 KiB
Markdown
# Module: inference_engine
|
|
|
|
## Purpose
|
|
|
|
Abstract base class defining the interface that all inference engine implementations must follow.
|
|
|
|
## Public Interface
|
|
|
|
### Class: InferenceEngine
|
|
|
|
#### Fields
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| `batch_size` | int | Number of images per inference batch |
|
|
|
|
#### Methods
|
|
|
|
| Method | Signature | Description |
|
|
|--------|-----------|-------------|
|
|
| `__init__` | `(bytes model_bytes, int batch_size=1, **kwargs)` | Stores batch_size |
|
|
| `get_input_shape` | `() -> tuple` | Returns (height, width) of model input. Abstract — raises `NotImplementedError` |
|
|
| `get_batch_size` | `() -> int` | Returns `self.batch_size` |
|
|
| `run` | `(input_data) -> list` | Runs inference on preprocessed input blob. Abstract — raises `NotImplementedError` |
|
|
|
|
## Internal Logic
|
|
|
|
Pure abstract class. All methods except `get_batch_size` raise `NotImplementedError` and must be overridden by subclasses (`OnnxEngine`, `TensorRTEngine`).
|
|
|
|
## Dependencies
|
|
|
|
- **External**: `numpy` (declared in .pxd, not used in base)
|
|
- **Internal**: none (leaf module)
|
|
|
|
## Consumers
|
|
|
|
- `onnx_engine` — subclass
|
|
- `tensorrt_engine` — subclass
|
|
- `inference` — type reference in .pxd
|
|
|
|
## Data Models
|
|
|
|
None.
|
|
|
|
## Configuration
|
|
|
|
None.
|
|
|
|
## External Integrations
|
|
|
|
None.
|
|
|
|
## Security
|
|
|
|
None.
|
|
|
|
## Tests
|
|
|
|
None found.
|