Skip to content

Face detection and recognition algorithm and some tools

Notifications You must be signed in to change notification settings

wvinzh/WutongFace

Repository files navigation

WutongFace---A toolkit for face detector and feature extractor using pytorch

Usage

  1. clone this repo and use like:
from wutong_face import WutongFace

wface = WutongFace()
image_file = "F:\\images\\000002.jpg"
### faces_no_align is a list of PIL.Image
faces_no_align = wface.face_no_align(image_file,crop_size=(180,180),min_face_size=20)
#faces_align = wface.face_align(image_file,crop_size=(180,180),min_face_size=20)
faces_no_align[0].show()
  1. you can also use the base detector api like:
from wutong_face import WutongFace
image_file = "F:\\images\\000002.jpg"
##init a WutongFace
wface = WutongFace()

# 1. using the detector
image = Image.open(image_file)
face_num,bounding_boxes,landmarks = wface.detect(image)
  1. the perfomance

  1. for face feature extract you should download the pretrained model file to the feature_extractor/pretrained_model path: sphereface-onedrive
    cosface-onedrive
    insightface-onedrive
    VGGFace2-resnet-onedrive

    # 2. use detector and extract feature
     faces_align,_,_ = wface.face_align(image_file,crop_size=(150,150))
     print(len(faces_align))
        if len(faces_align) <= 0:
            print("no faces")
     feature = wface.feature_extractor('resnet',faces_align)
     print(feature.shape)

Reference

mtcnn-pytorch sphereface_pytorch
CosFace_pytorch
InsightFace_Pytorch
VGGFace2-pytorch

About

Face detection and recognition algorithm and some tools

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages