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


Python Extractor.predict_multi方法代码示例

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


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

示例1: extract_multi

# 需要导入模块: from extractor import Extractor [as 别名]
# 或者: from extractor.Extractor import predict_multi [as 别名]
def extract_multi(args):
  # Extract  Featues from Net using prot_file from images from input file
  # it will save patch of max_value features at one .cPickle. 
  # Not as one file, because 2.4M images produce 10 GB of data
  pred = Extractor(args.proto_path,args.bin_path)
  max_value = 512 
  curr_value = 0
  list_all_result = list()
  list_good_class_all = list()
  list_name_file = list()
  create_dir(args.folder)
  with open(args.images,'r') as file_image:
    list_images = list()
    list_good_class = list()
    for idx,line in enumerate(file_image):
      splitted = line.split(' ')
      list_good_class.append(int(splitted[1]))
      list_images.append(splitted[0].strip())
      curr_value = curr_value + 1
      if curr_value < max_value:
        continue
      else:
        #predict using value
        predictions = pred.predict_multi(list_images)
        f = Feature(predictions,list_good_class)
        name = '/'.join((args.folder,str(idx)+"_file.cPickle"))
        list_name_file.append(os.path.abspath(name))
        save_cPickle(f,name)
        list_good_class = list()
        list_images = list()
        curr_value = 0
        print "Predicted 512"
        
    #predict last package of data, which is smaller than max_value
    if len(list_images) > 0:
      predictions = pred.predict_multi(list_images)
      list_all_result.append(predictions)
      f = Feature(predictions,list_good_class)
      name = '/'.join((args.folder,str(idx)+"_file.cPickle"))
      save_cPickle(f,name)
      list_name_file.append(os.path.abspath(name))
      
  f = open(args.folder+ '/' + 'files.txt', 'wb')
  f.writelines( "%s\n" % item for item in list_name_file)
  f.close()
开发者ID:Coderx7,项目名称:Apollo,代码行数:47,代码来源:main.py


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