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

About test and train #22

Closed
RainHxj opened this issue Jul 16, 2020 · 3 comments
Closed

About test and train #22

RainHxj opened this issue Jul 16, 2020 · 3 comments

Comments

@RainHxj
Copy link

RainHxj commented Jul 16, 2020

Thanks for your work. In the process of using this framework, I found some problems.
About test:
I download the trained model(DeepLabV3+ | R-101-D8 | 769x769 | 80000), and test the model on city val. I got 80.75 mIoU instead of 80.98.

About train:
I train the deeplabv3+ with this configure(DeepLabV3+ | R-50-D8 | 769x769 | 40000|4GPU). I got 78.49 mIoU instead of 78.97.

What could be the reason for the difference ?

@xvjiarui
Copy link
Collaborator

xvjiarui commented Jul 16, 2020

Hi @RainHxj
Thanks for your report.
I just tested the master branch. The result are as followed.

Method Backbone Crop Size Lr schd mIoU(Model Zoo) mIoU(master)
DeepLabV3+ R-101-D8 512x1024 80000 80.97 81.04
DeepLabV3+ R-101-D8 769x769 80000 80.98 80.92

The reason marginal difference is still under investagation.
In our original implementation (model zoo version), there is no padding. We add it back during refactoring.
We will update the benchmark to make it consistent.

However, I couldn't get your 80.75 mIoU result. Could you please have a check?

As for the gap between 78.49 and 78.97, it may majorly due to the training variance (the padding have very little impact). You may give it another try.

Please feel free to re-open this issue if there is any other concern.

@RainHxj
Copy link
Author

RainHxj commented Jul 16, 2020

@xvjiarui
In DepthwiseSeparableASPPModule, 3*3 conv is used. Without padding, how to ensure that the feature size before and after conv is consistent ?

@xvjiarui
Copy link
Collaborator

Hi @RainHxj
My bad. I just took a deeper look at this. I have removed my previous incorrect explanation.

Here is the previous version code.

class SeparableConvModule(nn.Module):

    def __init__(self,
                 in_channels,
                 out_channels,
                 kernel_size=3,
                 stride=1,
                 dilation=1,
                 relu_first=False,
                 bias=False,
                 norm_cfg=dict(type='BN')):
        super(SeparableConvModule, self).__init__()
        self.depthwise = nn.Conv2d(
            in_channels,
            in_channels,
            kernel_size,
            stride=stride,
            padding=dilation,
            dilation=dilation,
            groups=in_channels,
            bias=bias)
        self.norm_depth_name, norm_depth = build_norm_layer(
            norm_cfg, in_channels, postfix='_depth')
        self.add_module(self.norm_depth_name, norm_depth)

        self.pointwise = nn.Conv2d(in_channels, out_channels, 1, bias=bias)
        self.norm_point_name, norm_point = build_norm_layer(
            norm_cfg, out_channels, postfix='_point')
        self.add_module(self.norm_point_name, norm_point)

        self.relu_first = relu_first
        self.relu = nn.ReLU(inplace=not relu_first)

    @property
    def norm_depth(self):
        return getattr(self, self.norm_depth_name)

    @property
    def norm_point(self):
        return getattr(self, self.norm_point_name)

    def forward(self, x):
        if self.relu_first:
            out = self.relu(x)
            out = self.depthwise(out)
            out = self.norm_depth(out)
            out = self.pointwise(out)
            out = self.norm_point(out)
        else:
            out = self.depthwise(x)
            out = self.norm_depth(out)
            out = self.relu(out)
            out = self.pointwise(out)
            out = self.norm_point(out)
            out = self.relu(out)
        return out

The model trained with the above code is converted to the current code.
I will try again to find the reason.
Any suggestion is welcomed.

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