Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Aug 1, 2023
1 parent 3e4e353 commit 0cfd88d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gallery/plot_cutmix_mixup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
How to use CutMix and MixUp
===========================
:class:`~torchvision.transforms.v2.Cutmix` and
:class:`~torchvision.transforms.v2.Mixup` are popular augmentation strategies
:class:`~torchvision.transforms.v2.CutMix` and
:class:`~torchvision.transforms.v2.MixUp` are popular augmentation strategies
that can improve classification accuracy.
These transforms are slightly different from the rest of the Torchvision
Expand Down Expand Up @@ -79,8 +79,8 @@

dataloader = DataLoader(dataset, batch_size=4, shuffle=True)

cutmix = v2.Cutmix(num_classes=NUM_CLASSES)
mixup = v2.Mixup(num_classes=NUM_CLASSES)
cutmix = v2.CutMix(num_classes=NUM_CLASSES)
mixup = v2.MixUp(num_classes=NUM_CLASSES)
cutmix_or_mixup = v2.RandomChoice([cutmix, mixup])

for images, labels in dataloader:
Expand Down Expand Up @@ -148,5 +148,5 @@ def labels_getter(batch):
return batch["target"]["classes"]


out = v2.Cutmix(num_classes=NUM_CLASSES, labels_getter=labels_getter)(batch)
out = v2.CutMix(num_classes=NUM_CLASSES, labels_getter=labels_getter)(batch)
print(f"{out['imgs'].shape = }, {out['target']['classes'].shape = }")

0 comments on commit 0cfd88d

Please sign in to comment.