shaocong commited on
Commit
5313d97
·
1 Parent(s): 03adfb4

add spend time calc

Browse files
Files changed (1) hide show
  1. app.py +26 -5
app.py CHANGED
@@ -148,11 +148,24 @@ def process_video(
148
 
149
 
150
 
151
- prediction_result = DKT_PIPELINE(video_file, prompt=PROMPT, \
152
- negative_prompt=NEGATIVE_PROMPT,\
153
- height=height,width=width,num_inference_steps=num_inference_steps,\
154
- overlap=overlap, return_rgb=True)
155
-
 
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
 
158
 
@@ -162,7 +175,11 @@ def process_video(
162
  indices = np.round(indices).astype(np.int32)
163
 
164
 
 
165
  pcds = DKT_PIPELINE.prediction2pc_v2(prediction_result['depth_map'], prediction_result['rgb_frames'], indices, return_pcd=True)
 
 
 
166
  glb_files = []
167
 
168
  for idx, pcd in enumerate(pcds):
@@ -418,9 +435,13 @@ with gr.Blocks(css=css, title="DKT", head=head_html) as demo:
418
  return None, None, None, None, None, None, "Please upload a video file"
419
 
420
  try:
 
 
421
  output_path, glb_files = process_video(
422
  video_file, model_size, num_inference_steps, overlap
423
  )
 
 
424
 
425
 
426
  if output_path is None:
 
148
 
149
 
150
 
151
+ import time
152
+ start_time = time.time()
153
+
154
+ prediction_result = DKT_PIPELINE(
155
+ video_file,
156
+ prompt=PROMPT,
157
+ negative_prompt=NEGATIVE_PROMPT,
158
+ height=height,
159
+ width=width,
160
+ num_inference_steps=num_inference_steps,
161
+ overlap=overlap,
162
+ return_rgb=True
163
+ )
164
+
165
+ end_time = time.time()
166
+ spend_time = end_time - start_time
167
+ logger.info(f"DKT_PIPELINE spend time: {spend_time:.2f} seconds for depth prediction")
168
+
169
 
170
 
171
 
 
175
  indices = np.round(indices).astype(np.int32)
176
 
177
 
178
+ pc_start_time = time.time()
179
  pcds = DKT_PIPELINE.prediction2pc_v2(prediction_result['depth_map'], prediction_result['rgb_frames'], indices, return_pcd=True)
180
+ pc_end_time = time.time()
181
+ pc_spend_time = pc_end_time - pc_start_time
182
+ logger.info(f"prediction2pc_v2 spend time: {pc_spend_time:.2f} seconds for point cloud extraction")
183
  glb_files = []
184
 
185
  for idx, pcd in enumerate(pcds):
 
435
  return None, None, None, None, None, None, "Please upload a video file"
436
 
437
  try:
438
+ import time
439
+ start_time = time.time()
440
  output_path, glb_files = process_video(
441
  video_file, model_size, num_inference_steps, overlap
442
  )
443
+ spend_time = time.time() - start_time
444
+ logger.info(f"Total spend time in on_submit: {spend_time:.2f} seconds")
445
 
446
 
447
  if output_path is None: