yijiangh / InverseCSG

Code mirror of the paper: InverseCSG: Automatic Conversion of 3D Models to CSG Trees
https://people.csail.mit.edu/taodu/csg/csg.pdf
50 stars 13 forks source link

run_test.py fail with all examples #1

Open ig-d opened 3 years ago

ig-d commented 3 years ago

Hi,

I am trying to use the code after doing the manual installation (in Debian) that was successful but running the examples fails with the following error:

Traceback (most recent call last):
  File "main.py", line 45, in <module>
    sketch_pipeline.RunSketchPipeline()
  File "/home//remove/csg/InverseCSG-master/sketch_pipeline.py", line 717, in RunSketchPipeline
    point_cloud_seg.SegmentPointCloud(part_file, seg_num, \
  File "/home//remove/csg/InverseCSG-master/point_cloud_seg.py", line 25, in SegmentPointCloud
    cluster_result.fit(points)
  File "/home//.local/lib/python3.8/site-packages/sklearn/cluster/_agglomerative.py", line 834, in fit
    X = self._validate_data(X, ensure_min_samples=2, estimator=self)
  File "/home//.local/lib/python3.8/site-packages/sklearn/base.py", line 421, in _validate_data
    X = check_array(X, **check_params)
  File "/home//.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 63, in inner_f
    return f(*args, **kwargs)
  File "/home//.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 669, in check_array
    raise ValueError("Found array with %d sample(s) (shape=%s) while a"
ValueError: Found array with 1 sample(s) (shape=(1, 3)) while a minimum of 2 is required by AgglomerativeClustering

Checking the code, it points to the call of

cluster_result = cluster.AgglomerativeClustering(n_clusters = seg_num)
cluster_result.fit(points)

The problem is that points just contain a point and AgglomerativeClustering fails since it expects at least two.

Note this happens after

if not sketch_done or '[SKETCH] DONE' not in open(sketch_output_file).read():
      helper.PrintWithRedColor('Problem is too hard. Need segmentation.')
      return '', False

is called.

Note I have tried to run it with most the given examples but failed:

python3 run_tests.py <path> one_cube
python3 run_tests.py <path> ex_011
python3 run_tests.py <path> ex_067

Note I found the same issue https://github.com/antonymarion/inverseCSG/issues/4

How can we address this?

Thanks!

ig-d commented 3 years ago

To give more context:

WaferLi commented 2 years ago

I meet the same problem as you. How did you address it? thx

ig-d commented 2 years ago

I did not manage to address it, it seemed to require a major refactoring. Maybe the authors could weight in here on how to address it.

Thanks

Maksimo007 commented 1 year ago

Unfortunately, I also have the same problem. Is there a solution in the meantime?