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.86k stars 575 forks source link

RuntimeError The file might be corrupted, Windows 10 #91

Closed davidkern13 closed 1 year ago

davidkern13 commented 1 year ago

I get this errror in console after run this command backgroundremover -i "./image.jpeg" -o "output.png"

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "path\backgroundremover.exe__main__.py", line 7, in File "path\backgroundremover\cmd\cli.py", line 239, in main remove( File "path\backgroundremover\bg.py", line 183, in remove model = get_model(model_name) File "path\backgroundremover\bg.py", line 171, in get_model return detect.load_model(model_name="u2net") File "path\backgroundremover\u2net\detect.py", line 82, in load_model torch.load( File "path\torch\serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "path\torch\serialization.py", line 1051, in _legacy_load typed_storage._untyped_storage._set_from_file( RuntimeError: unexpected EOF, expected 4554729 more bytes. The file might be corrupted.


I think models its not downloaded and scripts dont find them and throw error. possible to redownload the train models automaticaly?

After put the error to chatgpt I get this response -> This error is coming from the torch library, which suggests that there might be an issue with the downloaded model file for the u2net model.

My environment:

Windows 10 FFmpeg version 5.1 Python version 3.11.4 Backgroundremover version 0.2.4 Torch version 2.0.1 Torchvision version 0.15.2

davidkern13 commented 1 year ago

when run command with model name backgroundremover -i "image.jpeg" -m "u2net_human_seg" -o "output.png" the model is download automaticaly for u2netp and u2net_human_seg and working whell, but for u2net still happen the error