OpenMatch: Open-set Consistency Regularization for Semi-supervised Learning with Outliers (NeurIPS 2021)

Overview

OpenMatch: Open-set Consistency Regularization for Semi-supervised Learning with Outliers (NeurIPS 2021)

OpenMatch Overview

This is an PyTorch implementation of OpenMatch. This implementation is based on Pytorch-FixMatch.

Requirements

  • python 3.6+
  • torch 1.4
  • torchvision 0.5
  • tensorboard
  • numpy
  • tqdm
  • sklearn
  • apex (optional)

See Pytorch-FixMatch for the details.

Usage

Dataset Preparation

This repository needs CIFAR10, CIFAR100, or ImageNet-30 to train a model.

To fully reproduce the results in evaluation, we also need SVHN, LSUN, ImageNet for CIFAR10, 100, and LSUN, DTD, CUB, Flowers, Caltech_256, Stanford Dogs for ImageNet-30. To prepare the datasets above, follow CSI.

mkdir data
ln -s path_to_each_dataset ./data/.

## unzip filelist for imagenet_30 experiments.
unzip files.zip

All datasets are supposed to be under ./data.

Train

Train the model by 50 labeled data per class of CIFAR-10 dataset:

sh run_cifar10.sh 50 save_directory

Train the model by 50 labeled data per class of CIFAR-100 dataset, 55 known classes:

sh run_cifar100.sh 50 10 save_directory

Train the model by 50 labeled data per class of CIFAR-100 dataset, 80 known classes:

sh run_cifar100.sh 50 15 save_directory

Run experiments on ImageNet-30:

sh run_imagenet.sh save_directory

Evaluation

Evaluate a model trained on cifar10

sh run_eval_cifar10.sh trained_model.pth

Trained models

Coming soon.

Acknowledgement

This repository depends a lot on Pytorch-FixMatch for FixMatch implementation, and CSI for anomaly detection evaluation. Thanks for sharing the great code bases!

Reference

This repository is contributed by Kuniaki Saito. If you consider using this code or its derivatives, please consider citing:

