Spaces:
Running on Zero
Running on Zero
Commit ·
2293af8
1
Parent(s): 3d1298a
attempt to log frames
Browse files
app.py
CHANGED
|
@@ -245,26 +245,28 @@ def _make3d(output_queue: SimpleQueue, images: Image.Image):
|
|
| 245 |
print(f'type(planes)={type(planes)}')
|
| 246 |
|
| 247 |
# # get video
|
| 248 |
-
|
| 249 |
-
|
|
|
|
|
|
|
| 250 |
|
| 251 |
-
#
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
# frames.append(frame)
|
| 269 |
|
| 270 |
# frames = torch.cat(frames, dim=1)
|
|
@@ -285,16 +287,8 @@ def _make3d(output_queue: SimpleQueue, images: Image.Image):
|
|
| 285 |
)
|
| 286 |
print(f'type(mesh_out)={type(mesh_out)}')
|
| 287 |
|
| 288 |
-
|
| 289 |
vertices, faces, vertex_colors = mesh_out
|
| 290 |
-
vertices = vertices[:, [1, 2, 0]]
|
| 291 |
-
print(f'type(vertices)={type(vertices)}')
|
| 292 |
-
print(f'type(faces)={type(faces)}')
|
| 293 |
-
print(f'type(vertex_colors)={type(vertex_colors)}')
|
| 294 |
|
| 295 |
-
save_glb(vertices, faces, vertex_colors, mesh_glb_fpath)
|
| 296 |
-
save_obj(vertices, faces, vertex_colors, mesh_fpath)
|
| 297 |
-
|
| 298 |
output_queue.put(
|
| 299 |
(
|
| 300 |
"log",
|
|
@@ -307,6 +301,15 @@ def _make3d(output_queue: SimpleQueue, images: Image.Image):
|
|
| 307 |
)
|
| 308 |
)
|
| 309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
print(f"Mesh saved to {mesh_fpath}")
|
| 311 |
|
| 312 |
output_queue.put(("mesh", mesh_out))
|
|
@@ -379,7 +382,7 @@ If you have any questions, feel free to open a discussion or contact us at <b>bl
|
|
| 379 |
with gr.Blocks() as demo:
|
| 380 |
gr.Markdown(_HEADER_)
|
| 381 |
with gr.Row(variant="panel"):
|
| 382 |
-
with gr.Column():
|
| 383 |
with gr.Row():
|
| 384 |
input_image = gr.Image(
|
| 385 |
label="Input Image",
|
|
@@ -419,7 +422,7 @@ with gr.Blocks() as demo:
|
|
| 419 |
examples_per_page=16
|
| 420 |
)
|
| 421 |
|
| 422 |
-
with gr.Column():
|
| 423 |
|
| 424 |
viewer = Rerun(streaming=True, height=800)
|
| 425 |
|
|
@@ -467,7 +470,7 @@ with gr.Blocks() as demo:
|
|
| 467 |
# fn=generate_mvs,
|
| 468 |
# inputs=[processed_image, sample_steps, sample_seed],
|
| 469 |
# outputs=[mv_images, mv_show_images]
|
| 470 |
-
|
| 471 |
# ).success(
|
| 472 |
# fn=make3d,
|
| 473 |
# inputs=[mv_images],
|
|
|
|
| 245 |
print(f'type(planes)={type(planes)}')
|
| 246 |
|
| 247 |
# # get video
|
| 248 |
+
chunk_size = 20 if IS_FLEXICUBES else 1
|
| 249 |
+
render_size = 384
|
| 250 |
+
|
| 251 |
+
print(f'IS_FLEXICUBES={IS_FLEXICUBES}')
|
| 252 |
|
| 253 |
+
# frames = []
|
| 254 |
+
for i in tqdm(range(0, render_cameras.shape[1], chunk_size)):
|
| 255 |
+
if IS_FLEXICUBES:
|
| 256 |
+
frame = model.forward_geometry(
|
| 257 |
+
planes,
|
| 258 |
+
render_cameras[:, i:i+chunk_size],
|
| 259 |
+
render_size=render_size,
|
| 260 |
+
)['img']
|
| 261 |
+
else:
|
| 262 |
+
frame = model.synthesizer(
|
| 263 |
+
planes,
|
| 264 |
+
cameras=render_cameras[:, i:i+chunk_size],
|
| 265 |
+
render_size=render_size,
|
| 266 |
+
)['images_rgb']
|
| 267 |
+
|
| 268 |
+
print(f'type(frame)={type(frame)}')
|
| 269 |
+
output_queue.put(("log", "3dvideo", rr.Image(frame)))
|
| 270 |
# frames.append(frame)
|
| 271 |
|
| 272 |
# frames = torch.cat(frames, dim=1)
|
|
|
|
| 287 |
)
|
| 288 |
print(f'type(mesh_out)={type(mesh_out)}')
|
| 289 |
|
|
|
|
| 290 |
vertices, faces, vertex_colors = mesh_out
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
|
|
|
|
|
|
|
|
|
|
| 292 |
output_queue.put(
|
| 293 |
(
|
| 294 |
"log",
|
|
|
|
| 301 |
)
|
| 302 |
)
|
| 303 |
|
| 304 |
+
vertices = vertices[:, [1, 2, 0]]
|
| 305 |
+
|
| 306 |
+
print(f'type(vertices)={type(vertices)}')
|
| 307 |
+
print(f'type(faces)={type(faces)}')
|
| 308 |
+
print(f'type(vertex_colors)={type(vertex_colors)}')
|
| 309 |
+
|
| 310 |
+
save_glb(vertices, faces, vertex_colors, mesh_glb_fpath)
|
| 311 |
+
save_obj(vertices, faces, vertex_colors, mesh_fpath)
|
| 312 |
+
|
| 313 |
print(f"Mesh saved to {mesh_fpath}")
|
| 314 |
|
| 315 |
output_queue.put(("mesh", mesh_out))
|
|
|
|
| 382 |
with gr.Blocks() as demo:
|
| 383 |
gr.Markdown(_HEADER_)
|
| 384 |
with gr.Row(variant="panel"):
|
| 385 |
+
with gr.Column(scale=1):
|
| 386 |
with gr.Row():
|
| 387 |
input_image = gr.Image(
|
| 388 |
label="Input Image",
|
|
|
|
| 422 |
examples_per_page=16
|
| 423 |
)
|
| 424 |
|
| 425 |
+
with gr.Column(scale=4):
|
| 426 |
|
| 427 |
viewer = Rerun(streaming=True, height=800)
|
| 428 |
|
|
|
|
| 470 |
# fn=generate_mvs,
|
| 471 |
# inputs=[processed_image, sample_steps, sample_seed],
|
| 472 |
# outputs=[mv_images, mv_show_images]
|
| 473 |
+
|
| 474 |
# ).success(
|
| 475 |
# fn=make3d,
|
| 476 |
# inputs=[mv_images],
|