Implement BiRefNet and HAT Sharper models with background removal capabilities
- Added validation documentation for AI model tiers. - Introduced `background.py` for background removal logic, including inference functions for alpha and foreground extraction. - Created `onnx_birefnet.py` to handle BiRefNet model sessions and alpha inference. - Developed tests for background models, ensuring proper dispatch and session reuse. - Added tests for BiRefNet ONNX model to validate alpha output and error handling for invalid values. - Implemented model export scripts for BiRefNet and HAT Sharper, ensuring proper weight compression and licensing. - Created `deform_sampling.py` for deformable convolution operations used in BiRefNet. - Added utility functions for compressing ONNX weights without altering graph arithmetic. - Introduced a reference plane node for depth field adjustments in geometry processing.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
## Purpose
|
||||
|
||||
确保正式模型目录、本地资产准备和远端镜像对应同一套可验证资源,并在模型退役时明确清理其源码登记、开发权重缓存及远端对象,使用户下载和开发工具持续使用有效模型。
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 资产准备与发布跟随正式清单
|
||||
`model prepare` 和 `model sync` SHALL 覆盖九款正式模型的完整文件集合,对每个文件验证大小和 SHA-256;缺失、损坏或无法验证的资产 SHALL 明确失败。
|
||||
|
||||
#### Scenario: 新模型资产损坏
|
||||
- **WHEN** HAT 或 BiRefNet 的本地文件与登记大小或哈希不一致
|
||||
- **THEN** 准备或发布失败,该模型不被标记为完整就绪
|
||||
|
||||
#### Scenario: 新镜像验收
|
||||
- **WHEN** 新模型上传到 R2
|
||||
- **THEN** 使用实际下载来源回读并校验完整文件,记录每款模型的来源、大小、哈希和就绪结果
|
||||
|
||||
### Requirement: 退役资源在各发布入口一致移除
|
||||
DA3 全部现存变体、MoGe-2 ViT-L Normal、SAFMN 和 PiSA-SR SHALL 从正式模型集合、自动准备、下载和生产推理入口退役;对应专用源码、导出登记与专用构建依赖 SHALL 清理。
|
||||
|
||||
#### Scenario: 执行正式准备命令
|
||||
- **WHEN** 完成本次模型调整后运行模型准备或同步
|
||||
- **THEN** 只准备和发布九款正式模型,不下载、导出或上传退役模型
|
||||
|
||||
### Requirement: 远端和本地退役清理采用明确对象清单
|
||||
本次退役清理 SHALL 在新模型通过发布验收后执行。清理前 SHALL 列出并保存归属于退役模型的本地目录、开发缓存文件与 R2 对象键,仅操作核对过的目标,并在结束后复查对象存在性。
|
||||
|
||||
#### Scenario: 清理 DA3 远端残留
|
||||
- **WHEN** R2 中仍存在未列入正式模型清单的 DA3 变体
|
||||
- **THEN** 将归属已确认的 DA3 对象纳入本次退役清单、删除并复查,不能将停止上传视为删除完成
|
||||
|
||||
#### Scenario: 相邻目录包含其他资源
|
||||
- **WHEN** 模型目录或桶内同时存在保留模型、其他对象或用户产物
|
||||
- **THEN** 清理范围严格限定于已列出的退役目标,其他资源保持原样
|
||||
|
||||
#### Scenario: 部分对象清理失败
|
||||
- **WHEN** 本地或 R2 删除未能完整完成
|
||||
- **THEN** 记录成功与失败目标,报告未完成项,并在复查全部通过前保持退役任务未完成
|
||||
Reference in New Issue
Block a user