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.

名称类型默认值
modelnn.Module—
postprocessorOptional[nn.Module]—
familyModelFamilyAdapter—
namesMapping[int, str]—
imgszTuple[int, int](640, 640)
model_namestr'detrium'
default_dirOptional[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
名称类型默认值
formatstr'onnx'
outputOptional[Union[str, Path]]None
imgszOptional[Union[int, Tuple[int, int]]]None
batchint1
dynamicboolTrue
simplifyboolTrue
halfboolFalse
precisionOptional[str]None
strongly_typedboolFalse
trt_pluginboolFalse
opsetint17
deviceOptional[Union[str, int]]None
workspace_gbfloat4.0
builder_optimization_levelint3
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_pathPath—
precisionstr—
out_pathPath—