edwardzhou130 / PolarSeg

Implementation for PolarNet: An Improved Grid Representation for Online LiDAR Point Clouds Semantic Segmentation (CVPR 2020)
BSD 3-Clause "New" or "Revised" License
369 stars 80 forks source link

nuScenes Pretrained Model Size Mismatch #35

Closed qifang-robotics closed 3 years ago

qifang-robotics commented 3 years ago

Hi, authors! When I tried directly run test_pretrain_nuscenes.py, it told me that the loaded model didn't match the defined model. Here are the command line logs:

test_pretrain_nuscenes.py Namespace(data_dir='data', grid_size=[480, 360, 32], model='polar', model_save_path='pretrained_weight/Nuscenes_PolarSeg.pt', test_batch_size=1, test_output_path='out/Nuscenes/lidarseg/test', visibilty=False) Traceback (most recent call last): File "test_pretrain_nuscenes.py", line 196, in main(args) File "test_pretrain_nuscenes.py", line 75, in main my_model.load_state_dict(torch.load(model_save_path)) File "/home/**/anaconda3/envs/polarseg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 847, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for ptBEVnet: size mismatch for BEV_model.network.inc.conv.0.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for BEV_model.network.inc.conv.0.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for BEV_model.network.inc.conv.0.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for BEV_model.network.inc.conv.0.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for BEV_model.network.inc.conv.1.conv1.0.weight: copying a param with shape torch.Size([64, 64, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 32, 3, 3]).

edwardzhou130 commented 3 years ago

The nuScenes pretrained model was trained with the visibility feature so that the channel is 64 rather than 32. It should work after adding the visibility arg python test_pretrain_nuscenes.py --visibility. There is a typo (visibility --> visibilty) in the code, I'll commit a fix now.

qifang-robotics commented 3 years ago

It works. Thank you for helping me out!