# bee-rembg **Repository Path**: xkpro/bee-rembg ## Basic Information - **Project Name**: bee-rembg - **Description**: 基于 rembg 封装的命令行工具 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-31 - **Last Updated**: 2025-11-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 背景移除命令行工具 基于 rembg 的批量图片背景移除工具,支持多种模型和高级处理选项。 ## 安装依赖 ```bash pip install rembg tqdm ``` ## 使用方法 推荐使用 `birefnet-` 开头的模型 ```bash # 处理单张图片 python .\src\main.py input.jpg -o output.png -m birefnet-general # 批量处理目录 python .\src\main.py ./input_images -o ./output_images # 使用人像分割模型 python .\src\main.py input.jpg -m birefnet-portrait # 启用 alpha matting 处理发丝细节 python .\src\main.py input.jpg -m birefnet-portrait --alpha-matting --erode-size 20 # 设置白色背景 python .\src\main.py input.jpg --bgcolor "255,255,255" # 只生成掩码 python .\src\main.py input.jpg --only-mask # 指定模型目录 python .\src\main.py "C:\Users\ke\Pictures\涛" -m birefnet-portrait --model-dir "C:\Users\ke\dev\llm-models\BiRefNet" ``` ## 打包 ```bash pip install pyinstaller python build.py ``` ## 模型列表 主要模型简介。[详细](./docs/models.md) - `birefnet-general`(通用版):[BiRefNet-general-epoch_244.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-general-epoch_244.onnx) - `birefnet-general-lite`(轻量版,移动设备):[BiRefNet-general-bb_swin_v1_tiny-epoch_232.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-general-bb_swin_v1_tiny-epoch_232.onnx) - `birefnet-portrait`(人像)[BiRefNet-portrait-epoch_150.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-portrait-epoch_150.onnx) - `birefnet-dis`(二分图像分割版):[BiRefNet-DIS-epoch_590.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-DIS-epoch_590.onnx) - `birefnet-hrsod`(高分辨率显著目标检测版):[BiRefNet-HRSOD_DHU-epoch_115.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-HRSOD_DHU-epoch_115.onnx) - `birefnet-cod`(隐藏目标检测版):[BiRefNet-COD-epoch_125.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-COD-epoch_125.onnx) - `birefnet-massive`(海量数据版): [BiRefNet-massive-TR_DIS5K_TR_TEs-epoch_420.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-massive-TR_DIS5K_TR_TEs-epoch_420.onnx)