rembg
rembg copied to clipboard
nnxruntime_pybind11_state.NoSuchFile: [ONNXRuntimeError] : 3 : NO_SUCHFILE :[BUG] ...
Hello,
When I run the code below, I get the following error:
onnxruntime.capi.onnxruntime_pybind11_state.NoSuchFile: [ONNXRuntimeError] : 3 : NO_SUCHFILE : Load model from /Users/fatihshen/.u2net/u2net.onnx failed:Load model /Users/fatihshen/.u2net/u2net.onnx failed. File doesn't exist
from rembg import remove
from PIL import Image
input_path = 'my_cat.jpeg'
output_path = 'my_cat.png'
input = Image.open(input_path)
output = remove(input)
output.save(output_path)
I am using Macbook Pro (macOS Monterey, version 12.2, M1 chip). My Python is 3.10.2.
the same on linux
rembg i "/home/user/Pictures/image.jpg" "/home/user/Pictures/image.png"
Access denied with the following error:
Too many users have viewed or downloaded this file recently. Please
try accessing the file again later. If the file you are trying to
access is particularly large or is shared with many people, it may
take up to 24 hours to be able to view or download the file. If you
still can't access a file after 24 hours, contact your domain
administrator.
You may still be able to access the file from the browser:
https://drive.google.com/uc?id=1tCU5MM1LhRgGou5OpmpjBQbSrYIUoYab
Traceback (most recent call last):
File "/usr/local/bin/rembg", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/rembg/cli.py", line 95, in i
output.write(remove(input.read(), session=new_session(model), **kwargs))
File "/usr/local/lib/python3.10/dist-packages/rembg/session_factory.py", line 60, in new_session
ort.InferenceSession(
File "/usr/local/lib/python3.10/dist-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 347, in __init__
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "/usr/local/lib/python3.10/dist-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 384, in _create_inference_session
sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.NoSuchFile: [ONNXRuntimeError] : 3 : NO_SUCHFILE : Load model from /home/user/.u2net/u2net.onnx failed:Load model /home/user/.u2net/u2net.onnx failed. File doesn't exist
I got same problem and found workaround:
- Download
u2net.onnxfrom https://drive.google.com/uc?id=1tCU5MM1LhRgGou5OpmpjBQbSrYIUoYab - Put
u2net.onnxto path${HOME}/.u2net/u2net.onnx
Maybe reached the limit to access the file on Google Drive.
This issue is stale because it has been open for 30 days with no activity.
nowadays the models are downloaded from github instead of google drive, so this bug is fixed.