Home

Awesome

IOMatch for Open-Set Semi-Supervised Learning

Introduction

This is the official repository for our ICCV 2023 paper:

IOMatch: Simplifying Open-Set Semi-Supervised Learning with Joint Inliers and Outliers Utilization</br> Zekun Li, Lei Qi, Yinghuan Shi*, Yang Gao</br>

[Paper] [Poster] [Slides] [Models and Logs] [BibTeX]

Preparation

Required Packages

We suggest first creating a conda environment:

conda create --name iomatch python=3.8

then use pip to install required packages:

pip install -r requirements.txt

Datasets

Please put the datasets in the ./data folder (or create soft links) as follows:

IOMatch
├── config
    └── ...
├── data
    ├── cifar10
        └── cifar-10-batches-py
    └── cifar100
        └── cifar-100-python
    └── imagenet30
        └── filelist
        └── one_class_test
        └── one_class_train
    └── ood_data
├── semilearn
    └── ...
└── ...  

The data of ImageNet-30 can be downloaded in one_class_train and one_class_test.

The out-of-dataset testing data for extended open-set evaluation can be downloaded in this link.

Usage

We implement IOMatch using the codebase of USB.

Training

Here is an example to train IOMatch on CIFAR-100 with the seen/unseen split of "50/50" and 25 labels per seen class (i.e., the task <u>CIFAR-50-1250</u> with 1250 labeled samples in total).

# seed = 1
CUDA_VISIBLE_DEVICES=0 python train.py --c config/openset_cv/iomatch/iomatch_cifar100_1250_1.yaml

Training IOMatch on other datasets with different OSSL settings can be specified by a config file:

# CIFAR10, seen/unseen split of 6/4, 25 labels per seen class (CIFAR-6-150), seed = 1  
CUDA_VISIBLE_DEVICES=0 python train.py --c config/openset_cv/iomatch/iomatch_cifar10_150_1.yaml

# CIFAR100, seen/unseen split of 50/50, 4 labels per seen class (CIFAR-50-200), seed = 1  
CUDA_VISIBLE_DEVICES=0 python train.py --c config/openset_cv/iomatch/iomatch_cifar100_200_1.yaml

# CIFAR100, seen/unseen split of 80/20, 4 labels per seen class (CIFAR-80-320), seed = 1    
CUDA_VISIBLE_DEVICES=0 python train.py --c config/openset_cv/iomatch/iomatch_cifar100_320_1.yaml

# ImageNet30, seen/unseen split of 20/10, 1% labeled data (ImageNet-20-p1), seed = 1  
CUDA_VISIBLE_DEVICES=0 python train.py --c config/openset_cv/iomatch/iomatch_in30_p1_1.yaml

Evaluation

After training, the best checkpoints will be saved in ./saved_models. The closed-set performance has been reported in the training logs. For the open-set evaluation, please see evaluate.ipynb.

Example Results

Close-Set Classification Accuracy

CIFAR-10, seen/unseen split of 6/4, 4 labels per seen class (CIFAR-6-24)

CIFAR-6-24Seed=0Seed=1Seed=2MeanStd.
FixMatch90.7075.1578.9081.586.63
OpenMatch42.0548.1840.6743.633.26
IOMatch89.2887.4092.3589.682.04

CIFAR-10, seen/unseen split of 6/4, 25 labels per seen class (CIFAR-6-150)

CIFAR-6-150Seed=0Seed=1Seed=2MeanStd.
FixMatch93.6791.8393.3292.940.80
OpenMatch65.0064.9068.9066.271.86
IOMatch94.0593.8893.6793.870.16

CIFAR-100, seen/unseen split of 20/80, 4 labels per seen class (CIFAR-20-80)

CIFAR-20-80Seed=0Seed=1Seed=2MeanStd.
FixMatch45.8046.0047.0046.270.64
OpenMatch34.4538.3539.5537.452.67
IOMatch52.8552.2056.1553.732.12

CIFAR-100, seen/unseen split of 20/80, 25 labels per seen class (CIFAR-20-500)

CIFAR-20-500Seed=0Seed=1Seed=2MeanStd.
FixMatch66.0066.0567.3066.450.74
OpenMatch60.8562.9064.3562.701.76
IOMatch67.0066.3568.5067.281.10

CIFAR-100, seen/unseen split of 50/50, 4 labels per seen class (CIFAR-50-200)

CIFAR-50-200Seed=0Seed=1Seed=2MeanStd.
FixMatch48.8043.9454.0448.935.05
OpenMatch33.3634.1233.7433.740.38
IOMatch54.1056.1458.6856.312.29

CIFAR-100, seen/unseen split of 50/50, 25 labels per seen class (CIFAR-50-1250)

CIFAR-50-1250Seed=0Seed=1Seed=2MeanStd.
FixMatch67.8268.9269.5868.770.89
OpenMatch66.4466.0467.1066.530.54
IOMatch69.1669.8470.3269.770.58

CIFAR-100, seen/unseen split of 80/20, 4 labels per seen class (CIFAR-80-320)

CIFAR-80-320Seed=0Seed=1Seed=2MeanStd.
FixMatch44.4542.3642.3643.061.21
OpenMatch29.2329.1827.2128.541.15
IOMatch51.8649.8950.7350.830.99

CIFAR-100, seen/unseen split of 80/20, 25 labels per seen class (CIFAR-80-2000)

CIFAR-80-2000Seed=0Seed=1Seed=2MeanStd.
FixMatch65.0264.0664.2564.440.51
OpenMatch62.1161.0960.5061.230.81
IOMatch65.3164.2864.6564.750.52

Acknowledgments

We sincerely thank the authors of USB (NeurIPS'22) for creating such an awesome SSL benchmark.

We sincerely thank the authors of the following projects for sharing the code of their great works:

License

This project is licensed under the terms of the MIT License. See the LICENSE file for details.

Citation

@inproceedings{iomatch,
  title={IOMatch: Simplifying Open-Set Semi-Supervised Learning with Joint Inliers and Outliers Utilization},
  author={Li, Zekun and Qi, Lei and Shi, Yinghuan and Gao, Yang},
  booktitle={ICCV},
  year={2023}
}