Skip to content

Commit b8856d1

Browse files
authored
Update usb_semisup_learn.py
Fix typos
1 parent 1ce983e commit b8856d1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

advanced_source/usb_semisup_learn.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
This tutorial will walk you through the basics of using the usb lighting package.
1818
Let's get started by training a FreeMatch/SoftMatch model on CIFAR-10 using pre-trained ViT!
19-
And we will show it is easy to change the semi-supervised algorthm and train on imbalanced datasets.
19+
And we will show it is easy to change the semi-supervised algorithm and train on imbalanced datasets.
2020
2121
2222
.. figure:: /_static/img/usb_semisup_learn/code.png
@@ -29,14 +29,14 @@
2929
# --------------------
3030
# Here we provide a brief introduction to FreeMatch and SoftMatch.
3131
# First we introduce a famous baseline for semi-supervised learning called FixMatch.
32-
# FixMatch is a very simple framework for semi-supervised learning, where it utlizes a strong augmentation to generate pseudo labels for unlabeled data.
32+
# FixMatch is a very simple framework for semi-supervised learning, where it utilizes a strong augmentation to generate pseudo labels for unlabeled data.
3333
# It adopts a confidence thresholding strategy to filter out the low-confidence pseudo labels with a fixed threshold set.
3434
# FreeMatch and SoftMatch are two algorithms that improve upon FixMatch.
3535
# FreeMatch proposes adaptive thresholding strategy to replace the fixed thresholding strategy in FixMatch.
3636
# The adaptive thresholding progressively increases the threshold according to the learning status of the model on each class.
3737
# SoftMatch absorbs the idea of confidence thresholding as an weighting mechanism.
3838
# It proposes a Gaussian weighting mechanism to overcome the quantity-quality trade-off in pseudo-labels.
39-
# In this toturial, we will use USB to train FreeMatch and SoftMatch.
39+
# In this tutorial, we will use USB to train FreeMatch and SoftMatch.
4040

4141

4242
######################################################################
@@ -46,7 +46,7 @@
4646
# It is easy-to-use/extend, affordable to small groups, and comprehensive for developing and evaluating SSL algorithms.
4747
# USB provides the implementation of 14 SSL algorithms based on Consistency Regularization, and 15 tasks for evaluation from CV, NLP, and Audio domain.
4848
# It has a modular design that allows users to easily extend the package by adding new algorithms and tasks.
49-
# It also supprts a python api for easier adaptation to different SSL algorithms on new data.
49+
# It also supports a python api for easier adaptation to different SSL algorithms on new data.
5050
#
5151
#
5252
# Now, let's use USB to train FreeMatch and SoftMatch on CIFAR-10.
@@ -57,7 +57,7 @@
5757
# - ``get_net_builder`` to create a model, here we use pre-trained ViT
5858
# - ``get_algorithm`` to create the semi-supervised learning algorithm, here we use FreeMatch and SoftMatch
5959
# - ``get_config``: to get default configuration of the algorithm
60-
# - ``Trainer``: a Traner class for training and evaluating the algorithm on dataset
60+
# - ``Trainer``: a Trainer class for training and evaluating the algorithm on dataset
6161
#
6262
import semilearn
6363
from semilearn import get_dataset, get_data_loader, get_net_builder, get_algorithm, get_config, Trainer
@@ -130,7 +130,7 @@
130130

131131
######################################################################
132132
# Finally, let's evaluate the trained model on validation set.
133-
# After training 4000 itertaions with FreeMatch on only 40 labels of CIFAR-10, we obtain a classifier that achieves above 93 accuracy on validation set.
133+
# After training 4000 iterations with FreeMatch on only 40 labels of CIFAR-10, we obtain a classifier that achieves above 93 accuracy on validation set.
134134
trainer.evaluate(eval_loader)
135135

136136

@@ -140,7 +140,7 @@
140140
# --------------------
141141
#
142142
# Now let's say we have imbalanced labeled set and unlabeled set of CIFAR-10, and we want to train a SoftMatch model on it.
143-
# We create an imbalanced labeld set and imbalanced unlabelde set of CIFAR-10, by setting the ``lb_imb_ratio`` and ``ulb_imb_ratio`` to 10.
143+
# We create an imbalanced labeled set and imbalanced unlabeled set of CIFAR-10, by setting the ``lb_imb_ratio`` and ``ulb_imb_ratio`` to 10.
144144
# Also we replace the ``algorithm`` with ``softmatch`` and set the ``imbalanced`` to ``True``.
145145
#
146146
config = {

0 commit comments

Comments
 (0)