rahul-goel / isrf_code

Code for our CVPR'23 paper "Interactive Segmentation of Radiance Fields".
57 stars 2 forks source link

Cannot get high confidence region (HCR) in the gui #1

Closed kts707 closed 1 year ago

kts707 commented 1 year ago

Hi Rahul,

Thanks for the great work!

I followed the commands in the README to train a horns scene and opened this scene in the provided GUI. However, after I create the strokes and click get hcr, it does not display the selected area and nothing happens. At the same time I am getting some error messages from the terminal as shown below. Do you know what the problem is and how to fix this issue? Thanks a lot!

Buliding K Means Model.
Traceback (most recent call last):
  File "/home/user/isrf_code/gui.py", line 222, in hcr_callback
    STATE["faiss_kmeans"] = run.do_kmeans_clustering_multiview(STATE["stroke_index"], STATE["features"])
  File "/home/user/anaconda3/envs/isrf/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/user/isrf_code/run.py", line 1091, in do_kmeans_clustering_multiview
    faiss_kmeans = kmeans(all_features)
  File "/home/user/anaconda3/envs/isrf/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/user/isrf_code/segment_3d.py", line 48, in kmeans
    kmeans.train(fv.contiguous())
  File "/home/user/anaconda3/envs/isrf/lib/python3.9/site-packages/faiss/__init__.py", line 1560, in train
    clus.train(x, self.index, weights)
  File "/home/user/anaconda3/envs/isrf/lib/python3.9/site-packages/faiss/__init__.py", line 68, in replacement_train
    self.train_c(n, swig_ptr(x), index)
  File "/home/user/anaconda3/envs/isrf/lib/python3.9/site-packages/faiss/swigfaiss_avx2.py", line 10348, in swig_ptr
    return _swigfaiss_avx2.swig_ptr(a)
ValueError: input not a numpy array

The screenshot of the GUI is shown below as well:

isrf_gui

rahul-goel commented 1 year ago

Hi!

I think this is an issue with the library faiss. Some versions of it allow us to directly pass torch tensors while for some we have to convert them to numpy first.

You can try changing this line to kmeans.train(fv.contiguous().numpy()) and similarly this line to dist, _ = kmeans.index.search(fg.numpy(), 1).

It may be a bit slower.

kts707 commented 1 year ago

Thanks for the quick response! After changing the two lines, the interactive segmentation works now!