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
37.54k stars 5.34k forks source link

Attempting to Run Map Faces Results in Error With OpenCV #629

Open ConnoisseurProtege opened 1 week ago

ConnoisseurProtege commented 1 week ago

Here's the error I'm getting -

Exception in Tkinter callback
Traceback (most recent call last):
  File "~\DeepLiveCam\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "~\DeepLiveCam\lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
    self._command()
  File "~\DeepLiveCam\Deep-Live-Cam\modules\ui.py", line 132, in <lambda>
    start_button = ctk.CTkButton(root, text='Start', cursor='hand2', command=lambda: analyze_target(start, root))
  File "~\DeepLiveCam\Deep-Live-Cam\modules\ui.py", line 170, in analyze_target
    create_source_target_popup(start, root, modules.globals.souce_target_map)
  File "~\DeepLiveCam\Deep-Live-Cam\modules\ui.py", line 206, in create_source_target_popup
    image = Image.fromarray(cv2.cvtColor(item['target']['cv2'], cv2.COLOR_BGR2RGB))
cv2.error: OpenCV(4.8.1) ~\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
Jayverma16 commented 6 days ago

I am not able to find create_source_target_popup in experimental branch

boromir674 commented 5 days ago

I am experiencing the same.

Replicate

  1. Run the app
  2. Put a Picture on the left and a Video on the right.
  3. toggle Map faces
  4. press Start

On Console output I get the following

Creating temp resources...
Extracting frames...
Extracting face embeddings from frames: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 26/26 [00:15<00:00,  1.65it/s]
Mapping frame embeddings to centroids-0: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 26/26 [00:00<00:00, 196844.59it/s]
Mapping frame embeddings to centroids-1: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 26/26 [00:00<00:00, 250694.03it/s]
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.10/tkinter/__init__.py", line 1924, in __call__
    return self.func(*args)
  File "/data/repos/Deep-Live-Cam/env/lib/python3.10/site-packages/customtkinter/windows/widgets/ctk_button.py", line 554, in _clicked
    self._command()
  File "/data/repos/Deep-Live-Cam/modules/ui.py", line 391, in <lambda>
    command=lambda: analyze_target(start, root),
  File "/data/repos/Deep-Live-Cam/modules/ui.py", line 485, in analyze_target
    create_source_target_popup(start, root, modules.globals.souce_target_map)
  File "/data/repos/Deep-Live-Cam/modules/ui.py", line 559, in create_source_target_popup
    image = Image.fromarray(cv2.cvtColor(item["target"]["cv2"], cv2.COLOR_BGR2RGB))
cv2.error: OpenCV(4.8.1) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

and then a second window pops-up, titled Source x Target Mapper, like below

image

Then no matter if I select another image (which btw I am not sure why I need to) the console remains as it is. If I click the Start button on the main window, I get prompted I should finish my business with the 2nd window. If I close the 2nd window and then click Start, then the app state reaches the same deadlock/bug as described above

System

hacksider commented 5 days ago

Map faces works if you're planning to have multiple faces on the scene or if you want to target a specific face.