コード例 #1
0
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
コード例 #2
0
def _evaluate(embeddings, actual_issame, nrof_folds=10):
    # 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)
    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)
    return tpr, fpr, accuracy, val, val_std, far
コード例 #3
0
def evaluate(embeddings, actual_issame, nrof_folds=10):
    # Calculate evaluation metrics
    thresholds = np.arange(0, 4, 0.01)
    embeddings1 = embeddings[0::2]  # 6000张图片 是每一个Paris中的第一张
    embeddings2 = embeddings[1::2]  # 6000张图片 是每一个Paris中的第2张
    # 计算roc曲线需要的数据和在测试数据上的每一折的测试精度
    tpr, fpr, accuracy = facenet.calculate_roc(thresholds,
                                               embeddings1,
                                               embeddings2,
                                               np.asarray(actual_issame),
                                               nrof_folds=nrof_folds)
    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)
    return tpr, fpr, accuracy, val, val_std, far