Joke Collection Website - Mood Talk - The owner of Bilibili Up made his own bald head generator, and you can get the same hairstyle as Zhang Dongsheng with one click. Netizens: The baldness is too real.
The owner of Bilibili Up made his own bald head generator, and you can get the same hairstyle as Zhang Dongsheng with one click. Netizens: The baldness is too real.
Recently, "The Hidden Corner" has become a hit all over the Internet, and the role of Zhang Dongsheng played by Qin Hao in the play is even more popular. If you take stock of Zhang Dongsheng's famous scenes, this scene is definitely indispensable: "Want to see yourself twenty years from now?
With spider webs on both sides and an ice rink in the middle, as a mathematics teacher, Zhang Dongsheng has been in grade 2 Being bald like this. Although the show uses special effects of makeup, hair loss has become a common anxiety among young people, especially young people working in high-pressure industries such as scientific research and programmers. It seems that baldness has become a destined fate. How many people have imagined themselves. What will you look like bald in twenty years?
After watching "The Hidden Corner", MarsLUL, the owner of Station B, decided to use code to realize his "dream". MarsLUL is an employee at Google. A programmer who studied computer science at the University of California (UC Irvine).
In a recently uploaded video, he used StyleGAN to create a baldness generator that can transform hair from thick hair. See yourself with thinning hair after twenty years. Let’s take a look at the effect.
First, let’s restore the whole process of Dongsheng’s baldness. The speed at which the hairline recedes is really scary. .
From the perspective of the generation effect, except for some differences in the face, the final hairstyle is still very consistent.
Looking at MarsLUL, this picture is simply unacceptable.
Netizens’ comments are even more heart-wrenching: It’s as if they have seen my future.
If you are also worried about hair loss and want to see yourself in twenty years, let’s do the same thing. Let’s talk about how the bald generator is implemented in detail.
In the video on Station B, MarsLUL did not present the implementation process of the code in detail, but the core technology and detailed reference materials used were given. The technology used in the generator, like the common image generators on the market, is NVIDIA’s open source StyleGAN. StyleGAN has excellent performance in terms of image synthesis quality and resolution. Usually, the realistic face exchanges we see are It is implemented based on it.
Based on StyleGAN technology, "Hairstyle Transfer-Semantic Editing GAN Latent Code" (link at the end of the article), this article details how to change the face while keeping it unchanged. The whole process of hairstyle.
The basic principle of GAN is to learn a non-linear mapping from the latent space distribution to the real data through adversarial training. Usually, the relationship between the latent space and the semantic attributes is unknown. . For example, how does the latent code determine the generated hairstyle attributes?
Therefore, latent code estimation and semantic editing are the key to solving the unknown relationship between the latent space and semantic attributes. Here, the researchers explain the principles of the two modules in detail.
First, the input image is sent to the pre-trained residual network for latent code estimation, and then the resulting estimate is sent to the generator. . At this point, the initial guess of the original input image has been completed. For this image, we can apply the pretrained image classifier to feature extraction, and at the same time, perform the same feature extraction on the input image.
Next, gradient descent is performed in the feature space to minimize the feature vector L2 loss and update the latent code estimate (red arrow). Compared to using gradient descent on pixel loss, this method of performing gradient descent on semantic feature vectors has more advantages, because using L2 optimization directly in pixel space will fall into undesirable local optima.
Generating latent code estimates
The so-called semantic editing refers to editing an image with a target attribute while retaining all other information. In this case, our target attribute is hair.
Before editing, we need to find specific boundaries in the latent space that separate binary attributes, where each boundary will correspond to a hair attribute. Such as hairstyle, color, hairline height, facial hair, etc.;
For any binary attribute, there is a hyperplane in the latent space, so that all samples from the same side have the same attributes, such that An independent linear SVM can be trained for each attribute. Therefore, we need to find a hyperplane from the 512-dimensional latent space of StyleGAN.
To find a hyperplane, you need paired latent code data and a score for that attribute. Ultimately the researchers decided to use a pre-trained classifier trained on a large dataset (CelebA) to obtain hair attributes. 10 classifiers with 10 attribute matches generated approximately 20k potential code and score groups. These paired latent codes trained independent linear SVMs on hair attributes, achieving 80% accuracy by validation evaluation.
For each input image, its specific position is first found in the StyleGAN latent space, and then moved along a specific direction and semantically edited.
As shown above, the researchers discovered the latent code of the image of young Leonardo DiCaprio in the StyleGAN space, drawing a direction orthogonal to the bangs hyperplane , and the position of the latent code is moved in this direction. Eventually Leonardo was created with different bangs states. The following is the final dynamic rendering:
Regarding conditional boundaries, the researchers talked about how many properties are coupled to each other. For example, the height of the hairline is related to age, women usually have longer hairstyles, and men have more obvious beards and sideburns. Therefore, it is crucial to separate the target attribute from its related attributes.
It is for this reason that this method of editing face attributes by finding hyperplane boundaries also has some shortcomings. When editing a face using one attribute, some other attributes may also be changed due to their dependencies. In addition, this model cannot complete cross-gender face swapping. Researchers say that perhaps more classifiers and training using special data sets can solve the above problems.
Finally, MarsLUL admitted that he made this baldness generator to alert everyone to a reasonable routine to prevent hair loss! I am providing the complete video link, hoping that everyone can become a prolific programmer. (Leifeng.com Lei Feng.com Lei Feng.com)
bilibili address: /video/BV1ot4y197MG?from=searchamp; seid=6465326088364452402
/swlh/hairstyle-transfer-semantic-editing-gan- latent-code-b3a6ccf91e82
- Previous article:Tell me about it.
- Next article:Five Essays on the Movie Gone with the Wind
- Related articles
- Aileen said pictures of calligraphy works in regular script and hard pen.
- I want to travel to Phuket, Thailand. Which hotel do you want to stay in?
- Get a new hairstyle and relax. What song?
- Let's talk about whether Nissan's Simmons mattress is genuine.
- A poem that is so beautiful that it makes people feel distressed; love does not have to last forever, the subtle fragrance floats just right
- Make acquaintances and have a chat.
- What should I do if my baby is bitten by a bug? ?
- On Sister's Self-study of Ancient Poetry
- Final teacher’s message to primary school is brief
- Don't know the piano, talk about copywriting