1414import datetime
1515from time import gmtime , strftime
1616from six .moves import xrange
17+ from PIL import Image
1718
1819import tensorflow as tf
1920import tensorflow .contrib .slim as slim
@@ -90,8 +91,8 @@ def center_crop(x, crop_h, crop_w,
9091 h , w = x .shape [:2 ]
9192 j = int (round ((h - crop_h )/ 2. ))
9293 i = int (round ((w - crop_w )/ 2. ))
93- return scipy . misc . imresize (
94- x [ j : j + crop_h , i : i + crop_w ], [ resize_h , resize_w ])
94+ im = Image . fromarray ( x [ j : j + crop_h , i : i + crop_w ])
95+ return np . array ( im . resize ([ resize_h , resize_w ]), PIL . Image . BILINEAR )
9596
9697def transform (image , input_height , input_width ,
9798 resize_height = 64 , resize_width = 64 , crop = True ):
@@ -100,8 +101,8 @@ def transform(image, input_height, input_width,
100101 image , input_height , input_width ,
101102 resize_height , resize_width )
102103 else :
103- cropped_image = scipy . misc . imresize ( image , [ resize_height , resize_width ])
104- return np .array (cropped_image )/ 127.5 - 1.
104+ im = Image . fromarray ( x [ j : j + crop_h , i : i + crop_w ])
105+ return np .array (im . resize ([ resize_h , resize_w ]), PIL . Image . BILINEAR )/ 127.5 - 1.
105106
106107def inverse_transform (images ):
107108 return (images + 1. )/ 2.
0 commit comments