Rudrabha / Wav2Lip

This repository contains the codes of "A Lip Sync Expert Is All You Need for Speech to Lip Generation In the Wild", published at ACM Multimedia 2020. For HD commercial model, please try out Sync Labs
https://synclabs.so
10.8k stars 2.29k forks source link

RuntimeError: Image too big to run face detection on GPU. Please use the --resize_factor argument #635

Open TzyTman opened 8 months ago

TzyTman commented 8 months ago

Traceback (most recent call last): File "/home/mk/Wav2Lip-master/inference.py", line 78, in face_detect predictions.extend(detector.get_detections_for_batch(np.array(images[i:i + batch_size]))) File "/home/mk/Wav2Lip-master/face_detection/api.py", line 66, in get_detections_for_batch detected_faces = self.face_detector.detect_from_batch(images.copy()) File "/home/mk/Wav2Lip-master/face_detection/detection/sfd/sfd_detector.py", line 42, in detect_from_batch bboxlists = batch_detect(self.face_detector, images, device=self.device) File "/home/mk/Wav2Lip-master/face_detection/detection/sfd/detect.py", line 68, in batch_detect olist = net(imgs) File "/home/mk/anaconda3/envs/Wav2Lip/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, *kwargs) File "/home/mk/Wav2Lip-master/face_detection/detection/sfd/net_s3fd.py", line 71, in forward h = F.relu(self.conv1_1(x)) File "/home/mk/anaconda3/envs/Wav2Lip/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(input, **kwargs) File "/home/mk/anaconda3/envs/Wav2Lip/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 447, in forward return self._conv_forward(input, self.weight, self.bias) File "/home/mk/anaconda3/envs/Wav2Lip/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 443, in _conv_forward return F.conv2d(input, weight, bias, self.stride, RuntimeError: CUDA error: no kernel image is available for execution on the device CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/mk/Wav2Lip-master/inference.py", line 280, in main() File "/home/mk/Wav2Lip-master/inference.py", line 249, in main for i, (img_batch, mel_batch, frames, coords) in enumerate(tqdm(gen, File "/home/mk/anaconda3/envs/Wav2Lip/lib/python3.10/site-packages/tqdm/std.py", line 1127, in iter for obj in iterable: File "/home/mk/Wav2Lip-master/inference.py", line 115, in datagen face_det_results = face_detect([frames[0]]) File "/home/mk/Wav2Lip-master/inference.py", line 81, in face_detect raise RuntimeError('Image too big to run face detection on GPU. Please use the --resize_factor argument') RuntimeError: Image too big to run face detection on GPU. Please use the --resize_factor argument

pawansharmaaaa commented 8 months ago

Use the argument --resize_factor 2

TimelessXZY commented 7 months ago

Use the argument --resize_factor 2

Still get the same error, with the argument --resize_factor 8, --resize_factor 480 and even --resize_factor 720

MDSALMANSHAMS commented 5 months ago

I needed a version of PyTorch that supports CUDA 11.1 or higher to use the A100 GPU. The latest versions of PyTorch support this, so one should install the correct version.

Run the following commands to update PyTorch and ensure you have the appropriate CUDA version:

  1. Uninstall the current PyTorch version: pip uninstall torch torchvision

  2. Install the latest version of PyTorch with CUDA 11.1 support: (according to my requirement) pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu111

This command ensures that you install PyTorch with CUDA 11.1 support, which is compatible with the A100 GPU.