getters
最后更新
modelconverter.platforms.getters平台特定转换组件的工厂。每个转换平台(RVC2、RVC3、RVC4 和 Hailo)都提供自己的导出器和推理器;Hailo 缺少基准测试,分析器和可视化工具仅由 RVC4 提供。此模块中的 getter 将 Platform 映射到匹配的实现并延迟导入,以便只有选定组件的依赖项才需要可用。导出器和推理器依赖项位于平台的 Docker 镜像中;主机运行的基准测试、分析器和可视化工具从主机环境获取其依赖项。函数
get_analyzer
Python
1def get_analyzer(platform: Platform, *args, **kwargs) -> Analyzer:platform(Platform): 模型转换所针对的平台。*args: 传递给分析器构造函数的 positional 参数。**kwargs: 传递给分析器构造函数的 keyword 参数。
Analyzer: 给定平台的分析器。
ValueError: 如果platform不是Platform.RVC4。
get_benchmark
Python
1def get_benchmark(platform: Platform, *args, **kwargs) -> Benchmark:platform(Platform): 用于对模型进行基准测试的平台。*args: 传递给基准测试构造函数的 positional 参数。**kwargs: 传递给基准测试构造函数的 keyword 参数。
Benchmark: 给定平台的基准测试。
NotImplementedError: 如果platform是Platform.HAILO。
get_exporter
Python
1def get_exporter(platform: Platform, *args, **kwargs) -> Exporter:platform(Platform): 模型转换所针对的平台。*args: 传递给导出器构造函数的 positional 参数。**kwargs: 传递给导出器构造函数的 keyword 参数。
Exporter: 给定平台的导出器。
get_inferer
Python
1def get_inferer(platform: Platform, *args, **kwargs) -> Inferer:from_config 构造函数构建。参数platform(Platform): 模型转换所针对的平台。*args: 传递给from_config的 positional 参数。**kwargs: 传递给from_config的 keyword 参数。
Inferer: 给定平台的推理器。
get_visualizer
Python
1def get_visualizer(platform: Platform, *args, **kwargs) -> Visualizer:platform(Platform): 模型转换所针对的平台。*args: 传递给可视化工具构造函数的 positional 参数。**kwargs: 传递给可视化工具构造函数的 keyword 参数。
Visualizer: 给定平台的可视化工具。
ValueError: 如果platform不是Platform.RVC4。