标签:win 参数 form array base location path hot .sh
最近学习发现,原来简单的人脸识别已经很成熟,都不需要用到AI了,直接有现成的库。
最开始是win10+pycharm,安装没搞定什么cmake ,dlib,face_recogniton库。尝试在虚拟机ubuntu中可以正常安装

import numpy as np
import argparse
import cv2
from PIL import Image
import face_recognition
#参数导入指定图片
ap=argparse.ArgumentParser()
ap.add_argument("-i","--image",required=True,help="Enter path to the image")
args=vars(ap.parse_args())
image =cv2.imread(args["image"])
#load the jpg file into a numpy
#image=face_recognition.load_image_file("presidents.jpg")
#find all the faces in the image using the default HOG-based model.
#自动识别图片中几个人脸,每个人脸对应四个参数 上左下右 脸的边缘坐标点
face_locations=face_recognition.face_locations(image)
print("I found {} faces in this photograph,".format(len(face_locations)))
for face_location in face_locations:
#print the location of each face in this image
top,right,bottom,left=face_location
print("A face is located at pixel location Top:{},Left:{},Bottom:{},Right:{}".format(top,left,bottom,right))
#access the actual face itself like this:
face_image=image[top:bottom,left:right]
pil_image=Image.fromarray(face_image)
pil_image.show()
~
~
~
尝试用家人照片,确实很快分割出来。
试试dota1的coco 和face void人物造型
很快识别了船长的脸
虚空就识别不到。初步看,准确率还可以


标签:win 参数 form array base location path hot .sh
原文地址:https://www.cnblogs.com/uxiuxi/p/10229011.html