Skip to content

❓ <title>How to control saving of concatenated (3-in-1) result images and adjust mask threshold in PatchCore (Anomalib v2.1) #3020

@QinHF5

Description

@QinHF5

Your Question

Hi Anomalib team,

I'm currently using Anomalib v2.1 and the PatchCore model for anomaly detection.
I have two questions regarding the inference process in the Python API:

Saving concatenated (3-in-1) results

During inference, Anomalib generates the concatenated visualization that includes the input image, anomaly map, and overlay result.

Is there a way to control whether this 3-in-1 image is saved when running inference from a Python script (not the CLI)?

For example, can I disable saving or only save specific outputs (e.g., overlay only)?

Mask threshold adjustment

Is there a parameter or function that allows adjusting the threshold used to create the binary anomaly mask from the anomaly score map?

If yes, could you please point me to where this threshold can be configured (e.g., via config file, Inferencer, or direct Python API call)?

Any code snippet or guidance would be greatly appreciated.
Thanks for your help and for maintaining such a great project!

Environment:

Anomalib version: 2.1

Model: PatchCore

Running mode: Python API

Forum Check

  • I have searched the discussions forum for an answer to my question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions