当前位置: 首页>>代码示例>>Python>>正文


Python Dataset.load_annotations方法代码示例

本文整理汇总了Python中dataset.Dataset.load_annotations方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.load_annotations方法的具体用法?Python Dataset.load_annotations怎么用?Python Dataset.load_annotations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dataset.Dataset的用法示例。


在下文中一共展示了Dataset.load_annotations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: open

# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import load_annotations [as 别名]
   
    if not os.path.exists(params["1st_stage_weights_fn"]):
        print "The weights for the first stage does not exist!"
        sys.exit(2)
    w_1st = np.genfromtxt(params["1st_stage_weights_fn"], delimiter=",").astype(np.float32)
    
    if not os.path.exists(params["sizes_indeces_fn"]):
        print "The sizes indices file does not exist!"
        sys.exit(2)
    sizes = np.genfromtxt(params["sizes_indeces_fn"], delimiter=",").astype(np.int32)
    
    if not os.path.exists(params["2nd_stage_weights_fn"]):
        print "The weights for the second stage does not exist!"
        sys.exit(2)
    f = open(params["2nd_stage_weights_fn"])
    w_str = f.read()
    f.close()
    w_2nd = json.loads(w_str)
    
    ds = Dataset(basepath = basepath, training_set_fn = training_set_fn, test_set_fn = test_set_fn, annotations_path = annotations_path, images_path = images_path)
       
    test_annotations = ds.load_annotations( mode = Dataset.TEST )
    print "Evaluating recall..."
    eval_recall = EvaluateRecall(w_1st = w_1st, 
                                 sizes_idx = sizes, 
                                 w_2nd = w_2nd, 
                                 num_bbs_per_size_1st_stage = params["num_win_psz"], 
                                 num_bbs_final = params["num_bbs"])
    recall = eval_recall.evaluate_test_set(test_annotations)
    print "Recall obetained with {0} windows per size index and {1} total final windows: {2:.5f}".format(params["num_win_psz"],params["num_bbs"],recall)
开发者ID:Johnson-yue,项目名称:BING-Objectness,代码行数:32,代码来源:test_recall.py


注:本文中的dataset.Dataset.load_annotations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。