File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 4
4
How to use CutMix and MixUp
5
5
===========================
6
6
7
- :class:`~torchvision.transforms.v2.Cutmix ` and
8
- :class:`~torchvision.transforms.v2.Mixup ` are popular augmentation strategies
7
+ :class:`~torchvision.transforms.v2.CutMix ` and
8
+ :class:`~torchvision.transforms.v2.MixUp ` are popular augmentation strategies
9
9
that can improve classification accuracy.
10
10
11
11
These transforms are slightly different from the rest of the Torchvision
79
79
80
80
dataloader = DataLoader (dataset , batch_size = 4 , shuffle = True )
81
81
82
- cutmix = v2 .Cutmix (num_classes = NUM_CLASSES )
83
- mixup = v2 .Mixup (num_classes = NUM_CLASSES )
82
+ cutmix = v2 .CutMix (num_classes = NUM_CLASSES )
83
+ mixup = v2 .MixUp (num_classes = NUM_CLASSES )
84
84
cutmix_or_mixup = v2 .RandomChoice ([cutmix , mixup ])
85
85
86
86
for images , labels in dataloader :
@@ -148,5 +148,5 @@ def labels_getter(batch):
148
148
return batch ["target" ]["classes" ]
149
149
150
150
151
- out = v2 .Cutmix (num_classes = NUM_CLASSES , labels_getter = labels_getter )(batch )
151
+ out = v2 .CutMix (num_classes = NUM_CLASSES , labels_getter = labels_getter )(batch )
152
152
print (f"{ out ['imgs' ].shape = } , { out ['target' ]['classes' ].shape = } " )
You can’t perform that action at this time.
0 commit comments