Safemotion Lib
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
stgcn_runner.STGCNRunner Class Reference
Inheritance diagram for stgcn_runner.STGCNRunner:

Public Member Functions

 __init__ (self, backbone, head, device='cuda:0')
 
 make_action_input (self, pose_list, img_shape)
 
 run_recognizer (self, pose_results, img_shape=None)
 
 inference (self, x)
 
 forward (self, x)
 

Public Attributes

 backbone
 
 head
 
 device
 
 k
 

Detailed Description

Definition at line 9 of file stgcn_runner.py.

Constructor & Destructor Documentation

◆ __init__()

stgcn_runner.STGCNRunner.__init__ ( self,
backbone,
head,
device = 'cuda:0' )
input:
    model_cfg : 
    model_checkpoint : 
    device : 

Definition at line 10 of file stgcn_runner.py.

10 def __init__(self, backbone, head, device='cuda:0'):
11 """
12 input:
13 model_cfg :
14 model_checkpoint :
15 device :
16 """
17 super().__init__()
18 self.backbone = build_action_model(backbone)
19 self.head = build_action_model(head)
20 self.device = device
21
22

Member Function Documentation

◆ forward()

stgcn_runner.STGCNRunner.forward ( self,
x )

Definition at line 43 of file stgcn_runner.py.

43 def forward(self, x):
44 return self.inference(x['keypoints'])

◆ inference()

stgcn_runner.STGCNRunner.inference ( self,
x )

Definition at line 37 of file stgcn_runner.py.

37 def inference(self, x):
38 feat = self.backbone(x)
39 scores = self.head(feat)
40 action_labels = scores.argmax()
41 return {'action_labels':action_labels, 'scores':scores}
42

◆ make_action_input()

stgcn_runner.STGCNRunner.make_action_input ( self,
pose_list,
img_shape )

Definition at line 23 of file stgcn_runner.py.

23 def make_action_input(self, pose_list, img_shape):
24 pass
25

◆ run_recognizer()

stgcn_runner.STGCNRunner.run_recognizer ( self,
pose_results,
img_shape = None )

Definition at line 26 of file stgcn_runner.py.

26 def run_recognizer(self, pose_results, img_shape=None):
27 if self.use_valid_check and not utils.check_valid(pose_results, self.k):
28 return None
29
30 if self.use_dummy_pose:
31 pose_results = utils.insert_dummy_pose(pose_results)
32
33 data = self.make_action_input(pose_results, img_shape)
34
35 return self.inference(data)
36

Member Data Documentation

◆ backbone

stgcn_runner.STGCNRunner.backbone

Definition at line 18 of file stgcn_runner.py.

◆ device

stgcn_runner.STGCNRunner.device

Definition at line 20 of file stgcn_runner.py.

◆ head

stgcn_runner.STGCNRunner.head

Definition at line 19 of file stgcn_runner.py.

◆ k

stgcn_runner.STGCNRunner.k

Definition at line 27 of file stgcn_runner.py.


The documentation for this class was generated from the following file: