drprojects / superpoint_transformer

Official PyTorch implementation of Superpoint Transformer introduced in [ICCV'23] "Efficient 3D Semantic Segmentation with Superpoint Transformer" and SuperCluster introduced in [3DV'24 Oral] "Scalable 3D Panoptic Segmentation As Superpoint Graph Clustering"
MIT License
601 stars 75 forks source link

ValueError: `min_samples` may not be larger than number of samples: n_samples = 1. #143

Closed lizhuangcui closed 3 months ago

lizhuangcui commented 3 months ago

Thank you for sharing this project,and I encounter a problem. please!

Processing...
 18%|█████████████████████████████████▏                                                                                                                                                         | 8/45 [00:09<00:44,  1.20s/it]
[2024-07-22 16:12:24,376][src.utils.utils][ERROR] - 
Traceback (most recent call last):
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/utils/utils.py", line 45, in wrap
    metric_dict, object_dict = task_func(cfg=cfg)
  File "src/train.py", line 114, in train
    trainer.fit(model=model, datamodule=datamodule, ckpt_path=cfg.get("ckpt_path"))
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 543, in fit
    call._call_and_handle_interrupt(
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/pytorch_lightning/trainer/call.py", line 44, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 579, in _fit_impl
    self._run(model, ckpt_path=ckpt_path)
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 946, in _run
    self._data_connector.prepare_data()
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/pytorch_lightning/trainer/connectors/data_connector.py", line 93, in prepare_data
    call._call_lightning_datamodule_hook(trainer, "prepare_data")
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/pytorch_lightning/trainer/call.py", line 181, in _call_lightning_datamodule_hook
    return fn(*args, **kwargs)
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/datamodules/base.py", line 144, in prepare_data
    self.dataset_class(
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/datasets/dbtunnel.py", line 270, in __init__
    super().__init__(*args, val_mixed_in_train=False, **kwargs)  # True
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/datasets/base.py", line 222, in __init__
    super().__init__(root, transform, pre_transform, pre_filter)
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/torch_geometric/data/in_memory_dataset.py", line 57, in __init__
    super().__init__(root, transform, pre_transform, pre_filter, log)
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 97, in __init__
    self._process()
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/datasets/base.py", line 648, in _process
    self.process()
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/datasets/base.py", line 683, in process
    self._process_single_cloud(p)
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/datasets/base.py", line 711, in _process_single_cloud
    nag = self.pre_transform(data)
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/torch_geometric/transforms/compose.py", line 24, in __call__
    data = transform(data)
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/transforms/transforms.py", line 23, in __call__
    return self._process(x)
  File "/home/clz/PycharmProjects/DBTunnel3D/superpoint_transformer/src/transforms/point.py", line 250, in _process
    ransac = RANSACRegressor(random_state=0, residual_threshold=1e-2).fit(
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/sklearn/base.py", line 1152, in wrapper
    return fit_method(estimator, *args, **kwargs)
  File "/home/clz/anaconda3/envs/spt/lib/python3.8/site-packages/sklearn/linear_model/_ransac.py", line 358, in fit
    raise ValueError(
ValueError: `min_samples` may not be larger than number of samples: n_samples = 1.
drprojects commented 3 months ago

As indicated in the traceback, the error comes from the sklearn's RANSACRegressor, which is used in our GroundElevation transform. The error tells you you probably do not have enough points to run RANSAC on. Check the size of the input Data passed to GroundElevation: do you have enough points there ? Investigate whether something strange is happening there. If you are working on your own point cloud and not one of the officially supported datasets, then maybe you need to adjust the GroundElevation parameters to suit your data ? For this, make sure you have a look at our documentation for GroundElevation (in the associated docstring) to understand how that works. And see how we parameterized it for other datasets, for reference.

If you ❤️ or simply use this project, don't forget to give the repository a ⭐, it means a lot to us !

dzj727 commented 3 days ago

I encountered the same problem, and I used the DALES dataset.I downloaded it from the official website.It named DALESObjects.tar.gz.What's going on here?Please.