『transparent-background』自動分離人像同背景,再生成遮罩,冇需人手干預.
https://github.com/plemeri/transparent-background |
登入『命令行模式CMD』, 進入資料夾Python.
CD C:\Program Files\Python310\ |
下載安裝『transparent-background』1.3.2版,
python.exe -m pip install transparent-background==1.3.2 |
裝1.3.3版係產生’fast’錯設
remover = Remover(fast=tb_use_fast_mode, jit=tb_use_jit, device=devices.get_optimal_device_name()) TypeError: Remover.init() got an unexpected keyword argument ‘fast’ |
卸裝『transparent-background』
pip uninstall transparent-background |
可能需要更新python
python.exe -m pip install –upgrade pip |
顯列python安装包及版本號.
Pip list |
下載模型『ckpt_base.pth』『ckpt_fast.pth』『ckpt_base_nightly.pth』
下載後擺係『C:\Users\user.transparent-background』
佢有圖形版『transparent-background-gui.exe』壹建生成遮罩.
C:\Program Files\Python310\Scripts\transparent-background-gui.exe |
- 撳『open file』載入圖檔.
- 勾『reverse』反轉遮罩.
- 撳『process』生成遮罩.
如果『pydantic』報錯可先卸载後重装
ImportError: cannot import name ‘ValidationInfo’ from ‘pydantic’ (C:\Users\bookc\AppData\Roaming\Python\Python310\site-packages\pydantic\__init__.cp310-win_amd64.pyd) |
先卸载『pydantic』
python.exe -m pip uninstall pydantic |
後重装『pydantic』
python.exe -m pip install pydantic==1.8.1 |