Files
rui40000-RUI-Nodes/feynobg/__init__.py
T
rui40000andClaude Opus 4.8 1bd90c71b6 feat: 新增满屏文字水印与 FeyNobg 抠图两个节点
满屏文字水印(watermark_node.py):
- 文案/字体/字号/旋转角度/密度/字间距/透明度/颜色 八项可调
- 交错网格平铺后整体旋转再从中心裁切,任意角度下四角均无空白

FeyNobg 抠图(feynobg_node.py + feynobg/):
- 内嵌 nobg 推理子集(Apache-2.0),全自动去背景,输出 alpha 与去背景图
- 重写预处理去掉对 transformers>=5.4 的依赖,4.x 环境可直接使用
- 修复权重键名与 transformers 4.x 的 SwinBackbone 命名不兼容:
  不处理时 958 个参数仅 405 个对得上,backbone 形同随机初始化,
  模型不报错但 alpha 几乎全黑;现按环境自动重映射并严格校验,
  除确定性 buffer 外任何失配都直接中止

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-29 09:26:05 +08:00

23 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""
FeyNobg 推理子集(内嵌自 https://github.com/feyninc/nobg ,Apache-2.0)
=====================================================================
只保留推理必需的部分,供 Ruinode 的 FeyNobg 抠图节点使用:
- modeling_birefnet.py / loss.py / mixin.py / utils.py —— 与上游逐字节一致
- image_processing_birefnet.py —— 已重写,去掉对 transformers>=5.4 的依赖
(上游继承 TorchvisionBackend,在 transformers 4.x 上直接 ImportError)
上游的 auto.py 未内嵌:其 AutoModel.from_pretrained 会调 model_info() 联网查
仓库 tags,而 ComfyUI 场景下模型是本地目录,联网检查既没必要又会在离线时失败。
节点改为直接调用 BiRefNet.from_pretrained(本地目录)。
"""
# ruff: noqa: F401
from .birefnet.image_processing_birefnet import BiRefNetImageProcessor
from .birefnet.modeling_birefnet import BiRefNet, BiRefNetConfig
# 对应上游 nobg 版本
__version__ = "0.2.4"
__all__ = ["BiRefNet", "BiRefNetConfig", "BiRefNetImageProcessor"]