当前位置:网站首页>[machine learning notes] [face recognition] deeplearning ai course4 4th week programming
[machine learning notes] [face recognition] deeplearning ai course4 4th week programming
2022-07-26 10:38:00 【LittleSeedling】
Face recognition
The goal is :
1. Use pre trained models , Conduct
1.1 Face verification
1.2 Face recognition
Face verification
Give a group 【 Face and identity 】, Look up... In the database ,【 Face 】 and 【 identity 】 match .
Send two pictures into CNN Online code become 128 Dimension vector .
Compare the two code Between distance , The smaller the distance , The more similar
CNN The Internet
Use FaceNet Model ( Others have been trained )
CNN Loss function of
Triplet loss
- A yes “Anchor”, It's an image of a person .
- P yes “Positive”, Is relative to “Anchor” Another image of the same person .
- N yes “Negative”, Is relative to “Anchor” Another image of a different person .
A-P The square of , Add each dimension + α \alpha α < A-N The square of , Add each dimension
∑ i n ∣ ∣ f ( A i ) − f ( P i ) ∣ ∣ 2 + α < ∑ i n ∣ ∣ f ( A i ) − f ( N i ) ∣ ∣ 2 \sum_i^n||f(A_i)-f(P_i)||^2 + \alpha < \sum_i^n||f(A_i) - f(N_i)||^2 i∑n∣∣f(Ai)−f(Pi)∣∣2+α<i∑n∣∣f(Ai)−f(Ni)∣∣2
A And P Between distance Be as small as possible ,A And N Between distance Try to be as big as possible .
among , α \alpha α yes 【 identical 】 and 【 Different 】 At least the distinction between images .
Transposition to ,
∑ i n ∣ ∣ f ( A i ) − f ( P i ) ∣ ∣ 2 − ∑ i n ∣ ∣ f ( A i ) − f ( N i ) ∣ ∣ 2 + α < 0 \sum_i^n||f(A_i)-f(P_i)||^2 - \sum_i^n||f(A_i) - f(N_i)||^2 + \alpha < 0 i∑n∣∣f(Ai)−f(Pi)∣∣2−i∑n∣∣f(Ai)−f(Ni)∣∣2+α<0
We define , Loss function ( Triplet loss ):
J ( A , P , N ) = m a x ( ∑ i n ∣ ∣ f ( A i ) − f ( P i ) ∣ ∣ 2 − ∑ i n ∣ ∣ f ( A i ) − f ( N i ) ∣ ∣ 2 + α , 0 ) J(A,P,N) = max(\sum_i^n||f(A_i)-f(P_i)||^2 - \sum_i^n||f(A_i) - f(N_i)||^2 + \alpha,0) J(A,P,N)=max(i∑n∣∣f(Ai)−f(Pi)∣∣2−i∑n∣∣f(Ai)−f(Ni)∣∣2+α,0)
send J As small as possible .
Implementation verification
Input 【 Face 】 and 【 identity 】. We need to verify that , The 【 Face 】 Is it this 【 identity 】.
We can store all the data in the database in advance 【 Face 】 Encoding , And use Dictionaries take 【 Face 】 and 【 identity 】 One-to-one correspondence .
after , Whenever the camera takes a picture , We just need to put it in CNN Online code , And then This code And database Code of corresponding identity Calculate both distance . if distance dist Less than threshold The verification is successful .
Face recognition
Input 【 Face 】. We need to verify that , The 【 Face 】 Is it in the database .
The practice is similar Face verification , In advance, code Good database all 【 Face 】
Traverse the coding of all faces in the database , Calculate the distance between the two . Take the minimum value of all distances .
If it's time to Minimum distance Less than threshold , Then the verification is successful .
边栏推荐
猜你喜欢
Introduction to data analysis | kaggle Titanic mission
Comparison of packet capturing tools fiddler and Wireshark
Redis Docker实例与数据结构
[Halcon vision] Fourier transform of image
[machine learning notes] [style transfer] deeplearning ai course4 4th week programming(tensorflow2)
控制随机抽中几率 [ C# | Random ]
【机器学习小记】【搭建循环神经网络及其应用】deeplearning.ai course5 1st week programming(keras)
Analysis of the transaction problem of chained method call
Centos8 (liunx) deploying WTM (asp.net 5) using PgSQL
多目标优化系列1---NSGA2的非支配排序函数的讲解
随机推荐
kali 查看ip地址
11 在 operator= 中处理“自我赋值”
10 令 operator= 返回一个 reference to *this
Controller返回JSON数据
C language calculation date interval days
Analysis of the transaction problem of chained method call
剑指Offer(九):变态跳台阶
[leetcode每日一题2021/2/18]【详解】995. K 连续位的最小翻转次数
鹏哥C语言第四课(3)
父类对子类的引用(父类引用指向子类对象)
MD5加密
Asynctask < T> decoration and await are not used in synchronous methods to obtain asynchronous return values (asynchronous methods are called in synchronous methods)
Redis特殊数据类型使用场景
JS对象赋值问题
putty的使用教程
Centos8 (liunx) deploying WTM (asp.net 5) using PgSQL
数据分析入门 | kaggle泰坦尼克任务(一)—>数据加载和初步观察
uniapp使用简单方法signalR(仅用于web调试,无法打包app)
Inheritance method of simplified constructor (II) - class inheritance in ES6
MD5 encryption