Saturday, July 10, 2021

How to setup StyleFlow using Pip in Windows 10

StyleFlow is a research program supported by the KAUST Office of Sponsored Research (OSR) and Adobe Research. The original source codes can be found from the following GitHub. A good video introduction can be found in YouTube. It's a very interesting application that allows us to do something that is related to DeepFake.

You can download the modified version of StyleFlow source code from GitHub (UI screen size & C++ compiler location)
In order to build and run the application you will need to follow the following steps: 
  1. Install Python 3.7 
  2. Install Visual Studio Code. We will use it to change and compile the Python codes. 
  3. Install Visual Studio Community 2017. Make sure you select the C++ development tools to install.
  4. Install TensorFlow GPU 1.14.0 by typing the following command "pip install tensorflow-gpu==1.14.0" in a windows command prompt.
  5. Download the nVidia NVIDIA GPU Computing Toolkit v10 from the nVidia site. We will need it to compile some of the nVidia libraries in Visual Studio Code.
  6. Download the nVidia cuDNN library 7.4 from nVidia cuDNN. if you do not have the account to the web site, you will need to register one.  Note: you can check the following web site for the corresponding package that you need to install depending on the TensorFlow version.
  7. Add the following environment variables into your computer so that the compiler knows where to find the nvcc.exe file. 
  8. If you are using virtual environment to run the Python, copy the following file from the cuDNN folder to the python virtual environment. For example, 
    This will allow Visual Studio Code to load the dll when compiling the application straight from the virtual environment. Example of Visual Studio Code running the Python interpreter from the virtual environment 'venv' 


Codes Changes:
  1. Once you have loaded the code in Visual Studio Code, the left panel should look something like below. 

  2. Change the path where the application can find the C++ compiler as shown in the picture below. You can find the version of the C++ compiler that you use by looking at the Windows file explorer. Note: Only C++ comes with Visual Studio 2017 is valid.

  3. Please note that in order to compile and run the application you will need an nVidia graphic card that supports CUDA.
If the application is compiled successfully a window as shown in the picture below will pop up. You should be able to adjust the values in the right panel to see the difference in the picture.


No comments: