datalist = open(list_file, 'w')
for f in files:
with PIL.Image.open(root + '/' + f) as image:
- img = np.array(image.resize((299, 299),
- PIL.Image.ANTIALIAS)).astype(np.float32)
+ # To handle ANTIALIAS deprecation
+ ANTIALIAS = PIL.Image.Resampling.LANCZOS if hasattr(
+ PIL.Image, "Resampling") else PIL.Image.ANTIALIAS
+
+ img = np.array(image.resize((299, 299), ANTIALIAS)).astype(np.float32)
img = ((img / 255) - 0.5) * 2.0
output_file = output_dir + '/' + f.replace('jpg', 'data')
img.tofile(output_file)