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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

High cpu usage 200%

wbender-wurl opened this issue · comments

Hi, no matter what I do I get high cpu usage. Even if I don't do any frame processing.

python3 fake.py --no-foreground -W 680 --no-ondemand --no-background

I am using v4l2loopback

$ apt show v4l2loopback-dkms 
Package: v4l2loopback-dkms
Version: 0.12.3-1ubuntu0.4
Priority: extra
Section: universe/graphics
Source: v4l2loopback
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 109 kB
Depends: dkms (>= 2.1.0.0)
Suggests: v4l2loopback-utils
Homepage: https://github.com/umlaeute/v4l2loopback
Download-Size: 27.3 kB
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
Description: Source for the v4l2loopback driver (DKMS)
 This module allows you to create "virtual video devices".
 Normal (v4l2) applications will read these devices as if they were ordinary
 video devices, but the video will not be read from e.g. a capture card but
 instead it is generated by another application.
 .
 This package provides the source code for the v4l2loopback kernel modules
 to be built with dkms.

N: There is 1 additional record. Please use the '-a' switch to see it

What kind of CPU do you have?

11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz

It is a dell xps 13 laptop

What's the Python version, and which Linux distribution are you running?

$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS (fossa-bulbasaur X54)"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ python3 --version
Python 3.8.10

I haven't received this report from other users. I will leave it open here. Hopefully someone else can comment on it.

commented

I'm also at 200%-300% CPU usage.

On Arch Linux (5.13.10-arch1-1), AMD Ryzen 7 3700X CPU, Python 3.8.11, with Akvcam.

I pinned MediaPipe version back to 0.8.5, please let me know if the bug still exists.

commented

For me, this has not changed anything in terms of CPU usage.

I personally cannot replicate the issue. I guess people just have discuss amongst themselves.

I'm seeing this issue as well on Gentoo, Intel Core i7 7700, Python 3.9.6, using v4l2loopback

It also segfaults after a while

[64079.508032] python3[1334911]: segfault at b8 ip 00007fb7d50df310 sp 00007ffd562250e8 error 4 in libpython3.9.so.1.0[7fb7d5057000+1c9000]
[64079.508041] Code: 00 ff d2 48 8b bb c0 00 00 00 48 85 ff 75 db 8b 83 b8 00 00 00 83 e8 01 89 83 b8 00 00 00 5b c3 66 2e 0f 1f 84 00 00 00 00 00 <8b> 87 b8 00 00 00 83 f8 31 7f 15 83 c0 01 89 87 b8 00 00 00 31 c0

@kabili207 , which version of MediaPipe do you have?

kabili@yakira ~ $ pip show mediapipe
Name: mediapipe
Version: 0.8.6.2
Summary: MediaPipe is the simplest way for researchers and developers to build world-class ML solutions and applications for mobile, edge, cloud and the web.
Home-page: https://github.com/google/mediapipe
Author: The MediaPipe Authors
Author-email: mediapipe@google.com
License: Apache 2.0
Location: /home/kabili/.local/lib/python3.9/site-packages
Requires: wheel, matplotlib, protobuf, absl-py, six, opencv-contrib-python, numpy, attrs

@kabili207 , please install MediaPipe 0.8.5.

Please checkout the latest commit (2f7d698). The FPS is vastly improved, but the CPU usage is about 200% on a i7-4900MQ.