Skip to content

Commit

Permalink
Merge pull request #860 from scap3yvt/859-bug-noise-and-blur-enhanced…
Browse files Browse the repository at this point in the history
…-fail-for-certain-images

Ensure a float tensor is passed for augmentations
  • Loading branch information
sarthakpati committed Apr 26, 2024
2 parents dd88b88 + 7f47e5b commit 50f369f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GANDLF/data/augmentation/blur_enhanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ def calculate_std_ranges(self, image: torch.Tensor) -> Tuple[float, float]:
std_ranges = self.std_original
if self.std_original is None:
# calculate the default std range based on 1.5% of the input image std - https://github.com/mlcommons/GaNDLF/issues/518
std_ranges = (0, 0.015 * torch.std(image.data).item())
std_ranges = (0, 0.015 * torch.std(image.data.float()).item())
return self.parse_params(std_ranges, None, "std", min_constraint=0)
2 changes: 1 addition & 1 deletion GANDLF/data/augmentation/noise_enhanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ def calculate_std_ranges(self, image: torch.Tensor) -> Tuple[float, float]:
std_ranges = self.std_original
if self.std_original is None:
# calculate the default std range based on 1.5% of the input image std - https://github.com/mlcommons/GaNDLF/issues/518
std_ranges = (0, 0.015 * torch.std(image.data).item())
std_ranges = (0, 0.015 * torch.std(image.data.float()).item())
return self._parse_range(std_ranges, "std", min_constraint=0)

0 comments on commit 50f369f

Please sign in to comment.