GithubHelp home page GithubHelp logo

ai's Introduction

AI01.py

python 接入 百度AI 人脸识别 爬虫 获取美女图片 并打分

1 数据源知乎 话题『美女』下所有问题中回答所出现的图片
2 抓取工具Python 
3,并使用第三方库 Requests、lxml、AipFace,代码共 100 + 行3 必要环境Mac / Linux / Windows (后两个没测,理论上可以,注意文件名的处理),无需登录知乎(即无需提供知乎帐号密码),人脸检测服务需要一个百度云帐号(即百度网盘帐号)
4 人脸检测库AipFace,由百度云 AI 开放平台提供,是一个可以进行人脸检测的 Python SDK。可以直接通过 HTTP 访问, 
5 检测过滤条件过滤所有未出现人脸图片(比如风景图、未露脸身材照等)过滤所有非女性(在抓取中,发现知乎男性图片基本是明星,故不考虑;存在 AipFace 性别识别不准的情况)过滤所有非真实人物,比如动漫人物 (AipFace Human 置信度小于 0.6)过滤所有颜值评分较低图片(AipFace beauty 属性小于 45,为了节省存储空间;再次声明,AipFace 评分无任何客观性)
6 实现逻辑通过 Requests 发起 HTTP 请求,获取『美女』下的部分讨论列表通过 lxml 解析抓取到的每个讨论中 HTML,获取其中所有的 img 标签相应的 src 属性通过 Requests 发起 HTTP 请求,下载 src 属性指向图片(不考虑动图)通过 AipFace 请求对图片进行人脸检测判断是否检测到人脸,并使用 『4 检测过滤条件』过滤将过滤后的图片持久化到本地文件系统,文件名为 颜值 + 作者 + 问题名 + 序号返回第一步,继续
7 抓取结果  直接存放在文件夹中
8 运行准备

安装 Python 3,Download Python 
安装 requests、lxml、 baidu-aip 库,都可以通过 pip 安装,一行命令
申请百度云检测服务,免费。人脸识别-百度AI 

huabanGirls.py

去花瓣 美女专题  爬取女性图片

ai's People

Contributors

kevin-zhou avatar

Stargazers

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

Watchers

 avatar

ai's Issues

if r["result_num"] == 0: KeyError: 'result_num'

Traceback (most recent call last):
File "C:/Users/Administrator/Desktop/AI-master/AI01.py", line 178, in
url = process_activities(datums, face_detective)
File "C:/Users/Administrator/Desktop/AI-master/AI01.py", line 109, in process_activities
scores = face_detective(s)
File "C:/Users/Administrator/Desktop/AI-master/AI01.py", line 142, in detective
if r["result_num"] == 0:
KeyError: 'result_num'

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.