Exemplo n.º 1
0
        loss = ae_loss(y_true=Y_true, y_pred=Y_pred)
        va_loss.update_state(y_true=Y_true, y_pred=Y_pred)

    #---------------------
    tr_loss.reset_states()
    va_loss.reset_states()
    # start training
    L = len(X_train)
    M = len(X_valid)
    steps = int(L / batch_size)
    steps1 = int(M / batch_size)

    for epoch in range(epochs):
        # Run on training data + Update weights
        for step in range(steps):
            images, _ = loader.get_batch_light(X_train, Y_train, batch_size,
                                               image_size, image_size)
            train_step(images, images)

            print(epoch,
                  "/",
                  epochs,
                  step,
                  steps,
                  "tr_loss:",
                  tr_loss.result().numpy(),
                  end="\r")

        # Run on validation data without updating weights
        for step in range(steps1):
            images, _ = loader.get_batch_light(X_valid, Y_valid, batch_size,
                                               image_size, image_size)
Exemplo n.º 2
0
        loss = my_loss(y_true=Y_true, y_pred=Y_pred)

        va_loss.update_state(y_true=Y_true, y_pred=Y_pred)
        va_accu(Y_true, Y_pred)

    #---------------------
    # start training
    L = len(X_train)
    M = len(X_valid)
    steps = int(L / batch_size)
    steps1 = int(M / batch_size)

    for epoch in range(epochs):
        # Run on training data + Update weights
        for step in range(steps):
            images, labels = loader.get_batch_light(X_train, Y_train,
                                                    batch_size, width, height)
            train_step(images, labels)

            print(epoch,
                  "/",
                  epochs,
                  step,
                  steps,
                  "loss:",
                  tr_loss.result().numpy(),
                  "accuracy:",
                  tr_accu.result().numpy(),
                  end="\r")

        # Run on validation data without updating weights
        for step in range(steps1):
Exemplo n.º 3
0
        Y_pred = model(X, training=False)
        loss = my_loss(y_true=Y_true, y_pred=Y_pred)
        va_loss.update_state(y_true=Y_true, y_pred=Y_pred)

    #---------------------
    # start training
    L = len(X_train)
    M = len(X_valid)
    steps = int(L / batch_size)
    steps1 = int(M / batch_size)

    for epoch in range(epochs):
        # Run on training data + Update weights
        for step in range(steps):
            noisy_imgs, imgs = loader.get_batch_light(X_train, X_train,
                                                      batch_size, width,
                                                      height)
            train_step(noisy_imgs, imgs)

            print(epoch,
                  "/",
                  epochs,
                  step,
                  steps,
                  "loss:",
                  tr_loss.result().numpy(),
                  end="\r")

        # Run on validation data without updating weights
        for step in range(steps1):
            noisy_images, images_ = loader.get_batch_light(