felixrosberg/FaceDancer

enviroment.yml

hichemfelouat opened this issue · 11 comments

I tried to use the FaceDancer project. However, I faced many issues. There is a problem with creating a new environment from the provided environment!

I tried to use the FaceDancer project. However, I faced many issues. There is a problem with creating a new environment from the provided environment!

What is your OS - Windows or Linux?

Lunux

I tried to use the FaceDancer project. However, I faced many issues. There is a problem with creating a new environment from the provided environment!

What is your OS - Windows or Linux?

Linux

Lunux

I tried to use the FaceDancer project. However, I faced many issues. There is a problem with creating a new environment from the provided environment!

What is your OS - Windows or Linux?

Linux

Have you tried running the project on a CPU or do you have an Nvidia GPU?

I will check it on WSL (Debian) and post my installation instructions a bit later.

I'm using Ubuntu, I tried to modify dependencies like below
image
plus, check out the prefix where the last line of the file.

I'm using Ubuntu, I tried to modify dependencies like below image plus, check out the prefix where the last line of the file.

Here's a little tutorial on how I did it on Windows, I think on Linux it will be almost the same:

conda create -n facedancer python=3.8
conda activate facedancer
python -m pip install --upgrade pip

(Skip for Linux) Download and install Microsoft Visual C++ for Visual Studio 2015 https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads?utm_source=www.tensorflow.org&utm_medium=referral (if you not installed it)

In my case, the easiest way to run FaceDancer on GPU is to install tensorflow-cpu and tensorflow-directml-plugin. if you need a CPU, then the installation of tensorflow-directml-plugin can be skipped. To work with the GPU, the latest Nvidia driver must be installed. directml-plugin also work in WSL, so you can try to install it on Linux as well.

pip install tensorflow-cpu==2.10
pip install tensorflow-directml-plugin

Install depencies:

pip install tensorflow-addons opencv-python-headless scipy scikit-image

Download from HugginFace (you need HugginFace account) FaceDancer_config_c_HQ.h5 and put in model_zoo folder, RetinaFace-Res50.h5 in retinaface folder and ArcFace-Res50.h5 in arcface_model.

In video_swap/multi_face_single_source.py change:

    gpus = tf.config.experimental.list_physical_devices('GPU')
    tf.config.set_visible_devices(gpus[opt.device_id], 'GPU')

to

    import tensorflow as tf

    print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
    if len(tf.config.list_physical_devices('GPU')) != 0:
      gpus = tf.config.experimental.list_physical_devices('GPU')
      tf.config.set_visible_devices(gpus[opt.device_id], 'GPU')

This will make it possible to run the project on the CPU if the GPU is not supported.

and in args device_id default from 1 to 0 (or add --device_id 0 to command)

I also advise you to move the multi_face_single_source.py file from the video_swap folder to the root of the FaceDancer folder.

Command example (multi_face_single_source.py is located at the root of the FaceDancer folder) :

python multi_face_single_source.py --device_id 0 --facedancer_path "./model_zoo/FaceDancer_config_c_HQ.h5" --vid_path "path/to/video.mp4" --swap_source "path/to/source_face.png"

Try it, hope it helps.

gpus 

Thank you so much for your efforts; our server works on ubuntu 18.04 with many GPUs. I tried to follow your instruction, and the environment is created correctly but still not working. I think if you create a Google colab notebook, it will be helpful for us and others who want to use this project.

gpus 

Thank you so much for your efforts; our server works on ubuntu 18.04 with many GPUs. I tried to follow your instruction, and the environment is created correctly but still not working. I think if you create a Google colab notebook, it will be helpful for us and others who want to use this project.

I will be able to make a Colab Notebook Demo if @felixrosberg uploads FaceDancer_config_c_HQ.h5 to the repository releases, since it is not very convenient for the demo to download the model from HugginFace (you need to enter your HugginFace login and password in the wget command)

gpus 

Thank you so much for your efforts; our server works on ubuntu 18.04 with many GPUs. I tried to follow your instruction, and the environment is created correctly but still not working. I think if you create a Google colab notebook, it will be helpful for us and others who want to use this project.

What kind of problems did you encounter?

Hello @hichemfelouat,

I see @netrunner-exe have made a great effort. The only thing I can think of is trying to install all the libraries separately as I suspect that latest version for each should work just fine assuming you us python 3.8. Also what exactly is not working? You said environment is created correctly but it is still not working? Are you trying to run any specific scripts? Also what error does this yield?

Regards Collab demo: I would like to provide one but is currently swamped until next year. For using the pretrained models in a custom Collab notebook, uploading the models to your drive and mounting the drive + following the custom script instruction should work for running the models using Collab.

I can add that there is a Colab demo available now if you missed it. Will close this issue for now.