Art  Lind

Art Lind


Face Detection in OpenCV

We will discuss how we can apply Face Detection using OpenCV. We go straightforward with a practical reproducible example.

The logic it the following: We get the image from the URL (or from the hard disk). We convert it to an numpy array and then to a grayscale. Then by applying the proper CascadeClassifier we get the bounding boxes of the faces. Finally, using PIllow (or even OpenCV) we can draw the boxes on the initial image.

import cv2 as cv
import numpy as np
import PIL
from PIL import Image
import requests
from io import BytesIO
from PIL import ImageDraw
## I have commented out the cat and eye cascade. Notice that the xml files are in the opencv folder that you have downloaded and installed
## so it is good a idea to write the whole path
face_cascade = cv.CascadeClassifier('C:\\opencv\\build\\etc\\haarcascades\\haarcascade_frontalface_default.xml')
#cat_cascade = cv.CascadeClassifier('C:\\opencv\\build\\etc\\haarcascades\\haarcascade_frontalcatface.xml')
#eye_cascade = cv.CascadeClassifier('C:\\opencv\\build\\etc\\haarcascades\\haarcascade_eye.xml')
URL = ""
response = requests.get(URL)
img =
img_initial = img.copy()
## convert it to np array
img = np.asarray(img)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray)
## And lets just print those faces out to the screen
## For each item in faces, lets surround it with a red box
for x,y,w,h in faces:
    ## That might be new syntax for you! Recall that faces is a list of rectangles in (x,y,w,h)
    ## format, that is, a list of lists. Instead of having to do an iteration and then manually
    ## pull out each item, we can use tuple unpacking to pull out individual items in the sublist
    ## directly to variables. A really nice python feature
    ## Now we just need to draw our box
    drawing.rectangle((x,y,x+w,y+h), outline="red")

#python #facedetection #ai #opencv #opencv-python

What is GEEK

Buddha Community

Face Detection in OpenCV
Chando Dhar

Chando Dhar


Deep Learning Project : Real Time Object Detection in Python & Opencv

Real Time Object Detection in Python And OpenCV

Github Link:

Blog Link:

I’m on Instagram as @knowledge_doctor.

Follow Me On Instagram :

Like My Facebook Page:

#python project #object detection #python opencv #opencv object detection #object detection in python #python opencv for object detection

Top 6 Alternatives To Hugging Face

  • With Hugging Face raising $40 million funding, NLPs has the potential to provide us with a smarter world ahead.

In recent news, US-based NLP startup, Hugging Face  has raised a whopping $40 million in funding. The company is building a large open-source community to help the NLP ecosystem grow. Its transformers library is a python-based library that exposes an API for using a variety of well-known transformer architectures such as BERT, RoBERTa, GPT-2, and DistilBERT. Here is a list of the top alternatives to Hugging Face .

Watson Assistant




#opinions #alternatives to hugging face #chatbot #hugging face #hugging face ai #hugging face chatbot #hugging face gpt-2 #hugging face nlp #hugging face transformer #ibm watson #nlp ai #nlp models #transformers

Face Liveness Detection through Blinking Eyes

Detect the Presence of Live Human Face with Open Source Tools

#face-liveness-detection #opencv-python #face-recognition #keras #progaming #opencv

Lenora  Hauck

Lenora Hauck


Face Detection with Python - OpenCV

Help me know if you want more videos like this one by giving a Like or a comment :)
Also please share with your friends :)
Download source code at:

#python #face detection #opencv

Face Mask Detector with OpenCV, Keras/Tensorflow and Deep Learning

The ongoing novel coronavirus pandemic situation is known to each and every individual. Almost every country has been affected by the devastating Coronavirus(COVID-19) disease. The pandemic threatens to reverse hard-won gains made in global health and human capital over the past decade. The mandated confinement and social distancing measures in force during an extended period of time, will make it beneficial to flatten the curve of transmission. Artificial intelligence could play an important part in the post-COVID recovery, helping to boost productivity and foster a new generation of innovative companies. While this situation happens to worsen day by day, it is very much essential for everyone to follow some rules in order to remain safe than to get badly affected with its consequences.

The frontline warriors are working hard to save many lives but it is more of an individual’s responsibility to fight one’s own battle and not compromise their health. Few ways suggested for it are: Washing hands regularly, maintaining social distance, wear face mask regularly and staying quarantined, if unwell

Here, I have tried to design a custom deep learning model of Face Mask Detector using OpenCV, Keras/Tensorflow libraries which detects if an individual is wearing a face mask or not and alerting for the same.

#face-mask #face-mask-detection #opencv #covid19 #deep-learning