AI 是怎么从照片里认出人脸的?How Does AI Pick a Face Out of a Photo?

计算机视觉16 分钟阅读更新于 2026 年 6 月

手机看你一眼就解锁了,Facebook 在你动手之前就给朋友标好了名字。这些背后是同一项技术:人脸识别 AI。下面用大白话把它讲清楚。

◆知微•计算机视觉 · 16 分钟阅读 · 2026 年 6 月 26 日
Computer Vision16 min readUpdated June 2026

Your phone opens the moment it sees you. Facebook puts a name on your friends before you do. Both rest on the same thing: facial recognition AI. Here is how that technology works, in plain English.

◆知微•Computer Vision · 16 min read · June 26, 2026
照片里的人脸,AI 是怎么认出来的?(2026 指南)

看一眼手机就解锁了;Facebook 上的照片会自动提示该给哪位朋友加标签;机场安检会扫过你的脸。场景各不相同,背后却是同一套引擎:人脸识别 AI。真正该问的是它内部到底做了什么——机器怎么能看一眼照片,就报出一个名字?

答案既比你想的简单,也比你想的复杂。下文会把完整流程走一遍,但不会用术语把你淹掉:先在一张拥挤的画面里定位一张脸,再拿它与数百万个身份逐一比对。全程用日常语言说明。

想了解底层的技术?驱动当代人脸识别系统的架构之一,我们在 什么是 Transformer 模型 这篇里讲过。

01朴素答案:靠的全是模式

说到底,这套机制的底层是算术:你的脸被转成一组数字。真的是数字。两眼间距多少、颧骨形状如何、嘴唇弧度怎样——每一项都会被表述成某种数学关系。

可以拿你向别人描述某个人时的说法作比:「蓝眼睛、尖鼻子、卷头发」。机器做的事与之类似,只不过形容词换成了精确的测量值和数值关系。把这些汇总起来,就是你的「faceprint」——一份独特程度不亚于指尖纹路的数字签名。

这一切还建立在一个更基础的问题上:AI 最初是怎么处理原始信息的。我们在 什么是 AI 中的分词(tokenization) 里讲过,不同类型的数据是如何被转换成机器可处理的格式。

02从照片到身份:一步步来看

下面把这条从照片到身份的路径逐段拆开:

03互动演示:亲眼看看人脸识别怎么跑

想看看关键点检测实际跑起来是什么样?点击下面的按钮,可以逐项看到机器「看」一张脸的方式:

04幕后的大脑:神经网络

这种识别人脸的能力最初从哪来?答案是深度学习神经网络——一种在设计上对人类大脑作了松散借鉴的计算系统。

训练过程是这样的。工程师把数百万张标注好的人脸照片摆到系统面前:「这张是 John。这张是 Sarah。这张是 Michael。」网络逐个研究样本、搜寻规律,可能会注意到 John 的下颌更宽、Sarah 的两眼靠得更近、Michael 的鼻子有独特的形状。

渐渐地,它摸清了在需要区分两个人时,哪些特征最重要。你自己的经验其实也差不多:你认得出朋友,并不是拿尺子量过他们的脸,而是见得足够多之后,大脑自动抓住了他们身上独有的东西。

让这一切成为可能的是数据量。我们在 AI 训练为什么需要这么多数据 里专门讨论了这一前提。

部件它做什么日常类比
卷积层提取面部的边缘、形状与纹理好比你会注意到某人的颧骨很立体
池化层削减复杂度,让重要特征凸显出来好比记住一张脸的整体轮廓,而不是每个毛孔
全连接层把所有特征汇总起来,得出最终身份判断好比你综合所有特征后脱口而出「那是 Sarah!」
激活函数判断哪些特征足够重要、值得保留好比大脑屏蔽背景噪声,把注意力放在一张脸上

05你每天都在遇到的人脸识别

这门技术并不只存在于科幻里。它比你意识到的更深地织进了你的日常:

手机解锁

设备的解锁靠的是 3D 面部测绘:Apple 的 Face ID 与 Android 的人脸解锁都是如此,它们会向你的脸投射数千个不可见的光点,从而构建一张精细的三维图。

