Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakpati committed Dec 19, 2024
1 parent 05f7101 commit ba3ea83
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions GANDLF/cli/generate_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ def __percentile_clip(
strictlyPositive=True,
)

overall_stats_dict[current_subject_id]["ssim"] = (
structural_similarity_index(output_infill, gt_image_infill, mask).item()
)
overall_stats_dict[current_subject_id][
"ssim"
] = structural_similarity_index(output_infill, gt_image_infill, mask).item()

# ncc metrics
compute_ncc = parameters.get("compute_ncc", True)
Expand Down Expand Up @@ -415,30 +415,30 @@ def __percentile_clip(
).item()

# same as above but with epsilon for robustness
overall_stats_dict[current_subject_id]["psnr_eps"] = (
peak_signal_noise_ratio(
output_infill, gt_image_infill, epsilon=sys.float_info.epsilon
).item()
)
overall_stats_dict[current_subject_id][
"psnr_eps"
] = peak_signal_noise_ratio(
output_infill, gt_image_infill, epsilon=sys.float_info.epsilon
).item()

# only use fix data range to [0;1] if the data was normalized before
if normalize:
# torchmetrics PSNR but with fixed data range of 0 to 1
overall_stats_dict[current_subject_id]["psnr_01"] = (
peak_signal_noise_ratio(
output_infill, gt_image_infill, data_range=(0, 1)
).item()
)
overall_stats_dict[current_subject_id][
"psnr_01"
] = peak_signal_noise_ratio(
output_infill, gt_image_infill, data_range=(0, 1)
).item()

# same as above but with epsilon for robustness
overall_stats_dict[current_subject_id]["psnr_01_eps"] = (
peak_signal_noise_ratio(
output_infill,
gt_image_infill,
data_range=(0, 1),
epsilon=sys.float_info.epsilon,
).item()
)
overall_stats_dict[current_subject_id][
"psnr_01_eps"
] = peak_signal_noise_ratio(
output_infill,
gt_image_infill,
data_range=(0, 1),
epsilon=sys.float_info.epsilon,
).item()

pprint(overall_stats_dict)
if outputfile is not None:
Expand Down

0 comments on commit ba3ea83

Please sign in to comment.