PyTorch Implementation of the paper Learning to Reweight Examples for Robust Deep Learning

Overview

Learning to Reweight Examples for Robust Deep Learning

Unofficial PyTorch implementation of Learning to Reweight Examples for Robust Deep Learning.

The paper addresses the problem of imbalanced and noisy datasets by learning a good weighting of examples using a small clean and balanced dataset.

Please Let me know if there are any bugs in my code. Thank you! =)

I implemented this on Python 3.6 using PyTorch 0.4.0.

Dataset

I only ran the experiments for the class imbalance problem. Following the paper, I created an imbalanced training dataset using class '4' and '9' of the MNIST dataset, where '9' is the dominant class. (code for creating the dataset is in data_loader.py)

Note that the test set used to measure the performance is balanced.

Some Results

We can see that even at 0.995 proportion of the dominant class in the training data, the model still reaches 90+% accuracy on the balanced test data.

Acknowledgements

Adrien Ecoffet: https://github.com/AdrienLE

Comments
  •  The loss of ResNet composed of MetaModule is difficult to decrease

    The loss of ResNet composed of MetaModule is difficult to decrease

    I find the loss of ResNet composed of MetaModule is difficult to decrease, and the regular ResNet behaves normally, regardless of whether or not to do Kaiming initialization. Has anyone encountered the same problem?

    opened by Surflyan 1
  • Preact layers

    Preact layers

    I'm having problem: TypeError: cannot assign 'torch.cuda.FloatTensor' as parameter 'weight' (torch.nn.Parameter or None expected)

    When I'm trying to implement resnet experiment. I saw instruction in another Issue page and follow to change nn.Module to MetaModule and linear to MetaLinear but there is still that same error. Do I need to change anything else?

    Also, I don't see any line of code where those PreAct layer being used. Please correct me if I'm wrong

    opened by Yurushia1998 0
  • cannot assign 'torch.FloatTensor' as parameter 'weight' (torch.nn.Parameter or None expected)

    cannot assign 'torch.FloatTensor' as parameter 'weight' (torch.nn.Parameter or None expected)

    Uploading image.png… hello ! danieltan! when i transfer your minist image to my CWRU(1-dimension)data. I meet this problem. i rewrite the LENET model because for the feature encoder is different between image and 1d-data. and i don't use your metamodel class. when i calculate the grad for the first virtual updata . this bug happends. shoud i use your metamodel class? should i write a class of meteconv1d? i can't find the reason of this bug. expect you suggestion

    opened by LIYIJIANNN 1
  • Two Issues

    Two Issues

    If Adam optimizer is used, can it still work ? (Line 7. indicates a standard gradient desent method) Or, this just fit into the SGD based optimizer? 2. I would like to use this reweighting strategy in more complicated neural framework such as LSTM, BERT for other downstream tasks. Whether I must modify these to the 'meta-style' structures ? It seems to be trivial.

    opened by LindgeW 2
  • Can't get model.named_params() from ResNet32(MeataModule)

    Can't get model.named_params() from ResNet32(MeataModule)

    Here is the code:

        def __init__(self, num_classes, block=BasicBlock, num_blocks=[5, 5, 5]):
            super(ResNet32, self).__init__()
            self.in_planes = 16
    
            self.conv1 = MetaConv2d(3, 16, kernel_size=3, stride=1, padding=1, bias=False)
            self.bn1 = MetaBatchNorm2d(16)
            self.layer1 = self._make_layer(block, 16, num_blocks[0], stride=1)
            self.layer2 = self._make_layer(block, 32, num_blocks[1], stride=2)
            self.layer3 = self._make_layer(block, 64, num_blocks[2], stride=2)
            self.linear = MetaLinear(64, num_classes)
    
            self.apply(_weights_init)
    
        def _make_layer(self, block, planes, num_blocks, stride):
            strides = [stride] + [1]*(num_blocks-1)
            layers = []
            for stride in strides:
                layers.append(block(self.in_planes, planes, stride))
                self.in_planes = planes * block.expansion
    
            return nn.Sequential(*layers)
    
        def forward(self, x):
            out = F.relu(self.bn1(self.conv1(x)))
            out = self.layer1(out)
            out = self.layer2(out)
            out = self.layer3(out)
            out = F.avg_pool2d(out, out.size()[3])
            out = out.view(out.size(0), -1)
            out = self.linear(out)
            return out
    
    model = ResNet32()```
    When I use 
    `for name, p in list(model.named_params()):`
    it returns   'NoneType' object has no attribute '_parameters'
    
    Thank you!
    opened by hhc1997 1
  • using transfer learning model on resnet18

    using transfer learning model on resnet18

    I build a resnet18 transfer learning model following the example in weblink: https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html.

    My program encounters the error when running to: meta_model.update_params(hyperparameters['lr'], source_params=grads) The error is: TypeError: cannot assign 'torch.cuda.FloatTensor' as parameter 'weight' (torch.nn.Parameter or None expected)

    Anyone has ideas about the error I encountered? Thanks

    Could you give the exact link for: class MetaModule(nn.Module): ? I have not found it from: Adrien Ecoffet https://github.com/AdrienLE

    opened by xhm1014 3
  • Some bugs for preact_resnet_meta.py

    Some bugs for preact_resnet_meta.py

    opened by guixianjin 0
Owner
Daniel Stanley Tan
Daniel Stanley Tan
[PyTorch] Official implementation of CVPR2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency". https://arxiv.org/abs/2103.05465

PointDSC repository PyTorch implementation of PointDSC for CVPR'2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency",

null 153 Dec 14, 2022
Unadversarial Examples: Designing Objects for Robust Vision

Unadversarial Examples: Designing Objects for Robust Vision This repository contains the code necessary to replicate the major results of our paper: U

Microsoft 93 Nov 28, 2022
A certifiable defense against adversarial examples by training neural networks to be provably robust

DiffAI v3 DiffAI is a system for training neural networks to be provably robust and for proving that they are robust. The system was developed for the

SRI Lab, ETH Zurich 202 Dec 13, 2022
Pre-trained model, code, and materials from the paper "Impact of Adversarial Examples on Deep Learning Models for Biomedical Image Segmentation" (MICCAI 2019).

Adaptive Segmentation Mask Attack This repository contains the implementation of the Adaptive Segmentation Mask Attack (ASMA), a targeted adversarial

Utku Ozbulak 53 Jul 4, 2022
The official implementation of the IEEE S&P`22 paper "SoK: How Robust is Deep Neural Network Image Classification Watermarking".

