【问题标题】:rembg library can't open 'i' error and also pickling errorrembg library can\'t open \'i\' error and also pickling error
【发布时间】:2022-12-26 19:16:11
【问题描述】:

I want to use rembg library to remove background of images. So I followed the instructions on github and try with rembg cli:

Python version: 3.9.12

rembg version: 1.0.27

OS: macOS Monterey 12.4

Chip: Apple M1 Silicon

https://github.com/danielgatis/rembg

rembg i man.jpeg output.png

Even if I'm on the right directory, I got this error message:

rembg: error: argument input: can't open 'i': [Errno 2] No such file or directory: 'i'

How can I resolve this? Is there any other methods?

Here is my other trial:

from rembg.bg import remove
from PIL import Image

input_path = 'man.jpeg'
output_path = 'output.png'

input = Image.open(input_path)
output = remove(input)
output.save(output_path)

It also gives that error message:

  File "/Users/cucal/Desktop/coding/venvs/science/lib/python3.9/site-packages/torch/serialization.py", line 920, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

Edit:I tried this one https://github.com/danielgatis/rembg/issues/262 , but I don't know how to handle downloaded files. One is '.pth' other is '.onnx' files. When I copy these files to u2net in site-package, I'm getting the same pickle error.

【问题讨论】:

    标签: python


    【解决方案1】:

    Perhaps it does not work with jpeg (only png)

    【讨论】:

      猜你喜欢
      • 2022-10-18
      • 2021-12-30
      • 2017-10-24
      • 2017-05-13
      • 2022-12-02
      • 2022-08-19
      • 1970-01-01
      • 2015-08-16
      相关资源
      最近更新 更多