How to detect landmark positions from caricature faces? - python

I have been working on the problem of recognizing faces from given caricatures using the IIIT-CFW dataset
So far, I have tried using Python's dlib library for detecting landmark points from the cartoon faces. However, it doesn't seem to work well on faces other than real human ones.
Is there any alternative for the same? Any suggestions regarding face alignment and landmark detection would be appreciated.

I would train a face landmarking model using dlib's tool on that dataset. Dlib comes with example programs showing you how to train new models (e.g. http://dlib.net/train_shape_predictor.py.html)

Related

Python face_recognition why not recognise cartoon image?

I am trying to face recognise by python Face-recognition library
I have tried below code for below image
Code :
import face_recognition
image = face_recognition.load_image_file("img/bill.jpeg")
property(image)
face_locations = face_recognition.face_locations(image)
print(len(face_locations))
For below image I am getting output for total face : 6
Image :
But When I am trying by a cartoon image
I am getting output : 0
How can I recognise cartoon face by face-recognition?
Sorry to say but if the face recognition is good it should not recognize cartoon faces, it's designed to recognize human faces and therefore should only tell you how many human faces it is on the image, otherwise it's a bad designed algorithm. If you want a machine-learning algorithm to recognize cartoon faces you would have to train it your self for that specific test.
I did a quick search on google and the first things I found was an article named "Cartoon Face Recognition: A Benchmark Dataset" at https://arxiv.org/pdf/1907.13394.pdf . Maybe you can find an already existing machine-learning algorithm that have been trained to recognize cartoon faces.
Hope this helped and I hope you find what you're looking for.
--------------------------------EDIT--------------------------------
I found these two git repositories, could be worth looking into more
https://github.com/srvCodes/Cartoon-Face-Detection-and-Recognition
https://github.com/hako/dissertation
The last link is a link for emotions of cartoon character.
Short answer: You need to train a new model to detect cartoon characters.
Long explanation:
Because cartoon characters have different facial features from normal
human faces. For cartoons, the face edges are smooth, perfectly round
eyes, smooth-shaped mouth, and cartoonish face structure.
The pre-trained model that you are using doesn't know to identify these structures, it hasn't seen such images during training.
A model detects a face using a lot of filters, these filters could detect lines and shapes in an image. If all these filters combine and give a high output, then there is a face in that location.
So, you either have to look for models that are trained on cartoons, or label
and train a model by your self.

Is there a better way other than HoG feature to recognize a real chess piece image?

I am using machine learning to recognize chess pieces. HoG is the feature used in my code to identify the different set of pieces, however, the results are not that accurate because of how HoG adjusts the image. Are there any other better ways to identify images, specifically chess pieces?
fd, hog_image = hog(img, orientations=16, pixels_per_cell=(8, 8),cells_per_block=(2, 2), visualize=True)
The main idea is to use convolutional neural networks if you have a classification problem. For the object detection (localization + classification) You can use TensorFlow object detection API as well as YOLO models.
Here you can read more
https://towardsdatascience.com/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9
https://github.com/tensorflow/models
https://medium.com/#jonathan_hui/real-time-object-detection-with-yolo-yolov2-28b1b93e2088
http://cs231n.github.io/convolutional-networks/

Low accuracy in facial recognition model

I am running the code provided by Adrian in this link https://www.pyimagesearch.com/2018/06/25/raspberry-pi-face-recognition/#comment-473194.
I have a dataset containing 6 faces of 3 people each. I ran this code and it works fine when detecting my face and my friend’s face. It faces trouble while detecting the third person’s face. It detects it as my face. Does this algorithm work only for binary classification? Will the accuracy improve if I improve if I make the dataset bigger?
If you increase your database. It will increase the accuracy for sure. Also opencv is not a good solution if you want to detect a face in real time for the sake of accuracy.Cause, when an object is moving, then the cascade function shows some kind of miss classification.
However you can use dlib function to make your processing robust. Or you can use yolo for face recognition.

Image processing and neural networks approach

I am currently working on a project for identification of mood/emotions of a person .
As the first step we are working on a image recognition , detection and tracking python code.
I went through the various different approach towards this problem and found out.
1)Haar cascade method (fast but no scope for recognition and reading expressions ).
2)Neural networks(Great at image recognition ie for details such as smile/ anger..... ).
I am confused with neural networks , ie the approach.
We can first use haar cascade to detect the faces with ease(really fast) then use either canny edge detection or Cropping to crop out the part of the face.
After that is done i have no clue on how to proceed .
This is my idea of it.
continue using haar cascade method to detect the features of the face like eyes, nose ,cheek ,lips....
then find out the distance between them to find out ratios which we can further use to form a neural network .
Different internal layers would be used to detect different features.
We can use differential method to optimize the cost by altering the weights of the synapses .
How good is the approach and is there a better way to do it .
Like say we can use canny edge to detect the edges and then make a new matrix just out of the edges and then use this to train the data.
I dont know , i am really confused.
Anyways thanks in advance for all answers
Image processing libraries such as scikit-image or OpenCV are a good place to start. For example, here's an example of canny edge detection in OpenCV.
Regarding neural networks, as lejlot pointed out, you've got to ask yourself how much you want to build from scratch.
An example for building your own neural network based on some parameters (which you'd have to define for your facial features), I suggest you read through A Neural Network in 11 lines of Python which illustrates some of problems you might face (especially part 2 where it's about image processing too).
What you seem to need are Convolutional Neurl Networks (check this http://cs231n.github.io/convolutional-networks/ to learn about them).
Convolutional Neural Networks (CNN for short) are a kind of neural nets that learn to extract visual features from an image and how to relate those features to recognize what's on the image, so you don't need to detect all the features, just give a CNN a bunch of labeled face pictures and it will learn to identificate the mood of the eprson.
What you can do is to detect the face in every picture (openCV is good enough at detecting faces) and then crop and align each face so all the faces have the same size. Then feed the CNN with all the faces, and it will gradually learn to recognize the emotions of a person.

Which training method is used in cv2.createLBPHFaceRecognizer.train?

I am doing a project for recognizing expressions.my plan is to use LBP and SVM.For Implementing I choose Opencv and Python.I know that there is a inbuilt function createLBPHFaceRecognizer in opencv for LBP calculations.Which training method is used in createLBPHFaceRecognizer.train, is it SVM or K nearest or anything else?
I worked on a similar problem and if I was you, I would first detect face landmarks (best is DLib: http://dlib.net/webcam_face_pose_ex.cpp.html but in C++) then classify face points to get expression. They made something great in JavaScript (face landmarks, expressions classification - https://github.com/auduno/clmtrackr) but it is not pretty robust in detecting face landmarks.

Categories

Resources