Code Monkey home page Code Monkey logo

Comments (5)

hellbell avatar hellbell commented on July 28, 2024 1

@EmmaW8
In our implementation, we put this cutmix operation into forward function of resnet.py model.
For example, Feature CutMix after layer 1 is,

            ...
            x = self.layer1(x)

            # Feature CutMix
            bbx1, bby1, bbx2, bby2 = rand_bbox(x.size(), lam)
            x[:,:,bbx1:bbx2,bby1:bby2] = x[rand_index,:,bbx1:bbx2,bby1:bby2]

            x = self.layer2(x)
            ...

From our experience, inplace=True option may cause the runtime error, so try with inplace=False.

Thanks!

from cutmix-pytorch.

emma-sjwang avatar emma-sjwang commented on July 28, 2024

Thank you for your reply.
Do you know more about how to implement inplace=False.
Exactly, the runtime error is derived from the gradient calculation for the assignment operation.

from cutmix-pytorch.

hellbell avatar hellbell commented on July 28, 2024

@EmmaW8
In my case, it was worked when I change nn.ReLU(inplace=True) to nn.ReLU(inplace=False).
I hope this would work. :)

from cutmix-pytorch.

zs-zhong avatar zs-zhong commented on July 28, 2024

Hello, thanks for your great job!
I have a question about Feature Cutmix: When training with Feature-Level Cutmix, how is the label transformation? Keeping it the same with Image-Level Cutmix or no transformation on the label?

from cutmix-pytorch.

hellbell avatar hellbell commented on July 28, 2024

@zzs1994

I have a question about Feature Cutmix: When training with Feature-Level Cutmix, how is the label transformation? Keeping it the same with Image-Level Cutmix or no transformation on the label?

We do it in the same way of image-level CutMix.

from cutmix-pytorch.

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.