From 504d8edfb22606fad284981be9155c3a4f440e41 Mon Sep 17 00:00:00 2001 From: SuiAn Date: Mon, 7 Nov 2022 21:55:38 +0800 Subject: [PATCH] Update misc.py --- engine/utils/misc.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/engine/utils/misc.py b/engine/utils/misc.py index ec5c3f4..6a2f16a 100644 --- a/engine/utils/misc.py +++ b/engine/utils/misc.py @@ -99,31 +99,6 @@ def write_pickle(data, name): pickle.dump(data, f) -def mixup(x, y, alpha, use_cuda=True): - """ - :param x: - :param y: one-hot - :param alpha: - :param use_cuda: - :return: - """ - if alpha > 0: - lam = np.random.beta(alpha, alpha) - else: - lam = 1 - - batch_size = x.size()[0] - - if use_cuda: - index = torch.randperm(batch_size).cuda() - else: - index = torch.randperm(batch_size) - - mixed_x = lam * x + (1 - lam) * x[index, :] - y_a, y_b = y, y[index] - return mixed_x, y_a, y_b, lam - - def accuracy(output, target, topk=(1,)): """Computes the accuracy(%) over the k top predictions for the specified values of k""" with torch.no_grad():