hujiecpp commited on
Commit
ab04b21
·
1 Parent(s): 8e746f8

init project

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -501,23 +501,23 @@ def get_reconstructed_scene(outdir, filelist, schedule, niter, min_conf_thr,
501
  # also return rgb, depth and confidence imgs
502
  # depth is normalized with the max value for all images
503
  # we apply the jet colormap on the confidence maps
504
- rgbimg = scene.imgs
505
- depths = to_numpy(scene.get_depthmaps())
506
- confs = to_numpy([c for c in scene.im_conf])
507
- # confs = to_numpy([c for c in scene.conf_2])
508
- cmap = pl.get_cmap('jet')
509
- depths_max = max([d.max() for d in depths])
510
- depths = [d / depths_max for d in depths]
511
- confs_max = max([d.max() for d in confs])
512
- confs = [cmap(d / confs_max) for d in confs]
513
-
514
- imgs = []
515
- for i in range(len(rgbimg)):
516
- imgs.append(rgbimg[i])
517
- imgs.append(rgb(depths[i]))
518
- imgs.append(rgb(confs[i]))
519
-
520
- return scene, outfile, imgs
521
 
522
  @spaces.GPU(duration=180)
523
  def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
@@ -607,8 +607,8 @@ with tempfile.TemporaryDirectory(suffix='pe3r_gradio_demo') as tmpdirname:
607
  find_btn = gradio.Button("Find")
608
 
609
  outmodel = gradio.Model3D()
610
- outgallery = gradio.Gallery(label='rgb,depth,confidence', columns=3, height="100%",
611
- visible=False)
612
 
613
  # events
614
  scenegraph_type.change(set_scenegraph_options,
@@ -621,7 +621,7 @@ with tempfile.TemporaryDirectory(suffix='pe3r_gradio_demo') as tmpdirname:
621
  inputs=[inputfiles, schedule, niter, min_conf_thr, as_pointcloud,
622
  mask_sky, clean_depth, transparent_cams, cam_size,
623
  scenegraph_type, winsize, refid],
624
- outputs=[scene, outmodel, outgallery])
625
  min_conf_thr.release(fn=model_from_scene_fun,
626
  inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
627
  clean_depth, transparent_cams, cam_size],
 
501
  # also return rgb, depth and confidence imgs
502
  # depth is normalized with the max value for all images
503
  # we apply the jet colormap on the confidence maps
504
+ # rgbimg = scene.imgs
505
+ # depths = to_numpy(scene.get_depthmaps())
506
+ # confs = to_numpy([c for c in scene.im_conf])
507
+ # # confs = to_numpy([c for c in scene.conf_2])
508
+ # cmap = pl.get_cmap('jet')
509
+ # depths_max = max([d.max() for d in depths])
510
+ # depths = [d / depths_max for d in depths]
511
+ # confs_max = max([d.max() for d in confs])
512
+ # confs = [cmap(d / confs_max) for d in confs]
513
+
514
+ # imgs = []
515
+ # for i in range(len(rgbimg)):
516
+ # imgs.append(rgbimg[i])
517
+ # imgs.append(rgb(depths[i]))
518
+ # imgs.append(rgb(confs[i]))
519
+
520
+ return scene, outfile#, imgs
521
 
522
  @spaces.GPU(duration=180)
523
  def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
 
607
  find_btn = gradio.Button("Find")
608
 
609
  outmodel = gradio.Model3D()
610
+ # outgallery = gradio.Gallery(label='rgb,depth,confidence', columns=3, height="100%",
611
+ # visible=False)
612
 
613
  # events
614
  scenegraph_type.change(set_scenegraph_options,
 
621
  inputs=[inputfiles, schedule, niter, min_conf_thr, as_pointcloud,
622
  mask_sky, clean_depth, transparent_cams, cam_size,
623
  scenegraph_type, winsize, refid],
624
+ outputs=[scene, outmodel]) # , outgallery
625
  min_conf_thr.release(fn=model_from_scene_fun,
626
  inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
627
  clean_depth, transparent_cams, cam_size],