def __init__(self, nist_path, label_path, ocr_path, ocrlabel_path): self.train_data = open(nist_path, 'rb') self.train_labels = open(label_path, 'rb') self.dim = tuple(ft._read_header(self.train_data)[3]) # in order to seek to the beginning of the file self.train_data.close() self.train_data = open(nist_path, 'rb') self.ocr_data = open(ocr_path, 'rb') self.ocr_labels = open(ocrlabel_path, 'rb')
def reload(output_file_path, params_output_file_path): images_ft = open(output_file_path, 'rb') images_ft_dim = tuple(ft._read_header(images_ft)[3]) print "Images dimensions: ", images_ft_dim params = numpy.load(params_output_file_path) print "Params dimensions: ", params.shape print params