Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'Loader' is not defined #62

Closed
doskebaby opened this issue May 25, 2024 · 2 comments
Closed

NameError: name 'Loader' is not defined #62

doskebaby opened this issue May 25, 2024 · 2 comments

Comments

@doskebaby
Copy link

Thank you for your excellent and user-friendly project.
I’m reporting an error that occurred in my environment.
While it works fine with images, an error occurs when trying to make the video GreenBack.
The path to FFmpeg is set correctly.

Windows 10 Home 22H2 19045.4412
NVIDIA-SMI 531.61 Driver Version: 531.61 CUDA Version: 12.1
Python 3.10.11

K:\>transparent-background --source K:\a.mkv --type green
Settings -> Mode=base, Device=cuda:0, Torchscript=disabled
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\lawra\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\lawra\AppData\Local\Programs\Python\Python310\Scripts\transparent-background.exe\__main__.py", line 7, in <module>
  File "C:\Users\lawra\AppData\Local\Programs\Python\Python310\lib\site-packages\transparent_background\Remover.py", line 264, in console
    loader = eval(_format + "Loader")(args.source)
  File "<string>", line 1, in <module>
NameError: name 'Loader' is not defined

K:>transparent-background --source K:\a.mkv
Settings -> Mode=base, Device=cuda:0, Torchscript=disabled
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\user0\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\user0\AppData\Local\Programs\Python\Python310\Scripts\transparent-background.exe_main
.py", line 7, in
File "C:\Users\user0\AppData\Local\Programs\Python\Python310\lib\site-packages\transparent_background\Remover.py", line 264, in console
loader = eval(_format + "Loader")(args.source)
File "", line 1, in
NameError: name 'Loader' is not defined

K:\>ffmpeg -version
ffmpeg version N-115371-g62397bcf6a-20240524 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 13.2.0 (crosstool-NG 1.26.0.65_ecc5e41)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20240524
libavutil      59. 20.100 / 59. 20.100
libavcodec     61.  5.104 / 61.  5.104
libavformat    61.  3.104 / 61.  3.104
libavdevice    61.  2.100 / 61.  2.100
libavfilter    10.  2.102 / 10.  2.102
libswscale      8.  2.100 /  8.  2.100
libswresample   5.  2.100 /  5.  2.100
libpostproc    58.  2.100 / 58.  2.100
@plemeri
Copy link
Owner

plemeri commented May 30, 2024

Hi @doskebaby, the error happens because of the mkv extension which is currently not supported. I think it may work by just renaming the file such as a.mp4 since opencv would accept mkv files, but not sure about it.

Please refer to the source code down below for supported video formats

vid_count = len([i for i in source if i.lower().endswith(('.mp4', '.avi', '.mov' ))])

@plemeri
Copy link
Owner

plemeri commented Jun 11, 2024

I guess your problem has been resolved since there's no further question. Closing the issue.

@plemeri plemeri closed this as completed Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants