Skip to content

Commit

Permalink
Merge pull request #30 from hi-paris/bug_fixing
Browse files Browse the repository at this point in the history
adapt M and m depending on model
  • Loading branch information
brash6 authored Apr 23, 2024
2 parents 597da4a + cfc2d85 commit b9bf54a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 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
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


setup(
author="Emanuele Dalsasso, Youcef Kemiche, Pierre Blanchard, Hadrien Mariaccia",
author="Emanuele Dalsasso, Hadrien Mariaccia, Youcef Kemiche, Pierre Blanchard",
author_email='[email protected]',
python_requires='>=3.6',
classifiers=[
Expand Down Expand Up @@ -40,6 +40,6 @@
name='deepdespeckling',
packages=find_packages(include=['deepdespeckling', 'deepdespeckling.*']),
url='https://github.com/hi-paris/deepdespeckling',
version='0.7',
version='0.8',
zip_safe=False,
)

0 comments on commit b9bf54a

Please sign in to comment.