Safemotion Lib
Loading...
Searching...
No Matches
runner_builder.py
Go to the documentation of this file.
1from smdetect.runner.mmdet_pytorch_runner import MMDetPyTorchRunner
2from smdetect.runner.mmdet_trt_runner import MMDetTRTRunner
3from smdetect.runner.yolov8_runner import YoloV8Runner
4
5__runner_builders__ = {
6 "MMDetPyTorchRunner": MMDetPyTorchRunner,
7 "MMDetTRTRunner" : MMDetTRTRunner,
8 "YoloV8Runner" : YoloV8Runner,
9}
10
12 """
13 detect/runner 의 모델을 빌드하는 함수
14 현재 detect/runner의 모델은 오픈소스기반으로 구현되어 있음
15
16 args :
17 type -> 모델의 타입 __runner_builders__ 의 키값이 들어가야함
18 type을 제외한 나머지 파라미터는 모델의 파라미터값이 있어야함
19 세부적으로 모듈의 타입과 모듈의 파라미터가 정의되어 있어야함
20
21 returns:
22 파이토이 모델 or TensorRT 모델
23 """
24 assert args.type in __runner_builders__, \
25 f'not found detection model type : {args.type}'
26
27 runner_builder = __runner_builders__[args.type]
28 runner_args = args.copy()
29 runner_args.pop('type')
30 return runner_builder(**runner_args)
build_detect_runner(args)