diff --git a/image2numpy_imagenet_train.py b/image2numpy_imagenet_train.py index 34b5e85..d1cdb03 100644 --- a/image2numpy_imagenet_train.py +++ b/image2numpy_imagenet_train.py @@ -3,9 +3,13 @@ from argparse import ArgumentParser from utils import * import os -from scipy import misc +from imageio import imread import numpy as np +from PIL import PngImagePlugin +LARGE_ENOUGH_NUMBER = 100 +PngImagePlugin.MAX_TEXT_CHUNK = LARGE_ENOUGH_NUMBER * (1024**2) + def parse_arguments(): parser = ArgumentParser() parser.add_argument('-i', '--in_dir', help="Input directory with source images") @@ -35,7 +39,7 @@ def process_folder(in_dir, out_dir): images = [] for image_name in os.listdir(os.path.join(in_dir, folder)): try: - img = misc.imread(os.path.join(in_dir, folder, image_name)) + img = imread(os.path.join(in_dir, folder, image_name)) r = img[:, :, 0].flatten() g = img[:, :, 1].flatten() b = img[:, :, 2].flatten() diff --git a/image2numpy_imagenet_val.py b/image2numpy_imagenet_val.py index 2fdda0a..12dffc8 100644 --- a/image2numpy_imagenet_val.py +++ b/image2numpy_imagenet_val.py @@ -3,9 +3,12 @@ from argparse import ArgumentParser import numpy as np import os -from scipy import misc +from imageio import imread from utils import * +from PIL import PngImagePlugin +LARGE_ENOUGH_NUMBER = 100 +PngImagePlugin.MAX_TEXT_CHUNK = LARGE_ENOUGH_NUMBER * (1024**2) def parse_arguments(): parser = ArgumentParser() @@ -45,7 +48,7 @@ def process_folder(in_dir, out_dir): if label not in labels_searched: continue try: - img = misc.imread(os.path.join(in_dir, image_name)) + img = imread(os.path.join(in_dir, image_name)) r = img[:, :, 0].flatten() g = img[:, :, 1].flatten() b = img[:, :, 2].flatten()