dvlab-research / FocalsConv

Focal Sparse Convolutional Networks for 3D Object Detection (CVPR 2022, Oral)
https://arxiv.org/abs/2204.12463
Apache License 2.0
370 stars 35 forks source link

UnboundLocalError: local variable 'mv_height' referenced before assignment #8

Closed Jane-QinJ closed 2 years ago

Jane-QinJ commented 2 years ago

Hello, thank u for your awesome job! When I try to use the pv_rcnn_focal_lidar.yaml to train, there was an error occured: UnboundLocalError: local variable 'mv_height' referenced before assignment

the full error is:

Traceback (most recent call last): | 0/464 [00:00<?, ?it/s] File "train.py", line 201, in main() File "train.py", line 153, in main train_model( File "/data1/qinjia/FocalsConv/OpenPCDet/tools/train_utils/train_utils.py", line 111, in train_model accumulated_iter = train_one_epoch( File "/data1/qinjia/FocalsConv/OpenPCDet/tools/train_utils/train_utils.py", line 25, in train_one_epoch batch = next(dataloader_iter) File "/home/qinjia/Software/anaconda3/envs/FocalConv/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 363, in next data = self._next_data() File "/home/qinjia/Software/anaconda3/envs/FocalConv/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 989, in _next_data return self._process_data(data) File "/home/qinjia/Software/anaconda3/envs/FocalConv/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1014, in _process_data data.reraise() File "/home/qinjia/Software/anaconda3/envs/FocalConv/lib/python3.8/site-packages/torch/_utils.py", line 395, in reraise raise self.exc_type(msg) UnboundLocalError: Caught UnboundLocalError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/qinjia/Software/anaconda3/envs/FocalConv/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop data = fetcher.fetch(index) File "/home/qinjia/Software/anaconda3/envs/FocalConv/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/qinjia/Software/anaconda3/envs/FocalConv/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 "/data1/qinjia/FocalsConv/OpenPCDet/tools/../pcdet/datasets/kitti/kitti_dataset.py", line 425, in getitem data_dict = self.prepare_data(data_dict=input_dict) File "/data1/qinjia/FocalsConv/OpenPCDet/tools/../pcdet/datasets/dataset.py", line 130, in prepare_data data_dict = self.data_augmentor.forward( File "/data1/qinjia/FocalsConv/OpenPCDet/tools/../pcdet/datasets/augmentor/data_augmentor.py", line 243, in forward data_dict = cur_augmentor(data_dict=data_dict) File "/data1/qinjia/FocalsConv/OpenPCDet/tools/../pcdet/datasets/augmentor/database_sampler.py", line 403, in call mv_height = mv_height[valid_mask] UnboundLocalError: local variable 'mv_height' referenced before assignment

and I set the USE_ROAD_PLANE : FALSE in pv_rcnn_focal_lidar.yaml , because my custom dataset don't have the road plane data, but then I try to use KITTI data, the same error still occured.

I try to google this error, it seems like that this vraiable is not defined before the reference. I try to check out the mv_height in /FocalsConv/OpenPCDet/tools/../pcdet/datasets/augmentor/database_sampler.py. line 403, in call: mv_height = mv_height[valid_mask]

But I don't understand what wrong with this, if u can help me, I'd be very appreciated! Thanks!

yukang2017 commented 2 years ago

Thanks for your interests in our work.

I have updated pcdet/datasets/augmentor/database_sampler.py. Would you please try it again? Thanks.

https://github.com/dvlab-research/FocalsConv/blob/c382ec9d38131ed289faa3d8ee2fff2ef27d8b62/OpenPCDet/pcdet/datasets/augmentor/database_sampler.py#L404

Jane-QinJ commented 2 years ago

Thanks for your interests in our work.

I have updated pcdet/datasets/augmentor/database_sampler.py. Would you please try it again? Thanks.

https://github.com/dvlab-research/FocalsConv/blob/c382ec9d38131ed289faa3d8ee2fff2ef27d8b62/OpenPCDet/pcdet/datasets/augmentor/database_sampler.py#L404

Thank u very much! It works!

yukang2017 commented 2 years ago

Please feel free to contact me if any other questions exist.