From cf14b84aa81c1996cf29a4fdb2b3a00fe546c388 Mon Sep 17 00:00:00 2001 From: Jordan Gong Date: Thu, 14 Jul 2022 17:43:22 +0800 Subject: Add Siamese transform wrapper --- libs/datautils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libs/datautils.py') diff --git a/libs/datautils.py b/libs/datautils.py index feae481..6a7c506 100644 --- a/libs/datautils.py +++ b/libs/datautils.py @@ -115,3 +115,13 @@ class MultiCropDatasetWrapper(Dataset): multi_crops = list(map(lambda trans: trans(img), self.transform)) return multi_crops, target + + +class TwinTransform: + def __init__(self, transform): + self.transform = transform + + def __call__(self, x): + v1 = self.transform(x) + v2 = self.transform(x) + return v1, v2 -- cgit v1.2.3