@@ -98,9 +107,24 @@ class CutmixOperator(BatchOperator):
lams=np.array([lam]*bs,dtype=np.float32)
returnlist(zip(imgs,labels,labels[idx],lams))
def__call__(self,batch):
imgs,labels,bs=self._unpack(batch)
ifnp.random.rand()<self._switch_prob:
returnself._cutmix(imgs,labels,bs)
else:
returnself._mixup(imgs,labels,bs)
classCutmixOperator(BatchOperator):
def__init__(self,**kwargs):
raiseException(
f"\"CutmixOperator\" has been deprecated. Please use MixupOperator with \"cutmix_alpha\" and \"switch_prob\" to enable Cutmix. Refor to doc for details."