https://github.com/danielgatis/rembg
Linux环境下:
python3.8环境下 pip install rembg
第一次运行时,如果不能运行,说明下载模型没有自动加载。模型需要下载。 https://docs.google.com/uc?export=download&id=1ao1ovG1Qtx4b7EoskHXmi2E9rp5CHLcZ
将下载的u2net.pth 保存到根目录自创.u2net文件夹下 运行 rembg p path/to/input path/to/output
命令即可
如报错no module named ‘torch._c’ 则安装conda install pytorch即可