plt.figure(figsize=(12, 5)) plt.subplot(1, 3, 1) plt.imshow(d[0,0], cmap="gray") plt.subplot(1, 3, 2) d1=elastic_transform_2d(d[0,0], 550., 20.) plt.imshow(d1, cmap="gray") plt.subplot(1, 3, 3) plt.imshow(d[0,0]-d1) plt.show() plt.close()''' data_gen_validation = SegmentationBatchGeneratorDavid(all_patients, BATCH_SIZE, validation_patients, PATCH_SIZE=INPUT_PATCH_SIZE, mode="test", ignore=[81], losses=None, num_batches=None, seed=None) data_gen_validation = seg_channel_selection_generator(data_gen_validation, [2]) data_gen_validation = center_crop_seg_generator(data_gen_validation, OUTPUT_PATCH_SIZE) data_gen_validation = Multithreaded_Generator(data_gen_validation, 2, 10) data_gen_validation._start() net = build_UNet(25, BATCH_SIZE, num_output_classes=num_classes, base_n_filters=16, input_dim=INPUT_PATCH_SIZE, pad="valid") output_layer_for_loss = net["output_flattened"] n_batches_per_epoch = 300 # n_batches_per_epoch = np.floor(n_training_samples/float(BATCH_SIZE)) n_test_batches = 30 # n_test_batches = np.floor(n_val_samples/float(BATCH_SIZE)) x_sym = T.tensor4() seg_sym = T.ivector() w_sym = T.vector() # add some weight decay l2_loss = lasagne.regularization.regularize_network_params(output_layer_for_loss, lasagne.regularization.l2) * 1e-4