detrium.tasks.detect.exporter
DetectionExporter: one-stop ONNX / TensorRT 10-11 (.engine) / TorchScript / OpenVINO export
with automatic CUDA-ops tracing guard, AOT CUDA TRT plugin (`dfine::MSDeformAttnV2Fused`),
ONNXSlim/ONNXSim graph optimization, strongly-typed FP16/BF16 support, and embedded metadata.
class DetectionExporter(BaseExporter)
Export Detrium detection models to ONNX, TensorRT engine (with optional AOT CUDA plugin),
TorchScript, or OpenVINO.
| 名称 | 类型 | 默认值 |
|---|
model | nn.Module | — |
postprocessor | Optional[nn.Module] | — |
family | ModelFamilyAdapter | — |
names | Mapping[int, str] | — |
imgsz | Tuple[int, int] | (640, 640) |
model_name | str | 'detrium' |
default_dir | Optional[Path] | None |
export(self, *, format: str='onnx', output: Optional[Union[str, Path]]=None, imgsz: Optional[Union[int, Tuple[int, int]]]=None, batch: int=1, dynamic: bool=True, simplify: bool=True, half: bool=False, precision: Optional[str]=None, strongly_typed: bool=False, trt_plugin: bool=False, opset: int=17, device: Optional[Union[str, int]]=None, workspace_gb: float=4.0, builder_optimization_level: int=3) -> Path
| 名称 | 类型 | 默认值 |
|---|
format | str | 'onnx' |
output | Optional[Union[str, Path]] | None |
imgsz | Optional[Union[int, Tuple[int, int]]] | None |
batch | int | 1 |
dynamic | bool | True |
simplify | bool | True |
half | bool | False |
precision | Optional[str] | None |
strongly_typed | bool | False |
trt_plugin | bool | False |
opset | int | 17 |
device | Optional[Union[str, int]] | None |
workspace_gb | float | 4.0 |
builder_optimization_level | int | 3 |
prepare_strongly_typed_onnx(onnx_path: Path, precision: str, out_path: Path) -> Path
Convert an FP32 ONNX graph to clean strongly-typed FP16 or BF16 ONNX for TensorRT 10/11+.
| 名称 | 类型 | 默认值 |
|---|
onnx_path | Path | — |
precision | str | — |
out_path | Path | — |