def calib_input(iter): images = [] line = open(calib_image_list).readlines() #print(line) for index in range(0, calib_batch_size): curline = line[iter * calib_batch_size + index] #print("iter= ", iter, "index= ", index, "sum= ", int(iter*calib_batch_size + index), "curline= ", curline) calib_image_name = curline.strip() image_path = os.path.join(calib_image_dir, calib_image_name) image2 = cnn.NormalizeImageArr(image_path) #image2 = image2.reshape((image2.shape[0], image2.shape[1], 3)) images.append(image2) return {"input_1": images}
else: model = unet.UNET_v3(N_CLASSES, HEIGHT, WIDTH) ###################################################################### # prepare testing and validation data ###################################################################### # load validation images valid_images = os.listdir(dir_valid_img) valid_images.sort() valid_segmentations = os.listdir(dir_valid_seg) valid_segmentations.sort() X_valid = [] Y_valid = [] for im, seg in zip(valid_images, valid_segmentations): X_valid.append(cnn.NormalizeImageArr(os.path.join(dir_valid_img, im))) Y_valid.append( cnn.LoadSegmentationArr(os.path.join(dir_valid_seg, seg), N_CLASSES, WIDTH, HEIGHT)) X_valid, Y_valid = np.array(X_valid), np.array(Y_valid) print("\n") print("validation data (X) (Y) shapes:", X_valid.shape, Y_valid.shape) # load testing images test_images = os.listdir(dir_test_img) test_images.sort() test_segmentations = os.listdir(dir_test_seg) test_segmentations.sort() X_test = [] Y_test = [] for im, seg in zip(test_images, test_segmentations):