haomengz / HyperPC

[CVPR 2023] Hyperspherical Embedding for Point Cloud Completion
Other
18 stars 1 forks source link

NN Architecture not matching input shape #2

Closed Harry-OBrien closed 6 months ago

Harry-OBrien commented 9 months ago

I'm trying to run the code and have the docker image set up. After running train.py, I get this error:

Jitting Chamfer 3D
Loaded JIT 3D CUDA chamfer distance

**************************

    dataset:m40
    task:completion
    bsize:64
    max_epoch:100
    lr:0.0002
    lr_step_size:40
    lr_gamma:0.2
    check_dir:checkpoint_mvp_pc
    log_dir:logs_mvp_pc
    encoder_choice:pcn
    completion_decoder_choice:folding
    maxpool_bottleneck:1024
    use_hyperspherical_module:True
    hyper_bottleneck:512
    use_hyperspherical_encoding:True
    norm_order:2
    hyperspherical_module_layers:1
    hyperspherical_module_BN:False
    weight_sec_loss:None
    mlps_classifier:512,256,16
    use_BN_classifier:True
    mlps_segmentator:512,256,50
    use_BN_segmentator:True
    eval:False
    pretrained_path:None
    compute_gradient_norm:False
    grad_surgey_flag:False
    uncertainty_flag:False
    optimal_search:False
    ratio:0.0001

**************************

Model name: m40_pc_b64ep100lr0.0002s40g0.2_pcn_HyperModuleTrue_HyperEncodeTrue_MaxPool1024-Hyper512-NormOrder2-LayerNum1-HyperModuleBNFalse_folding
Downloading http://modelnet.cs.princeton.edu/ModelNet40.zip
Extracting data_root/ModelNet40/ModelNet40.zip
Processing...
Done!

Start training!

Traceback (most recent call last):
  File "main.py", line 540, in <module>
    train(args=args, train_dataloader=train_dataloader, test_dataloader=test_dataloader)
  File "main.py", line 249, in train
    train_one_epoch(args, train_dataloader, optimizer, logger, epoch, check_dir)
  File "main.py", line 77, in train_one_epoch
    model(None, pos, batch)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/harry/GitRepos/HyperPC/utils/model.py", line 133, in forward
    self.pred_completion = self.decoder_completion(encoding_feature)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/harry/GitRepos/HyperPC/utils/models/decoder_folding.py", line 38, in forward
    x = self.fold1(x)  # x = batch,3,45^2
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/harry/GitRepos/HyperPC/utils/models/decoder_folding.py", line 54, in forward
    x = self.relu(self.conv1(x))  # x = batch,512,45^2
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 302, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 298, in _conv_forward
    return F.conv1d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [512, 1026, 1], expected input[64, 514, 2025] to have 1026 channels, but got 514 channels instead

Any suggestions or sample config files to use?

haomengz commented 9 months ago

Thanks for pointing this out.

The problem is that the dimension for the features before hyperspherical module and after are different. In this specific config it is 1024(maxpool_bottleneck) versus 512(hyper_bottleneck). The published code is still using the feature dimension before the module (i.e. 1024). You could fix this problem by setting the input_channels of the decoder based on the use_hyperspherical_encoding flag, or you could try to directly set the maxpool_bottleneck and hyper_bottleneck to have same dimensions (which they don'e have to in the general case).

Sorry for the confusion. Hope this helps!