From acf1535b14d346c46c86eda53c40edf6991b6e13 Mon Sep 17 00:00:00 2001 From: James Betker Date: Thu, 7 Jan 2021 16:31:43 -0700 Subject: [PATCH] Fix for randomresizedcrop injector --- codes/trainer/injectors/base_injectors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codes/trainer/injectors/base_injectors.py b/codes/trainer/injectors/base_injectors.py index 1030d8c7..28006fec 100644 --- a/codes/trainer/injectors/base_injectors.py +++ b/codes/trainer/injectors/base_injectors.py @@ -379,9 +379,10 @@ class RandomCropInjector(Injector): dim_in = opt['dim_in'] dim_out = opt['dim_out'] scale = dim_out / dim_in - self.operator = RandomResizedCrop(size=(dim_out, dim_out), scale=(scale, 1), ratio=(1,1), + self.operator = RandomResizedCrop(size=(dim_out, dim_out), scale=(scale, 1), + ratio=(.99,1), # An aspect ratio range is required, but .99,1 is effectively "none". resample='NEAREST') def forward(self, state): - return {self.output: self.operator(self.input)} + return {self.output: self.operator(state[self.input])}