|
Safemotion Lib
|
Functions | |
| pose_sampling (sample, clip_len) | |
| pose_compact (sample) | |
| pose_shift (sample, shift_ratio=0.05) | |
| pose_resize (sample, scale=(64, 64)) | |
| get_crop_bbox (kp_hw, area_range, aspect_ratio_range, max_attempts=10) | |
| pose_random_crop (sample, area_range=(0.56, 1.0), aspect_ratio_range=(3/4, 4/3)) | |
| pose_flip (sample, flip_ratio=0.5) | |
| generate_a_heatmap (pose_heatmap, centers, max_values) | |
| generate_heatmap (pose_heatmap, kps, kpscores) | |
| make_pose_heatmap (sample) | |
| pose_transform.generate_a_heatmap | ( | pose_heatmap, | |
| centers, | |||
| max_values ) |
하나의 스켈레톤에 대한 히트맵을 생성하는 기능, 여러명의 사람일 수 있음
args:
pose_heatmap (np.array): 1종 스켈레톤의 히트맵, shape (H, W)
centers (np.array): 1-종의 스켈레톤 좌표(ex-손목, 코 등), shape (num_person, 2)
max_values (np.array): 1-종의 스켈레톤 스코어, shape (num_person)
return ():
Definition at line 267 of file pose_transform.py.
| pose_transform.generate_heatmap | ( | pose_heatmap, | |
| kps, | |||
| kpscores ) |
한 프레임에 대한 스켈레톤 히트맵을 생성하는 기능
args:
pose_heatmap :
kps : 스켈레톤 좌표, shape (num_person, 17, 2)
kpscores : 스켈레톤 스코어, shape (num_person, 17)
Definition at line 306 of file pose_transform.py.
| pose_transform.get_crop_bbox | ( | kp_hw, | |
| area_range, | |||
| aspect_ratio_range, | |||
| max_attempts = 10 ) |
랜덤으로 자르는 영역을 생성하는 기능
args:
kp_hw (tuple): 스켈레톤을 모두 포함하는 박스의 영역 크기
area_range (tuple): 자르는 영역 크기의 범위, 원본 대비 비율
aspect_ratio_range (tuple): aspect_ratio(가로 세로 비율) 범위
max_attempts (int): 랜덤 생성 최대 반복횟수, 10번안에 파라미터를 만족하는 영역이 생성되지 않으면 고정된 영역을 반환함
return (float, float, float, float): left, top, right, bottom
Definition at line 165 of file pose_transform.py.
| pose_transform.make_pose_heatmap | ( | sample | ) |
스켈레톤 좌표를 사용해서 히트맵을 생성하는 기능
args:
sample (dict): 데이터, 여러 프레임의 스켈레톤 좌표와 스코어 값이 저장된 'keypoint', 'keypoint_score'와 스켈레톤 영역의 크기가 저장된 'kp_hw'를 포함함
return (dict): 스켈레톤을 기반으로한 히트맵이 포함된 데이터, 히트맵의 키는 'pose_heatmap'임
Definition at line 318 of file pose_transform.py.
| pose_transform.pose_compact | ( | sample | ) |
모든 스켈레톤을 포함하는 영역을 계산하고 좌상단의 좌표가 (0, 0)이 되도록 스켈레톤 좌표를 shifting함
스켈레톤 좌표의 전체 영역의 크기(높이, 너비)는 'kp_hw'에 저장됨
args:
sample (dict): 데이터, 스켈레톤 좌표가 저장된 'keypoint'를 포함함
return (dict): shifting함된 스켈레톤 좌표와 영역의 크기가 포함된 데이터
Definition at line 67 of file pose_transform.py.
| pose_transform.pose_flip | ( | sample, | |
| flip_ratio = 0.5 ) |
스켈레톤을 좌우 반전하는 기능
args:
sample (dict): 데이터, 여러 프레임의 스켈레톤 좌표와 스코어 값이 저장된 'keypoint', 'keypoint_score'와 스켈레톤 영역의 크기가 저장된 'kp_hw'를 포함함
flip_ratio (float): 좌우 반전 할 확률
return (dict): 일정 확률로 좌우 반전이된 스켈레톤을 포함하는 데이터
Definition at line 230 of file pose_transform.py.
| pose_transform.pose_random_crop | ( | sample, | |
| area_range = (0.56, 1.0), | |||
| aspect_ratio_range = (3 / 4, 4 / 3) ) |
키포인트를 랜덤으로 자르는 기능, 랜덤으로 영역을 생성하고 자름
args:
sample (dict): 데이터, 스켈레톤 좌표가 저장된 'keypoint'와 스켈레톤 영역의 크기가 저장된 'kp_hw'를 포함함
area_range (tuple): 자르는 영역 크기의 범위, 원본 대비 비율
aspect_ratio_range (tuple): aspect_ratio(가로 세로 비율) 범위
return (dict): 잘린 키포인트가 포함된 데이터
Definition at line 206 of file pose_transform.py.
| pose_transform.pose_resize | ( | sample, | |
| scale = (64,64) ) |
스켈레톤 전체 영역의 크기를 지정한 크기로 변환
args:
sample (dict): 데이터, 스켈레톤 좌표가 저장된 'keypoint'와 스켈레톤 영역의 크기가 저장된 'kp_hw'를 포함함
scale (tuple): 변환하려는 크기, (높이, 너비)의 형태
return (dict): 리사이즈된 스켈레톤을 포함한 데이터
Definition at line 144 of file pose_transform.py.
| pose_transform.pose_sampling | ( | sample, | |
| clip_len ) |
스켈레톤 데이터를 랜덤으로 샘플링하는 기능
args:
sample (dict): 데이터, 여러 프레임의 스켈레톤 좌표와 스코어 값이 저장된 'keypoint', 'keypoint_score'를 포함하여야함
'image_feature'가 존재하면 'image_feature'도 함께 샘플링함
clip_len (int): 샘플링 수량
return (dict): 샘플링된 데이터
Definition at line 30 of file pose_transform.py.
| pose_transform.pose_shift | ( | sample, | |
| shift_ratio = 0.05 ) |
스켈레톤 좌표를 일정 비율만큼 이동 시키는 기능
args:
sample (dict): 데이터, 스켈레톤 좌표가 저장된 'keypoint'를 포함함
shift_ratio (float): 좌표 이동 비율
return (dict): 좌표가 이동된 스켈레톤을 포함하는 데이터
Definition at line 114 of file pose_transform.py.