照片整理

Google Photos、Apple Photos 和 Facebook 里的照片会按人物自动归类,想找出某位朋友或家人的所有照片只需几秒钟。

银行与支付

许多银行 App 会在放行交易或登录账户之前用人脸识别做身份核验,相当于多加一道防线。

机场安检

在边境,电子护照闸机会把你现场的脸与护照芯片里存的照片做比对——通关更快,安全性不打折。

门禁出入

现代办公楼和公寓正在用刷脸取代门禁卡,获授权的人无需接触任何设备就能进入。

零售与营销

一些零售商会用它来识别 VIP 顾客、发现扒手,或者分析顾客的人群构成与情绪。

这项技术的运作方式,与 AI 处理语言的方式有相通之处。我们在 AI 翻译是怎么工作的 里,讲了同一套模式匹配思路用在文字上的样子。

06准确率有多高?又在什么情况下失灵?

在理想条件下,如今的系统准确率高得惊人:最强的一批在标准基准测试上能跑到 99.8%。这句话里真正起作用的前提,是「理想条件」。

容易让它犯难的情况:

  1. ✗

    光线不佳

    ✗ 特征被阴影吞掉,关键点就很难定位。逆光强烈时情况最糟。

  2. ✗

    角度极端

    ✗ 正面或略微侧转的脸效果最好。纯侧面视角,或上下俯仰超过 30 度,都会让准确率明显下滑。

  3. ✗

    面部遮挡

    ✗ 口罩、墨镜、浓妆,甚至浓密的胡须,都可能遮掉系统赖以判断的关键点。

  4. ✗

    分辨率过低

    ✗ 画面里的人脸如果模糊、像素化或过于小,细节不足,特征就无法被正确提取。

  5. ✗

    外貌变化

    ✗ 体重明显变化、衰老、整容,甚至只是换了个发型,都可能让一个用旧照片训练出来的系统判断失准。

有一点要分清楚:人脸识别和一般意义上的自动化并不是一回事。想了解 AI 能力的整体版图,可以看 AI 与自动化的区别。

07隐私之争:我们该担心吗?

这项技术附带着严肃的隐私与伦理问题,而社会至今还没找到答案:

