コード例 #1
0
ファイル: main.py プロジェクト: shadow2496/AI_Starthon2019
def local_eval(model, test_loader=None, test_label_file=None):
    prediction_file = 'pred_train.txt'
    feed_infer(
        prediction_file, lambda root_path: _infer(
            model, root_path, test_loader=test_loader, local_val=True))
    metric_result = evaluation_metrics(prediction_file, test_label_file)
    print('Eval result: {:.4f}'.format(metric_result))
    return metric_result
コード例 #2
0
def local_eval(model, data_loader=None):
    prediction_file = 'test_pred'
    feed_infer(
        prediction_file,
        lambda root_path: _infer(model, root_path, data_loader=data_loader))
    test_label_file = '/home/data/nipa_faces_sr_tmp2/test/test_label'  # local datapath
    metric_result = evaluation_metrics(prediction_file, test_label_file)
    print('Eval result: {:.4f}'.format(metric_result))
    return metric_result
コード例 #3
0
ファイル: main.py プロジェクト: zzsza/ai-starthon-2019
def local_eval(model, test_loader=None, test_label_file=None):
    model.eval()
    prediction_file = 'pred_train.txt'
    feed_infer(prediction_file, lambda root_path: _infer(model, root_path, test_loader=test_loader))
    if not test_label_file:
        test_label_file = os.path.join(VAL_DATASET_PATH, 'test_label')
    metric_result = evaluation_metrics(
        prediction_file,
        test_label_file)
    return metric_result
コード例 #4
0
ファイル: main.py プロジェクト: zzsza/ai-starthon-2019
def local_eval(model, test_loader=None, test_label_file=None):
    prediction_file = 'pred_train.txt'
    feed_infer(
        prediction_file,
        lambda root_path: _infer(model, root_path, test_loader=test_loader))
    if not test_label_file:
        test_label_file = os.path.join(VAL_DATASET_PATH, 'test_label')
    metric_result = evaluation_metrics(prediction_file, test_label_file)
    logger.info('Eval result: {:.4f} mIoU'.format(metric_result))
    return metric_result
コード例 #5
0
ファイル: main.py プロジェクト: andy5090/deepart_8
def local_eval(model,
               test_loader=None,
               test_label_file="../food_img/food_label.txt"):
    prediction_file = "pred_train.txt"
    feed_infer(
        prediction_file,
        lambda root_path: _infer(
            model, root_path, test_loader=test_loader, local_val=True),
    )
    metric_result = evaluation_metrics(prediction_file, test_label_file)
    print("Eval result: {:.4f}".format(metric_result))
    return metric_result
コード例 #6
0
ファイル: main.py プロジェクト: temerara-nplab/round-1
def local_eval(model, test_loader=None, test_label_file=None):
    """Local debugging function.

    You can use this function for debugging.
    """
    prediction_file = 'pred_train.txt'
    feed_infer(
        prediction_file,
        lambda root_path: _infer(model, root_path, test_loader=test_loader))
    if not test_label_file:
        test_label_file = os.path.join(VAL_DATASET_PATH, 'test_label')
    metric_result = evaluation_metrics(prediction_file, test_label_file)
    print('[Eval result] recall: {:.2f}'.format(metric_result))
    return metric_result
コード例 #7
0
def local_eval(model, loader, gt_path):
    """Local debugging function.

    You can use this function for debugging. You may need dummy gt file.

    Args:
        model: instance.
        test_loader: instance.
        gt_path: string.

    Returns:
        metric_result: float. Performance of your method.
    """
    pred_path = 'pred.txt'
    feed_infer(
        pred_path, lambda root_path: _infer(
            model=model, root_path=root_path, loader=loader))
    metric_result = evaluation_metrics(pred_path, gt_path)
    return metric_result