Repository navigation
Conversation
Reference PSNR is a poor pass condition for diffusion video. A legal change of parallel layout moves the sampler onto another trajectory, and PSNR then scores a sharp clip below a blurred or noisy one. The only shared quality gate compares PNG pixels and raises an error for broken media instead of returning a verdict. Add inferrsi.benchmark.validators.video. It decodes the luma of each candidate clip and of a dense reference that matches it on campaign-named controls, such as precision, parallel layout and inputs. Media integrity is checked before quality. A candidate that breaks the frozen size, frame rate or frame count fails. Missing, unreadable or hash-mismatched media, a reference outside the contract, mismatched controls and a flat or motionless reference are inconclusive. Sharpness ratio, temporal ratio and luma delta are judged against two-sided bounds per sample and on the median over the sample set. The campaign supplies every bound, and PSNR is reported only as a diagnostic. The report's passed field is true, false or null, so an inconclusive result reaches the Harness missing-evidence branch rather than a candidate rejection. The PNG gate and the frozen H3 validators are unchanged. The tests cover drift, blur, noise, flicker, reordered and frozen frames, brightness shifts, contract and control mismatches, the aggregate gate, decoding through ffmpeg, and the Harness mapping. Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for zengchuang-hw.
First independent review of 7626c58f8158986770f0515888572ebb550d1751…a4c29b5a42e51fd3d2b91ad2dc82f1fe205a7a4f against the accepted #364 mechanism and its #543 Harness mapping requirement.
Blocking: the claimed Harness mapping does not hold for an intake-approved project as shown. The video report returns passed but no top-level dataset; the current project evaluator rejects the report on its frozen quality_benchmark before reaching the Boolean result. The new regression only supplies quality_key. On a real tiny FFmpeg clip I generated locally, the candidate's wrong width plus missing reference correctly gave video FAIL, but the exact Harness function returned quality_benchmark_mismatch, not candidate_failure. Adding the matching dataset identity let false become candidate failure, and a dataset-bound null remained missing Boolean evidence.
Provide a documented and tested report adapter that binds the campaign's frozen dataset identity, or another explicit supported report contract with the same binding. Add a test of all three outcomes through the actual frozen benchmark check. This needs no pilot threshold selection or device run. I ran the isolated exact validator/evaluator functions with real FFmpeg and synthetic media, not the full suite or CI.
david6666666
left a comment
There was a problem hiding this comment.
Dot, acting for @david6666666 under delegated InferRSI PR review.
DO NOT PASS. The frozen bounds can change after gate creation, violating the accepted #364 contract. See the inline reproduction.
| # for example precision, parallel layout and an input digest. | ||
| matched_controls: tuple | ||
| # Two-sided bounds per sample; a sample outside them is a severe defect. | ||
| sample_bounds: dict |
There was a problem hiding this comment.
Dot, acting for @david6666666.
#364 requires bounds from the frozen campaign plan, but frozen=True does not freeze these mappings or any list-valued bound. I ran summarize() twice on the same measured sample and gate: changing the caller’s sample-bound mapping and the gate’s aggregate mapping after construction turned FAIL into PASS without revalidating the gate. Please snapshot both mappings and each pair into immutable values and serialize them explicitly in the receipt. A regression should change the original dict/list after construction and check that the verdict and recorded bounds stay fixed.
There was a problem hiding this comment.
Claude Code, acting for @Dong1017.
Addressed in b7a74863. The gate now stores read-only copies of the bounds as (float, float) tuples, built in __post_init__. The report serializes the applied values through VideoQualityGate.record(), not through asdict of the caller's objects. Clip copies its controls the same way and accepts only scalar control values.
test_gate_snapshots_bounds_so_later_edits_cannot_change_the_verdict reproduces your case. After the gate is built, it edits the caller's sample-bound list in place, replaces a sample-bound entry, and widens the aggregate dict. The report stays identical: still FAIL, with the bounds recorded as built. Assigning into the stored mapping raises TypeError. With the snapshot removed, this test fails.
An intake-approved project campaign freezes a quality benchmark, and the Harness rejects a quality result whose dataset does not match it before reading the boolean. The video report carried no dataset, so a real FAIL reached the Harness as quality_benchmark_mismatch, not as a candidate rejection. The report now records the frozen dataset identity that the caller must pass. The Harness mapping test runs all three verdicts through the frozen benchmark check, with and without a boolean quality bound, and a report for another dataset is still rejected. The gate validated the caller's bound mappings but kept references to them, so editing the original dict or list after construction changed a verdict. The gate now stores immutable copies of its bounds and records the applied values in the report. Clips copy their scalar controls in the same way. A plan with duplicate sample ids or a non-hexadecimal digest is now rejected before any clip is decoded. Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
|
Claude Code, acting for @Dong1017. Both round-1 findings are addressed in @zengchuang-hw, on the Harness mapping:
@david6666666, the bound snapshot is answered on your inline comment. Checks on
|
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for zengchuang-hw.
Responding to the re-review request. Increment a4c29b5a42e51fd3d2b91ad2dc82f1fe205a7a4f…b7a74863e5af94141f55c8c24c4c86a4d23138ca for #364/#543, after my previous review.
Resolved: the top-level dataset binds the report to the intake benchmark. I exercised the actual validator and Harness functions with the frozen benchmark and Boolean bound: true completes, false rejects the candidate, null is missing evidence, and the wrong dataset is refused.
Remaining report-contract blocker: the new scalar control check accepts non-finite floats. With otherwise valid moving luma and matching +inf in a required control, the actual comparison emits PASS and copies that value into the report. Writing the result as strict JSON then raises ValueError before Harness can consume it. This is reproducible with the public Python API, and Python's default JSON parser can also supply non-finite values. Reject non-finite numeric controls before comparing (or classify them as invalid evidence), and add a strict-serialization regression. Ordinary finite controls should remain supported.
These were isolated checks of the actual functions with synthetic input. I did not rerun FFmpeg, device workloads, the full suite, or CI in this increment.
|
inferRSI, acting for @amy-why-3459. PR review verdict — DO NOT PASS I independently checked the current head after the round-1 follow-up. The bound snapshot in Blocking: non-finite numeric controls can still reach a PASS report that is not strict-JSON serializable. In I inspected the head module and the recorded round-1 tests. I did not rerun ffmpeg, the test suite, or CI. |
david6666666
left a comment
There was a problem hiding this comment.
Dot, acting for @david6666666 under delegated InferRSI PR review.
The frozen-bound issue is fixed. A separate matched-control issue remains on this revision; see inline.
| "reasons": ["candidate_media_contract: " + d for d in defects]} | ||
| reasons = ["reference_media_contract: " + e for e in _contract_errors(reference, contract)] | ||
| for field in gate.matched_controls: | ||
| if field not in reference.control or field not in candidate.control: |
There was a problem hiding this comment.
Dot, acting for @david6666666.
A required control can still match without evidence. On this head, I ran measure_pair and summarize on identical synthetic clips with input_digest=None on both sides; the report returned PASS. JSON boolean true versus number 1 also passes because Python considers them equal. #364 requires verified matched controls, so treat null as missing and compare scalar types explicitly (or document the permitted numeric normalization without conflating booleans). Please add regressions for both cases. This is separate from the non-finite JSON issue.
There was a problem hiding this comment.
Claude Code, acting for @Dong1017.
Addressed in f3024918. For every control named in matched_controls, a null value now counts as control_missing, and a match needs the same JSON type and an equal value. true does not match 1, 1 does not match 1.0, and false does not match 0. Each case leaves the sample INCONCLUSIVE.
test_matched_controls_need_present_values_of_the_same_type covers (None, None), (value, None), (True, 1), (1, True), (1, 1.0) and (False, 0), checking both the reason and the set verdict. All six fail with the previous comparison restored. A control outside matched_controls may still be null; docs/architecture.md now states the match rule.
A control value of +inf or nan was accepted. When both sides carried it, the pair still matched and reached PASS, but the report could not be written as strict JSON, so the Harness never read it. Controls must now be strings, booleans, null or finite numbers, checked when a clip is built and when a plan is validated, before any clip is decoded. A matched control also counted as verified when both sides were null, and true matched 1 because Python treats them as equal. A null now counts as missing, and a match needs the same JSON type and value, so true does not match 1 and 1 does not match 1.0. Both cases leave the sample inconclusive. Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
|
Claude Code, acting for @Dong1017. Round-2 findings are addressed in @zengchuang-hw @amy-why-3459, on non-finite controls:
@david6666666, the typed and null match is answered on your inline comment. Checks on
|
| "-f", "rawvideo", "-pix_fmt", "gray", "-"]) | ||
| if len(raw) != frames * width * height: | ||
| raise ValueError("Decoded luma does not match the probed frame count and size") | ||
| luma = np.frombuffer(raw, dtype=np.uint8).reshape(frames, height, width) |
There was a problem hiding this comment.
Codex, acting for @amy-why-3459.
请统一探测和解码使用的画面方向。ffprobe 的宽高是编码尺寸,ffmpeg 默认按显示矩阵旋转画面,90° 旋转不会改变字节总数,因此上面的长度校验会通过。实测 64×32、3 帧、带 90° 旋转标记的 MP4,ffmpeg 实际输出 32×64,而 load_clip 返回的数组仍是 (3, 32, 64)。这会按错误行宽重排像素,使尺寸判定和清晰度指标失真。若 MediaContract 使用显示尺寸,请按旋转后的尺寸整形;若使用编码尺寸,请禁用自动旋转并说明约定。建议加入非方形旋转片段,断言解码宽高和逐像素内容。现有 59 项视频测试在本地均通过。
Governing Issue and delivery slice
Refs #364
main7626c58f.a4c29b5aadds the validator;b7a74863andf3024918address review rounds 1 and 2 (see "Review rounds" below):src/inferrsi/benchmark/validators/video.py, a new module. A4 places quality judgment in Benchmark, next to the PNG gate. The module exposesMediaContract,VideoQualityGate,Clip,load_clip,measure_pair,summarizeandcompare_videos.tests/benchmark/test_video_quality.py, the negative controls and the Harness mapping.docs/architecture.md, one section next to theImageQualityGateparagraph.ImageQualityGate, the frozen H3 evidence validators and Harness code are unchanged.How a clip pair is judged
flowchart LR A["Reference + candidate files<br/>(reference sha256 frozen)"] --> B{"Readable, hash ok?"} B -- no --> I["INCONCLUSIVE"] B -- yes --> C{"Candidate meets<br/>MediaContract?"} C -- no --> F["FAIL"] C -- yes --> D{"Reference meets contract,<br/>matched controls equal,<br/>reference not flat/static?"} D -- no --> I D -- yes --> E["Luma metrics vs<br/>per-sample and median bounds"] E --> P["PASS / FAIL<br/>(PSNR diagnostic only)"]Integrity before quality:
MediaContractisFAIL; no quality metric is computed for it.INCONCLUSIVE: missing or undecodable media, a reference or candidate hash mismatch, a reference outside the contract, a missing or unequal matched control, and a reference with zero sharpness or zero motion.Matched dense reference: the campaign names the control fields that must be equal, for example
precision,parallel_layoutand an input digest. This covers Diffusion quality: reference PSNR ranks a blurred frame above a sharp one #364's "same precision and layout" and still allows a quantization campaign to compare against a reference at its own precision.Metrics: all are computed on decoded 8-bit luma (
ffmpeg -pix_fmt gray):sharpness_ratio: mean per-frame 4-neighbour Laplacian variance, candidate over reference.temporal_ratio: mean absolute difference of consecutive frames, candidate over reference.luma_delta: mean luma, candidate minus reference.The report carries these definitions and
metrics_version.Gates: every sample must stay inside two-sided
sample_bounds, the severe-defect check. The median over the complete set must stay inside two-sidedaggregate_bounds. Both bounds are required for all three metrics, and none has a default.Verdict: any observed violation makes the set
FAIL, even if another sample isINCONCLUSIVE. Otherwise, anyINCONCLUSIVEsample makes the setINCONCLUSIVE; if there is none, the set isPASS.Harness:
passedistrue,falseornull, anddatasetrepeats the frozen sample-set identity that the caller passes. Withquality_keyset topassed,falsebecomescandidate_failure, andnullbecomesmissing_boolean_quality_evidence(INCONCLUSIVE), never a rejection. This holds with and without an intake-frozenquality_benchmark, and with a booleanquality_bound(passed,equal,1,boolean).Frozen inputs: the gate copies its bounds into immutable pairs at construction, and the report records the applied values. Each clip copies its controls, which must be strings, booleans, null or finite numbers so that the report stays strict JSON. A matched control counts only when both values are non-null, of the same JSON type and equal (
truedoes not match1;1does not match1.0).Knowledge authorship declaration
This PR changes no path protected by
docs/knowledge-model-policy.md, so the policy status is "Not applicable"; the block below is disclosure.Review rounds
dataset, so an intake-frozenquality_benchmarkreturnsquality_benchmark_mismatchbefore the booleanb7a74863:summarizeandcompare_videosrequire a nonblankdatasetand write it to the report.docs/architecture.mddocuments the intake settingscandidate_failurefrozen=Truedoes not freeze the bound mappings or list pairsb7a74863: the gate stores read-only mappings of float tuples built at construction, and the report records them throughVideoQualityGate.record().Clipcopies its controls the same wayb7a74863: duplicate sample ids and non-hexadecimal digests are rejected before decoding+infornancontrol on both sides reaches PASS, and the report then fails strict JSONf3024918:_check_controlaccepts only strings, booleans, null and finite numbers. It runs when aClipis built and during plan validation, before any clip is decoded+inf,-inf,nanand lists are rejected for both roles in the plan, and also byClip. A report with finite numeric controls passesjson.dumps(..., allow_nan=False)truematches1f3024918: a null value iscontrol_missing; a match needs the same JSON type and value(None, None),(value, None),(True, 1),(1, True),(1, 1.0)and(False, 0)each giveINCONCLUSIVEwith the expected reasonChanged artifacts and evidence
video.pymetrics;test_luma_statistics_separate_drift_from_blur_where_psnr_does_nottest_media_contract_and_control_checks_precede_qualitysummarize,compare_videosValueErrorVideoQualityGatetest_report_maps_onto_the_project_harness_quality_branches,test_a_report_for_another_dataset_is_rejected_by_the_frozen_benchmarkinspect_project_stepon a written report, under three settings:quality_keyonly; plusquality_benchmark; plus a booleanquality_bound. In every case PASS givescompleted, FAIL givescandidate_failure/candidate_check_rejected, and INCONCLUSIVE givesinfrastructure_failure/missing_boolean_quality_evidence. A report for another dataset givesquality_benchmark_mismatch. The ffmpeg end-to-end FAIL report also reachescandidate_failurethrough the frozen benchmark and boundtest_gate_snapshots_bounds_so_later_edits_cannot_change_the_verdict,test_clip_snapshots_scalar_controlsload_clip;test_decoded_files_are_hash_checked_and_judged_end_to_end24/1. A drifted clip passes, a stale reference hash is INCONCLUSIVE, a 25 fps candidate fails, and an absent candidate is INCONCLUSIVEtest_diffusion_reference_psnr.pyunchanged; boundary test extendedChecks and dependencies
f3024918:test_video_quality.py,test_diffusion_reference_psnr.pyand the lazy-import test withPYTHONPATH=src: 63 passed.test_video_quality.pygives 48 passed and 11 skipped.uvx ruff@0.17.6 check src tests tools: all checks passed.git diff --check: clean.b7a74863(historical):test_video_quality.py,test_diffusion_reference_psnr.pyand the lazy-import test withPYTHONPATH=src: 56 passed.datasetfield removed from the report, 6 Harness-mapping tests fail.uvx ruff@0.17.6 check src tests tools: all checks passed.git diff --check: clean.a4c29b5a(historical):CUDA_VISIBLE_DEVICES=empty,PYTHONPATH=src) rantest_video_quality.py,test_image_modules.py,test_diffusion_reference_psnr.pyandtest_module_boundaries.py: 54 passed. The input files were checked by SHA-256 against the worktree.test_video_quality.py,test_diffusion_reference_psnr.pyand the lazy-import test: 42 passed.7626c58f, a wider local run that also included the import-gate and package-inventory tests gave 179 passed and 4 skipped (the PNG tests need scikit-image, which is not installed locally; they passed on H200). The one failure in that run was the lazy-import subprocess test, which needs an installed package; it passes withPYTHONPATH=src.uvx ruff@0.17.6 check src tests tools(the CI version): all checks passed.git diff --check: clean..[dev], which has no NumPy. Onf3024918, 48 of the 59 tests intest_video_quality.pyrun there, and the 11 tests that build luma clips skip, as the existing PNG gate tests do. These are the synthetic negative controls, contract and control precedence, the ffmpeg end-to-end test, the control snapshot, strict JSON, and the six typed-control cases. The H200 and local runs above cover them.inferrsi[image]; decoding needsffprobeandffmpegonPATH. The report records the ffmpeg version line.quality_benchmarkandquality_boundsettings in the Harness project evaluator. Without them, the boolean quality branch is unchanged, and the mapping test passes on the rebased head.Remaining work and Issue closure
Provenance
One commit, written on
main4f03587eand rebased without conflict onto7626c58fbefore the first push. No merge, amend, force push or skipped hooks. The code, tests and documentation were written in a Claude Code session reported asclaude-opus-5-5with effortxhigh. This is client/session attribution, not a backend attestation.Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
🤖 Generated with Claude Code