johnwmillr / Facer

Simple (🤞) face averaging (🙂) in Python (🐍)
MIT License
81 stars 11 forks source link

Only add image to warped/incremental if saving gif #7

Closed veggiedefender closed 4 years ago

veggiedefender commented 4 years ago

I tried running Facer on ~600 images this afternoon but my process kept getting OOM killed after processing about 50 images on my laptop with 16 gb of ram. After digging into the code, I found that the library was storing intermediate results from each face in memory in order to generate animated GIFs of the averaging process (which is super cool, but also not what I wanted).

This PR makes some small changes to only save those intermediate results when return_intermediates is true. Memory consumption stayed relatively manageable for me after this, and I was successfully able to average all 600 faces without crashing.

Atunelat commented 4 years ago

Have a similar project I'm developing. Appreciate the added information on this.

Hope to get back to it soon presuming I ever get OpenCV installed correctly.

johnwmillr commented 4 years ago

Thanks for this PR, @veggiedefender! You've made a welcome change. I'll merge the PR now.