Code for paper "Learning to Reweight Examples for Robust Deep Learning"

Overview

learning-to-reweight-examples

Code for paper Learning to Reweight Examples for Robust Deep Learning. [arxiv]

Environment

We tested the code on

  • tensorflow 1.10
  • python 3

Other dependencies:

  • numpy
  • tqdm
  • six
  • protobuf

Installation

The following command makes the protobuf configurations.

make

MNIST binary classification experiment

python -m mnist.mnist_train --exp ours

Please see mnist/mnist_train.py for more options.

CIFAR noisy label experiments

Download CIFAR dataset

bash cifar/download_cifar.sh ./data

Config files are located in cifar/configs. For ResNet-32, use cifar/configs/cifar-resnet-32.prototxt. For Wide ResNet-28, use cifar/configs/cifar-wide-resnet-28-10.prototxt.

CIFAR-10/100 uniform flip noise experiment

python -m cifar.cifar_train --config [CONFIG]

Please see cifar/cifar_train.py for more options.

CIFAR-10/100 background flip noise experiment

python -m cifar.cifar_train_background --config [CONFIG]

Please see cifar/cifar_train_background.py for more options.

Citation

If you use our code, please consider cite the following: Mengye Ren, Wenyuan Zeng, Bin Yang, Raquel Urtasun. Learning to Reweight Examples for Robust Deep Learning. ICML 2018.

@inproceedings{ren18l2rw,
  author    = {Mengye Ren and Wenyuan Zeng and Bin Yang and Raquel Urtasun},
  title     = {Learning to Reweight Examples for Robust Deep Learning},
  booktitle = {ICML},
  year      = {2018},
}
Comments
  • The possibility of negative eps

    The possibility of negative eps

    Thanks for the great work! I was wondering whether you have tried to relax the constraint that eps must be greater than zero. I would be grateful if you could tell me.

    opened by xxchenxx 2
  • gradients of noisy loss w.r.t parameter \theta

    gradients of noisy loss w.r.t parameter \theta

    The basic procedure sounds like

    • (a) set \epsilon = 0, get grads to update \theta
    • (b) evaluate new \theta on clean validation set .
    • (c) set - grads (validation loss w.r.t \epsilon) as \epsilon
    • (d) use new \epsilon to evaluate noisy data and update parameters again

    My question is when \epsilon=0, the derivative of loss w.r.t. \theta =0? That means we don't update \theta actually in (a)?

    opened by qingerVT 2
  • No module named 'models.cnn.configs.resnet_model_config_pb2'

    No module named 'models.cnn.configs.resnet_model_config_pb2'

    Hi, thank you for open-sourcing learning-to-reweight-examples, interesting work!

    When I tired the code about CIFAR experiments, there is a file missing exception:

    File "~/projects/cifar/cifar_train.py", line 54, in from models.cnn.configs.resnet_model_config_pb2 import ResnetModelConfig ModuleNotFoundError: No module named 'models.cnn.configs.resnet_model_config_pb2'

    many scripts in cifar folder import this script resnet_model_config_pb2, but the file did not exist. is it a public file that I should download from the internet?

    opened by tonyqtian 1
  • tabular data/ noisy instances/ new datasets

    tabular data/ noisy instances/ new datasets

    Hi, thanks for sharing your implementation. I have some questions about it:

    1. Does it also work on tabular data?
    2. Is the code tailored to the datasets used in the paper or can one apply it to any data?
    3. Is it possible to identify the noisy instances (return the noisy IDs or the clean set)?

    Thanks!

    opened by nazaretl 0
  • Implementing in Tensorflow 2

    Implementing in Tensorflow 2

    In Tensorflow 2, eager execution seems to remove epsilon (ex_wts_a) from the computational graph, and the derivative of Lg with respect to epsilon is none. Is there a way to make it work in Tensorflow 2?

    epsilon = tf.Variable([0.0 for i in range(batch_size)], dtype=tf.float32) with tf.GradientTape(persistent=True) as tape: tape.reset() yf_hat = damage_classifier_model(Xf) binaryCrossEntropy = tf.keras.losses.BinaryCrossentropy() loss_f = binaryCrossEntropy(yf,yf_hat) Lf = tf.reduce_sum(loss_f * epsilon) trainable_vars = damage_classifier_model.trainable_variables delta_theta = tape.gradient(Lf, trainable_vars) damage_classifier_model.optimizer.apply_gradients(zip(delta_theta, trainable_vars)) yg_hat = damage_classifier_model(Xg) Lg = damage_classifier_model.compiled_loss(yg,yg_hat)

    delta_epsilon = tape.gradient(Lg, epsilon) delta_epsilon

    opened by karthikm1987 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 1
  • Code for noisy contamination is different compared to paper

    Code for noisy contamination is different compared to paper

    In file generate_nosi_cifar_data.py, there are some issues I don't understand:

    1. The paper claim using 10 images per class, but in fact the code choose randomly first 100 images, so it is not guaranteed to have 10 images per class. When I test the number of image per class is around 9-10-11-12
    2. The flip_data_background function: It does not flip data to background, but instead flip 40% data to another random class among number of class, and there is no guarantee they flip to wrong class as well.

    Please help me clarify these issues

    opened by Yurushia1998 0
  • Discrepancy between code and paper: number of clean examples in Cifar

    Discrepancy between code and paper: number of clean examples in Cifar

    Thanks very much for taking the effort to make your code available. While reproducing your results, I found that the default number of clean examples in the Cifar experiments is 100, while the paper reports using 1000. Is the number 1000 in the paper correct? If so, maybe you could change the defaults in your code.

    https://github.com/uber-research/learning-to-reweight-examples/blob/0b616c99ecf8a1c99925322167694272a966ed00/cifar/cifar_train.py#L698

    https://github.com/uber-research/learning-to-reweight-examples/blob/0b616c99ecf8a1c99925322167694272a966ed00/cifar/cifar_train_background.py#L715

    PS: does your Cifar code also include the MentorNet baseline somewhere?

    opened by tvogels 0
