聂如 commited on
Commit
f1b9ad9
Β·
1 Parent(s): bff377e

Add design file

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -187,6 +187,7 @@ def local_get_reconstructed_scene(inputfiles, min_conf_thr, cam_size):
187
  ])
188
  os.system('pip install iopath')
189
  os.system(f"pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html")
 
190
  outdir = tempfile.mkdtemp(suffix='_FLARE_gradio_demo')
191
  batch = load_images(inputfiles, size=image_size, verbose=not silent)
192
  images = [gt['img'] for gt in batch]
@@ -270,11 +271,11 @@ def local_get_reconstructed_scene(inputfiles, min_conf_thr, cam_size):
270
  # use knn to clean the point cloud
271
  K = 10
272
  points = torch.tensor(pts3d.reshape(1,-1,3)).cuda()
273
- # knn = knn_points(points, points, K=K)
274
- # dists = knn.dists
275
- # mean_dists = dists.mean(dim=-1)
276
- # masks_dist = mean_dists < torch.quantile(mean_dists.reshape(-1), 0.95)
277
- # masks_dist = masks_dist.detach().cpu().numpy()
278
  # masks_conf = (masks_conf > 0# & masks_dist.reshape(-1,H,W)
279
  masks_conf = masks_conf > 0
280
  os.makedirs(outdir, exist_ok=True)
 
187
  ])
188
  os.system('pip install iopath')
189
  os.system(f"pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html")
190
+ from pytorch3d.ops import knn_points
191
  outdir = tempfile.mkdtemp(suffix='_FLARE_gradio_demo')
192
  batch = load_images(inputfiles, size=image_size, verbose=not silent)
193
  images = [gt['img'] for gt in batch]
 
271
  # use knn to clean the point cloud
272
  K = 10
273
  points = torch.tensor(pts3d.reshape(1,-1,3)).cuda()
274
+ knn = knn_points(points, points, K=K)
275
+ dists = knn.dists
276
+ mean_dists = dists.mean(dim=-1)
277
+ masks_dist = mean_dists < torch.quantile(mean_dists.reshape(-1), 0.95)
278
+ masks_dist = masks_dist.detach().cpu().numpy()
279
  # masks_conf = (masks_conf > 0# & masks_dist.reshape(-1,H,W)
280
  masks_conf = masks_conf > 0
281
  os.makedirs(outdir, exist_ok=True)