Skip to content

Commit

Permalink
adapt M and m depending on model
Browse files Browse the repository at this point in the history
  • Loading branch information
brash6 committed Apr 23, 2024
1 parent 597da4a commit a8aef80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions deepdespeckling/merlin/merlin_denoiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ def preprocess_denoised_image(self, denoised_image_real_part: np.array, denoised
processed denoised full image, processed denoised image real part, processed denoised image imaginary part
"""
denoised_image_real_part = denormalize_sar_image(
denoised_image_real_part / count_image)
denoised_image_real_part / count_image, self.M, self.m)
denoised_image_imaginary_part = denormalize_sar_image(
denoised_image_imaginary_part / count_image)
denoised_image_imaginary_part / count_image, self.M, self.m)

# combine the two estimation
output_clean_image = 0.5 * (np.square(
Expand Down
4 changes: 3 additions & 1 deletion deepdespeckling/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ def normalize_sar_image(image: np.array) -> np.array:
return ((np.log(np.clip(image, 0, image.max())+1e-6)-m)/(M-m)).astype(np.float32)


def denormalize_sar_image(image: np.array) -> np.array:
def denormalize_sar_image(image: np.array, M: float = M, m: float = m) -> np.array:
"""Denormalize a sar image store in a numpy array
Args:
image (numpy array): a sar image
M (float): global maximum used for normalisation
m (float): global minimum used for normalisation
Raises:
TypeError: raise an error if the image file is not a numpy array
Expand Down

0 comments on commit a8aef80

Please sign in to comment.