监管正在跟上。越来越多的城市和国家开始限制、甚至全面禁止在公共场所使用人脸识别;欧盟的《人工智能法案》(EU's AI Act)以及美国各州陆续出台的法律,都在试图在安全收益与隐私权之间取得平衡。

08常见问题

AI 是如何在照片里识别出人脸的?
流程从检测开始:系统在图中定位眼睛、鼻子和嘴巴,再把这些特征转成一组独特的数字,也就是「faceprint」。随后拿这串数字与已知人脸库比对,看是否有匹配。整套流程运行在经数百万张人脸图像训练过的深度学习神经网络之上。
人脸检测和人脸识别之间有什么区别?
检测只负责找到人脸的位置,并给每张脸画个框。识别则更进一步,把面部特征与已知人物数据库比对,判断这张脸究竟属于谁。
人脸识别 AI 的准确率可靠吗?
在条件良好时,如今的人脸识别 AI 准确率很高——光线合适、照片清晰且为正面时,达到 99% 以上很常见。但遇到光线差、角度怪异、口罩之类的遮挡,或外貌发生明显变化,准确率就会下降。
人脸识别在日常生活中的用途有哪些?
它无处不在:Face ID 解锁手机、Facebook 在照片里提示标签、机场做安检、Google Photos 整理相册,部分支付系统也在用。它已经悄然成为现代生活的一部分。
AI 能识别老旧或低画质照片里的人脸吗?
关键在质量。对于年代久远或分辨率偏低的照片,现代 AI 的处理效果有时出人意料地好;但一旦人脸过于模糊、过小、损坏严重,或拍摄角度极端,准确率就会急剧下降——系统需要足够的细节才能提取关键特征。
人脸识别有可能被骗过吗?
有可能,但难度已经大了很多。早期系统拿一张照片或一副面具就能骗过。如今的 3D 系统加入了活体检测——会检查是否眨眼、是否有头部动作——门槛因此高出不少;不过借助深度伪造或高仿真面具的复杂攻击,依然是实实在在的隐患。
完全黑暗的环境下人脸识别还能用吗?
常规的人脸识别至少需要一点光。另一些系统则绕开了这个限制,改用红外摄像头或 3D 深度传感器——Face ID 就是一例——它们把不可见的光图案投射到你的脸上,因此在完全黑暗中也能工作。
AI 一次最多能识别多少张人脸?
目前的系统可以从单张图片中同时检出几十张、有时甚至上百张人脸。限制它的通常不是算法,而是算力和数据库规模。
◆

知微

让复杂的 AI 技术变得人人能懂,是我们的动力所在。本文把人脸识别拆成了容易消化的概念。还有疑问?我们随时愿意帮忙!

A glance opens your phone. A photo on Facebook arrives with your friend's name already suggested. Security at the airport sweeps your face. Different moments, one underlying engine: facial recognition AI. The obvious question is what happens inside it, how does a machine glance at a picture and come back with a name?

The truth sits somewhere between simple and surprisingly involved. What follows traces the whole path without burying you in jargon: spotting a single face inside a crowded frame, then testing it against millions of other identities. Everyday language throughout.

Curious about the machinery underneath? One of the architectures that drives today's facial recognition systems is covered in our piece on what a transformer model actually is.

01The Plain Answer: Everything Comes Down to Patterns

Strip it to the core and the mechanism is arithmetic: your face becomes a set of numbers. Literally numbers. Eyes spaced a certain way, cheekbones shaped a certain way, lips curving a certain way, each of those gets expressed as a mathematical relationship.

Compare it to the way you describe a person out loud: "blue eyes, a pointed nose, curly hair." The machine does a comparable job, except that adjectives give way to exact measurements and numeric relations. Assemble all of them and you have your "faceprint", a digital signature no less distinctive than the ridges on your fingertip.

All of this sits on top of something more basic: how AI handles raw information in the first place. Our guide to what tokenization means in AI covers how different kinds of data get turned into a format the machine can work with.

02Photo to Identity, One Step at a Time

Here is that journey laid out stage by stage:

03Try It: Watch Facial Recognition Happen

Curious what landmark detection looks like as it runs? The buttons below will show you, one aspect at a time, the way a machine "sees" a face:

04Under the Hood: Neural Networks

Where does the ability to recognise a face come from in the first place? From deep learning neural networks, computing systems whose design takes loose inspiration from the human brain.

The training routine goes like this. Engineers put millions of labelled face photos in front of the system: "This one is John. This one is Sarah. This one is Michael." The network studies each example hunting for patterns, and may register that John's jaw is broader, that Sarah's eyes sit closer together, that Michael's nose has a shape of its own.

Gradually it works out which features carry the most weight when two people have to be told apart. Your own experience is not so different: you recognise your friends not by running a ruler across their faces, but from having seen them often enough that your brain latches onto what makes them distinctive.

Data volume is what makes this possible. Our article on why AI training demands so much data digs into that requirement.

LayerWhat It DoesA Human Comparison
Convolutional LayersPicks out edges, shapes and textures across the faceComparable to noticing that someone's cheekbones are sharp
Pooling LayersStrips away complexity so the important features stand outComparable to recalling a face's overall shape rather than every pore
Fully Connected LayersPulls every feature together to reach the final identificationComparable to assembling all the features and concluding "That's Sarah!"
Activation FunctionsDetermine which features matter enough to be retainedComparable to your brain tuning out background noise to focus on a face

05Facial Recognition You Already Meet Every Day

This is not the stuff of science fiction. It is threaded through your ordinary day far more than you probably notice:

Unlocking Your Phone

Devices stay locked or open thanks to 3D facial mapping: Apple's Face ID and Android face unlock both work this way, casting thousands of invisible dots across your face to build a detailed 3D map.

Sorting Your Photos

Photos in Google Photos, Apple Photos and Facebook get grouped by person automatically, so pulling up every shot of one friend or relative takes seconds.

Banking and Payments

Verification before a transaction or an account login is handled by face recognition in many banking apps, which adds one more layer of protection.

Border Control

At the border, ePassport gates hold your live face against the image stored in your passport chip: faster queues, security intact.

Door and Building Access

Keycards are giving way to face recognition in modern offices and apartment blocks, so authorised people walk in without touching anything.

Retail and Marketing

Some retailers apply it to flag VIP shoppers, catch shoplifters, or read the demographics and moods of their customers.

There is a family resemblance between the way this technology works and the way AI handles language. Our guide to how AI translation works looks at the same pattern-matching ideas applied to words.

06How Accurate, and Where Does It Break Down?

Give today's systems ideal conditions and their accuracy is startling: the strongest ones post 99.8% on standard benchmarks. The qualifier doing all the work in that sentence is "ideal conditions."

Conditions That Trip It Up:

  1. ✗

    Bad Light

    ✗ Features get swallowed by shadow, so landmarks become hard to pin down. Strong backlighting is the worst offender.

  2. ✗

    Awkward Angles

    ✗ Frontal or slightly turned faces give the best results. A profile view, or a tilt beyond 30 degrees up or down, drags accuracy down sharply.

  3. ✗

    Things in the Way

    ✗ Key landmarks the system depends on can disappear behind masks, sunglasses, heavy makeup, or a substantial beard.

  4. ✗

    Low Detail

    ✗ Faces that are blurred, pixelated or simply too small in the frame carry too little detail for features to be extracted properly.

  5. ✗

    Changed Appearance

    ✗ Substantial weight change, ageing, surgery, or merely a different hairstyle can throw a system that was trained on older pictures.

Worth keeping straight: facial recognition and general automation are not the same thing. For the wider picture of what AI can and cannot do, see how AI differs from automation.

07Privacy: How Concerned Should You Be?

Serious questions about privacy and ethics come attached to this technology, and society has yet to settle them:

Regulation is arriving. Cities and countries are increasingly restricting or outright banning the use of facial recognition in public spaces, and frameworks such as the EU's AI Act, alongside a patchwork of US state laws, are being built to reconcile security gains with privacy rights.

08Questions People Ask Most

In what way does AI identify a face in a photo?
The pipeline starts with detection: the system locates eyes, nose and mouth in the image, then turns those features into a "faceprint", a distinctive series of numbers. That faceprint is checked against a store of known faces, and the whole thing runs on deep learning neural networks that have been trained on millions of facial images.
Where does face detection end and face recognition begin?
Detection stops at locating faces and drawing a box around each one. Recognition goes one step further, working out WHO a face belongs to by checking its features against a database of known individuals.
How reliable is facial recognition AI?
Under good conditions, today's facial recognition AI is highly accurate, 99%+ being common when the lighting is right and the photo is clear and front-facing. Accuracy does fall away with bad lighting, unusual angles, obstructions such as masks, or a marked change in appearance.
In daily life, what is facial recognition used for?
It turns up constantly: Face ID unlocks your phone, Facebook suggests tags in photos, airports run security checks, Google Photos sorts your library, and some payment systems use it too. It has quietly become part of ordinary modern life.
Can AI still recognize a face in an old or low-quality photo?
Quality decides everything. Older or low-resolution images can still be handled surprisingly well by modern AI, yet once a face is too blurry, too small, badly damaged or shot from an extreme angle, accuracy drops off sharply, because the system needs enough detail to pull out the key features.
Is it possible to fool facial recognition?
It can be, though it has become considerably harder. Photos and masks were enough to fool early systems. Today's 3D systems add liveness detection, checking for blinking or head movement, which raises the bar a lot, but clever attacks involving deepfakes or high-quality masks are still a real worry.
Does it work with no light at all?
Standard face recognition requires at least some light. Other systems sidestep the problem with infrared cameras or 3D depth sensors, Face ID being an example, which project invisible light patterns onto your face and therefore work in total darkness.
How many faces can be recognized at the same time?
Dozens, and in some cases hundreds, of faces in one image can be picked out by current systems. What limits them is normally processing power and the size of the database, not the algorithm.
◆

知微

Making complex AI technology understandable to everyone is what drives us. This guide turns facial recognition into concepts you can digest. Any questions? We're here to help!