Skip to content

[Fix] Handle extensionless MLflow image names - #1690

Open
ShreyanshGoyal wants to merge 1 commit into
open-mmlab:mainfrom
ShreyanshGoyal:fix/mlflow-image-extension
Open

ShreyanshGoyal wants to merge 1 commit into
open-mmlab:mainfrom
ShreyanshGoyal:fix/mlflow-image-extension

Conversation

@ShreyanshGoyal

Copy link
Copy Markdown

Motivation

MLflowVisBackend.add_image forwards its name directly to mlflow.log_image. Visualization hooks commonly use extensionless identifiers such as val_img, and MLflow passes that name to Pillow, which raises ValueError: unknown file extension.

Fixes #1681.

Modification

  • Preserve image names that already include an extension.
  • For extensionless names, use the existing MMEngine image convention <name>_<step>.png before calling MLflow.
  • Extend the MLflow backend unit test with an extensionless name at a nonzero step.

BC-breaking

No. Explicit filenames such as img.png are unchanged. Names that previously failed now log successfully as PNG artifacts.

Testing

  • Confirmed the new regression assertion fails before the source change with ValueError: unknown file extension.
  • pytest tests/test_visualizer/test_vis_backend.py::TestMLflowVisBackend::test_add_image -q (1 passed)
  • pytest tests/test_visualizer/test_vis_backend.py -q -k 'not TestDVCLiveVisBackend and not TestAimVisBackend' (36 passed, 7 skipped, 14 deselected)
  • pre-commit run --files mmengine/visualization/vis_backend.py tests/test_visualizer/test_vis_backend.py (all hooks passed)

The Aim and DVCLive classes were deselected because those optional dependencies are not installed; the same pre-change run failed only in those two classes for missing packages.

Checklist

  1. The complete repository pre-commit configuration passes on the changed files.
  2. The modification is covered by the existing MLflow backend test.
  3. No downstream API changes are introduced.
  4. No documentation change is needed for this bug fix.

@CLAassistant

CLAassistant commented Jul 13, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MLflowVisBackend.add_image fails when image name has no extension

2 participants