Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Python implements a face value prediction


Jun 01, 2021 Article blog



This article was reproduced to Know ID: Charles (Bai Lu) knows his personal column

Download the W3Cschool Mobile App, 0 Foundation Anytime, Anywhere Learning Programming >> Poke this to learn

Lead

Use Python to predict the face in a photo!!!

As for the reliability of the results....

I am not responsible for !!!

Those who are not satisfied with the results or who can't think of them because the result score is too low, please contact xxxPh.D. yourself. T hat is, the proposer of this face value prediction algorithm!!! I'm only partially re-emerging his algorithm!!!

The above and the following are pure jokes, if there is a similarities, it is not a great honor.


Related documents

Web disk download link: https://pan.baidu.com/s/1E_fc7PNaBHfMXNz3xLb12A

Password: 7nhm


The required tools

Python version: 3.5.4 (64bit)

Related modules:

opencv_python modules, sklearn modules, numpy modules, dlib modules, and some Python-owned modules.


Environment construction

(1) install the corresponding version of Python and add it to the environment variable;

(2) Pip installs the modules mentioned in the relevant modules.

For example:

 Python implements a face value prediction1

If the pip installation is reported as wrong, please go to:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Download the whl file for the pip installation error module and use:

Pip install whl file path s whl file name installation.

For example:

(I have provided the compiled whl file for the dlib library installation in the relevant files - > because this library is the worst to install)

 Python implements a face value prediction2

Reference link

1: xxxPh.D. blog

http://www.learnopencv.com/computer-vision-for-predicting-facial-attractiveness/

2: A laboratory at South China University of Technology

http://www.hcii-lab.net/data/SCUT-FBP/EN/introduce.html


The main idea

(1) Model training

The features are compressed and degraded by PCA algorithm.

Then train the model with a random forest.

The data originated from the network, it is said that the data "origin" is a laboratory of South China University of Technology, so I only added a link to this laboratory in the reference.

(2) Extract the key point of the face

The dlib library is mainly used.

Build feature extractors using officially available models.

(3) Feature generation

Full reference to xxxPh.D. blog.

(4) Face value prediction

Use previous data and models to make face value predictions.


How to use it

People with special diseases should carefully try to predict their face value, I am not responsible for the results of the face value prediction and all the negative effects!!!

It's true.

After the environment is built, unzip the Face_Value.rar file in the relevant file, and the cmd window switches to the directory where the decompressed .py file is located.

For example:

 Python implements a face value prediction3

Open the test_img folder and you'll need to predict the value of the photo to put in and rename it to the test .jpg.

For example:

 Python implements a face value prediction4

If you are in trouble or have other needs, please modify it yourself:

getLandmarks.py line 13 in the file.

Finally, run in turn:

train_model.py (ignore this step if you want to use my model directly)

getLandmarks.py

getFeatures.py

Predict.py

Use the demo

 Python implements a face value prediction5