Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*.pyc
checkpoints
data
logs
.DS_Store
.ipynb_checkpoints
plots_paper_figures.py
plot_results.ipynb
plots_paper_figures_iccv.py
plot/
slurm/
results/
ProcessWebVision.ipynb
results
configs/webvision_full
configs/webvision_imagenet
configs/clothing1m
script/WebVisionFull.slurm
script/WebVisionFull_ImageNet.slurm
script/Clothing1M.slurm
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 HanxunHuangLemonBear

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
103 changes: 58 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,68 @@
### Code for ICML 2018 paper "Dimensionality-Driven Learning with Noisy Labels".
# Normalized Loss Functions - Active Passive Losses
Code for ICML2020 Paper ["Normalized Loss Functions for Deep Learning with Noisy Labels"](https://arxiv.org/abs/2006.13554)

#### - Update (2018.07): Issues fixed on CIFAR-10.
#### - Update (2019.10): Start training with symmetric cross entropy (SCE) loss (replacing cross entropy).
## Requirements
```console
Python >= 3.6, PyTorch >= 1.3.1, torchvision >= 0.4.1, mlconfig
```

The Symmetric Cross Entropy (SCE) was demonstrated can improve several exisiting methods including the D2L:
ICCV2019 "Symmetric Cross Entropy for Robust Learning with Noisy Labels"
https://arxiv.org/abs/1908.06112
https://github.com/YisenWang/symmetric_cross_entropy_for_noisy_labels
## How To Run
##### Configs for the experiment settings
Check '*.yaml' file in the config folder for each experiment.

#### - Update (2020.03): convergence issue on CIFAR-100 when using SCE loss: learning rate, data augmentation and parameters for SCE.
##### Arguments
* noise_rate: noise rate
* asym: use if it is asymmetric noise, default is symmetric
* config_path: path to the configs folder
* version: the config file name
* exp_name: name of the experiments (as note)
* seed: random seed

Example for 0.4 Symmetric noise rate with NCE+RCE loss
```console
# CIFAR-10
$ python3 main.py --exp_name test_exp \
--noise_rate 0.4 \
--version nce+rce \
--config_path configs/cifar10/sym \
--seed 123


### 1. Train DNN models using command line:
# CIFAR-100
$ python3 main.py --exp_name test_exp \
--noise_rate 0.4 \
--version nce+rce \
--config_path configs/cifar100/sym \
--seed 123
```
Example for ploting lid_trend_through_training of 0.4 Symmetric noise rate with D2L Learning
```console
# CIFAR-10
$ python3 main.py --exp_name test_exp \
--noise_rate 0.4 \
--version d2l \
--config_path configs/cifar10/sym \
--seed 123 \
--plot

An example: <br/>
Example for ploting The LID、Accuracy、CSR trend of different learning models throughout of 0.4 Symmetric noise rate
```console
# CIFAR-10
$ python3 main.py --exp_name test_exp \
--noise_rate 0.4 \
--config_path configs/cifar10/sym \
--seed 123 \
--plotall

```
python train_model.py -d mnist -m d2l -e 50 -b 128 -r 40
```
## Citing this work
If you use this code in your work, please cite the accompanying paper:

`-d`: dataset in ['mnist', 'svhn', 'cifar-10', 'cifar-100'] <br/>
`-m`: model in ['ce', 'forward', 'backward', 'boot_hard', 'boot_soft', 'd2l'] <br/>
`-e`: epoch, `-b`: batch size, `-r`: noise rate in [0, 100] <br/>


### 2. Run with pre-set parameters in main function of train_model.py:
```python
# mnist example
args = parser.parse_args(['-d', 'mnist', '-m', 'd2l',
'-e', '50', '-b', '128',
'-r', '40'])
main(args)

# svhn example
args = parser.parse_args(['-d', 'svhn', '-m', 'd2l',
'-e', '50', '-b', '128',
'-r', '40'])
main(args)

# cifar-10 example
args = parser.parse_args(['-d', 'cifar-10', '-m', 'd2l',
'-e', '120', '-b', '128',
'-r', '40'])
main(args)

# cifar-100 example
args = parser.parse_args(['-d', 'cifar-100', '-m', 'd2l',
'-e', '200', '-b', '128',
'-r', '40'])
main(args)
```
@inproceedings{ma2020normalized,
title={Normalized Loss Functions for Deep Learning with Noisy Labels},
author={Ma, Xingjun and Huang, Hanxun and Wang, Yisen and Romano, Simone and Erfani, Sarah and Bailey, James},
booktitle={ICML},
year={2020}
}
```

#### Requirements:
tensorflow, Keras, numpy, scipy, sklearn, matplotlib
Loading