In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "Python how to achieve blurred photos to restore face clarity", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Python how to achieve blurred photos to restore face clarity" bar!
Let's take a look at the comparison picture.
On the far right is the effect of GFPGAN. If you take a look at the input image on the leftmost layer, you can see that GFPGAN restores the image very clearly. The effect is amazing.
According to the previous practice, I will install and use this project first to see if I can repackage the code into an engineered project.
Environmental installation
Let's take a look at the hints given by the project README.
The first required python version is > = 3.7, so I used Anaconda to create a virtual environment for python3.9. The installation of Pytorch can be obtained directly from the official website to install the latest version.
Because there are some basic dependent installations, just follow the installation. In fact, setup.py is already in the project, as shown in the figure below.
Because the model is relatively large, the author did not put it on github and gave the following download tips. The model is a trained model provided by the author.
If the download is slow, you can download it from my network disk.
Link extraction code: TUAN
The author also provides a basic model for self-training.
Verification model
Below I have prepared some pictures and selected some typical pictures, including black and white, color and mosaic, to see if they can all be clearly processed.
The prepared pictures are as follows:
Follow the instructions provided by README
Python inference_gfpgan.py-upscale 2-test_path inputs/newImages-save_root results
Take a look at the implementation result:
(pytorch49) C:\ Users\ yi\ PycharmProjects\ GFPGAN > python inference_gfpgan.py-- upscale 2-- test_path inputs/newImages-- save_root resultsC:\ Users\ yi\ PycharmProjects\ GFPGAN\ inference_gfpgan.py:45: UserWarning: The unoptimized RealESRGAN is very slow on CPU. We do not use it. If you really want to use it, please modify the corresponding codes. Warnings.warn ('The unoptimized RealESRGAN is very slow on CPU. We do not use it. 'Processing 331.jpg... E:\ ProgramData\ Anaconda3\ envs\ pytorch49\ lib\ site-packages\ torch\ nn\ functional.py:3679: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. Warnings.warn (Processing 333.jpg... Processing 334.jpg... Processing 335.jpg... Results are in the [results] folder. (pytorch49) C:\ Users\ yi\ PycharmProjects\ GFPGAN >
According to the default parameters, four directories will be generated in the results result folder, namely, the front and back image, the original detected face image, the processed face image, and the processed final image.
Let's see how it works.
Two points can be seen:
1. Mosaics cannot be eliminated. There is a picture of full mosaics that cannot be repaired directly.
2. The regular blurred photo repair is really clear.
At this point, I believe you have a deeper understanding of "Python how to achieve blurred photos to restore face clarity", might as well come to the actual operation of it! 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.