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

MTCNN instance with preloaded weights doesn't work when used to detect faces after that #21

Open
sriram7777 opened this issue Sep 18, 2018 · 0 comments

Comments

@sriram7777
Copy link

sriram7777 commented Sep 18, 2018

I'm using MTCNN module as one of the final layers to detect faces. In my API, I'm pre-loading the MTCNN instance by executing the following code before spanning workers using gunicorn.
**mtcnn_detector = MTCNN()**
But when I'm trying to use it on the image coming to MTCNN layer, the detect_faces method gets stuck and the worker times out all the time.
**detector_object = mtcnn_detector.detect_faces(image_rgb)**
But surprisingly. when I initialize it just before calling detect_faces method, it works. I also noticed that the object created while preloading is the one getting used inside too when the image comes, but just that it gets stuck.
And, even when I try to use it as a singleton inside, it gets created for all the workers since it is not preloaded. Each object takes to around 200 MB approximately and I'm not in the position to afford 5 instances of it across the workers.

Any help would be of great help.

Thanks in advance.

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

1 participant