In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Python to realize the smile of the Mona Lisa". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use Python to realize the smile of the Mona Lisa.
First of all, Clone the repository locally and install related dependencies.
Pip install-r requirements.txt
I recorded a video by myself, and I recorded a smiley face here, using the mp4 format. I haven't tested whether other formats are feasible. Copy the video to the warehouse directory. The warehouse provides a preprocessing file for processing video, first of all, you need to install face-alignment in a virtual environment.
Git clone https://github.com/1adrianb/face-alignmentcd face-alignmentpip install-r requirements.txtpython setup.py install
Then install ffmpeg.
Brew install ffmpeg
Use scripts to preprocess the video.
Python crop-video.py-inp video.mp4-cpu
This command does not process the video directly, but outputs a ffmpeg command that can be executed directly to process the video.
Ffmpeg-I video.mp4-ss 0.0-t 9.1-filter:v "crop=1023:943:238:0, scale=256:256" >
Next, we follow the link in the repository to download the model to the checkpoints directory of the project.
Finally, run the command to generate dynamic video, where crop.mp4 is the video we preprocessed in the previous step, image.jpg is our static image, and the model I use here is vox-cpk. You can also try other models.
Python demo.py-config config/vox-256.yaml-driving_video crop.mp4-source_image image.jpg-checkpoint checkpoints/vox-cpk.pth.tar-relative-adapt_scale-cpu
The final effect is as follows:
At this point, I believe you have a deeper understanding of "how to use Python to realize the smile of the Mona Lisa". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.