[PYTHON] I tried the super-resolution algorithm "PULSE" in a Windows environment

Try the high-performance super-resolution algorithm "PULSE: Self-Supervised Photo Upsampling via Latent Space Exploration of Generative Models" announced at this year's CVPR. I did. It is a popular "learning with self-teacher".

Points of "PULSE"

――Evaluation points are different than before --Compare with images downscaled after super-resolution, not images after super-resolution ――Super-resolution is possible than conventional methods --StyleGAN is used for super-resolution itself (learned with CelebA-HQ)

This GIF is easy to grasp the image. transformation.gif

Source code

The source code is available on Github. This time I will use this as it is.


I have installed the following modules on Python 3.7.

--Install from GUI of Anaconda Navigator - matplotlib - numpy - pandas - pillow - scipy - requests --Install from command line - pytorch - torchvision --cudatoolkit (100.2 is used this time)


Prepare a folder to store the images you want to super-resolution. Here, let's call it "input" for the time being.

Put the image you want to super-resolution there. (You can put more than one) The image has some restrictions.

--The vertical and horizontal sizes are the same --Size is a divisor of 1,024 --Format is PNG (RGB)


> python run.py

Run with.

Error handling

Most images give the following error:

Loading Synthesis Network
BEST (100) | L2: 0.0058 | GEOCROSS: 4.3057 | TOTAL: 0.7981 | time: 10.0 | it/s: 9.98 | batchsize: 1
Could not find a face that downscales correctly within epsilon

In the above example, the minimum value of L2 is "0.0058", but the default threshold is "0.002", and an error will occur if it is not closer than that.

As a countermeasure, change the threshold value with the argument "eps".

> python run.py -eps 0.005

Execution result

The execution result is saved in the "runs" folder. The output super-resolution image will be 1,024x1,024 png. image.png image.png

Foreigner bias is terrible. .. .. Also, it seems to be useless if it is not a front face.


It's easy to do, but there are a lot of things you have to do to actually use it.

Recommended Posts

I tried the super-resolution algorithm "PULSE" in a Windows environment
I tried to build an environment with WSL + Ubuntu + VS Code in a Windows environment
I tried replacing the Windows 10 HDD with a smaller SSD
I tried to create a server environment that runs on Windows 10
I tried putting virtualenv in Cygwin environment
I built a TensorFlow environment on windows10
I started Node.js in a virtual environment
I tried "Implementing a genetic algorithm (GA) in python to solve the traveling salesman problem (TSP)"
I tried to display the altitude value of DTM in a graph
I tried to build a super-resolution method / SRCNN ①
Use the latest pip in a virtualenv environment
I tried playing a typing game in Python
I tried simulating the "birthday paradox" in Python
I tried the least squares method in Python
(Machine learning) I tried to understand the EM algorithm in a mixed Gaussian distribution carefully with implementation.
[Memo] I tried a pivot table in Python
Set a fixed IP in the Linux environment
I tried adding a Python3 module in C
I tried to build a super-resolution method / SRCNN ③
I tried to build a super-resolution method / SRCNN ②
What I was addicted to when creating a web application in a windows environment
I want to use Python in the environment of pyenv + pipenv on Windows 10
I tried to implement what seems to be a Windows snipping tool in Python
Instructions for connecting Google Colab. To the local runtime in a Windows environment
virtualenvwrapper in windows environment
I tried to graph the packages installed in Python
I tried to implement a pseudo pachislot in Python
I tried running TensorFlow in AWS Lambda environment: Preparation
I tried to implement GA (genetic algorithm) in Python
[Go + Gin] I tried to build a Docker environment
I replaced the Windows PowerShell cookbook with a python script.
I tried the accuracy of three Stirling's approximations in python
I tried to implement a one-dimensional cellular automaton in Python
When I tried to install PIL and matplotlib in a virtualenv environment, I was addicted to it.
I tried running PIFuHD on Windows for the time being
Collaborate in a remote environment
I tried to simulate ad optimization using the bandit algorithm.
I tried "a program that removes duplicate statements in Python"
I tried to summarize the code often used in Pandas
I tried to automate "one heart even if separated" using a genetic algorithm in Python
I tried "How to get a method decorated in Python"
I tried to illustrate the time and time in C language
I tried the changefinder library!
I tried programming the chi-square test in Python and Java.
I created a class in Python and tried duck typing
I tried to create a Python script to get the value of a cell in Microsoft Excel
I tried to summarize the commands often used in business
I tried to implement the mail sending function in Python
I tried a little bit of the behavior of the zip function
I also tried to imitate the function monad and State monad with a generator in Python
I tried to make a stopwatch using tkinter in python
I wrote a doctest in "I tried to simulate the probability of a bingo game with Python"
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I tried running the offline speech recognition system Julius with python in the Docker virtual environment
I tried to automate the construction of a hands-on environment using IBM Cloud's SoftLayer API
I wrote a script that splits the image in two
I got an error when I tried to process luigi in parallel on windows, but the solution
I got an SSL Error when I installed Anaconda in a new environment, so I solved it (Windows10, Anaconda3-2019.10)
I tried to find out the difference between A + = B and A = A + B in Python, so make a note
A story that didn't work when I tried to log in with the Python requests module
Create a Python environment for professionals in VS Code on Windows