dchatel / comfyui_facetools

These custom nodes provide a rotation aware face extraction, paste back, and various face related masking options.
MIT License
45 stars 7 forks source link

[FEATURE REQUEST] Scale down before detection for better performance #12

Open kilroythethird opened 1 week ago

kilroythethird commented 1 week ago

I am working with relatively big images and everything over 1080p is "slow" (110 seconds for 3008x4000 for example).

I suggest an option for the Detect Faces node to downscale the image to max_size or some reasonable default before running the detection.

I could send a reference implementation pretty quickly i assume, but a proper PR would take some time.

kilroythethird commented 1 week ago

Quick and super dirty implementation here for now: https://gist.github.com/kilroythethird/125e1300c14e0e20630eb7847eab97e0

Its wonky and def not optimized but it seem to work really well. ATM i am abusing the max_size parameter to also mean "downscale the source image to this size for the BB detection step". It also has other changes, sorry about that. The relevant parts for this are the Detect Node and utils.detect_faces.

If you are interested in that i could clean it up and send a PR the coming days