@article{saito2021openmatch,
  title={OpenMatch: Open-set Consistency Regularization for Semi-supervised Learning with Outliers},
  author={Saito, Kuniaki and Kim, Donghyun and Saenko, Kate},
  journal={arXiv preprint arXiv:2105.14148},
  year={2021}
}
Comments
  • OSError: cannot identify image file <_io.BufferedReader name='./data/LSUN_fix/LSUN_fix/._correct_resize_1.png'>

    OSError: cannot identify image file <_io.BufferedReader name='./data/LSUN_fix/LSUN_fix/._correct_resize_1.png'>

    Hi, nice work!

    When I ran experiments on cifar10, I got the error, it seemed like that the files of LSUN_fix. I was a freshman on the task, Would you please give me some advice?

    Best wished to you!

    opened by zwy1996 10
  • the error of paper

    the error of paper

    First of all, thank you very much for your excellent work. I have a question about which accuracy rate was chosen in your paper to calculate the error? Closed acc or Overall acc? I look forward to your answer. I will be very grateful! image

    opened by July-blue 2
  • Question about labeled-unlabeled split

    Question about labeled-unlabeled split

    Hello, thanks for your interesting research! I was looking for the experimental settings of data for open-set semi-supervised learning.

    I have a question about splitting labeled and unlabeled data (function x_u_split(args, labels)).

    As long as I understood, in open-set semi-supervised learning, the unlabeled data may contain new categories which are not present in labeled data. For example, the categories of labeled data are 0, 1, 2, 3, 4, 5 while the categories of unlabeled data are 2, 3, 4, 5, 6, 7 (6 and 7 are new). However, in line 170 of cifar.py, because args.num_classes for cifar10 is 6, and the data samples of each class are assigned in the same for loop, both labeled data and unlabeled data have identical categories: 0, 1, 2, 3, 4, and 5. Then, the categories of each datasets become as follows: labeled: 0, 1, 2, 3, 4, 5 unlabeled: 0, 1, 2, 3, 4, 5 test: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

    I think I might miss something but couldn't figure it out.

    Thanks for your help in advance.

    opened by min9kwak 1
  • cifar.py

    cifar.py

    Dear Author

    thanks for providing the code. I have a question and hope you can help me understand it a bit.

    1. Is it possible that during some iterations, the exclude_dataset function selected no unlabeled data to be inliner, how does the code handle this edge case? https://github.com/VisionLearningGroup/OP_Match/blob/fd55de2e1913ffbcb3fd413bd9f024afce44c024/utils/misc.py#L167

    2. In the x_u_split function, why do you need to manually repeat the labeled set? Would the code not work without manually repeating the labeled set?

    https://github.com/VisionLearningGroup/OP_Match/blob/fd55de2e1913ffbcb3fd413bd9f024afce44c024/dataset/cifar.py#L183

    Hope to hear from you, thanks!

    opened by hzhz2020 0
  • The pseudo label threshold is 0?

    The pseudo label threshold is 0?

    Thanks for your code. It seems that the threshold for pseudo labeling is 0 in utils/parser.py. Usually, the threshold is 0.95 for FixMatch-based methods. Why the threshold is so low? Thanks!

    opened by chester256 1
  • About some questions

    About some questions

    Thank you for sharing the code~ You split the overall training dataset into labeled set/ val set/ unlabeled set, and then applying the val set to select the best ACC model, thus the extra val dataset leads to the unlabeled dataset is less than fixmatch. could you explain the rule of splitting

    opened by dlyldxwl 0
  • The unknown_size in accuracy_open is a bug?

    The unknown_size in accuracy_open is a bug?

    Hello, thanks for your interesting research! https://github.com/VisionLearningGroup/OP_Match/blob/fd55de2e1913ffbcb3fd413bd9f024afce44c024/utils/misc.py#L67 On line 67, I think unknown_size = len(ind) should be replaced by unknown_size = ind.sum(). len(ind) is the batch size.

    Thanks for your help in advance.

    opened by Mrchen116 0
  • About Train the model by 50 labeled data per class of CIFAR-100 dataset, 55 known classes in table1

    About Train the model by 50 labeled data per class of CIFAR-100 dataset, 55 known classes in table1

    Thanks for the excellent work. I have followed the readme to run python main.py --dataset cifar100 --num-labeled 50 --out Results --num-super 10 --arch wideresnet --lambda_oem 0.1 --lambda_socr 1.0 --batch-size 64 --lr 0.03 --expand-labels --seed 0 --mu 2 The final performance after epoch 512 is openmix Does the Table 1 include the best performance on test set or the mean of last 20 epochs? If run with the amp, the result is op Is it normal?

    opened by jingyang2017 0
  • The baseline results

    The baseline results

    Thanks for your great work!

    I met some problems when I reimplemented the Fixmatch results in your table. The error rate of Fixmatch is 7.4% on CIFAR10(Known/Unknown 6/4, number of the labeled image is 50), which is lower than your reported results. I have not figured out why. Do you have any ideas?

    I utilize the Fixmatch code in https://github.com/TorchSSL/TorchSSL

    opened by kleinzcy 4
Owner
Vision and Learning Group
Vision and Learning Group
Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CVPR 2021)

Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CAC) Xin Lai*, Zhuotao Tian*, Li Jiang, Shu Liu, Hengshuang Zhao, Li

DV Lab 137 Dec 14, 2022
ISBI 2022: Cross-level Contrastive Learning and Consistency Constraint for Semi-supervised Medical Image.

Cross-level Contrastive Learning and Consistency Constraint for Semi-supervised Medical Image Introduction This repository contains the PyTorch implem

null 25 Nov 9, 2022
Consistency Regularization for Adversarial Robustness

Consistency Regularization for Adversarial Robustness Official PyTorch implementation of Consistency Regularization for Adversarial Robustness by Jiho

null 40 Dec 17, 2022
Code for ACL2021 paper Consistency Regularization for Cross-Lingual Fine-Tuning.

xTune Code for ACL2021 paper Consistency Regularization for Cross-Lingual Fine-Tuning. Environment DockerFile: dancingsoul/pytorch:xTune Install the f

