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

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

Closed
Jane-QinJ opened this issue Jun 13, 2022 · 3 comments

Comments

@Jane-QinJ
Copy link

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
Copy link
Member

Thanks for your interests in our work.

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

if self.sampler_cfg.get('USE_ROAD_PLANE', False):

@Jane-QinJ
Copy link
Author

Thanks for your interests in our work.

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

if self.sampler_cfg.get('USE_ROAD_PLANE', False):

Thank u very much! It works!

@yukang2017
Copy link
Member

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

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

2 participants