'Args:
files (list): list of file paths.
channel (int): 1 or 3. Will convert grayscale to RGB images if channel==3.
resize (tuple): int or (h, w) tuple. If given, resize the image.'

def __init__(self, files, channel=3, resize=None, shuffle=False):

    assert len(files), 'No    image    files    given    to    ImageFromFile!'
    self.files = files
    self.channel = int(channel)
    self.imread_mode = (cv2.IMREAD_GRAYSCALE if (self.channel == 1) else cv2.IMREAD_COLOR)
    if (resize is not None):
        resize = shape2d(resize)
    self.resize = resize
    self.shuffle = shuffle
