Skip to main content

Programmer trains artificial intelligence to draw faces from text descriptions

T2F training time lapse

Programmer Animesh Karnewar wanted to know how characters described in books would appear in reality, so he turned to artificial intelligence to see if it could properly render these fictional people. Called T2F, the research project uses a generative adversarial network (GAN) to encode text and synthesize facial images.

Recommended Videos

Simply put, a GAN consists of two neural networks that argue with each other to produce the best results. For example, the job of network No. 1 is to fool network No. 2 into believing a rendered image is a real photograph while network No. 2 sets out to prove the alleged photo is just a rendered image. This back-and-forth process fine-tunes the rendering process until network No. 2 is eventually fooled.

Karnewar started the project using a dataset called Face2Text provided by researchers at the University of Copenhagen, which contains natural language descriptions for 400 random images.

“The descriptions are cleaned to remove reluctant and irrelevant captions provided for the people in the images,” he writes. “Some of the descriptions not only describe the facial features, but also provide some implied information from the pictures.”

While the results stemming from Karnewar’s T2F project aren’t exactly photorealistic, it’s a start. The video embedded above shows a time-lapsed view of how the GAN was trained to render illustrations from text, starting with solid blocks of color and ending with rough but identifiable pixilated renderings.

“I found that the generated samples at higher resolutions (32 x 32 and 64 x 64) has more background noise compared to the samples generated at lower resolutions,” Karnewar explains. “I perceive it due to the insufficient amount of data (only 400 images).”

The technique used to train the adversarial networks is called “Progressive Growing of GANs,” which improves quality and stability over time. As the video shows, the image generator starts from an extremely low resolution. New layers are slowly introduced into the model, increasing the details as the training progresses over time.

“The Progressive Growing of GANs is a phenomenal technique for training GANs faster and in a more stable manner,” he adds. “This can be coupled with various novel contributions from other papers.”

Image used with permission by copyright holder

In a provided example, the text description illustrates a woman in her late 20s with long brown hair swiped over to one side, gentle facial features and no make-up. She’s “casual” and “relaxed.” Another description illustrates a man in his 40s with an elongated face, a prominent nose, brown eyes, a receding hairline and a short mustache. Although the end results are extremely pixelated, the final renders show great progress in how A.I. can generate faces from scratch.

Karnewar says he plans to scale out the project to integrate additional datasets such as Flicker8K and Coco captions. Eventually, T2F could be used in the law enforcement field to identify victims and/or criminals based on text descriptions, among other applications. He’s open to suggestions and contributions to the project.

To access the code and contribute, head to Karnewar’s repository on Github here.

Kevin Parrish
Former Digital Trends Contributor
Kevin started taking PCs apart in the 90s when Quake was on the way and his PC lacked the required components. Since then…
The 10 best gaming monitors of 2024: tested and reviewed
Alienware ultrawide OLED on a desk.

Editor’s note: Gaming monitors are always hot sellers on Black Friday and Cyber Monday. We're expecting some really great discounts on some of the top models, including high-end OLED gaming monitors, super-fast refresh rate screens, and more budget-oriented fare. There are tons of fantastic monitor deals available now, and they're bound to get even better on Black Friday and Cyber Monday. Make sure to check out our other Black Friday deals or Cyber Monday deals for even more bargains on TV, headphones, and more.

A good monitor is essential for gaming due to its significant impact on the overall experience. There are a ton of options if you are on the hunt for one of the best gaming monitors, but for us, Alienware's 34 QD-OLED still takes the cake in 2024. It's not the display for everyone, though, and after reviewing dozens of the top gaming monitors, we've settled on a list of displays that offer great gaming performance for any budget or purpose.

Read more
Nvidia’s RTX 5070 Ti may trail behind the RTX 4080
Power adapter on the RTX 4070 Ti Super graphics card.

As we inch closer to the launch of Nvidia's RTX 50-series, new leaks keep cropping up daily. Today, one of the most prolific leakers in the PC hardware space shared a glimpse of the specs for Nvidia's upcoming RTX 5070 Ti. Although it's not the full spec sheet, one specification in particular tells us that we may be dealing with a GPU similar to the RTX 4080, which is still one of Nvidia's best graphics cards. But is that good news?

All of this is unconfirmed. Kopite7kimi is one of the accounts that most of us turn to when we want some new scoop on upcoming PC hardware, but this time, the leaker didn't post on X (Twitter), and has instead shared some specs directly with VideoCardz. Let's dig in.

Read more
I tried the RayNeo Air 2s glasses and they’re on sale for Black Friday
RayNeo Air 2s on custom Steam Deck - Briley Kenney Digital Trends_edited

With the holidays coming, I've been trying a spat of unique VR and AR devices. One pair I got my hands on, called the RayNeo Air 2s, basically gives you a portable 201-inch display that you can put on and use anytime, anywhere. They work with Android, Mac, Nintendo Switch, PS5, and -- my favorite -- Steam Deck. Our team has used the RayNeo Air 2 previously and also gave them high marks. Fun Fact I learned from reading that, RayNeo is actually a TCL brand. As for what I think of them, we'll get to that. For now, I want to talk about the crazy RayNeo Black Friday deals that have just dropped.

 
RayNeo Air 2 -- $184, was $380 51% off

Read more