Yuliang commited on
Commit
3861796
1 Parent(s): 9bb001d

add video for visualization

Browse files
app.py CHANGED
@@ -121,6 +121,7 @@ with gr.Blocks() as demo:
121
  fn=generate_model,
122
  outputs=out_lst)
123
 
 
124
  out_vid_download = gr.File(
125
  label="Download Video, welcome share on Twitter with #ICON")
126
 
@@ -140,7 +141,7 @@ with gr.Blocks() as demo:
140
  label="Download refined clothed human mesh")
141
 
142
  out_lst = [out_smpl, out_smpl_download, out_smpl_npy_download, out_recon, out_recon_download,
143
- out_final, out_final_download, out_vid_download, overlap_inp]
144
 
145
  btn_submit.click(fn=generate_model, inputs=[
146
  inp, radio_choice], outputs=out_lst)
 
121
  fn=generate_model,
122
  outputs=out_lst)
123
 
124
+ out_vid = gr.Video(label="Image + Normal + Recon + Refined Recon")
125
  out_vid_download = gr.File(
126
  label="Download Video, welcome share on Twitter with #ICON")
127
 
 
141
  label="Download refined clothed human mesh")
142
 
143
  out_lst = [out_smpl, out_smpl_download, out_smpl_npy_download, out_recon, out_recon_download,
144
+ out_final, out_final_download, out_vid, out_vid_download, overlap_inp]
145
 
146
  btn_submit.click(fn=generate_model, inputs=[
147
  inp, radio_choice], outputs=out_lst)
apps/infer.py CHANGED
@@ -453,4 +453,4 @@ def generate_model(in_path, model_type):
453
  gc.collect()
454
  torch.cuda.empty_cache()
455
 
456
- return [smpl_path, smpl_path, smpl_npy_path, recon_path, recon_path, refine_path, refine_path, video_path, overlap_path]
 
453
  gc.collect()
454
  torch.cuda.empty_cache()
455
 
456
+ return [smpl_path, smpl_path, smpl_npy_path, recon_path, recon_path, refine_path, refine_path, video_path, video_path, overlap_path]
gradio_cached_examples/13/log.csv DELETED
@@ -1,9 +0,0 @@
1
- 'flag','username','timestamp'
2
- '','','2022-08-01 22:47:24.908073'
3
- '','','2022-08-01 22:48:20.753663'
4
- '','','2022-08-01 22:49:15.504871'
5
- '','','2022-08-01 22:50:16.762017'
6
- '','','2022-08-01 22:51:09.444531'
7
- '','','2022-08-01 22:52:09.357219'
8
- '','','2022-08-01 22:53:02.217347'
9
- '','','2022-08-01 22:54:11.545178'
 
 
 
 
 
 
 
 
 
 
gradio_queue.db DELETED
Binary file (610 kB)
 
lib/common/render.py CHANGED
@@ -34,7 +34,7 @@ from pytorch3d.renderer import (
34
  from pytorch3d.renderer.mesh import TexturesVertex
35
  from pytorch3d.structures import Meshes
36
 
37
- import os
38
 
39
  from lib.dataset.mesh_util import SMPLX, get_visibility
40
  import lib.common.render_utils as util
@@ -327,6 +327,8 @@ class Render:
327
 
328
  def get_rendered_video(self, images, save_path):
329
 
 
 
330
  self.cam_pos = []
331
  for angle in range(0, 360, 3):
332
  self.cam_pos.append(
@@ -343,7 +345,7 @@ class Render:
343
 
344
  fourcc = cv2.VideoWriter_fourcc(*"mp4v")
345
  video = cv2.VideoWriter(
346
- save_path, fourcc, 30, (self.size * len(self.meshes) +
347
  new_shape[1] * len(images), self.size)
348
  )
349
 
@@ -373,6 +375,8 @@ class Render:
373
  video.write(final_img)
374
 
375
  video.release()
 
 
376
 
377
  def get_silhouette_image(self, cam_ids=[0, 2]):
378
 
 
34
  from pytorch3d.renderer.mesh import TexturesVertex
35
  from pytorch3d.structures import Meshes
36
 
37
+ import os, subprocess
38
 
39
  from lib.dataset.mesh_util import SMPLX, get_visibility
40
  import lib.common.render_utils as util
 
327
 
328
  def get_rendered_video(self, images, save_path):
329
 
330
+ tmp_path = save_path.replace('cloth', 'tmp')
331
+
332
  self.cam_pos = []
333
  for angle in range(0, 360, 3):
334
  self.cam_pos.append(
 
345
 
346
  fourcc = cv2.VideoWriter_fourcc(*"mp4v")
347
  video = cv2.VideoWriter(
348
+ tmp_path, fourcc, 30, (self.size * len(self.meshes) +
349
  new_shape[1] * len(images), self.size)
350
  )
351
 
 
375
  video.write(final_img)
376
 
377
  video.release()
378
+
379
+ os.system(f'ffmpeg -y -loglevel quiet -stats -i {tmp_path} -c:v libx264 {save_path}')
380
 
381
  def get_silhouette_image(self, cam_ids=[0, 2]):
382