Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to climb a beautiful woman with Python

Shulou Source: shulou.com Published: 2022-06-02 01:10:04 10月02日 Update

How to use Python to climb beautiful women, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1 data source

The pictures that appear in all the questions answered under the topic "Beauty"

2 grab tool

Python 3, and use third-party libraries Requests, lxml, AipFace, with a total of 100 + lines of code

3 necessary environment

Mac / Linux / Windows (Linux has not been tested, in theory. Most of the reactions in Windows were abnormal before, but windows has restricted the characters in the local file name and used regular filtering.)

There is no need to log in to Zhihu (that is, there is no need to provide the password of Zhihu account)

Face detection service requires a Baidu cloud account (that is, Baidu network disk / post bar account)

4 face detection database

AipFace, provided by Baidu Cloud AI open platform, is a Python SDK that can detect faces. You can access it directly through HTTP and use it for free.

5 detect the filter condition

Filter all non-appearing face pictures (such as landscape pictures, unexposed body photos, etc.)

Filter all non-women (in the crawl, it is found that Zhihu male pictures are basically stars, so they are not considered; there is a case of inaccurate gender identification in AipFace)

Filter all non-real characters, such as anime characters (AipFace Human confidence less than 0.6)

Filter all images with low appearance score (AipFace beauty attribute is less than 45, to save storage space; again, AipFace score does not have any objectivity)

6 implementation logic

Initiate a HTTP request through Requests to get a partial discussion list under "Beauty"

Parse the HTML in each discussion captured by lxml, and get the corresponding src attributes of all img tags in it.

Initiate a HTTP request through Requests, and download the src attribute to point to the image (regardless of moving image)

Face detection of the image through AipFace request

Determine whether a human face is detected and filter using "4 detection filter conditions"

Persist the filtered image to the local file system, and the file name is face + author + question name + serial number.

Return to the first step and continue

7 grab the result

Store it directly in the folder (angelababy strength exit). In addition, apart from baby, 88 is the highest score for the pictures captured so far. Personally, I object to the ranking, but my wife is not the highest score.

Code

9 Operation preparation

Install Python 3 perfect download Python

Install requests, lxml, baidu-aip libraries, all of which can be installed through pip, with one command

Apply for Baidu cloud testing service, free of charge. Face recognition-Baidu AI

After reading the above, have you mastered the method of how to climb a beautiful woman with Python? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Picture detection face beauty file attribute problem account highest character code content method more highest score condition service score necessary helpless Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Xiaomi Shulou Technology Shulou Information OPPO Reno