This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np, os, cv2 | |
from keras.utils import to_categorical | |
from keras.models import load_model | |
#reads images from folder (images must be labeled 0.png, 1.png, etc...) | |
def read_from_folder(folder, pattern, image_number, stop): | |
images = [] | |
while image_number < stop: | |
path = folder + pattern + '/' + str(image_number) + '.png' | |
img = cv2.imread(path, 0) |