xmrt commited on
Commit
27b01fb
·
1 Parent(s): 7df5b0c

3d change ND 2D NEW MODEL

Browse files
Files changed (1) hide show
  1. main_noweb.py +30 -2
main_noweb.py CHANGED
@@ -9,6 +9,7 @@ import gradio as gr
9
  import moviepy.editor as moviepy
10
 
11
 
 
12
  # System and files
13
  import os
14
  import glob
@@ -30,9 +31,9 @@ else:
30
  os.system("nvidia-smi")
31
 
32
  print("[INFO]: Imported modules!")
33
- human = MMPoseInferencer("dekr_hrnet-w32_8xb10-140e_coco-512x512") # ipr_res50_debias-8xb64-210e_coco-256x256-055a7699_20220913
34
  hand = MMPoseInferencer("hand")
35
- human3d = MMPoseInferencer("simplebaseline3d_h36m") # pose3d="human3d"
36
 
37
  print("[INFO]: Downloaded models!")
38
 
@@ -42,6 +43,33 @@ def check_fps(video):
42
  fps = cap.get(cv2.CAP_PROP_FPS)
43
  return nframes, fps
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  def check_extension(video):
46
  split_tup = os.path.splitext(video)
47
 
 
9
  import moviepy.editor as moviepy
10
 
11
 
12
+
13
  # System and files
14
  import os
15
  import glob
 
31
  os.system("nvidia-smi")
32
 
33
  print("[INFO]: Imported modules!")
34
+ human = MMPoseInferencer("ipr_res50_debias-8xb64-210e_coco-256x256-055a7699_20220913") # dekr_hrnet-w32_8xb10-140e_coco-512x512
35
  hand = MMPoseInferencer("hand")
36
+ human3d = MMPoseInferencer("pose-lift_simplebaseline3d_8xb64-200e_h36m") # pose3d="human3d"
37
 
38
  print("[INFO]: Downloaded models!")
39
 
 
43
  fps = cap.get(cv2.CAP_PROP_FPS)
44
  return nframes, fps
45
 
46
+
47
+ def get_frames(video, fps=15, height=512):
48
+ # extract the file name and extension
49
+ split_tup = os.path.splitext(video)
50
+
51
+ file_name = split_tup[0]
52
+ file_extension = split_tup[1]
53
+
54
+ if file_extension != ".mp4":
55
+ print("Converting to mp4")
56
+ video = file_name+".mp4"
57
+
58
+ clip = moviepy.VideoFileClip(video)
59
+
60
+ #check fps
61
+ if clip.fps > 15:
62
+ print("vide rate is over 15, resetting to 15")
63
+ clip_resized = moviepy.clip.resize(height=height)
64
+ clip_resized.write_videofile(video, fps=fps)
65
+ else:
66
+ print("video rate is OK")
67
+ clip_resized = clip.resize(height=height)
68
+ clip_resized.write_videofile(video, fps=clip.fps)
69
+
70
+ print("video resized to 512 height")
71
+
72
+
73
  def check_extension(video):
74
  split_tup = os.path.splitext(video)
75