kornia/kornia

[Feature]: masking for mutual information loss

Closed

#3,575 创建于 2026年2月18日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)Python (8,677 star) (892 fork)batch import
help wantedtriage

描述

🚀 Feature Description

The mutual_information submodule of kornia.losses was created in a former PR. Yet, at the time, we did not implement comparison of signals in restriction to the overlap of there respective regions of interest, as the context may lead to define.

The feature would be an enhancement of the original implementation with optional binary masks for both the reference signal and the signal to which it is compared. If no mask would be provided, the behaviour would be the current one.

📂 Feature Category

Loss Functions

💡 Motivation

Typically, the treated signals may suffer detectable artefacts in certain regions and one may wish to exclude these artefacts in the loss computations. the proposed usage of masks would solve this (via roi_mask = 1 - artefacts_mask).

💭 Proposed Solution

update init and forward methods for the relevant classes, update joint_histogram too. Update functional variants.

Please assign me, I think I am almost done with the feature.

🔄 Alternatives Considered

I considered relying on the MaskedTensor project, but it appears to be inactive for too long.

🎯 Use Cases

No response

📝 Additional Context

No response

🤝 Contribution Intent

  • I plan to submit a PR to implement this feature
  • I'm requesting this feature but not planning to implement it

贡献者指南