Implement Face Detection Using Python

Implement Face Detection Using Python

In this post, you'll learn how to build a face detection program using Python for yourself in less than 3 minutes.

Originally published by Sabina Pokhrel at https://towardsdatascience.com

Face detection is one of the most common applications of Artificial Intelligence. From camera applications in smartphones to Facebook’s tag suggestions, the use of face detection in applications is increasing every single day.

Face detection is the ability of a computer program to identify and locate human faces in a digital image.

With the increasing demand for face detection feature in applications, everyone is looking to use face detection in their application so that they are not left behind in the race.

In this post, I will teach you how to build a face detection program for yourself in less than 3 minutes.You will need to install the following python libraries if it is not already installed:

opencv-python
cvlib

Here is the code to import the required python libraries, read an image from storage and display it.

# import libraries
import cv2
import matplotlib.pyplot as plt
import cvlib as cvimage_path = 'couple-4445670_640.jpg'
im = cv2.imread(image_path)
plt.imshow(im)

Couple Photo (Image by Sonam Prajapati from Pixabay)

The code to detect faces in the loaded image, draw a bounding box around the detected faces and display the final image with detected faces is as follows.

faces, confidences = cv.detect_face(im)# loop through detected faces and add bounding box
for face in faces:    (startX,startY) = face[0],face[1]
    (endX,endY) = face[2],face[3]    # draw rectangle over face
    cv2.rectangle(im, (startX,startY), (endX,endY), (0,255,0), 2)# display output        
plt.imshow(im)

Result of Face Detection on couple image

You have your face detection program ready. It is that simple!

To know more about cvlib library, you can visit the link

Thanks for reading

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Further reading about Python

Python Tutorial - Python GUI Programming - Python GUI Examples (Tkinter Tutorial)

Python Tutorial: Image processing with Python (Using OpenCV)

A guide to Face Detection in Python

Face Detection using Open-CV


Machine Learning, Data Science and Deep Learning with Python

Machine Learning, Data Science and Deep Learning with Python

Complete hands-on Machine Learning tutorial with Data Science, Tensorflow, Artificial Intelligence, and Neural Networks. Introducing Tensorflow, Using Tensorflow, Introducing Keras, Using Keras, Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), Learning Deep Learning, Machine Learning with Neural Networks, Deep Learning Tutorial with Python

Machine Learning, Data Science and Deep Learning with Python

Complete hands-on Machine Learning tutorial with Data Science, Tensorflow, Artificial Intelligence, and Neural Networks

Explore the full course on Udemy (special discount included in the link): http://learnstartup.net/p/BkS5nEmZg

In less than 3 hours, you can understand the theory behind modern artificial intelligence, and apply it with several hands-on examples. This is machine learning on steroids! Find out why everyone’s so excited about it and how it really works – and what modern AI can and cannot really do.

In this course, we will cover:
• Deep Learning Pre-requistes (gradient descent, autodiff, softmax)
• The History of Artificial Neural Networks
• Deep Learning in the Tensorflow Playground
• Deep Learning Details
• Introducing Tensorflow
• Using Tensorflow
• Introducing Keras
• Using Keras to Predict Political Parties
• Convolutional Neural Networks (CNNs)
• Using CNNs for Handwriting Recognition
• Recurrent Neural Networks (RNNs)
• Using a RNN for Sentiment Analysis
• The Ethics of Deep Learning
• Learning More about Deep Learning

At the end, you will have a final challenge to create your own deep learning / machine learning system to predict whether real mammogram results are benign or malignant, using your own artificial neural network you have learned to code from scratch with Python.

Separate the reality of modern AI from the hype – by learning about deep learning, well, deeply. You will need some familiarity with Python and linear algebra to follow along, but if you have that experience, you will find that neural networks are not as complicated as they sound. And how they actually work is quite elegant!

This is hands-on tutorial with real code you can download, study, and run yourself.

Learning in Artificial Intelligence - Great Learning

Learning in Artificial Intelligence - Great Learning

What is Artificial Intelligence (AI)? AI is the ability of a machine to think like human, learn and perform tasks like a human. Know the future of AI, Examples of AI and who provides the course of Artificial Intelligence?

US and China are massively investing in Artificial Intelligence which create a promising career in the field. One of the first steps to a successful artificial Intelligence career is to learn the basics around the domain. Articles and Guides are your opening friends towards a successful AI Career. Read on to know more.

Data Science Full Course - Data Science For Beginners

Data Science Full Course - Data Science For Beginners

This video on Data Science is a full course compilation that will help you gain all the concepts, techniques, and algorithms involved in data science. Python and R are the primary programming languages used for data science.

Data Science Full Course | Data Science For Beginners | Learn Data Science In 10 Hours

Here, you will understand the basics of data science, such as data munging, data mining, and data wrangling. You will come across how to implement linear regression (2:30:10), logistic regression (3:09:12), decision tree (3:27:04), random forest, support vector machines (5:17:21), time series analysis (7:33:05), and lots more.

You will get an idea about the salary, skills, jobs, and resume of a data scientist (9:00:04).

Finally, you will learn about the important data science interview questions (9:04:42) that would help you crack any data science interview. Now, let's get started and learn data science in detail.

Below topics are explained in this Data Science tutorial:

1. Data Science basics (01:28)

2. What is Data Science (05:51)

3. Need for Data Science (06:38)

4. Business intelligence vs Data Science (17:30)

5. Prerequisites for Data Science (22:31)

6. What does a Data Scientist do? (30:23)

7. Demand for Data Scientist (53:03)

8. Linear regression (2:30:10)

9. Decision trees (2:53:39)

10. Logistic regression in R (3:09:12)

11. What is a decision tree? (3:27:04)

12. What is clustering? (4:35:40)

13. Divisive clustering (4:51:14)

14. Support vector machine (5:17:21)

15. K-means clustering 96:44:13)

16. Time series analysis (7:33:05)

17. How to become a Data Scientist (8:26:54)

18. Job roles in Data Science (8:30:59)

19. Simplilearn certifications in Data Science (8:33:50)

20. Who is a Data Science engineer? (8:34:34)

21. Data Science engineer resume (9:00:04)

22. Data Science interview questions and answers (9:04:42)