yuval-alaluf / stylegan3-editing

Official Implementation of "Third Time's the Charm? Image and Video Editing with StyleGAN3" (AIM ECCVW 2022) https://arxiv.org/abs/2201.13433
https://yuval-alaluf.github.io/stylegan3-editing/
MIT License
660 stars 72 forks source link

Error in preparing_faces_parallel.py #7

Closed shampooooo closed 2 years ago

shampooooo commented 2 years ago

'pretrained_models/shape_predictor_68_face_landmarks.dat' file exists in the path. What's the problem?

!python prepare_data/preparing_faces_parallel.py \ --root_path /content/drive/MyDrive/Dataset/landscape \ --mode align

1 Running on 201 paths Here we goooo multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/usr/lib/python3.7/multiprocessing/pool.py", line 121, in worker result = (True, func(*args, *kwds)) File "/usr/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar return list(map(args)) File "prepare_data/preparing_faces_parallel.py", line 42, in extract_on_paths predictor = dlib.shape_predictor(SHAPE_PREDICTOR_PATH) TypeError: init(): incompatible constructor arguments. The following argument types are supported:

  1. dlib.shape_predictor()
  2. dlib.shape_predictor(arg0: str)

Invoked with: PosixPath('pretrained_models/shape_predictor_68_face_landmarks.dat') """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "prepare_data/preparing_faces_parallel.py", line 91, in run() File "/usr/local/lib/python3.7/dist-packages/pyrallis/argparsing.py", line 158, in wrapper_inner response = fn(cfg, *args, **kwargs) File "prepare_data/preparing_faces_parallel.py", line 85, in run pool.map(partial(extract_on_paths, args=args), file_chunks) File "/usr/lib/python3.7/multiprocessing/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/usr/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value TypeError: init(): incompatible constructor arguments. The following argument types are supported:

  1. dlib.shape_predictor()
  2. dlib.shape_predictor(arg0: str)

Invoked with: PosixPath('pretrained_models/shape_predictor_68_face_landmarks.dat')

woctezuma commented 2 years ago

dlib.shape_predictor() expects a str, and got a PosixPath instead. See:

I believe this line could could be the culprit: https://github.com/yuval-alaluf/stylegan3-editing/blob/e2a63fc7f072c4f8b8a7ba1dac8c7f87a8eb1647/prepare_data/preparing_faces_parallel.py#L42

Change it to: https://github.com/yuval-alaluf/stylegan3-editing/blob/e2a63fc7f072c4f8b8a7ba1dac8c7f87a8eb1647/inversion/video/video_handler.py#L71

yuval-alaluf commented 2 years ago

Thanks @woctezuma for the correction! I guess we missed this in our tests before the release. This has been fixed using your suggestion.