-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
41 lines (30 loc) · 1.15 KB
/
main.py
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
import argparse
import mediapipe as mp
import cv2
from sign_recognizer import displayer
from sign_recognizer.parsermedia.camera import CameraStream
from sign_recognizer.parsermedia.video import VideoStream
from sign_recognizer.model.trainers.trainer import train_model_from_videos
# TODO movement detection (feu vert feu rouge)
def run():
pass
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Sign to text: Command that parse a video stream and recognizes signs')
parser.add_argument("-v", "--video", type=str, nargs='?')
parser.add_argument("-t", '--train', action="store_true")
parser.add_argument("-n", "--no-evaluate", action="store_true")
args = parser.parse_args()
# init stream value
stream = CameraStream()
if args.video:
stream = VideoStream(args.video)
# init components
mp_hands = mp.solutions.hands
mp_pose = mp.solutions.pose
# launch action
if args.no_evaluate:
displayer.display_from_stream(stream, mp_pose, mp_hands)
if args.train:
train_model_from_videos()
else:
displayer.display_evaluate_from_stream(stream, mp_pose, mp_hands)