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

Run out of input error #110

Open Ashmit12092000 opened 11 months ago

Ashmit12092000 commented 11 months ago

I'm using Windows OS and python version 3.8.10

FRAME RATE DETECTED: 25/1 (if this looks wrong, override the frame rate) FRAME RATE: 25 TOTAL FRAMES: 523 WORKER 0 ONLINE WORKER FRAMERIPPER ONLINE Process Process-3: Traceback (most recent call last): File "D:\lib\multiprocessing\process.py", line 315, in _bootstrap self.run() File "D:\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, self._kwargs) File "D:\lib\site-packages\backgroundremover\utilities.py", line 29, in worker net = Net(model_name) File "D:\lib\site-packages\backgroundremover\bg.py", line 88, in init net.load_state_dict(torch.load(path, map_location=torch.device(DEVICE))) File "D:\lib\site-packages\torch\serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "D:\lib\site-packages\torch\serialization.py", line 1033, in _legacy_load magic_number = pickle_module.load(f, **pickle_load_args) EOFError: Ran out of input

nadermx commented 11 months ago

What was your innitial commmand?

Sammyueru commented 10 months ago

i got the same error: backgroundremover -i "<input filename>.webm" -m "u2net" -tg -o "<output filename>.gif"

JasonHug commented 10 months ago

same error +1. python3.9.7 windows. cmd: backgroundremover -i "D:\1.jpeg" -m "u2net" -o "D:\2.png"

vosalo commented 9 months ago

Same error. I'm using Windows, Python version 3.9.

> backgroundremover -i o1.mp4 -mk -o kek.mp4

probing C:\x\o1.mp4
FRAME RATE DETECTED: 359/12 (if this looks wrong, override the frame rate)
FRAME RATE: 30 TOTAL FRAMES: 773
WORKER FRAMERIPPER ONLINE
WORKER 0 ONLINE
Process Process-3:
Traceback (most recent call last):
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\site-packages\backgroundremover\utilities.py", line 28, in worker
    net = Net(model_name)
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\site-packages\backgroundremover\bg.py", line 88, in __init__
    net.load_state_dict(torch.load(path, map_location=torch.device(DEVICE)))
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\serialization.py", line 1028, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\serialization.py", line 1246, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
EOFError: Ran out of input
vosalo commented 9 months ago

It seems this error appears when torch tries to open an empty model. The program is loading u2net.pth which for some reason is empty, I suppose there is some problem with the automatic installation of u2net. I downloaded the hopefully correct file from https://github.com/xuebinqin/U-2-Net?tab=readme-ov-file and it works now.

LeonadroW commented 8 months ago

there's something with the default u2net model I think, and I just set model as "-m u2netp" to use it. model loading is fine this way.....but still have problems excuting a real cli [backgroundremover -i "aninput.mp4" -m "u2netp" -tg -o "anoutput.gif"] just as this one https://github.com/nadermx/backgroundremover/issues/115

nadermx commented 8 months ago

So your saying it's not downloading the u2net model? What version of python?