c_list = [] for f in ds_train.create_dict_iterator(output_numpy=True): d = ((face - f['data']) ** 2).sum() if d < min_d: min_d = d c = f['label'] if c not in c_list: c_list.append(c) print(f['label']) if min_d < 200000000000: cv2.putText(img1, subjects[c_list[0]], (x, y), cv2.FONT_HERSHEY_COMPLEX, 1, (128, 128, 0), 2) # c_list[0]即为唯一值,选择第一个元素作为唯一值

Python代码示例:如何从列表中获取唯一值

原文地址: https://www.cveoy.top/t/topic/mUUe 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录