AttributeError in trainning RandLANet using SemSegSpatiallyRegularSampler
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 365
- Avg merge
- 4h 6m
- Merged PRs (30d)
- 1
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D-ML/issues).
- [X] I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).
### Describe the issue
I have been trying to train RandLANet on Toronto3D using torch pipeline, and I select the SemSegSpatiallyRegularSampler as the dataset's sampler which is defaultly SemSegRandomSampler. But I get a AttributeError: 'SemSegSpatiallyRegularSampler' object has no attribute 'cloud_id'. It seems that **get_point_sampler couldn't get self.cloud_id from get_cloud_sampler when split='train'** .
### Steps to reproduce the bug
```python
cd scripts/train_scripts
sh randlanet_toronto.sh torch #path-to-Toronto3D
( I used the config of randlanet_toronto3d as follows.)
dataset:
name: Toronto3D
cache_dir: ./logs/cache
dataset_path: # path/to/your/dataset
class_weights: [41697357, 1745448, 6572572, 19136493, 674897, 897825, 4634634, 374721]
ignored_label_inds:
- 0
num_classes: 8
num_points: 65536
test_files:
- L002.ply
test_result_folder: ./test
train_files:
- L001.ply
- L003.ply
val_files:
- L004.ply
use_cache: true
sampler:
name: SemSegSpatiallyRegularSampler
steps_per_epoch_train: 100
steps_per_epoch_valid: 10
model:
name: RandLANet
batcher: DefaultBatcher
ckpt_path: # path/to/your/checkpoint
num_neighbors: 16
num_layers: 5
num_points: 65536
num_classes: 8
ignored_label_inds: [0]
sub_sampling_ratio: [4, 4, 4, 4, 2]
in_channels: 6
dim_features: 8
dim_output: [16, 64, 128, 256, 512]
grid_size: 0.05
augment:
recenter:
dim: [0, 1, 2]
normalize:
points:
method: linear
pipeline:
name: SemanticSegmentation
optimizer:
lr: 0.001
batch_size: 2
main_log_dir: ./logs
max_epoch: 200
save_ckpt_freq: 5
scheduler_gamma: 0.99
test_batch_size: 1
train_sum_dir: train_log
val_batch_size: 2
summary:
record_for: []
max_pts:
use_reference: false
max_outputs: 1
```
### Error message
Traceback (most recent call last):
File "scripts/run_pipeline.py", line 163, in
main()
File "scripts/run_pipeline.py", line 153, in main
pipeline.run_train()
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/open3d/_ml3d/torch/pipelines/semantic_segmentation.py", line 407, in run_train
for step, inputs in enumerate(tqdm(train_loader, desc='training')):
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/tqdm/std.py", line 1195, in __iter__
for obj in iterable:
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
data = self._next_data()
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1199, in _next_data
return self._process_data(data)
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
data.reraise()
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/torch/_utils.py", line 429, in reraise
raise self.exc_type(msg)
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
data = fetcher.fetch(index)
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/open3d/_ml3d/torch/dataloaders/torch_dataloader.py", line 87, in __getitem__
data = self.transform(data, attr)
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/open3d/_ml3d/torch/models/randlanet.py", line 175, in transform
pc, selected_idxs, center_point = self.trans_point_sampler(
File "/data/panjieyun/.conda/envs/open3d/lib/python3.8/site-packages/open3d/_ml3d/datasets/samplers/semseg_spatially_regular.py", line 79, in _random_centered_gen
cloud_id = self.cloud_id
AttributeError: 'SemSegSpatiallyRegularSampler' object has no attribute 'cloud_id'
### Expected behavior
_No response_
### Open3D, Python and System information
```markdown
- Operating system: Ubuntu 20.04
- Python version: Python 3.8.13
- Open3D version: 0.15.2
- System architecture: x86
- Is this a remote workstation?: yes
- How did you install Open3D?: pip
```
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.