本文整理汇总了Python中facenet.calculate_roc方法的典型用法代码示例。如果您正苦于以下问题:Python facenet.calculate_roc方法的具体用法?Python facenet.calculate_roc怎么用?Python facenet.calculate_roc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类facenet
的用法示例。
在下文中一共展示了facenet.calculate_roc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: evaluate_accuracy
# 需要导入模块: import facenet [as 别名]
# 或者: from facenet import calculate_roc [as 别名]
def evaluate_accuracy(sess, images_placeholder, phase_train_placeholder, image_size, embeddings,
paths, actual_issame, augment_images, aug_value, batch_size, orig_image_size, seed):
nrof_images = len(paths)
nrof_batches = int(math.ceil(1.0*nrof_images / batch_size))
emb_list = []
for i in range(nrof_batches):
start_index = i*batch_size
end_index = min((i+1)*batch_size, nrof_images)
paths_batch = paths[start_index:end_index]
images = facenet.load_data(paths_batch, False, False, orig_image_size)
images_aug = augment_images(images, aug_value, image_size)
feed_dict = { images_placeholder: images_aug, phase_train_placeholder: False }
emb_list += sess.run([embeddings], feed_dict=feed_dict)
emb_array = np.vstack(emb_list) # Stack the embeddings to a nrof_examples_per_epoch x 128 matrix
thresholds = np.arange(0, 4, 0.01)
embeddings1 = emb_array[0::2]
embeddings2 = emb_array[1::2]
_, _, accuracy = facenet.calculate_roc(thresholds, embeddings1, embeddings2, np.asarray(actual_issame), seed)
return accuracy
示例2: evaluate
# 需要导入模块: import facenet [as 别名]
# 或者: from facenet import calculate_roc [as 别名]
def evaluate(embeddings, actual_issame, nrof_folds=10, distance_metric=0, subtract_mean=False):
# Calculate evaluation metrics
thresholds = np.arange(0, 4, 0.01)
embeddings1 = embeddings[0::2]
embeddings2 = embeddings[1::2]
tpr, fpr, accuracy = facenet.calculate_roc(thresholds, embeddings1, embeddings2,
np.asarray(actual_issame), nrof_folds=nrof_folds, distance_metric=distance_metric, subtract_mean=subtract_mean)
thresholds = np.arange(0, 4, 0.001)
val, val_std, far = facenet.calculate_val(thresholds, embeddings1, embeddings2,
np.asarray(actual_issame), 1e-3, nrof_folds=nrof_folds, distance_metric=distance_metric, subtract_mean=subtract_mean)
return tpr, fpr, accuracy, val, val_std, far