7575def flip_augment (image , fid , pid ):
7676 """ Returns both the original and the horizontal flip of an image. """
7777 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 )
7979
8080
8181def five_crops (image , crop_size ):
@@ -155,7 +155,7 @@ def main():
155155 # Convert filenames to actual image tensors.
156156 dataset = dataset .map (
157157 lambda fid : common .fid_to_image (
158- fid , 'dummy' , image_root = args .image_root ,
158+ fid , tf . constant ( 'dummy' ) , image_root = args .image_root ,
159159 image_size = pre_crop_size if args .crop_augment else net_input_size ),
160160 num_parallel_calls = args .loading_threads )
161161
@@ -173,8 +173,10 @@ def main():
173173 (five_crops (im , net_input_size )[0 ], fid , pid ))
174174 modifiers = [o + '_center' for o in modifiers ]
175175 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 )))
178180 dataset = dataset .apply (tf .contrib .data .unbatch ())
179181 modifiers = [o + m for o in modifiers for m in [
180182 '_center' , '_top_left' , '_top_right' , '_bottom_left' , '_bottom_right' ]]
0 commit comments