Bo Zheng 42 Dec 9, 2022
This repository is an implementation of paper : Improving the Training of Graph Neural Networks with Consistency Regularization

CRGNN Paper : Improving the Training of Graph Neural Networks with Consistency Regularization Environments Implementing environment: GeForce RTX™ 3090

THUDM 1 Dec 9, 2021
A Python implementation of the Locality Preserving Matching (LPM) method for pruning outliers in image matching.

LPM_Python A Python implementation of the Locality Preserving Matching (LPM) method for pruning outliers in image matching. The code is established ac

AoxiangFan 11 Nov 7, 2022
Project looking into use of autoencoder for semi-supervised learning and comparing data requirements compared to supervised learning.

Project looking into use of autoencoder for semi-supervised learning and comparing data requirements compared to supervised learning.

Tom-R.T.Kvalvaag 2 Dec 17, 2021
Automatically download the cwru data set, and then divide it into training data set and test data set

Automatically download the cwru data set, and then divide it into training data set and test data set.自动下载cwru数据集,然后分训练数据集和测试数据集

null 6 Jun 27, 2022
Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds (CVPR 2022)

Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds (CVPR2022)[paper] Authors: Chenhang He, Ruihuang Li, Shuai Li, L

Billy HE 141 Dec 30, 2022
This is the repository for the NeurIPS-21 paper [Contrastive Graph Poisson Networks: Semi-Supervised Learning with Extremely Limited Labels].

CGPN This is the repository for the NeurIPS-21 paper [Contrastive Graph Poisson Networks: Semi-Supervised Learning with Extremely Limited Labels]. Req

null 10 Sep 12, 2022
Official implementation of "Open-set Label Noise Can Improve Robustness Against Inherent Label Noise" (NeurIPS 2021)

Open-set Label Noise Can Improve Robustness Against Inherent Label Noise NeurIPS 2021: This repository is the official implementation of ODNL. Require

Hongxin Wei 12 Dec 7, 2022
UniMoCo: Unsupervised, Semi-Supervised and Full-Supervised Visual Representation Learning

UniMoCo: Unsupervised, Semi-Supervised and Full-Supervised Visual Representation Learning This is the official PyTorch implementation for UniMoCo pape

dddzg 49 Jan 2, 2023
Self-supervised Augmentation Consistency for Adapting Semantic Segmentation (CVPR 2021)

Self-supervised Augmentation Consistency for Adapting Semantic Segmentation This repository contains the official implementation of our paper: Self-su

Visual Inference Lab @TU Darmstadt 132 Dec 21, 2022
the official code for ICRA 2021 Paper: "Multimodal Scale Consistency and Awareness for Monocular Self-Supervised Depth Estimation"

G2S This is the official code for ICRA 2021 Paper: Multimodal Scale Consistency and Awareness for Monocular Self-Supervised Depth Estimation by Hemang

NeurAI 4 Jul 27, 2022
PyTorch implementation of Self-supervised Contrastive Regularization for DG (SelfReg)

SelfReg PyTorch official implementation of Self-supervised Contrastive Regularization for Domain Generalization (SelfReg, https://arxiv.org/abs/2104.0

null 64 Dec 16, 2022
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

null 5 Dec 10, 2022
Open-Set Recognition: A Good Closed-Set Classifier is All You Need

Open-Set Recognition: A Good Closed-Set Classifier is All You Need Code for our paper: "Open-Set Recognition: A Good Closed-Set Classifier is All You

null 194 Jan 3, 2023
[ICLR 2021] Heteroskedastic and Imbalanced Deep Learning with Adaptive Regularization

Heteroskedastic and Imbalanced Deep Learning with Adaptive Regularization Kaidi Cao, Yining Chen, Junwei Lu, Nikos Arechiga, Adrien Gaidon, Tengyu Ma

Kaidi Cao 29 Oct 20, 2022
Code for ICCV 2021 paper: ARAPReg: An As-Rigid-As Possible Regularization Loss for Learning Deformable Shape Generators..

ARAPReg Code for ICCV 2021 paper: ARAPReg: An As-Rigid-As Possible Regularization Loss for Learning Deformable Shape Generators.. Installation The cod

Bo Sun 132 Nov 28, 2022