From 23b011206a3c22979b70c34275cc6be479640a34 Mon Sep 17 00:00:00 2001 From: zh-hike <1583124882@qq.com> Date: Wed, 15 Feb 2023 03:05:33 +0000 Subject: [PATCH] fix randomapply --- ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar100_10000_4gpu.yaml | 2 +- ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar10_4000_4gpu.yaml | 2 +- ppcls/data/preprocess/ops/randaugment.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar100_10000_4gpu.yaml b/ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar100_10000_4gpu.yaml index e8055d5b..72e39816 100644 --- a/ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar100_10000_4gpu.yaml +++ b/ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar100_10000_4gpu.yaml @@ -162,7 +162,7 @@ DataLoader: contrast: 0.4 saturation: 0.4 hue: 0.1 - p: 0.8 + p: 1.0 - RandomGrayscale: p: 0.2 - NormalizeImage: diff --git a/ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar10_4000_4gpu.yaml b/ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar10_4000_4gpu.yaml index 22ec818e..d7f640bb 100644 --- a/ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar10_4000_4gpu.yaml +++ b/ppcls/configs/ssl/CCSSL/FixMatchCCSSL_cifar10_4000_4gpu.yaml @@ -162,7 +162,7 @@ DataLoader: contrast: 0.4 saturation: 0.4 hue: 0.1 - p: 0.8 + p: 1.0 - RandomGrayscale: p: 0.2 - NormalizeImage: diff --git a/ppcls/data/preprocess/ops/randaugment.py b/ppcls/data/preprocess/ops/randaugment.py index 538e2b47..f3a61bd5 100644 --- a/ppcls/data/preprocess/ops/randaugment.py +++ b/ppcls/data/preprocess/ops/randaugment.py @@ -168,6 +168,8 @@ class RandomApply(object): self.trans = T.Compose(ts) def __call__(self, img): + if self.p < np.random.rand(1): + return img timg = self.trans(img) return timg -- GitLab