Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FaceRestoreHelper seems not thread-safe #42

Open
henryruhs opened this issue Jul 17, 2023 · 3 comments
Open

FaceRestoreHelper seems not thread-safe #42

henryruhs opened this issue Jul 17, 2023 · 3 comments

Comments

@henryruhs
Copy link

henryruhs commented Jul 17, 2023

Using FaceRestoreHelper needs with threading.Semaphore() to work within threads. I experienced this first in GFPGAN and later in our custom implementations.

This limits performance of GFPGAN a lot!

@I8Robot
Copy link

I8Robot commented Jul 18, 2023

this error:

"facexlib\utils\face_restoration_helper.py", line 151, in get_face_landmarks_5
    self.det_faces.append(bbox[0:5])
AttributeError: 'numpy.ndarray' object has no attribute 'append'"?

May I ask where to add with threading.Semaphore()? I also want to work with multithreads.

@henryruhs
Copy link
Author

henryruhs commented Jul 18, 2023

Just before using it, you can create the instance via threading.Lock() before.
You can find our code (using gfpgan) here: https://github.com/s0md3v/roop/blob/main/roop/processors/frame/face_enhancer.py

@I8Robot
Copy link

I8Robot commented Jul 18, 2023

Just before using it, you can create the instance via threading.Lock() before. You can find our code (using gfpgan) here: https://github.com/s0md3v/roop/blob/main/roop/processors/frame/face_enhancer.py

OK, roop 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants