Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid label type #17

Closed
ghost opened this issue Jan 9, 2020 · 1 comment
Closed

Invalid label type #17

ghost opened this issue Jan 9, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 9, 2020

Hi @chrischoy,

I was training on a subset of scannet & I got the following error;

Traceback (most recent call last):
  File "main.py", line 154, in <module>
    main()
  File "main.py", line 147, in main
    train(model, train_data_loader, val_data_loader, config)
  File "/home/x23/workspace_pcs/SpatioTemporalSegmentation/lib/train.py", line 78, in train
    coords, input, target = data_iter.next()
  File "/home/x23/miniconda3/envs/mink/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 819, in __next__
    return self._process_data(data)
  File "/home/x23/miniconda3/envs/mink/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data
    data.reraise()
  File "/home/x23/miniconda3/envs/mink/lib/python3.7/site-packages/torch/_utils.py", line 369, in reraise
    raise self.exc_type(msg)
AssertionError: Caught AssertionError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/x23/miniconda3/envs/mink/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/x23/miniconda3/envs/mink/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/x23/miniconda3/envs/mink/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/x23/workspace_pcs/SpatioTemporalSegmentation/lib/dataset.py", line 266, in __getitem__
    coords, feats, labels, center=center)
  File "/home/x23/workspace_pcs/SpatioTemporalSegmentation/lib/voxelizer.py", line 130, in voxelize
    coords_aug, feats, labels = ME.utils.sparse_quantize(coords_aug, feats, labels=labels, ignore_label=self.ignore_label)
  File "/home/x23/miniconda3/envs/mink/lib/python3.7/site-packages/MinkowskiEngine-0.3.3-py3.7-linux-x86_64.egg/MinkowskiEngine/utils/quantization.py", line 194, in sparse_quantize
    ignore_label)
  File "/home/x23/miniconda3/envs/mink/lib/python3.7/site-packages/MinkowskiEngine-0.3.3-py3.7-linux-x86_64.egg/MinkowskiEngine/utils/quantization.py", line 82, in quantize_label
    assert labels.dtype == np.int32, f"Invalid label type {labels.dtype} != np.int32"
AssertionError: Invalid label type float32 != np.int32
@ghost
Copy link
Author

ghost commented Jan 9, 2020

As a workaround, I changed the dtype of labels to int32 before feeding them to ME.utils.sparse_quantize, see below;

labels = labels.astype(np.int32, copy=False)
coords_aug, feats, labels = ME.utils.sparse_quantize(coords_aug, feats, labels=labels, ignore_label=self.ignore_label)

@ghost ghost closed this as completed May 27, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants