diff --git a/ppcls/data/preprocess/batch_ops/batch_operators.py b/ppcls/data/preprocess/batch_ops/batch_operators.py index c9563e2294d43df8183e2cd32894c96da1f48f8e..cdcee0625326be61e2ed940a39c46219c0a678cd 100644 --- a/ppcls/data/preprocess/batch_ops/batch_operators.py +++ b/ppcls/data/preprocess/batch_ops/batch_operators.py @@ -88,7 +88,7 @@ class MixupOperator(BatchOperator): def __call__(self, batch): imgs, labels, bs = self._unpack(batch) - idx = np.random.permutation(bs) + idx = np.arange(bs)[::-1] lam = np.random.beta(self._alpha, self._alpha) imgs = lam * imgs + (1 - lam) * imgs[idx] targets = self._mix_target(labels, labels[idx], lam) @@ -143,7 +143,7 @@ class CutmixOperator(BatchOperator): def __call__(self, batch): imgs, labels, bs = self._unpack(batch) - idx = np.random.permutation(bs) + idx = np.arange(bs)[::-1] lam = np.random.beta(self._alpha, self._alpha) bbx1, bby1, bbx2, bby2 = self._rand_bbox(imgs.shape, lam) @@ -179,7 +179,7 @@ class FmixOperator(BatchOperator): def __call__(self, batch): imgs, labels, bs = self._unpack(batch) - idx = np.random.permutation(bs) + idx = np.arange(bs)[::-1] size = (imgs.shape[2], imgs.shape[3]) lam, mask = sample_mask(self._alpha, self._decay_power, \ size, self._max_soft, self._reformulate)