thangvubk / SoftGroup

[CVPR 2022 Oral] SoftGroup for Instance Segmentation on 3D Point Clouds
MIT License
349 stars 81 forks source link

Got size error while loading checkpoints #33

Closed sylyt62 closed 2 years ago

sylyt62 commented 2 years ago

I'm trying out spconv2, but got following error when loading provided pretrained model. spconv2 is installed by pip install spconv2-cu102. Envs: ubuntu 18, pytorch 1.10, cuda 10.2, spconv2

[2022-04-13 11:52:35,200 INFO test.py line 306 11019] #classifier parameters (model): 30839600 [2022-04-13 11:52:35,244 INFO utils.py line 67 11019] Restore from checkpoints/softgroup_scannet.pth Traceback (most recent call last): File "test.py", line 311, in use_cuda, cfg.test_epoch, dist=False, f=cfg.pretrain)
File "/media/yangtian/SATA3/Workspace/室内3d目标检测/SoftGroup/util/utils.py", line 83, in checkpoint_restore model.load_state_dict(net_checkpoint) File "/media/yangtian/SATA3/PyEnvs/ubuntu/softgroup-env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1483, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for SoftGroup: size mismatch for input_conv.0.weight: copying a param with shape torch.Size([3, 3, 3, 6, 32]) from checkpoint, the shape in current model is torch.Size([3, 3, 3, 32, 6]). size mismatch for unet.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 32, 64]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 64, 32]). size mismatch for unet.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 64, 96]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 96, 64]). size mismatch for unet.u.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 96, 128]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 128, 96]). size mismatch for unet.u.u.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 128, 160]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 160, 128]). size mismatch for unet.u.u.u.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 160, 192]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 192, 160]). size mismatch for unet.u.u.u.u.u.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 192, 224]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 224, 192]). size mismatch for unet.u.u.u.u.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 224, 192]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 192, 224]). size mismatch for unet.u.u.u.u.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 384, 192]) from checkpoint, the shape in current model is torch.Size([1, 1, 1, 192, 384]). size mismatch for unet.u.u.u.u.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 384, 192]) from checkpoint, the shape in current model is torch.Size([3, 3, 3, 192, 384]). size mismatch for unet.u.u.u.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 192, 160]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 160, 192]). size mismatch for unet.u.u.u.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 320, 160]) from checkpoint, the shape in current model is torch.Size([1, 1, 1, 160, 320]). size mismatch for unet.u.u.u.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 320, 160]) from checkpoint, the shape in current model is torch.Size([3, 3, 3, 160, 320]). size mismatch for unet.u.u.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 160, 128]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 128, 160]). size mismatch for unet.u.u.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 256, 128]) from checkpoint, the shape in current model is torch.Size([1, 1, 1, 128, 256]). size mismatch for unet.u.u.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 256, 128]) from checkpoint, the shape in current model is torch.Size([3, 3, 3, 128, 256]). size mismatch for unet.u.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 128, 96]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 96, 128]). size mismatch for unet.u.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 192, 96]) from checkpoint, the shape in current model is torch.Size([1, 1, 1, 96, 192]). size mismatch for unet.u.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 192, 96]) from checkpoint, the shape in current model is torch.Size([3, 3, 3, 96, 192]). size mismatch for unet.u.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 96, 64]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 64, 96]). size mismatch for unet.u.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 128, 64]) from checkpoint, the shape in current model is torch.Size([1, 1, 1, 64, 128]). size mismatch for unet.u.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 128, 64]) from checkpoint, the shape in current model is torch.Size([3, 3, 3, 64, 128]). size mismatch for unet.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 64, 32]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 32, 64]). size mismatch for unet.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 64, 32]) from checkpoint, the shape in current model is torch.Size([1, 1, 1, 32, 64]). size mismatch for unet.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 64, 32]) from checkpoint, the shape in current model is torch.Size([3, 3, 3, 32, 64]). size mismatch for intra_ins_unet.conv.2.weight: copying a param with shape torch.Size([2, 2, 2, 32, 64]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 64, 32]). size mismatch for intra_ins_unet.deconv.2.weight: copying a param with shape torch.Size([2, 2, 2, 64, 32]) from checkpoint, the shape in current model is torch.Size([2, 2, 2, 32, 64]). size mismatch for intra_ins_unet.blocks_tail.block0.i_branch.0.weight: copying a param with shape torch.Size([1, 1, 1, 64, 32]) from checkpoint, the shape in current model is torch.Size([1, 1, 1, 32, 64]). size mismatch for intra_ins_unet.blocks_tail.block0.conv_branch.2.weight: copying a param with shape torch.Size([3, 3, 3, 64, 32]) from checkpoint, the shape in current model is torch.Size([3, 3, 3, 32, 64]).

sylyt62 commented 2 years ago

configs:

GENERAL: task: test # train, test manual_seed: 123 model_dir: model/softgroup/softgroup.py dataset_dir: data/scannetv2_inst.py

DATA: data_root: dataset dataset: scannetv2 filename_suffix: _inst_nostuff.pth semantic_classes: 20 classes: 18 class_numpoint_mean: [-1., -1., 3917., 12056., 2303., 8331., 3948., 3166., 5629., 11719., 1003., 3317., 4912., 10221., 3889., 4136., 2120., 945., 3967., 2589.] ignore_label: -100 input_channel: 3 scale: 50 # voxel_size = 1 / scale, scale 50 -> voxel_size 0.02m batch_size: 4 full_scale: [128, 512] max_npoint: 250000 mode: 4 # 4=mean

STRUCTURE: model_name: softgroup width: 32 block_residual: True block_reps: 2 use_coords: True semantic_only: False

TRAIN: epochs: 500 train_workers: 4 # data loader workers optim: Adam # Adam or SGD lr: 0.001 step_epoch: 200 multiplier: 0.5 momentum: 0.9 weight_decay: 0.0001 save_freq: 16 # also eval_freq loss_weight: [1.0, 1.0, 1.0, 1.0, 1.0] # semantic_loss, offset_norm_loss, cls_loss, mask_loss, score_loss fg_thresh: 1. bg_thresh: 0. score_scale: 50 # the minimal voxel size is 2cm score_fullscale: 20
score_mode: 4 # mean pretrain_path: 'hais_ckpt.pth' pretrain_module: ['input_conv', 'unet', 'output_layer', 'semantic_linear', 'offset_linear', 'intra_ins_unet', 'intra_ins_outputlayer'] fix_module: ['input_conv', 'unet', 'output_layer', 'semantic_linear', 'offset_linear'] point_aggr_radius: 0.04 cluster_shift_meanActive: 300 prepare_epochs: -1 max_proposal_num: 200 iou_thr: 0.5 score_thr: 0.2

TEST: split: val test_epoch: 500 test_workers: 16 test_seed: 567 using_NMS: False TEST_NMS_THRESH: 0.3 TEST_SCORE_THRESH: -1 TEST_NPOINT_THRESH: 100

eval: True save_semantic: False save_pt_offsets: False save_instance: False

test_mask_score_thre: -0.5 # bias fg << bg

thangvubk commented 2 years ago

32