Pointcept / Pointcept

Pointcept: a codebase for point cloud perception research. Latest works: PTv3 (CVPR'24 Oral), PPT (CVPR'24), OA-CNNs (CVPR'24), MSC (CVPR'23)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pop key "segment" from list "data_dict"

dninfa opened this issue · comments

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.
(

segment=data_dict.pop("segment"), name=self.get_data_name(idx)
)

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

image

GirdSample in PTv3 config file

will return a list as defined:

return data_part_list

I think the problem here is that when the GridSample is called in test mode, it returns a list. But the test dataset preparation function, as @dninfa suggested, expects a dictionary from which it can pop the 'segment'

As most of the config for test dataset, GirdSampling in the test.transform is not test mode. https://github.com/Pointcept/Pointcept/blob/main/configs/nuscenes/semseg-pt-v3m1-0-base.py#L164