Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pin_labels attribute for image_diff comparison method #17866

Merged
merged 4 commits into from
Apr 3, 2024

Conversation

kostrykin
Copy link
Contributor

@kostrykin kostrykin commented Mar 29, 2024

In #17556 we had introduced the image_diff comparison method for output verification, which supports different metrics for quantification of the image differences.

The iou metric is designated for verification of label maps (images where the values correspond to labels of image regions). Usually the particular label values are interchangeable and only required to be distinct in order to be able to distinguish the differently labeled image regions. This fact is taken into account by the iou metric, which performs a pairwise comparison of uniquely labeled image regions, where pairs of corresponding regions are determined by maximizing the IoU.

However, there also often are cases where specific label values are not interchangeable. The most prominent example are segmentation masks, where the image background is canonically labeled by 0 or -1, but the label values of the individual objects still are interchangeable. To also take such use cases into account, this PR adds the pin_labels attribute:

<output name="out" value="res.tiff" compare="image_diff" metric="iou" pin_labels="0" />

The pin_labels attribute can be used to specify one or more labels, which are not interchangeable. For image regions labeled with those label values, the correspondences are established not by maximization of the IoU, but according to the label value itself.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@github-actions github-actions bot added this to the 24.1 milestone Mar 29, 2024
@kostrykin kostrykin marked this pull request as draft March 29, 2024 15:11
Before, objects could correspond to objects listed in `pin_labels` even if the label was different. Now, objects listed in `pin_labels` are prevented from being the corresponding objects of objects with different labels. This is overly more consistent and intuitive.
@kostrykin kostrykin marked this pull request as ready for review March 29, 2024 15:51
@kostrykin kostrykin marked this pull request as draft March 30, 2024 21:09
@kostrykin kostrykin marked this pull request as ready for review March 30, 2024 21:09
@@ -5,6 +5,7 @@

DEFAULT_METRIC = "mae"
DEFAULT_EPS = 0.01
DEFAULT_PIN_LABELS = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty string as the default value seems odd, is there a problem with making that None ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Fixed that in 8515eed.

@mvdbeek mvdbeek merged commit 28c8b2f into galaxyproject:dev Apr 3, 2024
51 of 53 checks passed
Copy link

github-actions bot commented Apr 3, 2024

This PR was merged without a "kind/" label, please correct.

@kostrykin kostrykin deleted the verify_imagediff_iou/upstream branch April 3, 2024 20:50
kostrykin pushed a commit to kostrykin/galaxy that referenced this pull request Apr 4, 2024
…f_iou/upstream

Add `pin_labels` attribute for `image_diff` comparison method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants