Coder Social home page Coder Social logo

Is the D right ? about resnext.pytorch HOT 6 OPEN

prlz77 avatar prlz77 commented on May 26, 2024
Is the D right ?

from resnext.pytorch.

Comments (6)

prlz77 avatar prlz77 commented on May 26, 2024 1

Please make sure that you are executing with the correct commandline parameters. For --cardinality 32 --widen_factor 4 --depth 50 --base_width 4 I get:

  (stage_1): Sequential(
    (stage_1_bottleneck_0): ResNeXtBottleneck(
      (conv_reduce): Conv2d(64, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
      (bn_reduce): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (conv_conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=32, bias=False)
      (bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (conv_expand): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
      (bn_expand): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (shortcut): Sequential(
        (shortcut_conv): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (shortcut_bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      )
    )

Which exactly corresponds to the paper (https://arxiv.org/pdf/1611.05431.pdf):
image

from resnext.pytorch.

prlz77 avatar prlz77 commented on May 26, 2024

Yes, it is right since these numbers are divided by the groups of the convolution.

from resnext.pytorch.

pppLang avatar pppLang commented on May 26, 2024

oh, really thanks for answer~

but, emmmm, i also refer to another implement: https://github.com/kuangliu/pytorch-cifar/blob/master/models/resnext.py

And the numbers of conv with stride 3 is less than that stride 1, even though it is also divided into some groups. I check the network architecture by print(net), maybe you want compare the two implement ?

thanks again~

from resnext.pytorch.

pppLang avatar pppLang commented on May 26, 2024

Yes, i think when --cardinality 32 --widen_factor 4 --depth 50 --base_width 4, it is right.

but in your train.py, --cardinality 8--widen_factor 4 --depth 29--base_width 64, i got :

(stage_1): Sequential( (stage_1_bottleneck_0): ResNeXtBottleneck( (conv_reduce): Conv2d(64, 512, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn_reduce): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv_conv): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=8, bias=False) (bn): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv_expand): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn_expand): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (shortcut): Sequential( (shortcut_conv): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False) (shortcut_bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) ) )

I think it is wrong, in a bottlenect, the channel number of the middle conv should be half of that of the output conv. But under this parameter setting, it is twice.

sorry, i don't know how to change lines, but you can test by yourself.

from resnext.pytorch.

prlz77 avatar prlz77 commented on May 26, 2024

Resnext bottlenecks are a bit different, if you ask for a base width of 64 and a cardinality of 8, this is 64*8 = 512. These 512 will be divided in 8 groups of 64 channels.

Maybe I am wrong, could you execute the oiriginal torch code and compare with mine to make it sure?

from resnext.pytorch.

pppLang avatar pppLang commented on May 26, 2024

Running the torch code is a bit troublesome, but i think you are right.

I test a total of three implement code:
yours: https://github.com/prlz77/ResNeXt.pytorch/blob/master/models/model.py
https://github.com/kuangliu/pytorch-cifar/blob/master/models/resnext.py
https://github.com/D-X-Y/ResNeXt-DenseNet/blob/master/models/resnext.py

And your network architecture is same as the third one, but different from the second.

After i finish my work, i will check again. Really thanks for your answer~

from resnext.pytorch.

Related Issues (18)

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.