SamsungLabs / fcaf3d

[ECCV2022] FCAF3D: Fully Convolutional Anchor-Free 3D Object Detection
MIT License
231 stars 37 forks source link

How can I generate per point classification? #27

Closed sylyt62 closed 2 years ago

sylyt62 commented 2 years ago

Hi, thanks for sharing your excellent work first! I have several questions.

I met the following error while testing. For my understanding, there are no annotations available while testing. So after a hard debug, I found that the second composer of test_pipeline called the 'annos' key of my test.pkl data, so I comment out this line dict(type='GlobalAlignment', rotation_axis=2), in the config file so that I can get a result. But actually I'm not sure will it cause any alignment problem on the results.

File "tools/test.py", line 214, in main() File "tools/test.py", line 184, in main outputs = single_gpu_test(model, data_loader, args.show, args.show_dir) File "/media/yangtian/SATA3/Workspace/fcaf3d-master/mmdet3d/apis/test.py", line 36, in single_gpu_test for i, data in enumerate(data_loader): File "/home/yangtian/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in next data = self._next_data() File "/home/yangtian/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1199, in _next_data return self._process_data(data) File "/home/yangtian/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data data.reraise() File "/home/yangtian/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/_utils.py", line 429, in reraise raise self.exc_type(msg) KeyError: Caught KeyError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/yangtian/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop data = fetcher.fetch(index) File "/home/yangtian/anaconda3/envs/open-mmlab/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 "/home/yangtian/anaconda3/envs/open-mmlab/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 "/media/yangtian/SATA3/Workspace/fcaf3d-master/mmdet3d/datasets/custom_3d.py", line 354, in getitem return self.prepare_test_data(idx) File "/media/yangtian/SATA3/Workspace/fcaf3d-master/mmdet3d/datasets/scannet_dataset.py", line 135, in prepare_test_data example = self.pipeline(input_dict) File "/home/yangtian/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmdet/datasets/pipelines/compose.py", line 41, in call data = t(data) File "/media/yangtian/SATA3/Workspace/fcaf3d-master/mmdet3d/datasets/pipelines/transforms_3d.py", line 475, in call assert 'axis_align_matrix' in input_dict['ann_info'].keys(), \ KeyError: 'ann_info'

And after that, I wanna visualize the results, so I added--show --show_dir ./results/custom_test/ . However met another error:

File "tools/test.py", line 214, in main() File "tools/test.py", line 184, in main outputs = single_gpu_test(model, data_loader, args.show, args.show_dir) File "/media/yangtian/SATA3/Workspace/fcaf3d-master/mmdet3d/apis/test.py", line 46, in single_gpu_test model.module.show_results(data, result, out_dir) File "/media/yangtian/SATA3/Workspace/fcaf3d-master/mmdet3d/models/detectors/base.py", line 107, in show_results show_result(points, None, pred_bboxes, out_dir, file_name) TypeError: show_result() missing 2 required positional arguments: 'out_dir' and 'filename'

Not fixed yet. But I found that in show_result.py, the function show_result() takes gt_labels and pred_labels as well while in the testing procedure it doesn't pass this two values. I'm gonna continue debugging on it.

Finally, I'm wondering if there's a convenience way to get per point classification results?

filaPro commented 2 years ago

Hi @sylyt62,

  1. Yes in general annotations should not be used for testing. However for some reasons in mmdetection3d this axis_align_matrix is stored in annotations, so we get it from there also during testing

  2. Did you make any modifications in our code? I think, after #17 everything should be fine.

  3. Actually we do not solve per point classification. You can try to assign the point with the class of the box, that contains it.

sylyt62 commented 2 years ago

@filaPro Oh I removed the comment outputs = single_gpu_test(model, data_loader) # , args.show, args.show_dir) in line 184, tools/test.py...

I changed it back.

I do get those .obj files when doing validation on the official scannetv2 dataset, cause I added --eval mAP I think. But for testing there's no groundtruth to do mAP and this error shows up,

Traceback (most recent call last): File "tools/test.py", line 214, in main() File "tools/test.py", line 210, in main print(dataset.evaluate(outputs, show=args.show, out_dir=args.show_dir, **eval_kwargs)) File "/media/yangtian/SATA3/Workspace/fcaf3d-master/mmdet3d/datasets/custom_3d.py", line 259, in evaluate gt_annos = [info['annos'] for info in self.data_infos] File "/media/yangtian/SATA3/Workspace/fcaf3d-master/mmdet3d/datasets/custom_3d.py", line 259, in gt_annos = [info['annos'] for info in self.data_infos] KeyError: 'annos'

my test.pkl:

[{'point_cloud': {'num_features': 6, 'lidar_idx': 'scene0707_00'}, 'pts_path': 'points/scene0707_00.bin'}, {'point_cloud': {'num_features': 6, 'lidar_idx': 'scene0708_00'}, 'pts_path': 'points/scene0708_00.bin'}, {'point_cloud': {'num_features': 6, 'lidar_idx': 'scene0709_00'}, 'pts_path': 'points/scene0709_00.bin'}, {'point_cloud': {'num_features': 6, 'lidar_idx': 'scene0710_00'}, 'pts_path': 'points/scene0710_00.bin'}]

filaPro commented 2 years ago

Unfortunately, we only update the show call in dataset.evaluate method in #10. You can somehow update detector.show_results method with the same call but only for pred_bboxes without gt_bboxes...

sylyt62 commented 2 years ago

Gotcha thx ~:)