Giter Site home page Giter Site logo

Comments (4)

sunzhe09 avatar sunzhe09 commented on May 24, 2024

me too

from bsconv.

zeiss-mamthor avatar zeiss-mamthor commented on May 24, 2024

Hi,
as already discussed in issue #4 (bullet point 1) and described in the paper (Sect. 4.2), we retain the layer arrangement of the original model.
However, even though for this specific case the layers are the same, the BSConvS variant uses the additional regularization loss which causes the improved results. This is not shown when printing the model.

from bsconv.

sunzhe09 avatar sunzhe09 commented on May 24, 2024

@zeiss-mamthor I want to replace the MobileNetV2 bottleneck ,should I replace DepthwiseConv with BSConvS ?or just replace invert_residual with BSConvS?I ‘m a little confused

from bsconv.

zeiss-mamthor avatar zeiss-mamthor commented on May 24, 2024

Following the implementation in the paper, the entire linear bottleneck block (not only the DW conv) is replaced by a special form of a BSConvS module, where the layer cascade of PW-PW-DW is shifted to match the original MobileNet design of PW-DW-PW. The reason is that in the MobileNet paper it was shown that residuals in the bottleneck provide a better accuracy/FLOP ratio compared to residuals outside of the bottleneck (as implemented in ResNets). We keep these findings for our models, i.e., converting a MobileNetV2 into its BSConvS variant consists of adding the regularization loss to the last PW conv of each bottleneck block while keeping the overall layer design.
You can simply use the transformer for MobileNetV2/3 which adds the required function to the corresponding modules or just load an already converted model:

import bsconv.pytorch
model = bsconv.pytorch.get_model('cifar_mobilenetv2_w1_bsconvs', num_classes=100)

Btw, do not forget to add the regularization loss during training:

output = model(images)
loss = criterion(output, target)

# THIS LINE MUST BE ADDED, everything else remains unchanged
loss += model.reg_loss(alpha=0.1)

from bsconv.

Related Issues (11)

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.