Safemotion Lib
Loading...
Searching...
No Matches
runner_builder.py
Go to the documentation of this file.
1from smaction.runner.mmaction_pytorch_runner import MMActionPyTorchRunner
2from smaction.runner.action_recognition_runner import ActionRecognitionRunner
3
4__runner_builders__ = {
5 "MMActionPyTorchRunner": MMActionPyTorchRunner,
6 "ActionRecognitionRunner" : ActionRecognitionRunner,
7}
8
10 """
11 action/runner 의 모델을 빌드하는 함수
12 action/runner의 모델은 action/models의 모듈 및 추가적인 파이토치 모듈을 이용해서 정의됨
13
14 args :
15 type -> 모델의 타입 __runner_builders__ 의 키값이 들어가야함
16 type을 제외한 나머지 파라미터는 모델의 파라미터값이 있어야함
17 세부적으로 모듈의 타입과 모듈의 파라미터가 정의되어 있어야함
18
19 returns:
20 파이토이 모델
21 """
22 assert args.type in __runner_builders__, \
23 f'not found runner model type : {args.type}'
24
25 runner_builder = __runner_builders__[args.type]
26 runner_args = args.copy()
27 runner_args.pop('type')
28 return runner_builder(**runner_args)
build_action_runner(args)