View full-text article in PMC Sensors (Basel). 2023 Jan 11;23(2):853. doi: 10.3390/s23020853 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). PMC Copyright notice Algorithm 2 Training AdvFace in impersonation attack Input: X Training Face Dataset f Target Face Dataset F Cosine similarity between an image pair obtained by face matcher G Generator with weight Gθ D Discriminator with Dθ m Batch size α Learning size 1:for number of training iterations do 2: Sample a batch of probes {x(i)}i=1m∼X 3: Sample a batch of target images {y(i)}i=1m∼f 4: δ(i)=G(x(i),y(i)) 5: xadv(i)=x(i)+δ(i) 6: Lperturbation=1m[∑i=1mmax(P,||δ(i)||2)] 7: Lidentity=1m[∑i=1mE[1−F(y(i),xadv(i))]] 8: LD=1m[∑i=1mlog(1−D(xadv(i)))] 9: Ladv=1m[∑i=1mlog(D(y(i)))+log(1−D(xadv(i)))] 10: LG=LadvG+λiLidentity+λpLperturbation 11: Gθ=Adam(▽GLG,Gθ,β1,β2) 12: Dθ=Adam(▽DLD,Gθ,β1,β2) 13: end for