问题描述
我正在对视频进行面部识别,并且有一组输入的图像,我会将视频中识别出的每个面部与之进行比较,以寻找匹配项。 (我也在修改该方法,但是我需要首先实现这一基本方法。)
在2个处理器上工作时,我看到对于一组75张图像(= 75次运行),并行处理需要16倍的顺序时间,而对于200张图像,则需要大约3倍的时间。有关系吗?我在Colab GPU上运行此程序,并尝试访问cpu进行池化。这可能是问题吗? 我已经提到过其他有关SO多处理的文章,但是我的代码中是否可以做一些加快工作的事情?
pool = mp.Pool(mp.cpu_count())
names = names_of_input_images
encodings_list = list_of_input_images_encodings
def match_face(index,recognized_face):
# find similarity between encodings_list[index] and recognized_face
kNown_face = encodings_list[index]
match = face_recognition.compare_faces([kNown_face],recognized_face)
if match==True: // return name of person
return names[index]
# sequential
names_list = [match_face(ind,face_encoding) for ind in range(len(kNown_faces))]
# parallel processing
names_list = [pool.apply(match_face,args=(ind,face_encoding)) for ind in range(len(kNown_faces))]
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)