Skip to content

Commit

Permalink
flexibility pose segmentation cut
Browse files Browse the repository at this point in the history
  • Loading branch information
RotemZilberman committed Feb 21, 2024
1 parent 32fa45e commit c20349f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions signwriting_transcription/pose_to_signwriting/bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_args():
parser.add_argument('--elan', required=True, type=str, help='path to elan file')
parser.add_argument('--model', type=str, default='bc2de71.ckpt', help='model to use')
parser.add_argument('--strategies', required=False, type=str, default='tight',
options=['tight', 'wide'], help='strategy to use')
choices=['tight', 'wide'], help='strategy to use')
return parser.parse_args()


Expand Down Expand Up @@ -74,12 +74,16 @@ def main():
temp_files = []
start = 0
for index, segment in tqdm(enumerate(sign_annotations)):
end = sign_annotations[index + 1][0] if index + 1 < len(sign_annotations) else None
if args.strategies == 'wide':
end = (sign_annotations[index + 1][0] + segment[1]) // 2 if index + 1 < len(sign_annotations) else None
end = (end + segment[1]) // 2 if index + 1 < len(sign_annotations) else None
np_pose = pose_to_matrix(temp_pose_path, start, end).filled(fill_value=0)
start = end
else:
np_pose = pose_to_matrix(temp_pose_path, segment[0], segment[1]).filled(fill_value=0)
end = end if end is not None else segment[1] + 300
np_pose = pose_to_matrix(temp_pose_path, segment[0] - (segment[0] - start) * 0.25
, segment[1] + (end - segment[1]) * 0.25).filled(fill_value=0)
start = segment[1]
pose_path = temp_dir / f'{index}.npy'
np.save(pose_path, np_pose)
temp_files.append(pose_path)
Expand Down

0 comments on commit c20349f

Please sign in to comment.