GithubHelp home page GithubHelp logo

kaiyuyue / mgd Goto Github PK

View Code? Open in Web Editor NEW
63.0 5.0 12.0 696 KB

Matching Guided Distillation (ECCV 2020)

Home Page: https://kaiyuyue.com/mgd

License: MIT License

Python 100.00%
matching-guided-distillation mgd model-distillation knowledge-distillation pytorch detectron2 kd detection classification moco-v2 unsupervised-learning deep-learning

mgd's Issues

BNs for student features in MGDistiller

I notice that there are BNs for student features in MGDistiller. Why need additional batch normalizations? What if calculating distillation loss by student features directly ?

Absolute Max Pooling

def amp(self, i, t_feats, s_feats, margins):
    """
    Absolute Max Pooling for channels reduction.
    """
    b, sc, h, w = s_feats[i].shape
    _, tc, _, _ = t_feats[i].shape

    groups = tc // sc

    t = []
    m = []
    for c in range(0, tc, sc):
        if c == (tc // sc) * sc and self.shave:
            continue

        t.append(t_feats[i][:, self.guided_inds[i][c:c+sc].detach(), :, :])
        m.append(margins[:, self.guided_inds[i][c:c+sc].detach(), :, :])

    t = torch.stack(t, dim=2)
    m = torch.stack(m, dim=2)

    t = t.reshape(b, sc, groups, -1)
    m = m.reshape(1, sc, groups, -1)

    t_inds = torch.argmax(t, dim=2)

    t = t.gather(2, t_inds.unsqueeze(2))
    m = m.mean(dim=2)

    t = t.reshape(b, sc, h, w)
    m = m.reshape(1, sc, 1, 1)

for Absolute Max Pooling ,t may be abs ?
the line t_inds = torch.argmax(t, dim=2) should change to t_inds = torch.argmax(torch.abs(t), dim=2)

self.model has no attribute module in d2/train_net.py

I run your code and occur this error message, the self.model is an MGDistiller or SMDistiller object, and both of them don't have 'module' attribute, and I replace the self.model.module to self.model, the code works. It's right ?

'RetinaNet' object has no attribute 'get_channel_num'

Hi author,

Thanks a lot for sharing the nice work!
For detection part: RetinaNet-R50->RetinaNet-R18, run the command:
An error show up.
In mge/builder.py [line61]( self.t_channels = self.t_net.get_channel_num()):

line61: self.t_channels = self.t_net.get_channel_num()
AttributeError: 'RetinaNet' object has no attribute 'get_channel_num'

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.