You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the python312._pth file's line 5 from #import site to import site
Download get-pip.py and use python.exe in dir to run it. (A folder will be create as the rusult which located near python.exe in the dir named Scripts)
Use pip.exe in Scripts dir to install rembg
Download u2net_human_seg.onnx and place it to the Scripts dir
Open powershell in Scripts dir and run the command as follow
Command1 (Error)
Use relative path.
./rembg.exe i -m u2net_custom -x '{"model_path": "./u2net_human_seg.onnx"}'"123.jpg""123_u.jpg"
Command2 (Error)
Use absolute path.
./rembg.exe i -m u2net_custom -x '{"model_path": "D:\\Temp\\rembg-embedded\\python-3.12.3-embed-amd64\\Scripts\\u2net_human_seg.onnx"}'"123.jpg""123_u.jpg"
Command3 (Error)
Change quotation marks
1
./rembg.exe i -m u2net_custom -x "{"model_path": "./u2net_human_seg.onnx"}""123.jpg""123_u.jpg"
2
./rembg.exe i -m u2net_custom -x "{model_path: ./u2net_human_seg.onnx}""123.jpg""123_u.jpg"
3
./rembg.exe i -m u2net_custom -x "{'model_path': './u2net_human_seg.onnx'}""123.jpg""123_u.jpg"
Command3 (Error)
Use equal sign
1
./rembg.exe i -m u2net_custom -x "{"model_path"="./u2net_human_seg.onnx"}""123.jpg""123_u.jpg"
2
./rembg.exe i -m u2net_custom -x="{"model_path": "./u2net_human_seg.onnx"}""123.jpg""123_u.jpg"
Error msg
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Scripts\rembg.exe\__main__.py", line 4, in <module>
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\rembg\cli.py", line 16, in <module>
_main()
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\rembg\commands\i_command.py", line 108, in i_command
output.write(remove(input.read(), session=new_session(model, **kwargs), **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\rembg\session_factory.py", line 44, in new_session
return session_class(model_name, sess_opts, providers, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Temp\rembg-embedded\python-3.12.3-embed-amd64\Lib\site-packages\rembg\sessions\u2net_custom.py", line 43, in __init__
raise ValueError("model_path is required")
I insert code in u2net_custom.py , line 37 (after comments) to show kwargs and args, and, I see nothing about model_path as if this kwarg has been delete when program transform the args info.
I also encountered this problem, it seems to be caused by the inconsistency between Linux system commands and Windows system commands. After trying, the correct usage for Windows is: rembg i -m u2net_custom -x "{\"model_path\": \"C:/your model path/your model name.onnx\"}" ./images/input.jpg ./images/output.jpg
I have successfully used the model I trained myself, but I need to pay attention to the '' '/' issue between the model path and the image path. I hope you can help me
Sum
I decide to use
u2net_human_seg.onnx
on my custom dir withPython embedded
(in order to make a portable package) and meet problem.To Reproduce
Steps to reproduce the behavior:
python312._pth
file's line 5 from#import site
toimport site
python.exe
in dir to run it. (A folder will be create as the rusult which located nearpython.exe
in the dir namedScripts
)pip.exe
inScripts
dir to installrembg
u2net_human_seg.onnx
and place it to theScripts
dirScripts
dir and run the command as followCommand1 (Error)
Use relative path.
Command2 (Error)
Use absolute path.
Command3 (Error)
Change quotation marks
1
2
3
Command3 (Error)
Use equal sign
1
2
Error msg
Expected behavior
Run successfully without any error.
System and Python info
Windows 10, 22H2, 19045.4291
Python 3.12.3 (embedded)
Rembg version
v2.0.57 (latest)
Additional info
u2net_custom.py
, line 37 (after comments) to show kwargs and args, and, I see nothing aboutmodel_path
as if this kwarg has been delete when program transform the args info.Code:
Show:
The text was updated successfully, but these errors were encountered: