xmrt commited on
Commit
7d480ef
1 Parent(s): 91f9212

Added ultralytics

Browse files
Files changed (1) hide show
  1. main.py +7 -8
main.py CHANGED
@@ -21,12 +21,12 @@ print("[INFO]: Imported modules!")
21
  human = MMPoseInferencer("human")
22
  hand = MMPoseInferencer("hand")
23
  human3d = MMPoseInferencer(pose3d="human3d")
 
 
24
  # ultraltics
25
 
26
  # Defining inferencer models to lookup in function
27
- inferencers = {"Estimate human 2d poses":human, "Estimate human 2d hand poses":hand, "Estimate human 3d poses":human3d}
28
-
29
- track_model = YOLO('yolov8n.pt') # Load an official Detect model
30
 
31
  print("[INFO]: Downloaded models!")
32
 
@@ -41,13 +41,11 @@ def tracking(video, model, boxes=True):
41
 
42
  return annotated_frame
43
 
44
-
45
-
46
- def show_tracking(video_content, vis_out_dir):
47
  video = cv2.VideoCapture(video_content)
48
 
49
  # Track
50
- video_track = tracking(video_content, track_model.track)
51
 
52
  # Prepare to save video
53
  out_file = os.path.join(vis_out_dir, "track.mp4")
@@ -97,7 +95,8 @@ def infer(video, check):
97
  inferencer = inferencers[i] # 'hand', 'human , device='cuda'
98
 
99
  print("[INFO]: Running inference!")
100
- out_file = poses(inferencer, video, vis_out_dir)
 
101
  if i == "Detect and track":
102
  show_tracking(video, vis_out_dir)
103
 
 
21
  human = MMPoseInferencer("human")
22
  hand = MMPoseInferencer("hand")
23
  human3d = MMPoseInferencer(pose3d="human3d")
24
+ track_model = YOLO('yolov8n.pt') # Load an official Detect model
25
+
26
  # ultraltics
27
 
28
  # Defining inferencer models to lookup in function
29
+ inferencers = {"Estimate human 2d poses":human, "Estimate human 2d hand poses":hand, "Estimate human 3d poses":human3d, "Detect and track":track_model}
 
 
30
 
31
  print("[INFO]: Downloaded models!")
32
 
 
41
 
42
  return annotated_frame
43
 
44
+ def show_tracking(video_content, vis_out_dir, model):
 
 
45
  video = cv2.VideoCapture(video_content)
46
 
47
  # Track
48
+ video_track = tracking(video_content, model .track)
49
 
50
  # Prepare to save video
51
  out_file = os.path.join(vis_out_dir, "track.mp4")
 
95
  inferencer = inferencers[i] # 'hand', 'human , device='cuda'
96
 
97
  print("[INFO]: Running inference!")
98
+ out_file = poses(inferencer, video) o, vis_out_dir)
99
+
100
  if i == "Detect and track":
101
  show_tracking(video, vis_out_dir)
102