Open
【11月贡献大赛-Bug修复】fix(image-processor-config-auditor): 拦截负 image_std 归一化标准差(Fixes #4171) #7338
W8FXN182FAdd on 19 hours ago
【11月贡献大赛-Bug修复】fix(image-processor-config-auditor): 拦截负 image_std 归一化标准差(Fixes #4171) #7338
Open
Merge blocked
19 hours ago Added label: ascend-cla/no
ascend-robot
19 hours ago Comments:
19 hours ago Comments:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
PR Approval Progress
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| sig-model-agent | ❌ (0/2)(You can also ask: starmountain, 花新宇, cookieyyds, 陈少宏, 胡晓曼) | ❌ (0/1)(You can also ask: 王岩, 张玉橙, 陈少宏, 胡晓曼, 顾梦沁) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
W8FXN182F, thanks for your pull request. All authors of the commits have signed the CLA. 👍


W8FXN182F
19 hours ago Comments:
19 hours ago Comments:
/check-cla


ascend-robot
19 hours ago Comments:
19 hours ago Comments:
CLA检查未通过,详情可参考这里


W8FXN182F
19 hours ago Comments:
19 hours ago Comments:
/check-cla


19 hours ago Removed label: ascend-cla/no
19 hours ago Added label: ascend-cla/yes
ascend-robot
19 hours ago Comments:
19 hours ago Comments:
CLA检查已通过,详情可参考这里


10 hours ago Modify description of pull request
一句话
preprocessor_config.json审计器只拦截image_std恰为 0 的情况,负标准差(如[-0.5, 0.5, 0.5])仍被判为 READY;本 PR 将负image_std作为独立 BLOCK finding 拦截,并保留原有零标准差规则。复现(命令 + 修复前输出)
import sys sys.path.insert(0, "skills/verification/ascend-image-processor-config-auditor/scripts") import audit_image_processor_config as auditor config = { "image_processor_type": "CLIPImageProcessor", "do_normalize": True, "image_mean": [0.5, 0.5, 0.5], "image_std": [-0.5, 0.5, 0.5], } print(auditor.audit(config, {"num_channels": 3}))修复前输出(决策 READY、无 finding):
对比:把
image_std中的-0.5换成0.0时原逻辑能返回 BLOCK,说明负值绕过了ZERO_NORMALIZATION_STD检查。负标准差会反转对应通道的归一化方向,与预处理契约不一致。方案
在
scripts/audit_image_processor_config.py的归一化向量校验处:ZERO_NORMALIZATION_STD(含 0 即 BLOCK);NEGATIVE_NORMALIZATION_STD(BLOCK),拦截image_std中任一负值。代码改动仅此 1 个脚本;另新增回归测试
tests/test_negative_std.py,并按赛制合规补齐readme.md(原目录仅含 SKILL.md,缺 readme.md)。证据(unittest 原始输出)
修复前基线(
tests/test_audit_image_processor_config.py):Ran 27 tests in 0.123s ... OK修复后:
tests/test_negative_std.py:Ran 4 tests in 0.066s ... OK(负值 BLOCK、正值向量 READY、零值仍 BLOCK、CLI 退出码 2)
tests/test_audit_image_processor_config.py:Ran 27 tests in 0.123s ... OK复现对象验证:
image_std->{'decision': 'BLOCK', 'findings': [{'level': 'BLOCK', 'code': 'NEGATIVE_NORMALIZATION_STD', ...}]}image_std->{'decision': 'READY', 'findings': []}说明:本修复为纯 Python 标准库确定性复现,无 NPU 环境,未声称真机验证。
影响面分析
本 Skill 是推理前离线审计门禁(退出码 0=READY / 1=REVIEW / 2=BLOCK / 3=INPUT_ERROR,可直接挂 CI)。负
image_std的实际危害:归一化公式为(x - mean) / std,std为负时对应通道的归一化方向反转,等于对模型输入做了一个"与训练预处理契约相反"的变换——推理精度会静默劣化,且这种劣化在无真机对比时极难归因。原逻辑any(value == 0 ...)只拦截恰为 0 的标准差,-0.5这类负值直接绕过审计拿到 READY,属"门禁形同虚设"级别缺陷。设计说明(为什么是独立 finding 而非扩宽零值检查)
修复采用新增
NEGATIVE_NORMALIZATION_STD独立 finding,而非把原 ZERO 检查改成value <= 0:std=0(除零)与std<0(方向反转)是两类不同的配置错误,独立的 code 让维护者与使用者在审计报告里能直接区分根因;兼容性说明
image_mean/ 其他归一化向量的校验路径未触碰;边界矩阵(tests/test_negative_std.py 覆盖)
image_std含负值(如[-0.5, 0.5, 0.5])image_std含 0