@@ -124,7 +124,8 @@ def preprocess_example(self, example, mode, unused_hparams):
124124 image .set_shape ([_CIFAR10_IMAGE_SIZE , _CIFAR10_IMAGE_SIZE , 3 ])
125125 if mode == tf .estimator .ModeKeys .TRAIN :
126126 image = image_utils .cifar_image_augmentation (image )
127- image = tf .image .per_image_standardization (image )
127+ if not self ._was_reversed :
128+ image = tf .image .per_image_standardization (image )
128129 example ["inputs" ] = image
129130 return example
130131
@@ -151,7 +152,8 @@ class ImageCifar10Plain(ImageCifar10):
151152 def preprocess_example (self , example , mode , unused_hparams ):
152153 image = example ["inputs" ]
153154 image .set_shape ([_CIFAR10_IMAGE_SIZE , _CIFAR10_IMAGE_SIZE , 3 ])
154- image = tf .image .per_image_standardization (image )
155+ if not self ._was_reversed :
156+ image = tf .image .per_image_standardization (image )
155157 example ["inputs" ] = image
156158 return example
157159
@@ -179,7 +181,8 @@ def dataset_filename(self):
179181 def preprocess_example (self , example , mode , unused_hparams ):
180182 image = example ["inputs" ]
181183 image = image_utils .resize_by_area (image , 8 )
182- image = tf .image .per_image_standardization (image )
184+ if not self ._was_reversed :
185+ image = tf .image .per_image_standardization (image )
183186 example ["inputs" ] = image
184187 return example
185188
@@ -192,7 +195,6 @@ def dataset_filename(self):
192195 return "image_cifar10_plain" # Reuse CIFAR-10 plain data.
193196
194197 def preprocess_example (self , example , unused_mode , unused_hparams ):
195-
196198 inputs = example ["inputs" ]
197199 # For Img2Img resize input and output images as desired.
198200 example ["inputs" ] = image_utils .resize_by_area (inputs , 8 )
@@ -330,7 +332,8 @@ def preprocess_example(self, example, mode, unused_hparams):
330332 image .set_shape ([_CIFAR100_IMAGE_SIZE , _CIFAR100_IMAGE_SIZE , 3 ])
331333 if mode == tf .estimator .ModeKeys .TRAIN :
332334 image = image_utils .cifar_image_augmentation (image )
333- image = tf .image .per_image_standardization (image )
335+ if not self ._was_reversed :
336+ image = tf .image .per_image_standardization (image )
334337 example ["inputs" ] = image
335338 return example
336339
@@ -357,7 +360,8 @@ class ImageCifar100Plain(ImageCifar100):
357360 def preprocess_example (self , example , mode , unused_hparams ):
358361 image = example ["inputs" ]
359362 image .set_shape ([_CIFAR100_IMAGE_SIZE , _CIFAR100_IMAGE_SIZE , 3 ])
360- image = tf .image .per_image_standardization (image )
363+ if not self ._was_reversed :
364+ image = tf .image .per_image_standardization (image )
361365 example ["inputs" ] = image
362366 return example
363367
@@ -385,7 +389,8 @@ def dataset_filename(self):
385389 def preprocess_example (self , example , mode , unused_hparams ):
386390 image = example ["inputs" ]
387391 image = image_utils .resize_by_area (image , 8 )
388- image = tf .image .per_image_standardization (image )
392+ if not self ._was_reversed :
393+ image = tf .image .per_image_standardization (image )
389394 example ["inputs" ] = image
390395 return example
391396
@@ -398,7 +403,6 @@ def dataset_filename(self):
398403 return "image_cifar100_plain" # Reuse CIFAR-100 plain data.
399404
400405 def preprocess_example (self , example , unused_mode , unused_hparams ):
401-
402406 inputs = example ["inputs" ]
403407 # For Img2Img resize input and output images as desired.
404408 example ["inputs" ] = image_utils .resize_by_area (inputs , 8 )
0 commit comments