def validate(args, sess, epoch, image_list, label_list, enqueue_op, image_paths_placeholder, labels_placeholder, control_placeholder, phase_train_placeholder, batch_size_placeholder, stat, loss, regularization_losses, cross_entropy_mean, accuracy, validate_every_n_epochs, use_fixed_image_standardization):
    print('Running forward pass on validation set')
    nrof_batches = (len(label_list) // args.lfw_batch_size)
    nrof_images = (nrof_batches * args.lfw_batch_size)
    labels_array = np.expand_dims(np.array(label_list[:nrof_images]), 1)
    image_paths_array = np.expand_dims(np.array(image_list[:nrof_images]), 1)
    control_array = ((np.ones_like(labels_array, np.int32) * facenet.FIXED_STANDARDIZATION) * use_fixed_image_standardization)
    sess.run(enqueue_op, {image_paths_placeholder: image_paths_array, labels_placeholder: labels_array, control_placeholder: control_array})
    loss_array = np.zeros((nrof_batches,), np.float32)
    xent_array = np.zeros((nrof_batches,), np.float32)
    accuracy_array = np.zeros((nrof_batches,), np.float32)
    start_time = time.time()
    for i in range(nrof_batches):
        feed_dict = {phase_train_placeholder: False, batch_size_placeholder: args.lfw_batch_size}
        (loss_, cross_entropy_mean_, accuracy_) = sess.run([loss, cross_entropy_mean, accuracy], feed_dict=feed_dict)
        (loss_array[i], xent_array[i], accuracy_array[i]) = (loss_, cross_entropy_mean_, accuracy_)
        if ((i % 10) == 9):
            print('.', end='')
            sys.stdout.flush()
    print('')
    duration = (time.time() - start_time)
    val_index = ((epoch - 1) // validate_every_n_epochs)
    stat['val_loss'][val_index] = np.mean(loss_array)
    stat['val_xent_loss'][val_index] = np.mean(xent_array)
    stat['val_accuracy'][val_index] = np.mean(accuracy_array)
    print(('Validation Epoch: %d\tTime %.3f\tLoss %2.3f\tXent %2.3f\tAccuracy %2.3f' % (epoch, duration, np.mean(loss_array), np.mean(xent_array), np.mean(accuracy_array))))
def validate(args, sess, epoch, image_list, label_list, enqueue_op, image_paths_placeholder, labels_placeholder, control_placeholder, phase_train_placeholder, batch_size_placeholder, stat, loss, regularization_losses, cross_entropy_mean, accuracy, validate_every_n_epochs, use_fixed_image_standardization):
    print('Running forward pass on validation set')
    nrof_batches = (len(label_list) // args.lfw_batch_size)
    nrof_images = (nrof_batches * args.lfw_batch_size)
    labels_array = np.expand_dims(np.array(label_list[:nrof_images]), 1)
    image_paths_array = np.expand_dims(np.array(image_list[:nrof_images]), 1)
    control_array = ((np.ones_like(labels_array, np.int32) * facenet.FIXED_STANDARDIZATION) * use_fixed_image_standardization)
    sess.run(enqueue_op, {image_paths_placeholder: image_paths_array, labels_placeholder: labels_array, control_placeholder: control_array})
    loss_array = np.zeros((nrof_batches,), np.float32)
    xent_array = np.zeros((nrof_batches,), np.float32)
    accuracy_array = np.zeros((nrof_batches,), np.float32)
    start_time = time.time()
    for i in range(nrof_batches):
        feed_dict = {phase_train_placeholder: False, batch_size_placeholder: args.lfw_batch_size}
        (loss_, cross_entropy_mean_, accuracy_) = sess.run([loss, cross_entropy_mean, accuracy], feed_dict=feed_dict)
        (loss_array[i], xent_array[i], accuracy_array[i]) = (loss_, cross_entropy_mean_, accuracy_)
        if ((i % 10) == 9):
            print('.', end=)
            sys.stdout.flush()
    print()
    duration = (time.time() - start_time)
    val_index = ((epoch - 1) // validate_every_n_epochs)
    stat['val_loss'][val_index] = np.mean(loss_array)
    stat['val_xent_loss'][val_index] = np.mean(xent_array)
    stat['val_accuracy'][val_index] = np.mean(accuracy_array)
    print(('Validation Epoch: %d\tTime %.3f\tLoss %2.3f\tXent %2.3f\tAccuracy %2.3f' % (epoch, duration, np.mean(loss_array), np.mean(xent_array), np.mean(accuracy_array))))