detrium.nn.autobackend

Unified multi-backend inference engine (`AutoBackend`): PyTorch (.pt / nn.Module), ONNXRuntime (.onnx), TensorRT (.engine / .plan), and OpenVINO (.xml).

class AutoBackend(nn.Module)

Unified inference wrapper across PyTorch, ONNXRuntime, TensorRT, and OpenVINO.

名称类型默认值
weightsUnion[str, Path, nn.Module]—
deviceOptional[Union[str, int, torch.device]]None
halfboolFalse
namesOptional[Mapping[int, str]]None
imgszOptional[Tuple[int, int]]None
taskstr'detect'
familystr'rtdetr'
forward(self, images: torch.Tensor, orig_target_sizes: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]
名称类型默认值
imagestorch.Tensor—
orig_target_sizestorch.Tensor—
select_device(device: Optional[Union[str, int, torch.device]]=None) -> torch.device
名称类型默认值
deviceOptional[Union[str, int, torch.device]]None