Giter Site home page Giter Site logo

Comments (5)

LiheYoung avatar LiheYoung commented on September 24, 2024 1

You can change the ASPPPooling from

class ASPPPooling(nn.Module):
def __init__(self, in_channels, out_channels):
super(ASPPPooling, self).__init__()
self.gap = nn.Sequential(nn.AdaptiveAvgPool2d(1),
nn.Conv2d(in_channels, out_channels, 1, bias=False),
nn.BatchNorm2d(out_channels),
nn.ReLU(True))
def forward(self, x):
h, w = x.shape[-2:]
pool = self.gap(x)
return F.interpolate(pool, (h, w), mode="bilinear", align_corners=True)
to

class ASPPPooling(nn.Module):
    def __init__(self, in_channels, out_channels):
        super(ASPPPooling, self).__init__()
        self.gap = nn.Sequential(nn.AdaptiveAvgPool2d(1),
                                 nn.Conv2d(in_channels, out_channels, 1, bias=False))
        self.post = nn.Sequential(nn.BatchNorm2d(out_channels),
                                  nn.ReLU(True))

    def forward(self, x):
        h, w = x.shape[-2:]
        pool = self.gap(x)
        return self.post(F.interpolate(pool, (h, w), mode="bilinear", align_corners=True))

from unimatch.

LiheYoung avatar LiheYoung commented on September 24, 2024 1

It is because the BN can not calculate the variance when the spatial size is 1x1.

from unimatch.

LiheYoung avatar LiheYoung commented on September 24, 2024

Did you use the supervised or fixmatch algorithm, instead of our unimatch? The unimatch should not encounter such a problem, because there are two concatenated strongly augmented images for each unlabeled sample. And if you used the former ones, you may solve this problem by updating the PyTorch version to 1.8.1.

from unimatch.

StevenLu1204 avatar StevenLu1204 commented on September 24, 2024

My PyTorch version is 1.8.1+cu111, the problem remains. Do you mind sharing your log on training fixmatch.py ?

from unimatch.

StevenLu1204 avatar StevenLu1204 commented on September 24, 2024

Thanks for the update. It works fine now. Looks like it's the problem of interpolation and BatchNorm2d?

from unimatch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.