fangfufu / Linux-Fake-Background-Webcam

Faking your webcam background under GNU/Linux, now supports background blurring, animated background, colour map effect, hologram effect and on-demand processing.
GNU General Public License v3.0
1.6k stars 161 forks source link

Suggestion: switch to new async interface for segmentation (>50% drop in CPU usage) #198

Open stephematician opened 11 months ago

stephematician commented 11 months ago

I would recommend switching to the asynchronous MediaPipe interface. I've been working on a similar (but fundamentally different) effect and I found that CPU usage dropped dramatically when switching to MediaPipe's new segment_async.

As an example, here's htop output when running Linux-Fake-Background-Webcam script doing no composition whatsoever (just segmenting) 1280x720, 30FPS, MJPG colour:

image

And here's the htop result when I'm running my own effect that uses segment_async (same input/output):

image

fangfufu commented 11 months ago

Feel free to submit a patch. I will review it and probably merge it.

stephematician commented 11 months ago

I won't have the time to work on this effect as well as my own - so feel free to close this issue.