forked from Tianhuanyu/simple_annotation_kpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (37 loc) · 1.5 KB
/
main.py
File metadata and controls
49 lines (37 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import argparse
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description="Simple annotation pipeline: extract dataset from video/images and review keypoints."
)
subparsers = parser.add_subparsers(dest="command", help="Available commands")
parser_extract = subparsers.add_parser(
"extract", help="Extract frames and initialize dataset files without any AI inference."
)
parser_extract.add_argument("--input", required=True, help="Path to a video file or image folder.")
parser_extract.add_argument("--output", default="outputs", help="Output root directory.")
parser_extract.add_argument(
"--frame-step",
type=int,
default=1,
help="Keep every Nth frame/image. Default: 1.",
)
parser_review = subparsers.add_parser("review", help="Open keypoint reviewer GUI.")
parser_review.add_argument("scene_path", help="Path to generated scene folder (e.g., outputs/my_video).")
return parser
def main() -> None:
parser = build_parser()
args = parser.parse_args()
if args.command == "extract":
from src.extractor import run_extract
run_extract(
input_path=args.input,
output_root=args.output,
frame_step=args.frame_step,
)
elif args.command == "review":
from src.reviewer import MatplotlibReviewer
MatplotlibReviewer(args.scene_path)
else:
parser.print_help()
if __name__ == "__main__":
main()