Let Hugging Face Give You a Happy Face
Years ago, a co-worker mentioned that he used to see the band Offspring play in tiny venues in southern California. They were proud that they were fans long before the band was widely known. ChatGPT has become a public phenomenon, making the Machine Learning (ML) and Artificial Intelligence (AI) spaces part of the mainstream. If the thought of a playground full of emerging ML tools sounds like something you’re interested in, you should check out Hugging Face.
Huggingface.co is a site designed to let developers of ML apps have a place to test their tools and collaborate with others. A nice side effect of this community is that we have a place to play with these tools before they’re mainstream.
To see the most popular tools, you can go to the “Spaces” section of the site and change the sort order from newest to “Most Likes.”
Some of the tools are just fun to play with. Here I use one called AnimeGanv2 to turn a picture of me into an anime style images.
In addition to being fun, there are several tools that provide helpful functionality, including enhancing images and turning Wikipedia into your personal assistant.
Let’s look at one that can be extremely useful for OSINT purposes, Face Swap.
Most OSINT practitioners use accounts with fictitious
information, also known as “sock puppets,” when performing their research to
improve their operational security or OPSEC. This can help prevent your
personal accounts or information from being exposed to your research targets.
Creating these accounts has gotten tougher in the past
decade, with many sites requiring an actual phone number instead of a number
from an internet-based service or app. Another requirement being seen more frequently
now is a request to upload a picture of your face.
When this request first started to appear, there was an easy solution to the problem. You could use a realistic computer-generated face from a site like ThisPersonDoesNotExist for your account. Soon people began realizing how easy it was to detect a face made using this technology, and sites started to stop accepting these images. A better solution was to have a Photoshop expert take elements from two different real faces and create one realistic-looking “fake” person. The problem was that this was extremely difficult to do well. Thankfully, the advances in ML have made this task much easier to perform for the average user. One of the tools currently hosted on Hugging Face is “Face Swap.”
Face Swap takes features from a source facial image and places
them on a target image. The end result is an image that appears similar to the
target image, but has features from the source face merged in.
One of the most detectable features of an image generated with a Generative Adversarial Network (GAN) used by sites like ThisPersonDoesNotExist is that the eyes always appear in the same place.
Let’s look at how Face Swap helps us solve this problem.
Here I use a picture of myself as the target image and a source file from
ThisPersonDoesNotExist. Notice that the source image has eyes that appear in
the same spot as the images shown above. In under five seconds, Face Swap mixed
in elements from this fake face into the picture of me and created a realistic-looking
Notice that while the output image eyes look very similar to the fake source image, their position is from my target image and therefore doesn’t have the characteristics of being computer generated. This is an example of how ML has created an easy solution to a long-standing problem for OSINT researchers.