tfmri.image.gmsd
tfmri.image.gmsd¶
- gmsd(img1, img2, max_val=1.0, batch_dims=None, image_dims=None, rank=None, name=None)¶
Computes the gradient magnitude similarity deviation (GMSD). (deprecated arguments)
Deprecated: SOME ARGUMENTS ARE DEPRECATED:
(rank)
. They will be removed after 2022-09-01. Instructions for updating: Use argumentimage_dims
instead.- Parameters
img1 – A
Tensor
. First batch of images. For 2D images, must have rank >= 3 with shapebatch_shape + [height, width, channels]
. For 3D images, must have rank >= 4 with shapebatch_shape + [depth, height, width, channels]
. Can have integer or floating point type, with values in the range[0, max_val]
.img2 – A
Tensor
. Second batch of images. For 2D images, must have rank >= 3 with shapebatch_shape + [height, width, channels]
. For 3D images, must have rank >= 4 with shapebatch_shape + [depth, height, width, channels]
. Can have integer or floating point type, with values in the range[0, max_val]
.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
MAX
for integer input images, whereMAX
is the largest positive representable number for the data type.batch_dims –
An int. The number of batch dimensions in
image
. If None, it is inferred fromimage
andimage_dims
asimage.shape.rank - image_dims - 1
. Ifimage_dims
is also None, thenbatch_dims
defaults to 1.batch_dims
can always be inferred ifimage_dims
was specified, so you only need to provide one of the two.image_dims –
An int. The number of spatial dimensions in
image
. If None, it is inferred fromimage
andbatch_dims
asimage.shape.rank - batch_dims - 1
. Defaults to None.image_dims
can always be inferred ifbatch_dims
was 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(img1) - 2
. In other words, if rank is not explicitly set,img1
andimg2
should have shape[batch, height, width, channels]
if processing 2D images or[batch, depth, height, width, channels]
if processing 3D images.name – Namespace to embed the computation in.
- Returns
A scalar GMSD value for each pair of images in
img1
andimg2
. The returned tensor has typetf.float32
and shapebatch_shape
.
References
- 1
W. Xue, L. Zhang, X. Mou and A. C. Bovik, “Gradient Magnitude Similarity Deviation: A Highly Efficient Perceptual Image Quality Index,” in IEEE Transactions on Image Processing, vol. 23, no. 2, pp. 684-695, Feb. 2014, doi: 10.1109/TIP.2013.2293423.