Pointcept / PointTransformerV3

[CVPR'24 Oral] Official repository of Point Transformer V3 (PTv3)
MIT License
728 stars 42 forks source link

Pop key "segment" from list "data_dict" #39

Closed dninfa closed 5 months ago

dninfa commented 5 months ago

It seems like the key segment is popped from a list data_dict -should be a dict- containing multiple dicts which do have the key segment in them.

https://github.com/Pointcept/Pointcept/blob/df36980119f4636beb2d02d04ef3b2fec0fddfba/pointcept/datasets/defaults.py#L101

As this is the default file for several datasets, it seems to me I'm causing this error myself. To give context: I altered the nuScenes preprossessing file to be able to preprocess, train and test on nuScenes-mini dataset:

image

The preprocessing does succesfully generate the Pickle files. In addition, the train script does seem to run but the test script does nost. Do you have any clue on what might cause this issue? Please find the complete Traceback below

(pointcept) root@docker-desktop:/PointTransformerV3/Pointcept# sh scripts/test.sh -g 0 -d nuscenes -c nuscenes-semseg-pt-v3m1-0-base_config -n semseg-pt-v3m1-0-base
Experiment name: semseg-pt-v3m1-0-base
Python interpreter dir: python
Dataset: nuscenes
GPU Num: 0
Loading config in: configs/nuscenes/nuscenes-semseg-pt-v3m1-0-base_config.py
Running code in: exp/nuscenes/semseg-pt-v3m1-0-base/code
 =========> RUN TASK <=========
[2024-04-24 20:21:08,283 INFO test.py line 41 88861] => Loading config ...
[2024-04-24 20:21:08,283 INFO test.py line 48 88861] => Building model ...
[2024-04-24 20:21:08,693 INFO test.py line 61 88861] Num params: 46159312
[2024-04-24 20:21:09,036 INFO test.py line 68 88861] Loading weight at: exp/nuscenes/semseg-pt-v3m1-0-base/model/model_best.pth
[2024-04-24 20:21:10,268 INFO test.py line 80 88861] => Loaded weight 'exp/nuscenes/semseg-pt-v3m1-0-base/model/model_best.pth' (epoch 48)
[2024-04-24 20:21:10,271 INFO test.py line 53 88861] => Building test dataset & dataloader ...
[2024-04-24 20:21:10,282 INFO defaults.py line 58 88861] Totally 81 x 1 samples in test set.
[2024-04-24 20:21:10,283 INFO test.py line 119 88861] >>>>>>>>>>>>>>>> Start Evaluation >>>>>>>>>>>>>>>>
1 <class 'dict'>
966 data par list
2 <class 'list'>
3 966
Traceback (most recent call last):
  File "tools/test.py", line 38, in <module>
    main()
  File "tools/test.py", line 27, in main
    launch(
  File "/PointTransformerV3/Pointcept/pointcept/engines/launch.py", line 89, in launch
    main_func(*cfg)
  File "tools/test.py", line 20, in main_worker
    tester.test()
  File "/PointTransformerV3/Pointcept/pointcept/engines/test.py", line 160, in test
    for idx, data_dict in enumerate(self.test_loader):
  File "/root/miniconda3/envs/pointcept/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 630, in __next__
1 <class 'dict'>
    data = self._next_data()
  File "/root/miniconda3/envs/pointcept/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1345, in _next_data
    return self._process_data(data)
  File "/root/miniconda3/envs/pointcept/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1371, in _process_data
    data.reraise()
  File "/root/miniconda3/envs/pointcept/lib/python3.8/site-packages/torch/_utils.py", line 694, in reraise
    raise exception
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/root/miniconda3/envs/pointcept/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop
    data = fetcher.fetch(index)
  File "/root/miniconda3/envs/pointcept/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/root/miniconda3/envs/pointcept/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/PointTransformerV3/Pointcept/pointcept/datasets/defaults.py", line 138, in __getitem__
    return self.prepare_test_data(idx)
  File "/PointTransformerV3/Pointcept/pointcept/datasets/defaults.py", line 106, in prepare_test_data
    segment=data_dict.pop("segment"), name=self.get_data_name(idx)
TypeError: 'str' object cannot be interpreted as an integer
dninfa commented 5 months ago

image

GirdSample in PTv3 config file https://github.com/Pointcept/Pointcept/blob/c759914eb3ab8255455c80c00472ab0bc664a20c/configs/nuscenes/semseg-pt-v3m1-0-base.py#L161

will return a list as defined:

https://github.com/Pointcept/Pointcept/blob/c759914eb3ab8255455c80c00472ab0bc664a20c/pointcept/datasets/transform.py#L881

dninfa commented 5 months ago

https://github.com/Pointcept/Pointcept/issues/228