Skip to content

Commit

Permalink
fix: reshape images to match in *shannon_cross_entropy*
Browse files Browse the repository at this point in the history
With this fix, we can now safely compare two images with different shapes.
  • Loading branch information
ruancomelli committed Jun 23, 2021
1 parent 666db0d commit 95f9855
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boiling_learning/preprocessing/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ def retained_variance(ref: np.ndarray, image: np.ndarray) -> float:
def shannon_cross_entropy(
ref: np.ndarray, image: np.ndarray, nbins: int = 100
) -> float:
ref, image = reshape_to_largest(ref, image)

ref_histogram, _ = histogram(ref, nbins=nbins)
img_histogram, _ = histogram(image, nbins=nbins)

Expand Down

0 comments on commit 95f9855

Please sign in to comment.