75
75
def flip_augment (image , fid , pid ):
76
76
""" Returns both the original and the horizontal flip of an image. """
77
77
images = tf .stack ([image , tf .reverse (image , [1 ])])
78
- return images , [fid ]* 2 , [pid ]* 2
78
+ return images , tf . stack ( [fid ]* 2 ), tf . stack ( [pid ]* 2 )
79
79
80
80
81
81
def five_crops (image , crop_size ):
@@ -155,7 +155,7 @@ def main():
155
155
# Convert filenames to actual image tensors.
156
156
dataset = dataset .map (
157
157
lambda fid : common .fid_to_image (
158
- fid , 'dummy' , image_root = args .image_root ,
158
+ fid , tf . constant ( 'dummy' ) , image_root = args .image_root ,
159
159
image_size = pre_crop_size if args .crop_augment else net_input_size ),
160
160
num_parallel_calls = args .loading_threads )
161
161
@@ -173,8 +173,10 @@ def main():
173
173
(five_crops (im , net_input_size )[0 ], fid , pid ))
174
174
modifiers = [o + '_center' for o in modifiers ]
175
175
elif args .crop_augment == 'five' :
176
- dataset = dataset .map (lambda im , fid , pid :
177
- (tf .stack (five_crops (im , net_input_size )), [fid ]* 5 , [pid ]* 5 ))
176
+ dataset = dataset .map (lambda im , fid , pid : (
177
+ tf .stack (five_crops (im , net_input_size )),
178
+ tf .stack ([fid ]* 5 ),
179
+ tf .stack ([pid ]* 5 )))
178
180
dataset = dataset .apply (tf .contrib .data .unbatch ())
179
181
modifiers = [o + m for o in modifiers for m in [
180
182
'_center' , '_top_left' , '_top_right' , '_bottom_left' , '_bottom_right' ]]
0 commit comments