wuhuikai / FaceSwap

Swap face between two photos.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot connect to X server

stephanedebove opened this issue · comments

Hi there,

I tried to run this code on an online notebook, and got the error message " cannot connect to X server ".

From what I understand it's because you're calling "cv2.imshow" at some point in your code. Is there a way to save the morphed image directly without displaying anything before that?

  1. --no_debug_window to disable all windows.
  2. If there're multiple faces in your images, a window is always opened.

Thanks for the reply! I have only one face in my images, but I get this error now:

Traceback (most recent call last):
File "main.py", line 72, in
src_points, src_shape, src_face = select_face(src_img)
File "main.py", line 14, in select_face
faces = face_detection(im)
File "/content/FaceSwap/face_detection.py", line 9, in face_detection
faces = detector(img, upsample_times)
TypeError: call(): incompatible function arguments. The following argument types are supported:
1. (self: dlib.fhog_object_detector, image: array, upsample_num_times: int=0) -> dlib.rectangles

Invoked with: <dlib.fhog_object_detector object at 0x7f62e1276ea0>, None, 1

Any idea why?

Try dlib == 19.9.0

It seems I can't install this version:

ERROR: Failed building wheel for dlib

If you feel like it, I have created a copy of my notebook that you can modify as you wish: https://colab.research.google.com/drive/1HYFv6vxwvo91wSxRGdTfUhuv_VfTBNyX

It works now :)

%cd /content
!git clone https://github.com/wuhuikai/FaceSwap
%cd /content/FaceSwap
!pip install -r requirements.txt
!python main.py --src imgs/test6.jpg --dst imgs/test7.jpg --out results/out.jpg --no_debug_window --correct_color