nadermx / backgroundremover

Background Remover lets you Remove Background from images and video using AI with a simple command line interface that is free and open source.
https://www.backgroundremoverai.com
MIT License
6.81k stars 573 forks source link

It doesn't use GPU and runs much slower on Intel CPU #145

Open Triuman opened 6 months ago

Triuman commented 6 months ago

I'm running backgroundremover with matte key. First of all, it uses only CPU. Is there a way to make it use the GPU (RTX 3070m)?

When I run it on my laptop with AMD Ryzen 9 5900HX, it runs at around 1.4x speed. When I run it on a Zotac PC with i7-13700HX, it runs at 0.1x or less. Any idea what could be the reason?

PS C:\videos> backgroundremover -i "session_1191215649_output_0.mp4" -o "session_1191215649_output_0_my_matte.mov" -mk -m "u2net_human_seg"
FRAME RATE DETECTED: 10000000/333333 (if this looks wrong, override the frame rate)
FRAME RATE: 31 TOTAL FRAMES: 958
WORKER 0 ONLINE
WORKER FRAMERIPPER ONLINE
ffmpeg version 7.0-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, rawvideo, from 'fd:':
  Duration: N/A, start: 0.000000, bitrate: 14284 kb/s
  Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 180x320, 14284 kb/s, 31 tbr, 31 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Output #0, mov, to 'C:\Users\Kinder 4\Desktop\net6.0\videos\session_1191215649_output_0_my_matte.mov':
  Metadata:
    encoder         : Lavf61.1.100
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(progressive), 180x320, q=2-31, 2000 kb/s, 31 fps, 15872 tbn
      Metadata:
        encoder         : Lavc61.3.100 mpeg4
      Side data:
        cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: N/A
frame=  356 fps=2.2 q=2.0 size=       0KiB time=00:00:11.48 bitrate=   0.0kbits/s speed=0.0724x