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


Python Parallel.remove方法代码示例

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


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

示例1: get_best_matches

# 需要导入模块: from joblib import Parallel [as 别名]
# 或者: from joblib.Parallel import remove [as 别名]
def get_best_matches(img, ids, kps, des):
	number_of_results = 3

	src_kp, src_des = get_kp_desc(img)
	os.remove(img)
	matches = []

	matches = Parallel(n_jobs=-1)(delayed(match_gen)([kp_to_list(src_kp), src_des, kp_to_list(kps[i]), des[i], ids[i]]) for i in range(len(ids)))
	
	# remove product ids that have 0 matches
	for elem in matches[:]:
		if elem[1] == 0:
			matches.remove(elem)

	# sort by ids in order to remove duplicate ids for pics with less matches of the same product
	matches = sorted(matches, key=lambda tup: tup[0])

	# and remove possible product id duplicates
	# that may appear from the match-making algorithm applied 
	# on different picture keypoints of the same product
	s = set()
	for elem in matches[:]:
		if elem[0] in s:
			matches.remove(elem)
		else:
			s.add(elem[0])

	# sort by number of matches
	matches = sorted(matches, key=lambda tup: tup[1])
	matches.reverse()

	# return the first number_of_results most matching
	return [i for i in matches[:number_of_results]]
开发者ID:AdinaPirjol,项目名称:product-matchmaking,代码行数:35,代码来源:match.py


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