本文整理汇总了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()