Skip to content

Metrics

Source

Metrics utilities for LVAE training and evaluation.

RunningPSNR

Track the running PSNR over validation batches.

get()

Return the current PSNR.

reset()

Reset accumulated statistics.

update(rec, tar)

Update statistics with a batch of reconstructed and target images.

PSNR(gt, pred, range_=None)

Compute PSNR for tensors shaped as (batch, H, W).

RangeInvariantPsnr(gt, pred)

Compute range-invariant PSNR for grayscale images.

avg_psnr(target, prediction)

Compute mean and standard error of PSNR.

avg_range_inv_psnr(target, prediction)

Compute mean and standard error of range-invariant PSNR.

avg_ssim(target, prediction)

Compute mean and standard deviation of SSIM.

compute_SE(arr)

Compute the standard error of the mean.

compute_custom_ssim(gt_, pred_, ssim_obj_dict)

Compute SSIM using custom per-channel scorers.

compute_masked_psnr(mask, tar1, tar2, pred1, pred2)

Compute PSNR on masked regions for two target/prediction pairs.

compute_multiscale_ssim(gt_, pred_, range_invariant=True)

Compute channel-wise multiscale SSIM.

compute_stats(highres_data, pred_unnorm, verbose=True)

Compute PSNR- and SSIM-based metrics on high-SNR data.

fix(gt, x)

Zero-mean tensors and match prediction range to the ground truth.

fix_range(gt, x)

Rescale a tensor to match the range of the ground truth.

range_invariant_multiscale_ssim(gt_, pred_)

Compute range-invariant multiscale SSIM for one channel.

zero_mean(x)

Return a zero-mean tensor along the channel dimension.