HyperAI

Average Gradient

The average gradient refers to the average value of the grayscale change rate. It is used to indicate image clarity. This is due to the obvious difference in grayscale near the boundaries or shadows of the image.

It reflects the rate of change of contrast of tiny details in the image, that is, the rate of change of density in the multi-dimensional direction of the image, and represents the relative clarity of the image.

The average gradient is the image clarity, which reflects the image's ability to express detail contrast. The calculation formula is:

Image gradient:

  • G(x,y) = dxi + dyj;
  • dx(i,j) = I(i+1,j) – I(i,j);
  • dy(i,j) = I(i,j+1) – I(i,j);

Among them, I is the value of the image pixel (such as RGB value), and (i,j) is the coordinate of the pixel.

Image gradient can generally also be calculated using median difference:

  • dx(i,j) = [I(i+1,j) – I(i-1,j)]/2;
  • dy(i,j) = [I(i,j+1) – I(i,j-1)]/2;

Image edges are generally achieved by performing gradient operations on the image.

Gradient descent related algorithms

Gradient descent is the most popular optimization algorithm today and is also the most commonly used method for optimizing neural networks.

Various variants of gradient descent:

  • Batch gradient descent
  • Stochastic gradient descent
  • Mini-batch gradient descent