Rudrabha / LipGAN

This repository contains the codes for LipGAN. LipGAN was published as a part of the paper titled "Towards Automatic Face-to-Face Translation".
http://cvit.iiit.ac.in/research/projects/cvit-projects/facetoface-translation
MIT License
585 stars 124 forks source link

Not using GPU #17

Closed Nixon1979 closed 4 years ago

Nixon1979 commented 4 years ago

The process is not using GPU, and CPU is taking 11 hours to complete a 1-minute video. Any idea what could be the reason?

prajwalkr commented 4 years ago

The code by default uses GPU. Please check if your keras + tensorflow installation is set to use CUDA. Also, please paste the error log below so that I can help you out further.

Nixon1979 commented 4 years ago

This issue got solved by re-building dlib from source and make it to use cuDNN. Now GPU is getting used but my GPU has only 12 GB ram and i am getting out of memory error

Nixon1979 commented 4 years ago

Using TensorFlow backend. Number of frames available for inference: 1861 (80, 2083) Length of mel chunks: 635 0%| | 0/30 [00:12<?, ?it/s] Traceback (most recent call last): | 0/30 [00:00<?, ?it/s] File "batch_inference.py", line 215, in main() File "batch_inference.py", line 186, in main total=int(np.ceil(float(len(mel_chunks))/batch_size)))): File "/data/xxxxxxxxxx/.local/lib/python3.6/site-packages/tqdm/std.py", line 1108, in iter for obj in iterable: File "batch_inference.py", line 94, in datagen face_det_results = face_detect([f[...,::-1] for f in frames]) # BGR2RGB for CNN face detection File "batch_inference.py", line 70, in face_detect predictions.extend(detector(images[i:i + batch_size])) RuntimeError: Error while calling cudaMalloc(&data, new_size*sizeof(float)) in file /data/xxxxxxxxxx/yyyyyy/installer/dlib/dlib-19.19/dlib/cuda/gpu_data.cpp:218. code: 2, reason: out of memory 0%|

prajwalkr commented 4 years ago

Please refer to line027 for the argument you can pass while running the program “face_det_batch_size”. Reduce it to use less memory.

Nixon1979 commented 4 years ago

Great was able to move ahead.. but this one now.... extremely sorry for these issues being reported


Total params: 49,573,971 Trainable params: 49,543,123 Non-trainable params: 30,848


Model Created Traceback (most recent call last): File "batch_inference.py", line 215, in main() File "batch_inference.py", line 191, in main model.load_weights(args.checkpoint_path) File "/data/xxxxxx/.local/lib/python3.6/site-packages/keras/engine/topology.py", line 2656, in load_weights f, self.layers, reshape=reshape) File "/data/xxxxxx/.local/lib/python3.6/site-packages/keras/engine/topology.py", line 3380, in load_weights_from_hdf5_group ' elements.') ValueError: Layer #37 (named "batch_normalization_34" in the current model) was found to correspond to layer conv2d_35 in the save file. However the new layer batch_normalization_34 expects 4 weights, but the saved weights have 2 elements. 0%|

prajwalkr commented 4 years ago
  1. Are you sure you are using the right weights? The weights in the master branch work only with the master branch code and the weights in the fully_pythonic branch work only with the code of that branch.
  2. Check your keras and tensorflow versions to match exactly with the ones mentioned in requirements.txt
Nixon1979 commented 4 years ago

Great able to generate.. I had used the master branch weights..

What steps do you recommend to improve the quality of the lip movement....

prajwalkr commented 4 years ago

That is an open-ended question, and we are still looking into ways to improve the generation :)

shikhar-scs commented 4 years ago

@Nixon1979 I'm facing the same issue where every epoch is taking a very long time. I've tried a few methods to install dlib from source but it isn't working yet and I'm getting this. image

Could you please guide me to the correct installation source for the same!

prajwalkr commented 4 years ago

In our case just pip install dlib worked as the CUDA paths were visible to the installer probably. Ensure your cuda paths are set, for instance, as indicated in the error above: CUDA_TOOLKIT_ROOT_DIR is not set. You can probably look into this guide as well. Or any other link you get when you search for install dlib with cuda support