Safemotion Lib
Loading...
Searching...
No Matches
model_builder.py
Go to the documentation of this file.
1from smaction.models.backbones.stgcn import STGCN
2from smaction.models.heads.gcn_head import GCNHead
3from smaction.models.backbones.resnet3d import ResNet3d
4from smaction.models.heads.i3d_head import I3DHead
5from smaction.models.heads.i3d_fusion import I3DFusion
6from smaction.models.heads.linear_head import LinearHead
7from smaction.models.heads.mlp_head import MLPHead
8from smaction.models.backbones.resnet2d import ResNet2d
9from smaction.models.heads.cat_layer import CatLayer
10
11
12__model_builders__ = {
13 "STGCN" : STGCN,
14 "GCNHead" : GCNHead,
15 "ResNet3d" : ResNet3d,
16 "I3DHead" : I3DHead,
17 "I3DFusion" : I3DFusion,
18 "LinearHead" : LinearHead,
19 "MLPHead" : MLPHead,
20 "ResNet2d" : ResNet2d,
21 "CatLayer" : CatLayer,
22}
23
25 """
26 action/models 의 모듈을 빌드하는 함수
27
28 args :
29 type -> 모듈의 타입 __model_builders__의 키값이 들어가야함
30 type을 제외한 나머지 파라미터는 모듈의 파라미터값이 있어야함
31
32 returns:
33 파이토이 모델(모듈)
34 """
35 assert args.type in __model_builders__, \
36 f'not found action model type : {args.type}'
37
38 runner_builder = __model_builders__[args.type]
39 runner_args = args.copy()
40 runner_args.pop('type')
41 return runner_builder(**runner_args)
build_action_model(args)