mchong6 / JoJoGAN

Official PyTorch repo for JoJoGAN: One Shot Face Stylization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Face not detected. Try a different image.

sidgupta234 opened this issue · comments

Tried using 3-4 different images, but getting the same error in all cases.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-16-59b843d3fc1f> in <module>()
     13 try:
---> 14     aligned_face = align_face(filepath)
     15 except:

2 frames
/content/JoJoGAN/util.py in align_face(filepath, output_size, transform_size, enable_padding)
    131     predictor = dlib.shape_predictor("models/dlibshape_predictor_68_face_landmarks.dat")
--> 132     lm = get_landmark(filepath, predictor)
    133 

/content/JoJoGAN/util.py in get_landmark(filepath, predictor)
    109 
--> 110     img = dlib.load_rgb_image(filepath)
    111     dets = detector(img, 1)

RuntimeError: Unable to open file: test_input/content/JoJoGAN/pic.jpeg

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
<ipython-input-16-59b843d3fc1f> in <module>()
     14     aligned_face = align_face(filepath)
     15 except:
---> 16     raise Exception('Face not detected. Try a different image.')
     17 
     18 # my_w = restyle_projection(aligned_face, name, device, n_iters=1).unsqueeze(0)

Exception: Face not detected. Try a different image.

Was pic.jpeg uploaded in test_input folder? If yes can you post how the reference looks like? It must be of a face that can be detected by dlib in order to be cropped and aligned. Else, you can do it manually yourself and just upload that.