许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  1000个人脸关键点检测大PK:算法对比与性能评估

1000个人脸关键点检测大PK:算法对比与性能评估

阅读数 12
点赞 0
article_banner

Face++:

Face⁺⁺

1000个全脸关键点,api,整体效果最好,

请求代码:

import base64import ioimport osimport tracebackfrom json import JSONDecoder import PIL.Image as Imageimport cv2import numpy as npimport requestsimport base64 from misc import is_url, download_image API_KEY = "zYVNURhMvDx47H-f5au2YKKQKNoLRKOO"API_SECRET = "Sme_EoOr1oOl2w1ZLFnloP206mKZrEV8"  def image_to_base64(img, ext='.png'):    retval, buf = cv2.imencode(ext, img)    return base64.b64encode(buf).decode()  def image_from_base64(img_b64):    return cv2.imdecode(np.fromstring(base64.b64decode(img_b64.encode()), np.uint8), cv2.IMREAD_UNCHANGED)  class FacePPAPI(object):     def __init__(self):        pass     def thousandlandmark(self, img):        http_url = 'https://api-cn.faceplusplus.com/facepp/v1/face/thousandlandmark'        data = {"api_key": API_KEY,                "api_secret": API_SECRET,                "return_landmark": "all",                }         files = {"image_file": self.__get_image_data(img)}        resp = requests.post(http_url, data=data, files=files, timeout=5)        req_con = resp.content.decode('utf-8')        data_dict = JSONDecoder().decode(req_con)        return data_dict     @staticmethod    def __get_image_data(img):        image_data = None        if isinstance(img, bytes):            image_data = img        elif isinstance(img, str):            if os.path.exists(img):                img_path = img                with open(img_path, "rb") as image_file:                    image_data = image_file.read()                return image_data            elif is_url(img):                img_url = img                return download_image(img_url, timeout=5)             try:                image_data = base64.b64decode(img.encode())            except:                raise RuntimeError("不是base64格式字符串")            return image_data        elif type(img).__module__ == np.__name__:            retval, image_data = cv2.imencode('.jpg', img)            return image_data        elif isinstance(img, Image.Image):            img_byte_arr = io.BytesIO()            img.save(img_byte_arr, format='jpg')            image_data = img_byte_arr.getvalue()            return image_data        return image_data  facepp_api = FacePPAPI()  if __name__=="__main__":    data_dir = "./images/"    out_dir= "./out/"    radius_lists = ["right_eye_pupil_radius", "left_eye_pupil_radius"]    for name in os.listdir(data_dir):        print(name)        fullname = os.path.join(data_dir, name)        image = cv2.imread(fullname)        data_dict = facepp_api.thousandlandmark(image)        for key, key_value in data_dict["face"]["landmark"].items():            for kkey, value in key_value.items():                if kkey not in radius_lists:                    cv2.circle(image, (value["x"], value["y"]), 1, (255,255,255),4)        cv2.imwrite(os.path.join(out_dir,name), image)
import reimport traceback import requestsimport requests.compat CAPITALS = re.compile('([A-Z])')  def is_url(url):    try:        res = requests.compat.urlparse(url)        if not res.scheme or not res.netloc or not "." in res.netloc:            return False        res = requests.compat.urlparse(requests.compat.urljoin(url, "/"))        if not res.scheme or not res.netloc or not "." in res.netloc:            return False    except:        return False    return True  def download_image(url, timeout=10):    image_file = None    try:        response = requests.get(url, timeout=timeout)        if response.status_code == 200:            image_file = response.content    except:        traceback.print_exc()     return image_file

TengineKit:

GitHub - OAID/TengineKit: TengineKit - Free, Fast, Easy, Real-Time Face Detection & Face Landmarks & Face Attributes & Hand Detection & Hand Landmarks & Body Detection & Body Landmarks & Iris Landmarks & Yolov5 SDK On Mobile.https://github.com/OAID/TengineKit

424个全脸关键点,c++ so,居然依赖 libcurl 的库,慎重使用,整体效果中等

FaceLandmark1000:

https://github.com/Single430/FaceLandmark1000

1000个全脸关键点,python,onnx,整体效果最差


最终效果对比:



免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删


相关文章
技术文档
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空