tfmri.metrics.PSNR
tfmri.metrics.PSNR¶
- class PSNR(*args, **kwargs)[source]¶
Bases:
tensorflow_mri.python.metrics.iqa_metrics.MeanMetricWrapperIQAPeak signal-to-noise ratio (PSNR) metric.
The PSNR is the ratio between the maximum possible power of an image and the power of corrupting noise, estimated by comparing to a reference image.
This metric supports 2D and 3D image inputs,
y_trueandy_pred. For 2D images, inputs must have rank >= 3 with shapebatch_shape + [height, width, channels]. For 3D images, inputs must have rank >= 4 with shapebatch_shape + [depth, height, width, channels]. Ifmultichannelis False, the channel dimension should be omitted.- Parameters
max_val – The dynamic range of the images (i.e., the difference between the maximum and the minimum allowed values). Defaults to 1 for floating point input images and
MAXfor integer input images, whereMAXis the largest positive representable number for the data type.batch_dims –
An int. The number of batch dimensions in input images. If None, it is inferred from inputs and
image_dimsas(rank of inputs) - image_dims - 1. Ifimage_dimsis also None, thenbatch_dimsdefaults to 1.batch_dimscan always be inferred ifimage_dimswas specified, so you only need to provide one of the two.image_dims –
An int. The number of spatial dimensions in input images. If None, it is inferred from inputs and
batch_dimsas(rank of inputs) - batch_dims - 1. Defaults to None.image_dimscan always be inferred ifbatch_dimswas specified, so you only need to provide one of the two.rank –
An int. The number of spatial dimensions. Must be 2 or 3. Defaults to
tf.rank(y_true) - 2. In other words, if rank is not explicitly set,y_trueandy_predshould have shape[batch, height, width, channels]if processing 2D images or[batch, depth, height, width, channels]if processing 3D images.multichannel –
A boolean. Whether multichannel computation is enabled. If False, the inputs
y_trueandy_predare not expected to have a channel dimension, i.e. they should have shapebatch_shape + [height, width](2D) orbatch_shape + [depth, height, width](3D).complex_part – The part of a complex input to be used in the computation of the metric. Must be one of
'real','imag','abs'or'angle'. Note that real and imaginary parts, as well as angles, will be scaled to avoid negative numbers.name – String name of the metric instance.
dtype – Data type of the metric result.
DEPRECATED FUNCTION ARGUMENTS
Deprecated: SOME ARGUMENTS ARE DEPRECATED:
(rank). They will be removed after 2022-09-01. Instructions for updating: Use argumentimage_dimsinstead.