mmdeploy/codebase/base/backend_model.py
def _build_wrapper(backend: Backend,
                       backend_files: Sequence[str],
                       device: str,
                       output_names: Optional[Sequence[str]] = None):
        """The default methods to build backend wrappers.

        Args:
            backend (Backend): The backend enum type.
            beckend_files (Sequence[str]): Paths to all required backend files(
                e.g. '.onnx' for ONNX Runtime, '.param' and '.bin' for ncnn).
            device (str): A string specifying device type.
            output_names (Sequence[str] | None): Names of model outputs in
                order. Defaults to `None` and the wrapper will load the output
                names from the model.
        """
        if backend == Backend.ONNXRUNTIME:
            from mmdeploy.backend.onnxruntime import ORTWrapper
            return ORTWrapper(
                onnx_file=backend_files[0],
                device=device,
                output_names=output_names)
        elif backend == Backend.TENSORRT:
            from mmdeploy.backend.tensorrt import TRTWrapper
            return TRTWrapper(
                engine=backend_files[0], output_names=output_names)
        elif backend == Backend.PPLNN:
            from mmdeploy.backend.pplnn import PPLNNWrapper
            return PPLNNWrapper(
                onnx_file=backend_files[0],
                algo_file=backend_files[1],
                device=device,
                output_names=output_names)
        elif backend == Backend.NCNN:
            from mmdeploy.backend.ncnn import NCNNWrapper
            return NCNNWrapper(
                param_file=backend_files[0],
                bin_file=backend_files[1],
                output_names=output_names)
        elif backend == Backend.OPENVINO:
            from mmdeploy.backend.openvino import OpenVINOWrapper
            return OpenVINOWrapper(
                ir_model_file=backend_files[0], output_names=output_names)
        else:
            raise NotImplementedError(f'Unknown backend type: {backend.value}')
The default methods to build backend wrappers.

        Args:
            backend (Backend): The backend enum type.
            beckend_files (Sequence[str]): Paths to all required backend files(
                e.g. '.onnx' for ONNX Runtime, '.param' and '.bin' for ncnn).
            device (str): A string specifying device type.
            output_names (Sequence[str] | None): Names of model outputs in
                order. Defaults to `None` and the wrapper will load the output
                names from the model.
        
The default methods to build backend wrappers.
The default methods to build backend wrappers .
def _build_wrapper(backend: Backend,
                       backend_files: Sequence[str],
                       device: str,
                       output_names: Optional[Sequence[str]] = None):
        if backend == Backend.ONNXRUNTIME:
            from mmdeploy.backend.onnxruntime import ORTWrapper
            return ORTWrapper(
                onnx_file=backend_files[0],
                device=device,
                output_names=output_names)
        elif backend == Backend.TENSORRT:
            from mmdeploy.backend.tensorrt import TRTWrapper
            return TRTWrapper(
                engine=backend_files[0], output_names=output_names)
        elif backend == Backend.PPLNN:
            from mmdeploy.backend.pplnn import PPLNNWrapper
            return PPLNNWrapper(
                onnx_file=backend_files[0],
                algo_file=backend_files[1],
                device=device,
                output_names=output_names)
        elif backend == Backend.NCNN:
            from mmdeploy.backend.ncnn import NCNNWrapper
            return NCNNWrapper(
                param_file=backend_files[0],
                bin_file=backend_files[1],
                output_names=output_names)
        elif backend == Backend.OPENVINO:
            from mmdeploy.backend.openvino import OpenVINOWrapper
            return OpenVINOWrapper(
                ir_model_file=backend_files[0], output_names=output_names)
        else:
            raise NotImplementedError(f'Unknown backend type: {backend.value}')
def _build_wrapper ( backend : Backend , backend_files : Sequence [ str ] , device : str , output_names : Optional [ Sequence [ str ] ] = None ) : if backend == Backend . ONNXRUNTIME : from mmdeploy . backend . onnxruntime import ORTWrapper return ORTWrapper ( onnx_file = backend_files [ 0 ] , device = device , output_names = output_names ) elif backend == Backend . TENSORRT : from mmdeploy . backend . tensorrt import TRTWrapper return TRTWrapper ( engine = backend_files [ 0 ] , output_names = output_names ) elif backend == Backend . PPLNN : from mmdeploy . backend . pplnn import PPLNNWrapper return PPLNNWrapper ( onnx_file = backend_files [ 0 ] , algo_file = backend_files [ 1 ] , device = device , output_names = output_names ) elif backend == Backend . NCNN : from mmdeploy . backend . ncnn import NCNNWrapper return NCNNWrapper ( param_file = backend_files [ 0 ] , bin_file = backend_files [ 1 ] , output_names = output_names ) elif backend == Backend . OPENVINO : from mmdeploy . backend . openvino import OpenVINOWrapper return OpenVINOWrapper ( ir_model_file = backend_files [ 0 ] , output_names = output_names ) else : raise NotImplementedError ( f'Unknown backend type: {backend.value}' )
The default methods to build backend wrappers.
The default methods to build backend wrappers .
"""The default methods to build backend wrappers.

        Args:
            backend (Backend): The backend enum type.
            beckend_files (Sequence[str]): Paths to all required backend files(
                e.g. '.onnx' for ONNX Runtime, '.param' and '.bin' for ncnn).
            device (str): A string specifying device type.
            output_names (Sequence[str] | None): Names of model outputs in
                order. Defaults to `None` and the wrapper will load the output
                names from the model.
        """
backend
Backend
The backend enum type.
The backend enum type .
backend_files
Sequence[str]
device
str
A string specifying device type.
A string specifying device type .
output_names
Optional[Sequence[str]]
Names of model outputs in
order. Defaults to `None` and the wrapper will load the output
names from the model.
Names of model outputs in order . Defaults to ` None ` and the wrapper will load the output names from the model .
beckend_files
Paths to all required backend files(
e.g. '.onnx' for ONNX Runtime, '.param' and '.bin' for ncnn).
Paths to all required backend files ( e . g . ' . onnx ' for ONNX Runtime ' . param ' and ' . bin ' for ncnn ) .