Watermark-Robustness-Toolbox - Official PyTorch Implementation This repository contains the official PyTorch implementation of the following paper to

null 49 Dec 19, 2022
PyTorch implementation of NeurIPS 2021 paper: "CoFiNet: Reliable Coarse-to-fine Correspondences for Robust Point Cloud Registration"

PyTorch implementation of NeurIPS 2021 paper: "CoFiNet: Reliable Coarse-to-fine Correspondences for Robust Point Cloud Registration"

null 76 Jan 3, 2023
Official PyTorch implemention of our paper "Learning to Rectify for Robust Learning with Noisy Labels".

WarPI The official PyTorch implemention of our paper "Learning to Rectify for Robust Learning with Noisy Labels". Run python main.py --corruption_type

Haoliang Sun 3 Sep 3, 2022
PyTorch implementation of the Deep SLDA method from our CVPRW-2020 paper "Lifelong Machine Learning with Deep Streaming Linear Discriminant Analysis"

Lifelong Machine Learning with Deep Streaming Linear Discriminant Analysis This is a PyTorch implementation of the Deep Streaming Linear Discriminant

Tyler Hayes 41 Dec 25, 2022
Code for the CVPR 2021 paper: Understanding Failures of Deep Networks via Robust Feature Extraction

Welcome to Barlow Barlow is a tool for identifying the failure modes for a given neural network. To achieve this, Barlow first creates a group of imag

Sahil Singla 33 Dec 5, 2022
Official PyTorch implementation for Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers, a novel method to visualize any Transformer-based network. Including examples for DETR, VQA.

PyTorch Implementation of Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers 1 Using Colab Please notic

Hila Chefer 489 Jan 7, 2023
LBK 26 Dec 28, 2022
Official implementation of the paper WAV2CLIP: LEARNING ROBUST AUDIO REPRESENTATIONS FROM CLIP

Wav2CLIP ?? WIP ?? Official implementation of the paper WAV2CLIP: LEARNING ROBUST AUDIO REPRESENTATIONS FROM CLIP ?? ?? Ho-Hsiang Wu, Prem Seetharaman

Descript 240 Dec 13, 2022
Source code, datasets and trained models for the paper Learning Advanced Mathematical Computations from Examples (ICLR 2021), by François Charton, Amaury Hayat (ENPC-Rutgers) and Guillaume Lample

Maths from examples - Learning advanced mathematical computations from examples This is the source code and data sets relevant to the paper Learning a

Facebook Research 171 Nov 23, 2022
PyTorch implementation for Partially View-aligned Representation Learning with Noise-robust Contrastive Loss (CVPR 2021)

2021-CVPR-MvCLN This repo contains the code and data of the following paper accepted by CVPR 2021 Partially View-aligned Representation Learning with

XLearning Group 33 Nov 1, 2022
Official Pytorch implementation of "Learning to Estimate Robust 3D Human Mesh from In-the-Wild Crowded Scenes", CVPR 2022

Learning to Estimate Robust 3D Human Mesh from In-the-Wild Crowded Scenes / 3DCrowdNet News ?? 3DCrowdNet achieves the state-of-the-art accuracy on 3D

Hongsuk Choi 113 Dec 21, 2022
The official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averaging Approach

Graph Optimizer This repo contains the official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averagin

Chenyu 109 Dec 23, 2022
This repository contains the implementation of the paper: "Towards Frequency-Based Explanation for Robust CNN"

RobustFreqCNN About This repository contains the implementation of the paper "Towards Frequency-Based Explanation for Robust CNN" arxiv. It primarly d

Sarosij Bose 2 Jan 23, 2022
This framework implements the data poisoning method found in the paper Adversarial Examples Make Strong Poisons

Adversarial poison generation and evaluation. This framework implements the data poisoning method found in the paper Adversarial Examples Make Strong

null 31 Nov 1, 2022
Repository for reproducing `Model-Based Robust Deep Learning`

Model-Based Robust Deep Learning (MBRDL) In this repository, we include the code necessary for reproducing the code used in Model-Based Robust Deep Le

Alex Robey 16 Sep 19, 2022