Owner
Uber Research
Uber's research projects. Projects in this organization are not built for production usage. Maintainance and supports are limited.
Uber Research
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

Gautam Singh 66 Dec 26, 2022
Code for paper ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization in the Loop.

Who Left the Dogs Out? Evaluation and demo code for our ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization

Benjamin Biggs 29 Dec 28, 2022
TensorFlow code for the neural network presented in the paper: "Structural Language Models of Code" (ICML'2020)

SLM: Structural Language Models of Code This is an official implementation of the model described in: "Structural Language Models of Code" [PDF] To ap

null 73 Nov 6, 2022
Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

CoProtector Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

Zhensu Sun 1 Oct 26, 2021
Code to use Augmented Shapiro Wilks Stopping, as well as code for the paper "Statistically Signifigant Stopping of Neural Network Training"

This codebase is being actively maintained, please create and issue if you have issues using it Basics All data files are included under losses and ea

J K Terry 32 Nov 9, 2021
Code for our method RePRI for Few-Shot Segmentation. Paper at http://arxiv.org/abs/2012.06166

Region Proportion Regularized Inference (RePRI) for Few-Shot Segmentation In this repo, we provide the code for our paper : "Few-Shot Segmentation Wit

Malik Boudiaf 138 Dec 12, 2022
Code for ACM MM 2020 paper "NOH-NMS: Improving Pedestrian Detection by Nearby Objects Hallucination"

NOH-NMS: Improving Pedestrian Detection by Nearby Objects Hallucination The offical implementation for the "NOH-NMS: Improving Pedestrian Detection by

Tencent YouTu Research 64 Nov 11, 2022
Official TensorFlow code for the forthcoming paper

~ Efficient-CapsNet ~ Are you tired of over inflated and overused convolutional neural networks? You're right! It's time for CAPSULES :)

Vittorio Mazzia 203 Jan 8, 2023
This is the code for the paper "Contrastive Clustering" (AAAI 2021)

Contrastive Clustering (CC) This is the code for the paper "Contrastive Clustering" (AAAI 2021) Dependency python>=3.7 pytorch>=1.6.0 torchvision>=0.8

Yunfan Li 210 Dec 30, 2022
Code for the paper Learning the Predictability of the Future

Learning the Predictability of the Future Code from the paper Learning the Predictability of the Future. Website of the project in hyperfuture.cs.colu

Computer Vision Lab at Columbia University 139 Nov 18, 2022
PyTorch code for the paper: FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning

FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning This is the PyTorch implementation of our paper: FeatMatch: Feature-Based Augmentat

null 43 Nov 19, 2022
Code for the paper A Theoretical Analysis of the Repetition Problem in Text Generation

A Theoretical Analysis of the Repetition Problem in Text Generation This repository share the code for the paper "A Theoretical Analysis of the Repeti

Zihao Fu 37 Nov 21, 2022
Code for our ICASSP 2021 paper: SA-Net: Shuffle Attention for Deep Convolutional Neural Networks

SA-Net: Shuffle Attention for Deep Convolutional Neural Networks (paper) By Qing-Long Zhang and Yu-Bin Yang [State Key Laboratory for Novel Software T

Qing-Long Zhang 199 Jan 8, 2023
Open source repository for the code accompanying the paper 'Non-Rigid Neural Radiance Fields Reconstruction and Novel View Synthesis of a Deforming Scene from Monocular Video'.

Non-Rigid Neural Radiance Fields This is the official repository for the project "Non-Rigid Neural Radiance Fields: Reconstruction and Novel View Synt

Facebook Research 296 Dec 29, 2022
Code for the Shortformer model, from the paper by Ofir Press, Noah A. Smith and Mike Lewis.

Shortformer This repository contains the code and the final checkpoint of the Shortformer model. This file explains how to run our experiments on the

Ofir Press 138 Apr 15, 2022
PyTorch code for ICLR 2021 paper Unbiased Teacher for Semi-Supervised Object Detection

Unbiased Teacher for Semi-Supervised Object Detection This is the PyTorch implementation of our paper: Unbiased Teacher for Semi-Supervised Object Detection

Facebook Research 366 Dec 28, 2022
Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

ming71 56 Nov 28, 2022
Code for our CVPR 2021 paper "MetaCam+DSCE"

Joint Noise-Tolerant Learning and Meta Camera Shift Adaptation for Unsupervised Person Re-Identification (CVPR'21) Introduction Code for our CVPR 2021

FlyingRoastDuck 59 Oct 31, 2022
Code for our CVPR2021 paper coordinate attention

Coordinate Attention for Efficient Mobile Network Design (preprint) This repository is a PyTorch implementation of our coordinate attention (will appe

Qibin (Andrew) Hou 726 Jan 5, 2023