https://github.com/TACJu/Bi-Sampling
This is the official PyTorch implementation of the paper "Rethinking Re-Sampling in Imbalanced Semi-Supervised Learning" (Ju He, Adam Kortylewski, Shaokang Yang, Shuai Liu, Cheng Yang, Changhu Wang, Alan Yuille).
https://github.com/TACJu/Bi-Sampling
imbalanced-classification semi-supervised-learning
Last synced: about 1 year ago
JSON representation
This is the official PyTorch implementation of the paper "Rethinking Re-Sampling in Imbalanced Semi-Supervised Learning" (Ju He, Adam Kortylewski, Shaokang Yang, Shuai Liu, Cheng Yang, Changhu Wang, Alan Yuille).
- Host: GitHub
- URL: https://github.com/TACJu/Bi-Sampling
- Owner: TACJu
- License: mit
- Created: 2021-06-01T03:10:59.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-18T20:12:47.000Z (over 4 years ago)
- Last Synced: 2024-11-15T06:32:56.854Z (over 1 year ago)
- Topics: imbalanced-classification, semi-supervised-learning
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 27
- Watchers: 7
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rethinking Re-Sampling in Imbalanced Semi-Supervised Learning
## Dependencies
* `python3`
* `pytorch`
* `torchvision`
* `randAugment (Pytorch re-implementation: https://github.com/ildoonet/pytorch-randaugment)`
### Command for reproducing results in the paper
To train a model on CIFAR-10 with imbalanced ratio $\beta$ = 100, unlabeled ratio $\lambda$ = 2, random sampler for labeled data and random sampler for unlabeled data
```
python3 fix_train.py --gpu 0 --dataset cifar10 --imb_ratio 100 --ratio 2 \
--sampler random --semi-sampler random --out cifar10_fix_100_2_random_random
```
To fine-tune a model (here the model trained with above command) on CIFAR-10 with imbalanced ratio $\beta$ = 100, unlabeled ratio $\lambda$ = 2, mean sampler for labeled data and mean sampler for unlabeled data
```
python3 fix_finetune.py --gpu 0 --dataset cifar10 --imb_ratio 100 --ratio 2 \
--sampler mean --semi-sampler mean --resume cifar10_fix_100_2_random_random/checkpoint.pth.tar --out cifar10_fix_100_2_random_random_stage2
```
To train a Bi-Sampling model on CIFAR-10 with imbalanced ratio $\beta$ = 100, unlabeled ratio $\lambda$ = 2, random sampler + random sampler for the first stage and mean sampler + mean sampler for the second stage
```
python3 fix_BiS.py --gpu 0 --dataset cifar10 --imb_ratio 100 --ratio 2 \
--sampler1 random --semi-sampler1 random --sampler2 mean --semi-sampler2 mean --out cifar10_fix_100_2_BiS
```
To analyze the per-class precision and recall of a pertained model on CIFAR-10 with imbalanced ratio $\beta$ = 100, unlabeled ratio $\lambda$ = 2
```
python3 fix_analysis.py --gpu 0 --dataset cifar10 --imb_ratio 100 --ratio 2 \
--resume cifar10_fix_100_2_BiS/checkpoint.pth.tar
```