wangyida / softpool

SoftPoolNet: Shape Descriptor for Point Cloud Completion and Classification - ECCV 2020 oral
Apache License 2.0
74 stars 5 forks source link

Bug : SoftPool Operator #11

Closed slothfulxtx closed 3 years ago

slothfulxtx commented 3 years ago
class SoftPool(nn.Module):
    def __init__(self, regions=16, cabins=8, sp_ratio=4):
        super(SoftPool, self).__init__()
        self.regions = regions
        self.num_cabin = cabins
        self.sp_ratio = sp_ratio

    def forward(self, x):
        [self.size_bth, self.size_feat, self.pnt_per_sort] = list(x.shape)
        self.pnt_per_sort //= self.sp_ratio
        # cabin -2
        conv2d_1 = nn.Conv2d(
            self.size_feat, self.size_feat, kernel_size=(1, 3),
            stride=(1, 1)).cuda()
        # cabin -2
        conv2d_2 = nn.Conv2d(
            self.size_feat, self.size_feat, kernel_size=(1, 3),
            stride=(1, 1)).cuda()
        conv2d_3 = nn.Conv2d(
            self.size_feat,
            self.size_feat,
            kernel_size=(1, self.num_cabin - 2 * (3 - 1)),
            stride=(1, 1)).cuda()
        conv2d_5 = nn.Conv2d(
            self.size_feat,
            self.size_feat,
            kernel_size=(self.regions, 1),
            stride=(1, 1)).cuda()

Here you shouldn't create nn layers in forward function, otherwise you cann't save the weights of conv2d into the checkpoint file. I've been debugging for more than 3 days and finally I've found it.

wangyida commented 3 years ago

Oh really? Let me check it on my local machine, weights are usually defined in init() in my Network classes. Thanks a lot, I'll inform you once there are code updates;)

wangyida commented 3 years ago

@slothfulxtx Thank you Sloth! It's right like what you have described, that's why my regional activation is not identical to the tensorflow codes. By the way, I further modified my model.py script so that you can evaluate more related works in the same training and validation framework.

Thank you again friend Yida