Repository navigation
test: preserve image baselines across Matplotlib text renderers - #9201
agourakis82 wants to merge 2 commits into
Conversation
Matplotlib 3.11 changes text rendering, so references must track renderer generations without weakening image comparisons. Related to Project-MONAI#9069. Assisted-by: OpenAI Codex Signed-off-by: Demetrios Agourakis <demetrios@agourakis.med.br>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Register the optional-dependency test module alongside test_matshow3d in the minimal-suite exclusion list, as required by CONTRIBUTING.md. Verified one unique exclusion entry, an existing target module, and git diff --check. This does not change the rendering code or references. Assisted-by: OpenAI Codex Signed-off-by: Demetrios Agourakis <demetrios@agourakis.med.br>
|
The remaining draft item is distributing the four Matplotlib 3.11 reference PNGs through external test-data storage, as requested by CONTRIBUTING.md. I rechecked the current MONAI-extra-test-data release assets and did not find these four references. I also confirmed that the frozen asset Git blobs still match this PR's current head, 435ccec. Could a maintainer host these exact files in a MONAI-extra-test-data release, or indicate another approved location? Once the actual URLs exist, I can replace the source-tree PNGs with entries in data_config.json and use the existing test-data download helpers.
The files are currently accessible under tests/testing_data/matplotlib_3_11/ in this PR. They have not been regenerated, and this transfer does not change image-comparison tolerances. No rendering tests were rerun for this asset-custody check. Prepared with OpenAI Codex assistance. |
Related to #9069.
Problem
With Matplotlib 3.11.2, the image comparisons in
ThreadContainer.test_plotand threematshow3dcases fail against the existing reference PNGs. This patch selects references by renderer generation while keeping the existing comparison tolerances and legacy references.Changes
get_matplotlib_baseline()to select the existing references before Matplotlib 3.11 and a separatematplotlib_3_11directory from3.11.0.dev0onward.test_samplesRMS expectation only for the legacy reference; the modern reference must satisfy the normal image comparison.Validation and scope
On 2026-10-24, a fresh Ubuntu 24.04 / CPython 3.12.3 environment with Torch 2.8.0, torchvision 0.23.0 and Matplotlib 3.11.2 reproduced the four affected image failures. The native MONAI extension was built and imported, and dependency checks passed.
The command selected the zarr merger, FID, threadcontainer and matshow3d test modules:
tests.test_matplotlib_baselineto the command: 34 tests passed, with no skips.9cbaeadfda56acc8e8a6cf973a59cf28e9a6ffd7. The follow-up changes only the minimal-suite exclusion list.This execution used a private composition based on #9140 at
4043f3bd332bf4867fe5a3ac80abb5257841a2c9, with a separate CI experiment, followed by the exact renderer patch. It is focused regression evidence, not a hosted-CI or complete-suite result for this standalone PR. The follow-up minimal-suite exclusion was checked for a unique entry and an existing module; the rendering tests were not rerun for that registration change. Hosted workflow approval remains a separate gate.Remaining draft item: reference distribution
The current draft commits the four PNGs directly.
CONTRIBUTING.mdasks contributors to host binary test data outside the source repository, preferably inMONAI-extra-test-datareleases, and reference it throughtests/testing_data/data_config.json.The references need to be moved to that distribution path before this draft is ready. Could these four files be hosted in a
MONAI-extra-test-datarelease so the tests can use the project's download helpers?Types of changes
Technical summary prepared with OpenAI Codex assistance.