资源算法python-seetaface2

python-seetaface2

2020-01-02 | |  38 |   0 |   0

python-seetaface2

A python API interface for SeetaFaceEngine2

Installation

Prerequisite

Download binary models and libraries from SeetaFaceEngine2

git clone --recursive https://github.com/twmht/python-seetaface2cd python-seetaface2 
cp $seetaface_lib ./
python setup.py install

$seetaface_lib is a lib directory after you unzip the library SDK.

If you want to build with opencv3

USE_OPENCV3=ON python setup.py build

Usage

detect faces and their landmarks

import seetafaceimport cv2

root = 'example1.jpg'im = cv2.imread(root)
image = seetaface.SeetaImage(im)# or you can pass the image path to build SeetaImage# image = seetaface.SeetaImage(root)fd = seetaface.FaceDetector('/home/tumh/python-seetaface2/SeetaFaceDetector2.0.ats')
pd = seetaface.PointDetector('/home/tumh/python-seetaface2/SeetaPointDetector2.0.pts5.ats')

rects = fd.detect(image)for rect in rects:
    cv2.rectangle(im, (rect.x, rect.y), (rect.x + rect.width, rect.y + rect.height), (0,0,255), 2)
    points = pd.detect(image, rect)    for p in points:
        cv2.circle(im, (int(p.x), int(p.y)), 2, (0,0,255), -1)

example1_result.jpg

given a bounding box and detect the landmark

import seetafaceimport cv2

root = 'example2.jpg'image = seetaface.SeetaImage(root)

pd = seetaface.PointDetector('/home/tumh/python-seetaface2/SeetaPointDetector2.0.pts5.ats')# given a boudning boxrect = seetaface.SeetaRect()
rect.x = 221rect.y = 130rect.width = 232rect.height = 278im = cv2.imread(root)
cv2.rectangle(im, (rect.x, rect.y), (rect.x + rect.width, rect.y + rect.height), (0,0,255), 2)
points = pd.detect(image, rect)for p in points:
    cv2.circle(im, (int(p.x), int(p.y)), 2, (0,0,255), -1)

example2_result.jpg


上一篇:seetaface2_demo

下一篇:seetafaceJNI

用户评价
全部评价

热门资源

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • shih-styletransfer

    shih-styletransfer Code from Style Transfer ...