question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to implement Feature level Cutmix?

See original GitHub issue

Thanks for your sharing.

But I have a question about how to implement ‘ResNet-50 + Feature Cutmix’, since if we just use the replace operation like we did in the image level cutmix, the gradients will not be back propagated.

Actually, I encountered such problem:

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

Could you give me some suggestions or hints to solve this feature level cutmix problem?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
hellbellcommented, Jul 24, 2019

@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!

0reactions
hellbellcommented, Aug 6, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CutMix Explained | Papers With Code
CutMix is an image data augmentation strategy. ... Strategy to Train Strong Classifiers with Localizable Features ... You Only Look One-level Feature.
Read more >
CutMix : An Augmentation Technique for Image Classification ...
Though Cutout and Mixup perform well in increasing the output prediction ... On the feature level as well CutMix gives the best performance....
Read more >
CutMix: Regularization Strategy to Train Strong Classifiers ...
The performance of feature-level CutMix is given in. Figure 3, right plot. We changed the layer on which Cut-. Mix is applied, from...
Read more >
CutMix: Regularization Strategy to Train Strong ... - arXiv Vanity
In this work, we introduced CutMix for training CNNs to have strong classification and localization ability. CutMix is simple, easy to implement, and...
Read more >
Modern Data Augmentation Techniques for Computer Vision
This article gives a comparison between Cutout, mixup, CutMix, ... and therefore they learn better higher-level features.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found