Skip to main content

Simplest and efficient way to detect face

Project description

#YOLO FACE

You only look once (YOLO) is a state-of-the-art, real-time object detection system. It is based on Deep Learning.
Face detection is one of the important tasks of object detection. We apply a single neural network to the full image.
This project focuses on improving the accuracy of detecting the face using the model of deep learning network (YOLO).
This network divides the image into regions and predicts bounding boxes and probabilities for each region.These bounding boxes are weighted by the predicted probabilities.


For this project, I am going to use YOLOv3, one of the most frequently used versions of the YOLO family, which comprises the 
state-of-the-art object detection system for the real-time scenario and it is amazingly accurate and fast.
you can give  the weights file created by training with YOLOv3 and our results on the custom dataset.
Also it has been added configuration files for use of weights file properly. 
You want to test our face detection system you can use the following sample code sample.

User Installation :

If you already have a working installation of numpy and pandas, opencv the easiest way to install yoloface is using pip

pip install yoloface

This Package Depend On Other Packages:

# Prerequisites
  1.numpy
  2.cv2
  3.os 
  4.PIL
  5.gdown
  6.time
  7.IPython

Usage

Face Detection In Image

# import libraries
from yoloface import face_analysis
import numpy
import cv2


face=face_analysis()        #  Auto Download a large weight files from Google Drive.
                            #  only first time.
                            #  Automatically  create folder .yoloface on cwd.

# example 1
%%time
img,box,conf=face.face_detection(image_path='path/to/jpg/or/png/filename.jpg',model='tiny')
print(box)                  # box[i]=[x,y,w,h]
print(conf)                 #  value between(0 - 1)  or probability
face.show_output(img,box)



# example 2
%%time
img,box,conf=face.face_detection(image_path='path/to/jpg/or/png/filename.jpg',model='full')
print(box)
print(conf)
face.show_output(img,box)

Real-Time Detection on a Webcam

from yoloface import face_analysis
import numpy
import cv2

# example 3
cap = cv2.VideoCapture(0)
while True: 
    _, frame = cap.read()
    _,box,conf=face.face_detection(frame_arr=frame,frame_status=True,model='tiny')
    output_frame=face.show_output(frame,box,frame_status=True)
    cv2.imshow('frame',output_frame)
    key=cv2.waitKey(1)
    if key ==ord('v'): 
        break 
cap.release()
cv2.destroyAllWindows()
#press v (exits)



# example 4
cap = cv2.VideoCapture(r'video file path.mp4')
while True: 
    _, frame = cap.read()
    __,box,conf=face.face_detection(frame_arr=frame,frame_status=True,model='full')
    output_frame=face.show_output(img=frame,face_box=box,frame_status=True)
    print(box)
    cv2.imshow('frame',output_frame)
    key=cv2.waitKey(0)
    if key ==ord('v'): 
        break 
cap.release()
cv2.destroyAllWindows()
#press v (exits)

Input Image

input

Output Image 1

output1

Output Image 2

output2

The YOLOv3 (You Only Look Once) is a state-of-the-art, real-time object detection algorithm. The published model recognizes 80 different objects in images and videos. For more details, you can refer to this paper. Reference link

Github file source fist Github file source second

Change Log

0.0.1 (28/04/2021)

  • First Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yoloface-0.0.3.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file yoloface-0.0.3.tar.gz.

File metadata

  • Download URL: yoloface-0.0.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for yoloface-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4549e2e77fe1387499c6ed6488807dde1233b21d5eaa8532660efb2ff93f25f0
MD5 9eed3097fa886cc2a1c59ef2f8c17c49
BLAKE2b-256 28f705219ea1036ef902e8e2f34e3ecfd19c7708a8219f74cdd3368e4c850843

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page