Skip to content

Labels: Add support for ONNX-based models #5769

Description

@photoprismci

As a PhotoPrism user, I want image labels to be generated with ONNX-based models, so that I get better labels from a smaller and faster installation.

PhotoPrism currently classifies images with TensorFlow, while face detection already runs on ONNX Runtime. Adding ONNX support for labels as well is a step toward maintaining a single inference runtime instead of two.

Why

  • Smaller installation. The bundled TensorFlow library is large and ships in every Docker image. Once the remaining TensorFlow-based features have been migrated, it can be removed entirely.
  • One runtime to maintain. ONNX Runtime is already included for face detection, so labels would reuse what is there.
  • Build portability. TensorFlow is not available on every platform. See Feature: build-time disable of tensorflow #5591 and Build: Add notf tag to build without TensorFlow dependency #5609, where PhotoPrism cannot be built while TensorFlow is a hard requirement.
  • A better choice of models. Many more models, and more recent ones, are published in ONNX format than for TensorFlow 2. This matters most for users who are comfortable selecting a different model but not converting between formats.
  • Quality and speed. Modern classifiers are expected to label more accurately than the current model, and ONNX Runtime may be a better fit for this workload.

Expected Behavior

The label vocabulary stays the same, so existing labels remain valid and no re-indexing is required. The model can be selected through the configuration without rebuilding, and custom models supplied by users continue to work (see #5011).

Acceptance Criteria

  • Image classification MUST be able to run through ONNX Runtime without requiring TensorFlow.
  • The existing label vocabulary MUST be preserved, so stored labels stay valid and no re-indexing is needed.
  • The model MUST be selectable through the configuration without rebuilding PhotoPrism.
  • Custom models supplied by users MUST continue to be supported.
  • The bundled model SHOULD label at least as accurately as the current one, measured on real photos rather than on published benchmark figures.
  • Indexing time and memory use SHOULD NOT increase noticeably.
  • The size of the bundled model SHOULD stay the same or get smaller.
  • Additional optional models MAY be offered for users who want a different trade-off between accuracy and speed.

Related

Activity

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

Metadata

Metadata

Assignees

Labels

aiArtificial Intelligence, Machine Learning (ML)ideaFeedback wanted / feature requestlabelsRelated to labels assigned manually or from metadata

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions