Package: semilearn
USB: A Unified Semi-supervised learning Benchmark for CV, NLP, and Audio ClassificationPaper·Benchmark·Demo·Docs·Issue·Blog·Blog (Pytorch)·Blog (Chinese)·Video·Video (Chinese)Table of ContentsNews and UpdatesIntroductionGetting StartedPrerequisitesInstallationUsageBenchmark ResultsModel ZooCommunityLicenseAcknowledgmentsNews and Updates[07/07/2023] AddDeFixmatch. Fixed some bugs. Release semilearn=0.3.1/[06/01/2023] USB has officially joined the Pytorch ecosystem! [Pytorch blog][01/30/2023] Update semilearn==0.3.0. AddFreeMatchandSoftMatch. Add imbalanced algorithms. Update results and add wandb support. ReferCHANGE_LOGfor details.[Results][Logs][Wandb]. Older classic logs can be found here:[TorchSSL Log].[10/16/2022] Dataset download link and process instructions released! [Datasets][10/13/2022] We have finished the camera ready version with updated [Results]. [Openreview][10/06/2022] Training logs and results of USB has been updated! Available dataset will be uploaded soon. [Logs] [Results][09/17/2022] The USB paper has been accepted by NeurIPS 2022 Dataset and Benchmark Track! [Openreview][08/21/2022] USB has been released!IntroductionUSBis a Pytorch-based Python package for Semi-Supervised Learning (SSL). It is easy-to-use/extend,affordableto small groups, and comprehensive for developing and evaluating SSL algorithms. USB provides the implementation of 14 SSL algorithms based on Consistency Regularization, and 15 tasks for evaluation from CV, NLP, and Audio domain.(back to top)Getting StartedThis is an example of how to set up USB locally.
To get a local copy up, running follow these simple example steps.PrerequisitesUSB is built on pytorch, with torchvision, torchaudio, and transformers.To install the required packages, you can create a conda environment:condacreate--nameusbpython=3.8then use pip to install required packages:pipinstall-rrequirements.txtFrom now on, you can start use USB by typingpythontrain.py--cconfig/usb_cv/fixmatch/fixmatch_cifar100_200_0.yamlInstallationWe provide a Python packagesemilearnof USB for users who want to start training/testing the supported SSL algorithms on their data quickly:pipinstallsemilearn(back to top)DevelopmentYou can also develop your own SSL algorithm and evaluate it by cloning USB:gitclonehttps://github.com/microsoft/Semi-supervised-learning.git(back to top)Prepare DatasetsThe detailed instructions for downloading and processing are shown inDataset Download. Please follow it to download datasets before running or developing algorithms.(back to top)UsageUSB is easy to use and extend. Going through the bellowing examples will help you familiar with USB for quick use, evaluate an existing SSL algorithm on your own dataset, or developing new SSL algorithms.Quick Start with USB packagePlease seeInstallationto install USB first. We provide colab tutorials for:Beginning exampleCustomize datasetsStart with DockerStep1: Check your environmentYou need to properly install Docker and nvidia driver first. To use GPU in a docker container
You also need to install nvidia-docker2 (Installation Guide).
Then, Please check your CUDA version vianvidia-smiStep2: Clone the projectgitclonehttps://github.com/microsoft/Semi-supervised-learning.gitStep3: Build the Docker imageBefore building the image, you may modify theDockerfileaccording to your CUDA version.
The CUDA version we use is 11.6. You can change the base image tag according tothis site.
You also need to change the--extra-index-urlaccording to your CUDA version in order to install the correct version of Pytorch.
You can check the url throughPytorch website.Use this command to build the imagecdSemi-supervised-learning&&dockerbuild-tsemilearn.Job done. You can use the image you just built for your own project. Don't forget to use the argument--gpuwhen you want
to use GPU in a container.TrainingHere is an example to train FixMatch on CIFAR-100 with 200 labels. Training other supported algorithms (on other datasets with different label settings) can be specified by a config file:pythontrain.py--cconfig/usb_cv/fixmatch/fixmatch_cifar100_200_0.yamlEvaluationAfter training, you can check the evaluation performance on training logs, or running evaluation script:python eval.py --dataset cifar100 --num_classes 100 --load_path /PATH/TO/CHECKPOINTDevelopCheck the developing documentation for creating your own SSL algorithm!For more examples, please refer to theDocumentation(back to top)Benchmark ResultsPlease refer toResultsfor benchmark results on different tasks.(back to top)Model ZooTODO: add pre-trained models.(back to top)TODOFinish ReadmeUpdating SUPPORT.MD with content about this project's support experienceMulti-language SupportChineseSee theopen issuesfor a full list of proposed features (and known issues).(back to top)ContributingThis project welcomes contributions and suggestions.  Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visithttps://cla.opensource.microsoft.com.When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.This project has adopted theMicrosoft Open Source Code of Conduct.
For more information see theCode of Conduct FAQor
contactopencode@microsoft.comwith any additional questions or comments.If you have a suggestion that would make USB better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!Fork the projectCreate your branch (git checkout -b your_name/your_branch)Commit your changes (git commit -m 'Add some features')Push to the branch (git push origin your_name/your_branch)Open a Pull Request(back to top)TrademarksThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must followMicrosoft's Trademark & Brand Guidelines.
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.LicenseDistributed under the MIT License. SeeLICENSE.txtfor more information.(back to top)Community and ContactThe USB community is maintained by:Yidong Wang (yidongwang37@gmail.com), Tokyo Institute of TechnologyHao Chen (haoc3@andrew.cmu.edu), Carnegie Mellon UniversityYue Fan (yfan@mpi-inf.mpg.de), Max Planck Institute for InformaticsWenxin Hou (wenxinhou@microsoft.com), Microsoft STCARan Tao (rant@andrew.cmu.edu), Carnegie Mellon UniversityJindong Wang (jindwang@microsoft.com), Microsoft Research Asia(back to top)Citing USBPlease cite us if you fine this project helpful for your project/paper:@inproceedings{usb2022,
  doi = {10.48550/ARXIV.2208.07204},
  url = {https://arxiv.org/abs/2208.07204},
  author = {Wang, Yidong and Chen, Hao and Fan, Yue and Sun, Wang and Tao, Ran and Hou, Wenxin and Wang, Renjie and Yang, Linyi and Zhou, Zhi and Guo, Lan-Zhe and Qi, Heli and Wu, Zhen and Li, Yu-Feng and Nakamura, Satoshi and Ye, Wei and Savvides, Marios and Raj, Bhiksha and Shinozaki, Takahiro and Schiele, Bernt and Wang, Jindong and Xie, Xing and Zhang, Yue},
  title = {USB: A Unified Semi-supervised Learning Benchmark for Classification},
  booktitle = {Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track}
  year = {2022}
}

@article{wang2023freematch,
  title={FreeMatch: Self-adaptive Thresholding for Semi-supervised Learning},
  author={Wang, Yidong and Chen, Hao and Heng, Qiang and Hou, Wenxin and Fan, Yue and and Wu, Zhen and Wang, Jindong and Savvides, Marios and Shinozaki, Takahiro and Raj, Bhiksha and Schiele, Bernt and Xie, Xing},
  booktitle={International Conference on Learning Representations (ICLR)},
  year={2023}
}

@article{chen2023softmatch,
  title={SoftMatch: Addressing the Quantity-Quality Trade-off in Semi-supervised Learning},
  author={Chen, Hao and Tao, Ran and Fan, Yue and Wang, Yidong and Wang, Jindong and Schiele, Bernt and Xie, Xing and Raj, Bhiksha and Savvides, Marios},
  booktitle={International Conference on Learning Representations (ICLR)},
  year={2023}
}

@article{zhang2021flexmatch,
  title={FlexMatch: Boosting Semi-supervised Learning with Curriculum Pseudo Labeling},
  author={Zhang, Bowen and Wang, Yidong and Hou, Wenxin and Wu, Hao and Wang, Jindong and Okumura, Manabu and Shinozaki, Takahiro},
  booktitle={Neural Information Processing Systems (NeurIPS)},
  year={2021}
}AcknowledgmentsWe thanks the following projects for reference of creating USB:TorchSSLFixMatchCoMatchSimMatchHuggingFacePytorch LightingREADME Template(back to top)