Custom model requirements

Napari-OmniEM can run compatible models trained outside the plugin. This page describes the artifacts and model contract required for import.

From a custom model to inference

Follow this three-stage workflow:

  1. Prepare the task. Select an existing task with the correct task type, or create a new task. For an Image-to-Label model, define labels whose count and order match the model outputs.
  2. Add the solution. Prepare the config and weights according to the requirements on this page, then follow the Add Solution procedure to validate and register the model.
  3. Run inference. Select the registered task and solution, choose an appropriate inference mode, and follow the inference workflow.

Compatibility overview

A custom model must be compatible with the installed omniem package, which must be able to parse the model config and load the corresponding weights.

OmniEM compatibility is necessary but not sufficient

The omniem package may support models that the current Napari-OmniEM release has not enabled. Use the architecture and encoder listed under Required materials below.

Required materials

Prepare these materials from the same training or export run:

  • A model using the omniemv1 architecture with the emdinov1 encoder. Other architectures cannot currently be imported into Napari-OmniEM.
  • A model config (.yaml or .yml) that can be parsed by omniem.config.ModelConfig.from_yaml().
  • A compatible PyTorch weights file (.pt) in one of these layouts:
    • A combined checkpoint containing the backbone and task head.
    • A head-only checkpoint containing the metadata needed to identify its head and donor backbone. A matching backbone must already be registered in Napari-OmniEM; see Managing backbones.

Use the config distributed with the selected weights. Do not reuse a config from another run simply because the architectures look similar.

Keep the config and weights together

A model config is not cryptographically tied to a checkpoint. A mismatched pair may pass basic file checks but fail during model loading or silently produce incorrect results.

Model configuration

Napari-OmniEM uses the model-config format defined and validated by the omniem package. Refer to the omniem documentation for the current configuration schema, field requirements, and examples. Use the config generated for the same training or export run as the selected weights.

Preparation checklist

Before opening Add Solution, confirm that:

  • [ ] The config and weights came from the same training or export run.
  • [ ] The config satisfies the requirements documented by omniem.
  • [ ] The installed omniem package can load the model artifacts.
  • [ ] The destination task type and labels match the model outputs.
  • [ ] A head-only checkpoint has its matching backbone registered.

Training and examples

Use omniem-train to train or fine-tune compatible OmniEM heads. Keep the generated model config with its weights when transferring a run.