Wolfram Research

Function Repository Resource:

CreateFace (1.0.0) current version: 1.1.1 »

Source Notebook

Retrieve the face of a nonexistent person from thispersondoesnotexist.com

Contributed by: Bob Sandheinrich

ResourceFunction["CreateFace"][]

returns a generated image of a face from thispersondoesnotexist.com.

ResourceFunction["CreateFace"][n]

returns n generated faces.

Details and Options

The following is the description on thispersondoesnotexist.com:
"Imagined by a GAN (generative adversarial network)".
"StyleGAN2 (Dec 2019)–Karras et al. and Nvidia".
"Don't panic. Learn how it works [1] [2] [3]".
"Code for training your own [original] [simple] [light]".
Repeated calls to the service can result in duplicate faces. To avoid duplicates, ResourceFunction["CreateFace"] supports a "WaitTime" option with a default value of 1 that adds time between each call to decrease the rate of duplicates.
These people do not exist.

Examples

Basic Examples (1) 

Create a new face using thispersondoesnotexist.com:

In[1]:=
ResourceFunction["CreateFace"][]
Out[1]=

Scope (1) 

Create four faces:

In[2]:=
ResourceFunction["CreateFace"][4]
Out[2]=

Options (2) 

By default, retrieving five images takes a few seconds and usually contains no duplicates faces:

In[3]:=
AbsoluteTiming[ResourceFunction["CreateFace"][5]]
Out[3]=

Use the "WaitTime" option with a value smaller than the default of 1 to get faster results with more duplicates:

In[4]:=
AbsoluteTiming[ResourceFunction["CreateFace"][5, "WaitTime" -> 0]]
Out[4]=

Applications (2) 

Create a dataset of facial feature data for generated faces. Most are happy in their nonexistent state:

In[5]:=
Dataset[FacialFeatures /@ DeleteDuplicates[ResourceFunction["CreateFace"][8]]]
Out[5]=

Create faces, then destroy them:

In[6]:=
ResourceFunction["OccludeFaces"] /@ ResourceFunction["CreateFace"][3]
Out[6]=

Publisher

Bob

Version History

  • 1.1.1 – 15 September 2023
  • 1.1.0 – 27 February 2023
  • 1.0.0 – 16 November 2021

Related Resources

Author Notes

Imagined by a GAN (generative adversarial network)
StyleGAN2 (Dec 2019)–Karras et al. and Nvidia
Don't panic. Learn how it works [1] [2] [3]
Code for training your own [original] [simple] [light]

License Information