Exemplo n.º 1
0
def single_run(aug_sat, aug_gs, aug_blur, aug_rr, TEST_RUM_ONLY=False):
    def augment_data_ext(x, y):
        return data.augment_data_extended(x,
                                          y,
                                          saturation=aug_sat,
                                          use_grayscale=aug_gs,
                                          blur_amount=aug_blur,
                                          num_random_rotations=aug_rr)

    epochs = 150
    if TEST_RUM_ONLY:
        epochs = 1

    crt_config_name = "_" + str(aug_sat) + "_" + str(aug_gs) + "_" + str(
        aug_blur) + "_" + str(aug_rr)

    # u_net_cross_entropy_augmented
    model = unet.get_model(None, None, 3, do_compile=False)
    model.compile(optimizer='adam',
                  loss='binary_crossentropy',
                  metrics=[
                      'accuracy',
                      tf.keras.metrics.MeanIoU(num_classes=2), f1, f1_binary
                  ])
    model_name = 'u_net_cross_entropy_augmented_extended_3' + crt_config_name

    cross_val(model,
              model_name,
              augment_data_func=augment_data_ext,
              epochs=epochs)
Exemplo n.º 2
0
def main():
    from models import unet

    # focal
    from losses import focal
    loss = focal.focal_loss
    model_name = 'u_net_focal_loss_cross_training_ext_aug_5'
    model = unet.get_model(None, None, 3, do_compile=False)
    model.compile(
        optimizer='adam',
        loss=loss,
        metrics=['accuracy',
                 tf.keras.metrics.MeanIoU(num_classes=2)])
    cross_val(model, model_name)