def read_data(image_name_file, image_path, size, batch_size): """Executes common.read_images with CornerNet_Lite arguments. Args: image_name_file: file with names of images image_path: path to images size: size of images batch_size: size of batch Returns: np array of shape (num_images, size, size, channels) """ return common.read_images(image_name_file=image_name_file, image_path=image_path, size=size)
#!/usr/bin/python3 import sys, os import numpy as np import common # Load data prefix = "t10k" images = common.read_images(prefix) labels = common.read_labels(prefix) # Load result try: result_filepath = sys.argv[1] result = np.loadtxt(result_filepath).astype("float32") result = result.reshape([result.shape[0], 1]) except IndexError: print("Usage: " + os.path.basename(__file__) + " <result_filepath>") sys.exit(1) # Get false indices false_indices = np.argwhere(labels != result)[:, 0] # Debugging debug_dir = "debugging" common.create_dir_if_not_exists(debug_dir) for i in false_indices: common.debug(debug_dir, i, images[i], labels[i][0], result[i][0])
import common # Metadata batch_size = 128 epochs = 1000 training_dir = "training" checkpoint_format = "weights.{epoch:04d}-{val_loss:.2f}.h5" period = 5 shift_range = 2 # Create checkpoint directory if not exists common.create_dir_if_not_exists(training_dir) # Load data images = common.read_images("train") ori_labels = common.read_labels("train") new_labels = common.category2binary(ori_labels) # Load test test_images = common.read_images("t10k") test_labels = common.category2binary(common.read_labels("t10k")) # Create model model = common.create_model() # Summary model print("=" * 80) model.summary() input("Press Enter to continue...") print("=" * 80)