add some models
This commit is contained in:
@@ -27,8 +27,13 @@ Support the use of new and old versions of BiRefNet models
|
||||
- General-HR: A pre-trained model for general use cases which shows great performance on higher resolution images (2048x2048).
|
||||
- General-Lite: A light pre-trained model for general use cases.
|
||||
- General-Lite-2K: A light pre-trained model for general use cases in high resolution (2560x1440).
|
||||
- General-dynamic: A pre-trained model for dynamic resolution, trained with images in range from 256x256 to 2304x2304.
|
||||
- General-reso_512: A pre-trained model for faster and more accurate lower resolution, trained with images in 512x512.
|
||||
- General-legacy: A pre-trained model for general use trained on DIS5K-TR,DIS-TEs, DUTS-TR_TE,HRSOD-TR_TE,UHRSD-TR_TE, HRS10K-TR_TE (w/o portrait seg data).
|
||||
- Portrait: A pre-trained model for human portraits.
|
||||
- Matting: A pre-trained model for general trimap-free matting use.
|
||||
- Matting-HR: A pre-trained model for general matting use which shows great matting performance on higher resolution images (2048x2048).
|
||||
- Matting-Lite: A light pre-trained model for general trimap-free matting use.
|
||||
- DIS: A pre-trained model for dichotomous image segmentation (DIS).
|
||||
- HRSOD: A pre-trained model for high-resolution salient object detection (HRSOD).
|
||||
- COD: A pre-trained model for concealed object detection (COD).
|
||||
@@ -41,8 +46,13 @@ If necessary, they can be downloaded from:
|
||||
- [General-HR](https://huggingface.co/ZhengPeng7/BiRefNet_HR/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `General-HR.safetensors`
|
||||
- [General-Lite](https://huggingface.co/ZhengPeng7/BiRefNet_T/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `General-Lite.safetensors`
|
||||
- [General-Lite-2K](https://huggingface.co/ZhengPeng7/BiRefNet_lite-2K/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `General-Lite-2K.safetensors`
|
||||
- [General-dynamic](https://huggingface.co/ZhengPeng7/BiRefNet_dynamic/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `General-dynamic.safetensors`
|
||||
- [General-legacy](https://huggingface.co/ZhengPeng7/BiRefNet-legacy/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `General-legacy.safetensors`
|
||||
- [General-reso_512](https://huggingface.co/ZhengPeng7/BiRefNet_512x512/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `General-reso_512.safetensors`
|
||||
- [Portrait](https://huggingface.co/ZhengPeng7/BiRefNet-portrait/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `Portrait.safetensors`
|
||||
- [Matting](https://huggingface.co/ZhengPeng7/BiRefNet-matting/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `Matting.safetensors`
|
||||
- [Matting-HR](https://huggingface.co/ZhengPeng7/BiRefNet_HR-matting/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `Matting-HR.safetensors`
|
||||
- [Matting-Lite](https://huggingface.co/ZhengPeng7/BiRefNet_lite-matting/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `Matting-Lite.safetensors`
|
||||
- [DIS](https://huggingface.co/ZhengPeng7/BiRefNet-DIS5K/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `DIS.safetensors`
|
||||
- [HRSOD](https://huggingface.co/ZhengPeng7/BiRefNet-HRSOD/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `HRSOD.safetensors`
|
||||
- [COD](https://huggingface.co/ZhengPeng7/BiRefNet-COD/resolve/main/model.safetensors) ➔ `model.safetensors` must be renamed `COD.safetensors`
|
||||
@@ -56,8 +66,8 @@ Some models on GitHub:
|
||||
- [BiRefNet-ep480.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/BiRefNet-ep480.pth)
|
||||
|
||||
## Weight Models (Optional)
|
||||
- [swin_large_patch4_window12_384_22kto1k.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/swin_large_patch4_window12_384_22kto1k.pth)(not General-Lite and General-Lite-2K model)
|
||||
- [swin_tiny_patch4_window7_224_22kto1k_finetune.pth](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms)(just General-Lite and General-Lite-2K model)
|
||||
- [swin_large_patch4_window12_384_22kto1k.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/swin_large_patch4_window12_384_22kto1k.pth)(not General-Lite, General-Lite-2K and Matting-Lite model)
|
||||
- [swin_tiny_patch4_window7_224_22kto1k_finetune.pth](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms)(just General-Lite, General-Lite-2K and Matting-Lite model)
|
||||
|
||||
|
||||
## Nodes
|
||||
@@ -67,7 +77,7 @@ Some models on GitHub:
|
||||
- Can select model from `${comfyui_rootpath}/models/BiRefNet` or the path of `birefnet` configured in the extra YAML file
|
||||
- You can download latest models from [BiRefNet Releases](https://github.com/ZhengPeng7/BiRefNet/releases) or old models [BiRefNet-DIS_ep580.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/BiRefNet-DIS_ep580.pth) and [BiRefNet-ep480.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/BiRefNet-ep480.pth)
|
||||
- When param use_weight is True, need download weight model [swin_large_patch4_window12_384_22kto1k.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/swin_large_patch4_window12_384_22kto1k.pth)
|
||||
model General-Lite must use weight model [swin_tiny_patch4_window7_224_22kto1k_finetune.pth](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms)
|
||||
model General-Lite, General-Lite-2K and Matting-Lite must use weight model [swin_tiny_patch4_window7_224_22kto1k_finetune.pth](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms)
|
||||
- RembgByBiRefNet
|
||||
- Output transparent foreground image and mask
|
||||
- RembgByBiRefNetAdvanced
|
||||
|
||||
+14
-4
@@ -27,8 +27,13 @@
|
||||
- General-HR: 用于一般用例的预训练模型,在更高分辨率的图像上表现出色(训练分辨率2048x2048)。
|
||||
- General-Lite: 用于一般用例的轻量级预训练模型。
|
||||
- General-Lite-2K: 用于一般用例的轻量级预训练模型,适用于高分辨率图像(最佳分辨率2560x1440)。
|
||||
- General-dynamic: 用于动态分辨率的预训练模型,基于256x256到2304x2304的图片分辨率进行训练。
|
||||
- General-reso_512: 一个更快、更准确的低分辨率预训练模型,基于512x512的图像训练。
|
||||
- General-legacy: 一般用例的预训练模型,基于DIS5K-TR,DIS-TEs, DUTS-TR_TE,HRSOD-TR_TE,UHRSD-TR_TE, HRS10K-TR_TE (w/o portrait seg data)。
|
||||
- Portrait: 人物肖像预训练模型。
|
||||
- Matting: 一种使用无trimap matting的预训练模型。
|
||||
- Matting: 一种使用无过渡遮罩抠图的预训练模型。
|
||||
- Matting-HR: 在更高分辨率的图像上显示出出色的性能的预训练模型 (2048x2048)。
|
||||
- Matting-Lite: 用一般用例的无过渡遮罩抠图的轻量级预训练模型。
|
||||
- DIS: 一种用于二分图像分割(DIS)的预训练模型。
|
||||
- HRSOD: 一种用于高分辨率显著目标检测(HRSOD)的预训练模型。
|
||||
- COD: 一种用于隐蔽目标检测(COD)的预训练模型。
|
||||
@@ -41,8 +46,13 @@
|
||||
- [General-HR](https://huggingface.co/ZhengPeng7/BiRefNet_HR/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `General-HR.safetensors`
|
||||
- [General-Lite](https://huggingface.co/ZhengPeng7/BiRefNet_T/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `General-Lite.safetensors`
|
||||
- [General-Lite-2K](https://huggingface.co/ZhengPeng7/BiRefNet_lite-2K/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `General-Lite-2K.safetensors`
|
||||
- [General-dynamic](https://huggingface.co/ZhengPeng7/BiRefNet_dynamic/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `General-dynamic.safetensors`
|
||||
- [General-legacy](https://huggingface.co/ZhengPeng7/BiRefNet-legacy/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `General-legacy.safetensors`
|
||||
- [General-reso_512](https://huggingface.co/ZhengPeng7/BiRefNet_512x512/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `General-reso_512.safetensors`
|
||||
- [Portrait](https://huggingface.co/ZhengPeng7/BiRefNet-portrait/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `Portrait.safetensors`
|
||||
- [Matting](https://huggingface.co/ZhengPeng7/BiRefNet-matting/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `Matting.safetensors`
|
||||
- [Matting-HR](https://huggingface.co/ZhengPeng7/BiRefNet_HR-matting/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `Matting-HR.safetensors`
|
||||
- [Matting-Lite](https://huggingface.co/ZhengPeng7/BiRefNet_lite-matting/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `Matting-Lite.safetensors`
|
||||
- [DIS](https://huggingface.co/ZhengPeng7/BiRefNet-DIS5K/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `DIS.safetensors`
|
||||
- [HRSOD](https://huggingface.co/ZhengPeng7/BiRefNet-HRSOD/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `HRSOD.safetensors`
|
||||
- [COD](https://huggingface.co/ZhengPeng7/BiRefNet-COD/resolve/main/model.safetensors) ➔ `model.safetensors` 重命名为 `COD.safetensors`
|
||||
@@ -58,8 +68,8 @@ GitHub上的模型:
|
||||
|
||||
## 权重模型(非必须)
|
||||
下载放在`models/BiRefNet`
|
||||
- [swin_large_patch4_window12_384_22kto1k.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/swin_large_patch4_window12_384_22kto1k.pth)(非General-Lite和General-Lite-2K模型)
|
||||
- [swin_tiny_patch4_window7_224_22kto1k_finetune.pth](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms)(仅General-Lite和General-Lite-2K模型)
|
||||
- [swin_large_patch4_window12_384_22kto1k.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/swin_large_patch4_window12_384_22kto1k.pth)(非General-Lite、General-Lite-2K和Matting-Lite模型)
|
||||
- [swin_tiny_patch4_window7_224_22kto1k_finetune.pth](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms)(仅General-Lite、General-Lite-2K和Matting-Lite模型)
|
||||
|
||||
|
||||
## 节点
|
||||
@@ -68,7 +78,7 @@ GitHub上的模型:
|
||||
- LoadRembgByBiRefNetModel
|
||||
- 从 `${comfyui_rootpath}/models/BiRefNet` 和 在extra YAML 文件中通过`birefnet`配置的路径中选择模型
|
||||
- 支持 [BiRefNet Releases](https://github.com/ZhengPeng7/BiRefNet/releases) 中的新模型 和 老的模型[BiRefNet-DIS_ep580.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/BiRefNet-DIS_ep580.pth) 与 [BiRefNet-ep480.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/BiRefNet-ep480.pth)
|
||||
- 参数use_weight设为True时, 需要下载权重模型,General-Lite模型使用[swin_tiny_patch4_window7_224_22kto1k_finetune.pth](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms),其它模型使用 [swin_large_patch4_window12_384_22kto1k.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/swin_large_patch4_window12_384_22kto1k.pth)
|
||||
- 参数use_weight设为True时, 需要下载权重模型,General-Lite、General-Lite-2K和Matting-Lite模型使用[swin_tiny_patch4_window7_224_22kto1k_finetune.pth](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms),其它模型使用 [swin_large_patch4_window12_384_22kto1k.pth](https://huggingface.co/ViperYX/BiRefNet/resolve/main/swin_large_patch4_window12_384_22kto1k.pth)
|
||||
- RembgByBiRefNet
|
||||
- 输出透明前景图和遮罩
|
||||
- RembgByBiRefNetAdvanced
|
||||
|
||||
+11
-5
@@ -19,17 +19,23 @@ models_path_default = folder_paths.get_folder_paths(models_dir_key)[0]
|
||||
usage_to_weights_file = {
|
||||
'General': 'BiRefNet',
|
||||
'General-HR': 'BiRefNet_HR',
|
||||
'General-Lite': 'BiRefNet_T',
|
||||
'Matting-HR': 'BiRefNet_HR-matting',
|
||||
'General-Lite': 'BiRefNet_lite',
|
||||
'General-Lite-2K': 'BiRefNet_lite-2K',
|
||||
'General-reso_512': 'BiRefNet_512x512',
|
||||
'Portrait': 'BiRefNet-portrait',
|
||||
'Matting': 'BiRefNet-matting',
|
||||
'Matting-Lite': 'BiRefNet_lite-matting',
|
||||
# 'Anime-Lite': 'BiRefNet_lite-Anime',
|
||||
'DIS': 'BiRefNet-DIS5K',
|
||||
'HRSOD': 'BiRefNet-HRSOD',
|
||||
'COD': 'BiRefNet-COD',
|
||||
'DIS-TR_TEs': 'BiRefNet-DIS5K-TR_TEs'
|
||||
'DIS-TR_TEs': 'BiRefNet-DIS5K-TR_TEs',
|
||||
'General-legacy': 'BiRefNet-legacy',
|
||||
'General-dynamic': 'BiRefNet_dynamic',
|
||||
}
|
||||
|
||||
modelNameList = ['General', 'General-HR', 'General-Lite', 'General-Lite-2K', 'Portrait', 'Matting', 'DIS', 'HRSOD', 'COD', 'DIS-TR_TEs']
|
||||
modelNameList = list(usage_to_weights_file.keys())
|
||||
|
||||
|
||||
def get_model_path(model_name):
|
||||
@@ -118,7 +124,7 @@ class AutoDownloadBiRefNetModel:
|
||||
DESCRIPTION = "Auto download BiRefNet model from huggingface to models/BiRefNet/{model_name}.safetensors"
|
||||
|
||||
def load_model(self, model_name, device, dtype="float32"):
|
||||
bb_index = 3 if model_name == "General-Lite" or model_name == "General-Lite-2K" else 6
|
||||
bb_index = 3 if model_name == "General-Lite" or model_name == "General-Lite-2K" or model_name == "Matting-Lite" else 6
|
||||
biRefNet_model = BiRefNet(bb_pretrained=False, bb_index=bb_index)
|
||||
model_file_name = f'{model_name}.safetensors'
|
||||
model_full_path = folder_paths.get_full_path(models_dir_key, model_file_name)
|
||||
@@ -163,7 +169,7 @@ class LoadRembgByBiRefNetModel:
|
||||
biRefNet_model = OldBiRefNet(bb_pretrained=use_weight)
|
||||
else:
|
||||
version = VERSION[1]
|
||||
bb_index = 3 if model == "General-Lite.safetensors" or model == "General-Lite-2K.safetensors" else 6
|
||||
bb_index = 3 if model == "General-Lite.safetensors" or model == "General-Lite-2K.safetensors" or model == "Matting-Lite.safetensors" else 6
|
||||
biRefNet_model = BiRefNet(bb_pretrained=use_weight, bb_index=bb_index)
|
||||
|
||||
model_path = folder_paths.get_full_path(models_dir_key, model)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui_birefnet_ll"
|
||||
description = "Sync with version of BiRefNet. NODES:AutoDownloadBiRefNetModel, LoadRembgByBiRefNetModel, RembgByBiRefNet, RembgByBiRefNetAdvanced, GetMaskByBiRefNet, BlurFusionForegroundEstimation."
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
license = {file = "LICENSE"}
|
||||
dependencies = ["numpy", "opencv-python", "timm"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user