Git Product home page Git Product logo

knowledgereview's People

Contributors

zjykzj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

marssgon

knowledgereview's Issues

Question about ABF model

class ABF(nn.Module):

def __init__(self, in_channel, out_channel, mid_channel, is_fuse=True):
    super(ABF, self).__init__()

    self.conv_first = nn.Sequential(
        nn.Conv2d(in_channel, mid_channel, kernel_size=(1, 1), bias=False),
        nn.BatchNorm2d(mid_channel)
    )

    self.conv_last = nn.Sequential(
        nn.Conv2d(mid_channel, out_channel, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False),
        nn.BatchNorm2d(out_channel)
    )

    self.att_conv = None if not is_fuse else nn.Sequential(
        nn.Conv2d(mid_channel * 2, 2, kernel_size=(1, 1)),
        nn.Sigmoid()
    )

    self.__init_weights()

def __init_weights(self):
    nn.init.kaiming_uniform_(self.conv_first[0].weight, a=1)
    nn.init.kaiming_uniform_(self.conv_last[0].weight, a=1)

def forward(self, x, y=None, shape=None):
    assert len(x.shape) == 4
    N, _, H, W = x.shape[:4]

    x = self.conv_first(x)
    if self.att_conv is not None:
        # up sample residual features
        y = F.interpolate(y, shape, mode="nearest")
        # fusion
        z = torch.cat([x, y], dim=1)
        z = self.att_conv(z)

        x = (x * z[:, 0].view(N, 1, H, W) + y * z[:, 1].view(N, 1, H, W))
    y = self.conv_last(x)

    return y, x

In the 'forward' function, only the channel of y seems must be equal to mid_channel if self.att_conv could work.But the input y is res_features, the channel's number of res_features seem can't be guaranteed to be equal to mid_channel.

A Training Bug

There is a training bug in this project. That is I only set teacher model's require_grad_=False, but still put it's parameters to optimizer. So teacher model will update in training while it doesn't compute grad.

I don't have plan to fix it, because the training result shows it also works well.

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.