config.NO_NUMPAD = args.noNumpad config.WITH_SCANNING = args.withScanning # Load the training configuration file. TRAINING_CONFIG = Config.load('.', config.CONFIG_ID) # First, we define the constants for the window size of the experiment. # `XSIZE` and `YSIZE` refer to the size of the window on the screen. config.YSIZE, config.XSIZE = 100, 100 # Next, we load the stimulus. Opening the image files can be expensive # so we're doing at this at the very start and loading them into a # variable. # `IMAGE_TEMPLATE` is a string of the filepath of the stimulus digit images. config.IMAGE_TEMPLATE = './images/{}.png' # `IMAGE_SIZE` is an (int, int) tuple of the image size of the first image. # We assume that each image is of the same size as the image labelled "0" config.IMAGE_SIZE = np.shape(imread(config.IMAGE_TEMPLATE.format(0))) # `IMAGES` holds the original digit images. config.IMAGES = [ cv2.cvtColor( cv2.resize(imread(config.IMAGE_TEMPLATE.format(digit)), dsize=(TRAINING_CONFIG.grid.render_shape)), cv2.COLOR_RGBA2RGB) for digit in range(10) ] # Initialise the checkpoint if config.CONDITION == 0:
# `SCALE` links the two. config.XSIZE = 100 config.YSIZE = 100 config.SCALE = 10 config.EXSIZE = config.XSIZE // config.SCALE config.EYSIZE = config.YSIZE // config.SCALE config.INPUT_XSIZE = 64 config.INPUT_YSIZE = 64 # Next, we load the stimulus. Opening the image files can be expensive # so we're doing at this at the very start and loading them into a # variable. # `IMAGE_TEMPLATE` is a string of the filepath of the stimulus digit images. config.IMAGE_TEMPLATE = './data/digit-images-aliased/{}.png' # `IMAGE_SIZE` is an (int, int) tuple of the image size of the first image. # We assume that each image is of the same size as the image labelled "0" config.IMAGE_SIZE = np.shape(imread(config.IMAGE_TEMPLATE.format(0))) # `IMAGE_SCALE` is an int describing the ratio of electrode size to image size. # It assumes that EXSIZE == EYSIZE and the input images are square. # This may need changing later. config.IMAGE_SCALE = config.EXSIZE / config.IMAGE_SIZE[0] # `IMAGES` holds the original digit images. config.IMAGES = [ cv2.cvtColor( cv2.resize(imread(config.IMAGE_TEMPLATE.format(digit)), dsize=(config.INPUT_XSIZE, config.INPUT_YSIZE)),