Sapphire-356 commited on
Commit
6bd7964
·
1 Parent(s): 6298c5f

add: count

Browse files
Files changed (2) hide show
  1. app.py +7 -0
  2. videopose_PSTMO.py +18 -0
app.py CHANGED
@@ -5,11 +5,16 @@ import os
5
  # ffmpeg -i input_videos/kun_1280x720_30fps_0-14_0-32.mp4 -vf trim=0:5,setpts=PTS-STARTPTS input_videos/kun_test_5sec.mp4
6
  # ffmpeg -i input.mp4 -vf scale=320:-1 output.mp4
7
 
 
8
 
9
  def Video2MC(video, progress=gr.Progress(track_tqdm=True)):
10
 
11
  progress(1.0, desc="Step 0: Starting")
12
  output_path, output_video = gr_video2mc(video, progress)
 
 
 
 
13
 
14
  return output_path, output_path, output_video
15
 
@@ -125,6 +130,8 @@ with gr.Blocks() as iface:
125
 
126
  使用前,强烈建议先观看我的[B站视频](https://www.bilibili.com/video/BV1SP411W7pw),快速了解该项目的用法。
127
 
 
 
128
  """
129
  )
130
 
 
5
  # ffmpeg -i input_videos/kun_1280x720_30fps_0-14_0-32.mp4 -vf trim=0:5,setpts=PTS-STARTPTS input_videos/kun_test_5sec.mp4
6
  # ffmpeg -i input.mp4 -vf scale=320:-1 output.mp4
7
 
8
+ Count = 0
9
 
10
  def Video2MC(video, progress=gr.Progress(track_tqdm=True)):
11
 
12
  progress(1.0, desc="Step 0: Starting")
13
  output_path, output_video = gr_video2mc(video, progress)
14
+
15
+ global Count
16
+ Count += 1
17
+ print(f"Count: {Count}")
18
 
19
  return output_path, output_path, output_video
20
 
 
130
 
131
  使用前,强烈建议先观看我的[B站视频](https://www.bilibili.com/video/BV1SP411W7pw),快速了解该项目的用法。
132
 
133
+ 注:目前使用的是CPU,代码运行较慢。GPU算力过于昂贵,若有需求请私信联系。
134
+
135
  """
136
  )
137
 
videopose_PSTMO.py CHANGED
@@ -14,6 +14,10 @@ from model.stmo import Model
14
 
15
  import HPE2keyframes as Hk
16
 
 
 
 
 
17
  # from joints_detectors.openpose.main import generate_kpts as open_pose
18
 
19
 
@@ -198,6 +202,12 @@ def inference_video(video_path, detector_2d, progress):
198
 
199
  def gr_video2mc(video_path, progress):
200
 
 
 
 
 
 
 
201
  if not os.path.exists('output_3Dpose_npy'):
202
  os.makedirs('output_3Dpose_npy')
203
  if not os.path.exists('output_alphapose'):
@@ -212,6 +222,14 @@ def gr_video2mc(video_path, progress):
212
  Hk.hpe2keyframes(output_dir_dict['npy'], FPS_mine_imator, f"output_miframes/{output_dir_dict['video_name']}.miframes")
213
  path1 = os.path.abspath(f"output_miframes/{output_dir_dict['video_name']}.miframes")
214
  path2 = os.path.abspath(f"output_videos/{output_dir_dict['video_name']}.mp4")
 
 
 
 
 
 
 
 
215
  return path1, path2
216
 
217
 
 
14
 
15
  import HPE2keyframes as Hk
16
 
17
+ from datetime import datetime
18
+ import pytz
19
+
20
+
21
  # from joints_detectors.openpose.main import generate_kpts as open_pose
22
 
23
 
 
202
 
203
  def gr_video2mc(video_path, progress):
204
 
205
+ print("\n>>>>> One video uploaded <<<<<\n")
206
+ china_tz = pytz.timezone('Asia/Shanghai')
207
+ current_time = datetime.now(china_tz)
208
+ formatted_time = current_time.strftime('%Y-%m-%d %H:%M:%S')
209
+ print(f"Start Time: {formatted_time}\n")
210
+
211
  if not os.path.exists('output_3Dpose_npy'):
212
  os.makedirs('output_3Dpose_npy')
213
  if not os.path.exists('output_alphapose'):
 
222
  Hk.hpe2keyframes(output_dir_dict['npy'], FPS_mine_imator, f"output_miframes/{output_dir_dict['video_name']}.miframes")
223
  path1 = os.path.abspath(f"output_miframes/{output_dir_dict['video_name']}.miframes")
224
  path2 = os.path.abspath(f"output_videos/{output_dir_dict['video_name']}.mp4")
225
+
226
+ print("\n----- One video processed -----\n")
227
+ china_tz = pytz.timezone('Asia/Shanghai')
228
+ current_time = datetime.now(china_tz)
229
+ formatted_time = current_time.strftime('%Y-%m-%d %H:%M:%S')
230
+ print(f"Finished Time: {formatted_time}\n")
231
+
232
+
233
  return path1, path2
234
 
235