Giter Site home page Giter Site logo

facerecognition's Introduction

Face Recognition

Face Recognition using OpenCV in Python

Youtube Tutorial

https://youtu.be/h21wMKGs0qs

Prerequisites

Numpy
OpenCV

Note: Please install opencv-contrib-python package instead of opencv-contrib as it contains the main modules and also contrib modules.

Installing

Install Numpy via anaconda: conda install numpy

Install OpenCV via anaconda: conda install -c menpo opencv

Running the tests

Run Tester.py script on commandline to train recognizer on training images and also predict test_img:

python tester.py

1.Place some test images in TestImages folder that you want to predict in tester.py file
2.Place Images for training the classifier in trainingImages folder.If you want to train clasifier to recognize multiple people then add each persons folder in separate label markes as 0,1,2,etc and then add their names along with labels in tester.py/videoTester.py file in 'name' variable.
3.To generate test images for training classifier use videoimg.py file.
4.To do test run via tester.py give the path of image in test_img variable
5.Use "videoTester.py" script for predicting faces realtime via your webcam.(But ensure that you run tester.py first since it generates training.yml file that is being used in "videoTester.py" script.

Acknowledgments

facerecognition's People

Contributors

neha01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facerecognition's Issues

AttributeError

module 'cv2.cv2' has no attribute 'face'

in line---> "face_recognizer=cv2.face.LBPHFaceRecognizer_create()"

Why do we have resizedimagesfolder here ?

This is not an issue but curious to know why do we have resizedimages folder. Code worked fine without that folder too.
But if I have to use this code on my own dataset, can I resize it first and run the trainer to save time ? Will the accuracy be same ?

Error on OpenCV4.1.1

cv2.error: OpenCV(4.1.1) /home/pi/opencv_contrib/modules/face/src/lbph_faces.cpp:365: error: (-210:Unsupported format or combination of formats) Labels must be given as integer (CV_32SC1). Expected 4, but was 6. in function 'train'.
Can you please help me ?

cv::CascadeClassifier::detectMultiScale

Traceback (most recent call last):
File "C:\Users\DELL\Desktop\openCV.py", line 18, in
faces=face_cascade.detectMultiScale(gray_img,scaleFactor=1.32,minNeighbors=5)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1658: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'

I don't know what to do in this phase!

opencv error

File "tester.py", line 9, in
faces_detected,gray_img=fr.faceDetection(test_img)
File "C:\Users\sunil\Desktop\ml_project\me\face_recognition.py", line 6, in faceDetection
gray_img=cv2.cvtColor(test_img,cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

this is the error i m getting.Can you tell me what to do in that

Error in printing faces_detected

I am having this error on printing faces_detected after using faceDetection module -

OpenCV(3.4.2) c:\miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper<struct cv::Set<3,4,-1>,struct cv::Set<1,-1,-1>,struct cv::Set<0,2,5>,2>::CvtHelper'

in the line -
gray_img = cv2.cvtColor(test_img,cv2.COLOR_BGR2GRAY)

opencv error

File "tester.py", line 9, in
faces_detected,gray_img=fr.faceDetection(test_img)
File "C:\Users\sunil\Desktop\ml_project\me\face_recognition.py", line 6, in faceDetection
gray_img=cv2.cvtColor(test_img,cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

this is the error i m getting.Can you tell me what to do in that

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.