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

change model.predict() to model(), notably improve memory leak (issue #697) #857

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

Villyli
Copy link

@Villyli Villyli commented Oct 10, 2023

To help improve #697, I use model() replace model.predict() and get notably improvement, which aviod generates a data generator in model.predict().

In my case, for a 1000 times loop, the memory increment is about 50 MiB. it seems that DeepFace.represent() now is capable of 100k loop for most use.

@Villyli
Copy link
Author

Villyli commented Oct 10, 2023

Besides, u can use a redirect stdout warpper to clean annoying process output

original_stdout = sys.stdout
sys.stdout = open(os.devnull, 'w')

# your codes intended to ignore output in terminal

sys.stdout.close()
sys.stdout = original_stdout

@merasil
Copy link

merasil commented Oct 19, 2023

this seems to fix my problem that i had which caused to lock up my app after long runtime when using facenet512 and yunet

@serengil serengil merged commit 68eaafc into serengil:master Oct 22, 2023
2 checks passed
@serengil
Copy link
Owner

thank you for your contribution

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

Successfully merging this pull request may close these issues.

3 participants