hacksider / Deep-Live-Cam

real time face swap and one-click video deepfake with only a single image
GNU Affero General Public License v3.0
34.93k stars 4.93k forks source link

Face Swapper fails to load, causing Live preview to crash #400

Open hotlabs-technology opened 3 weeks ago

hotlabs-technology commented 3 weeks ago

I'm experiencing an issue with the face swapping functionality in the Deep-Live-Cam project. The main window of the application loads correctly, but when I click on the "Live" button, a small empty window appears briefly before the application crashes.

Environment:

Steps to reproduce:

  1. Launch the application using python run.py --execution-provider cuda
  2. The main window loads successfully
  3. Click on the "Live" button
  4. A small empty window appears briefly
  5. The application crashes with an error

Error message: The application throws an exception when trying to load the face swapping model. The key part of the error is:

onnxruntime.capi.onnxruntime_pybind11_state.InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from [PATH]\models\inswapper_128_fp16.onnx failed:Protobuf parsing failed.

Full error traceback:

Frame processor face_enhancer not found
[TIMESTAMP] registry_win.h:57:GetProtoFromRegistryValue Opening registry key Software\Google\DriveFS\Share failed with 0x2
Frame processor face_enhancer not found
Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: [PROVIDER OPTIONS OMITTED FOR BREVITY]
find model: [PATH]/.insightface\models\buffalo_l\1k3d68.onnx landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0
[SIMILAR LINES FOR OTHER MODELS OMITTED]
set det-size: (640, 640)
Exception in Tkinter callback
Traceback (most recent call last):
  [INTERMEDIATE TRACEBACK LINES OMITTED]
  File "[PATH]\modules\processors\frame\face_swapper.py", line 43, in get_face_swapper
    FACE_SWAPPER = insightface.model_zoo.get_model(model_path, providers=modules.globals.execution_providers)
  [INTERMEDIATE TRACEBACK LINES OMITTED]
onnxruntime.capi.onnxruntime_pybind11_state.InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from [PATH]\models\inswapper_128_fp16.onnx failed:Protobuf parsing failed.

Additional observations:

Simon-Str commented 3 weeks ago

Got the same error

vic4key commented 3 weeks ago

@hotlabs-technology Make sure your models folder and gfpgan\weights folder look like this (file name, file size):

image

image

omer-re commented 3 weeks ago

@vic4key what's the full path of gfpgan\weight? I am trying to make it works and got a similar problem, but I couldn't find that gfpgan folder

vic4key commented 3 weeks ago

@omer-re These files in the weights folder are auto download in the first run.

omer-re commented 2 weeks ago

@vic4key thanks, what can I do if it doesn't appear and I don't have them?

I can find such folder under Deep-Live-Cam\.deep_live_cam_venv\Lib\site-packages\gfpgan\weights but it's empty.

hotlabs-technology commented 2 weeks ago

I have downloaded the .pth file in the models folder but I cannot find gfpgan\weights Did anybody manage to run it?

omer-re commented 2 weeks ago

@hotlabs-technology not sure it's the perfect one, but it workd for me (I found it online) download link from huggingface

hotlabs-technology commented 2 weeks ago

thanks @omer-re but when I click on the link I get this:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<script/>
<Code>InvalidKey</Code>
<Message>Unknown Key</Message>
</Error>

would you mind trying again?

omer-re commented 2 weeks ago

@hotlabs-technology sure! https://huggingface.co/sinadi/aar/tree/main scroll to the right file and download it

Simon-Str commented 2 weeks ago

I made it work. Don't follow any old READMES. Follow the instructions of the README of this Repo. The models are linked there. When the program starts I had to choose a face picture obviously but I also chose a Target Video, then the live mode worked. It needs 30 seconds to start. Just be patient.

Consider to make a fresh install so a fresh repo clone. I also used python venv.

ElKaydan commented 2 weeks ago

https://github.com/hacksider/Deep-Live-Cam/issues/464 Hey I opened this issue so I have all models in folder but no gfpgan\weights

hotlabs-technology commented 2 weeks ago

Thanks a lot @omer-re , I'm doing some progress but it still doesn't work:

same error, not sure what am I missing

vic4key commented 2 weeks ago

It's gfpgan\weights not gfpgan\weight.

Try to manually get the file at https://huggingface.co/gmk123/GFPGAN/tree/main

hotlabs-technology commented 2 weeks ago

@vic4key sorry that was just my typo, the directory name was indeed correct. Thanks a lot for the link, I have downloaded the .pth files in the weights directory but I still have the following errors:

This last error seems to be the most critical, indicating that there was a problem loading the ONNX model file for the face swapper functionality. In terms of output I still see the same small empty window when I click on "Live"

Screenshot 2024-08-27 140548