Difference between revisions of "ESRGAN Installation Guide for Windows"

From Upscale Wiki
Jump to navigation Jump to search
m
Line 7: Line 7:
 
Our goal is to open up A.I. upscaling to everyone, not just to those who can pay lots of money or are good at coding.
 
Our goal is to open up A.I. upscaling to everyone, not just to those who can pay lots of money or are good at coding.
  
Before you start, make sure that your '''driver is up-to-date''' if you have an '''Nvidia GPU''', to make sure it supports the newest cuda version. If you want to be on the save site, use the [https://developer.nvidia.com/cuda-downloads cuda driver].
+
Before you start, make sure that your '''display driver is up-to-date''' if you have an '''Nvidia GPU''', to make sure it supports the newest CUDA version. If you want to be on the safe side, use the [https://developer.nvidia.com/cuda-downloads CUDA driver].
  
 
== Installing ESRGAN ==
 
== Installing ESRGAN ==
  
<ol style="list-style-type: decimal;">
+
# Get the latest stable 64-bit Python 3 release here: [https://www.python.org/downloads/windows/ Python Download]  
<li>Get the latest stable 64-bit Python 3 release here: [https://www.python.org/downloads/windows/ Python Download] [[File:GuideEsrganWin_1-python-link.jpg|center|1-python-link]]</li>
+
#: [[File:GuideEsrganWin_1-python-link.jpg|center|A snapshot of the "Python Releases for Windows" section of the above linked webpage as of August 12, 2019. The "Download Windows x86-64 executable installer" link is highlighted.]]
<li>Run the installer and make sure that <code>Add Python 3.*x* to Path</code> and <code>Install launcher for all users (recommended)</code> is selected, then click on Customize installation. [[File:GuideEsrganWin_2-installer-1.jpg|center|1-python-link]]</li>
+
# Run the installer and make sure that <code>Add Python 3.*x* to Path</code> and <code>Install launcher for all users (recommended)</code> is selected, then click on Customize installation.  
<li>Make sure that every Option is selected and click on next. [[File:GuideEsrganWin_3-installer-2.jpg|center|1-python-link]]</li>
+
#: [[File:GuideEsrganWin_2-installer-1.jpg|center|The "Install Python" screen from the python installer. All checkboxes are checked. The checkboxes and the "Customize installation" button are highlighted.]]
<li>Mirror my selections and click on install (Make sure that the install location contains no spaces). [[File:GuideEsrganWin_4-installer-3.jpg|center|1-python-link]]</li>
+
# Make sure that every Option is selected and click on next.  
<li>You have now successfully installed Python 3. Click on Close now.</li>
+
#: [[File:GuideEsrganWin_3-installer-2.jpg|center|The Optional Features screen from the Python installer. All options are checked. The checked boxes are highlighted.]]
<li>Press <Windows/Super key> + R. Enter <code>cmd</code> and click on <code>OK</code> [[File:GuideEsrganWin_6-run.jpg|center|6-run]]</li>
+
# Mirror my selections and click on install (Make sure that the install location contains no spaces).  
<li>We will now install Pytorch:
+
#: [[File:GuideEsrganWin_4-installer-3.jpg|center|The Advanced Options screen from the Python installer. All options are checked except "Download debug binaries". Install location is set as "C:\Python37". The checked boxes and the install location are highlighted.]]
<ol style="list-style-type: decimal;">
+
# You have now successfully installed Python 3. Click on Close now.
<li>If you have a '''Nvidia''' graphic card enter the following command in the cmd:</li></ol>
+
# Press <Windows/Super key> + R. Enter <code>cmd</code> and click on <code>OK</code>  
 
+
#: [[File:GuideEsrganWin_6-run.jpg|center|A picture of the Windows Run prompt open with "cmd" in the "Open:" field. "cmd" and the OK button are highlighted.]]
<code>pip install https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-win_amd64.whl</code>
+
# We will now install Pytorch:
then: <code>bash  pip install https://download.pytorch.org/whl/cu100/torchvision-0.3.0-cp37-cp37m-win_amd64.whl</code> [[File:GuideEsrganWin_7-Nvidia.jpg|center|cmd-NV]]
+
## If you have a '''Nvidia''' graphic card enter the following command in the cmd:  
<ol start="2" style="list-style-type: decimal;">
+
##: <code>pip install https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-win_amd64.whl</code>
<li>If you have an '''AMD / Intel''' graphic card enter the following command in the cmd:</li></ol>
+
##: then:
 
+
##: <code>bash  pip install https://download.pytorch.org/whl/cu100/torchvision-0.3.0-cp37-cp37m-win_amd64.whl</code>  
<code>pip install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-win_amd64.whl</code>
+
##: [[File:GuideEsrganWin_7-Nvidia.jpg|center|A Windows command prompt open with the first of the two above commands entered but not executed.]]
then: <code>bash  pip install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-win_amd64.whl</code> [[File:GuideEsrganWin_7-CPU.jpg|center|cmd-CPU]]
+
## If you have an '''AMD / Intel''' graphic card enter the following command in the cmd:
<ol start="3" style="list-style-type: decimal;">
+
##: <code>pip install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-win_amd64.whl</code>
<li>If the command won’t work for you, please report it and get a new one in the meantime here [https://pytorch.org/get-started/locally/ Pytorch Website]. Select Stable, Windows, Pip, your Python version and your cuda version (should be the newest) or None for AMD / Intel users.</li></ol>
+
##: then:
</li>
+
##: <code>bash  pip install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-win_amd64.whl</code>  
<li>Press Enter.</li>
+
##: [[File:GuideEsrganWin_7-CPU.jpg|center|A Windows command prompt open with the first of the two above commands entered but not executed.]]
<li>Now we install the other requirements for running and training ESRGAN and SFTGAN. Enter:</li></ol>
+
## If the command won’t work for you, please report it. In the meantime, you can get an up to date version here at the [https://pytorch.org/get-started/locally/ Pytorch Website]. Select Stable, Windows, Pip, your Python version and your CUDAversion (should be the newest) or None for AMD / Intel users.
 
+
# Press Enter.
<code>pip install opencv-python</code>
+
# Now we install the other requirements for running and training ESRGAN and SFTGAN. Enter:
[[File:GuideEsrganWin_8-pip.jpg|center|cmd-others]]
+
#: <code>pip install opencv-python</code>
 
+
#: [[File:GuideEsrganWin_8-pip.jpg|center|A Windows command prompt open with the above command entered but not executed.]]
<ol start="10" style="list-style-type: decimal;">
+
# Choose a folder where you want to install ESRGAN. Because of the maximum path length limitation in windows, I recommend something as short as possible like: <code>C:\ctp\esrgan\</code></p>
<li><p>Choose a folder where you want to install ESRGAN. Because of the maximum path length limitation in windows, I recommend something as short as possible like: <code>C:\ctp\esrgan\</code></p>
+
## Create a folder called <code>ctp</code> (That will come in handy if you want to install Deorders scripts later)
<ol style="list-style-type: decimal;">
+
## In the <code>ctp</code> folder create a folder called <code>esrgan</code>
<li>Create a folder called <code>ctp</code> (That will come in handy if you want to install Deorders scripts later)</li>
+
## Open the <code>esrgan</code> folder.
<li>In the <code>ctp</code> folder create a folder called <code>esrgan</code></li>
+
# Now it is time to download ESRGAN:
<li>Open the <code>esrgan</code> folder.</li></ol>
+
## Go to [https://github.com/xinntao/ESRGAN/tree/aceb85730832001ec1fa3a77bd6856b75e1d0e87 the ESRGAN GitHub Repo (old model structure)]
</li>
+
## Click on <code>Clone or Download</code>
<li><p>Now it is time to download ESRGAN:</p>
+
## Click on <code>Download ZIP</code>  
<ol style="list-style-type: decimal;">
+
##: [[File:GuideEsrganWin_10-github.jpg|center|An image of the ESRGAN repo on Github, with the "Clone or download" dropdown button highlighted as well as the "Download ZIP" link]]
<li>Go to [https://github.com/xinntao/ESRGAN/tree/aceb85730832001ec1fa3a77bd6856b75e1d0e87 the ESRGAN GitHub Repo (old model structure)]</li>
+
# Extract the contents of the folder into your <code>C:\ctp\esrgan</code> folder you created in step 10. It should already be open and look like the image below:
<li>Click on <code>Clone or Download</code></li>
+
#: [[File:GuideEsrganWin_11-explorer.jpg|center|An image of C:/ctp/esrgan/ open in Windows Explorer with the address bar underlined]]
<li>Click on <code>Download ZIP</code> [[File:GuideEsrganWin_10-github.jpg|center|cmd-CPU]]</li></ol>
+
# Now it is time to download and install the default ESRGAN models:
</li>
+
## Go to the [https://drive.google.com/drive/folders/17VYV_SoZZesU6mbxz2dMAIccSSlqLecY ESRGAN Pretrained Models Google Drive]
<li><p>Extract the contents of the folder into your <code>C:\ctp\esrgan</code> folder you created in step 10. It should already be open and look like this: [[File:GuideEsrganWin_11-explorer.jpg|center|cmd-CPU]]</p></li>
+
## Download the two <code>_old_arch.pth</code> files.
<li><p>Now it is time to download and install the default ESRGAN models:</p>
+
## Put the two <code>.pth</code> files that you have just downloaded into your <code>models</code> folder in your <code>esrgan</code> folder
<ol style="list-style-type: decimal;">
+
### For example in:
<li>Go to the [https://drive.google.com/drive/folders/17VYV_SoZZesU6mbxz2dMAIccSSlqLecY ESRGAN Pretrained Models Google Drive]</li>
+
###: <code>C:\ctp\esrgan\models\</code>
<li>Download the two <code>_old_arch.pth</code> files.</li>
+
# If you have a Nvidia Graphic Card, then you have successfully installed ESRGAN, congratulations!
<li>Put the two <code>.pth</code> files that you have just downloaded into your <code>models</code> folder in your <code>esrgan</code> folder
+
# However, if you have an AMD / Intel Graphic Card, then you need to open <code>test.py</code> in your ESRGAN folder with a text editor.
<ol style="list-style-type: decimal;">
+
## Change:
<li>For example in:</li></ol>
+
##: <code>device = torch.device('cuda') # if you want to run on CPU, change 'cuda' -> cpu</code>
 
+
##: into:
<pre>C:\ctp\esrgan\models\</pre></li></ol>
+
##: <code>device = torch.device('cpu') # if you want to run on CPU, change 'cuda' -> cpu</code>
</li>
 
<li><p>If you have a Nvidia Graphic Card, then you have successfully installed ESRGAN, congratulations!</p></li>
 
<li><p>But If you have an AMD / Intel Graphic Card then open <code>test.py</code> in your ESRGAN folder with a text editor.</p>
 
<ol style="list-style-type: decimal;">
 
<li>Change:</li></ol>
 
 
 
<code>device = torch.device('cuda') # if you want to run on CPU, change 'cuda' -> cpu</code>
 
<p>into</p>
 
<code>device = torch.device('cpu') # if you want to run on CPU, change 'cuda' -> cpu</code></li></ol>
 

Revision as of 03:25, 13 August 2019

This guide will help you to install ESRGAN on Windows, by showing you step by step with images how to do it.

No knowledge of Python or coding is necessary to follow this guide.

If you have any problems during or after the installation, feel free to ask any questions on our Discord server and we will try to help you out.

Our goal is to open up A.I. upscaling to everyone, not just to those who can pay lots of money or are good at coding.

Before you start, make sure that your display driver is up-to-date if you have an Nvidia GPU, to make sure it supports the newest CUDA version. If you want to be on the safe side, use the CUDA driver.

Installing ESRGAN

  1. Get the latest stable 64-bit Python 3 release here: Python Download
    A snapshot of the "Python Releases for Windows" section of the above linked webpage as of August 12, 2019. The "Download Windows x86-64 executable installer" link is highlighted.
  2. Run the installer and make sure that Add Python 3.*x* to Path and Install launcher for all users (recommended) is selected, then click on Customize installation.
    The "Install Python" screen from the python installer. All checkboxes are checked. The checkboxes and the "Customize installation" button are highlighted.
  3. Make sure that every Option is selected and click on next.
    The Optional Features screen from the Python installer. All options are checked. The checked boxes are highlighted.
  4. Mirror my selections and click on install (Make sure that the install location contains no spaces).
    The Advanced Options screen from the Python installer. All options are checked except "Download debug binaries". Install location is set as "C:\Python37". The checked boxes and the install location are highlighted.
  5. You have now successfully installed Python 3. Click on Close now.
  6. Press <Windows/Super key> + R. Enter cmd and click on OK
    A picture of the Windows Run prompt open with "cmd" in the "Open:" field. "cmd" and the OK button are highlighted.
  7. We will now install Pytorch:
    1. If you have a Nvidia graphic card enter the following command in the cmd:
      pip install https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-win_amd64.whl
      then:
      bash pip install https://download.pytorch.org/whl/cu100/torchvision-0.3.0-cp37-cp37m-win_amd64.whl
      A Windows command prompt open with the first of the two above commands entered but not executed.
    2. If you have an AMD / Intel graphic card enter the following command in the cmd:
      pip install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-win_amd64.whl
      then:
      bash pip install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-win_amd64.whl
      A Windows command prompt open with the first of the two above commands entered but not executed.
    3. If the command won’t work for you, please report it. In the meantime, you can get an up to date version here at the Pytorch Website. Select Stable, Windows, Pip, your Python version and your CUDAversion (should be the newest) or None for AMD / Intel users.
  8. Press Enter.
  9. Now we install the other requirements for running and training ESRGAN and SFTGAN. Enter:
    pip install opencv-python
    A Windows command prompt open with the above command entered but not executed.
  10. Choose a folder where you want to install ESRGAN. Because of the maximum path length limitation in windows, I recommend something as short as possible like: C:\ctp\esrgan\

    1. Create a folder called ctp (That will come in handy if you want to install Deorders scripts later)
    2. In the ctp folder create a folder called esrgan
    3. Open the esrgan folder.
  11. Now it is time to download ESRGAN:
    1. Go to the ESRGAN GitHub Repo (old model structure)
    2. Click on Clone or Download
    3. Click on Download ZIP
      An image of the ESRGAN repo on Github, with the "Clone or download" dropdown button highlighted as well as the "Download ZIP" link
  12. Extract the contents of the folder into your C:\ctp\esrgan folder you created in step 10. It should already be open and look like the image below:
    An image of C:/ctp/esrgan/ open in Windows Explorer with the address bar underlined
  13. Now it is time to download and install the default ESRGAN models:
    1. Go to the ESRGAN Pretrained Models Google Drive
    2. Download the two _old_arch.pth files.
    3. Put the two .pth files that you have just downloaded into your models folder in your esrgan folder
      1. For example in:
        C:\ctp\esrgan\models\
  14. If you have a Nvidia Graphic Card, then you have successfully installed ESRGAN, congratulations!
  15. However, if you have an AMD / Intel Graphic Card, then you need to open test.py in your ESRGAN folder with a text editor.
    1. Change:
      device = torch.device('cuda') # if you want to run on CPU, change 'cuda' -> cpu
      into:
      device = torch.device('cpu') # if you want to run on CPU, change 'cuda' -> cpu