liveBook · Manning

GPU kernel

As explained in Deep Learning with JAX

A compiled low-level executable unit for performing an operation on target hardware, not a convolution kernel.

In image filtering, a kernel is a matrix of weights that slides across an image. It multiplies each local pixel window by corresponding weights, sums the products, and produces an output pixel through convolution. This matrix-based meaning is different from a compiled low-level executable kernel. section 3.1.4

Typical filtering kernels include:

  • A normalized 5×5 blur kernel gives every neighboring pixel equal weight. section 3.1.4
  • A Gaussian kernel gives nearby pixels greater influence and supports image denoising. section 3.1.4
  • A sharpening kernel combines negative surrounding weights with a strong positive center weight. section 3.1.4

Applying a kernel to a color image

A filtering function processes each of three color channels with convolve2d, clips values to the range 0.0–1.0, and stacks the channels back together. Applying a Gaussian kernel denoises the image but can leave it blurred; applying a sharpening kernel can restore detail. section 3.1.4

Listing 3.5 Matrix (or kernel) for a simple blur filter
kernel_blur = np.ones((5,5))                       #1
kernel_blur /= np.sum(kernel_blur)                 #2
kernel_blur
  
>>> array([[0.04, 0.04, 0.04, 0.04, 0.04],         #3
>>>        [0.04, 0.04, 0.04, 0.04, 0.04],         #3
>>>        [0.04, 0.04, 0.04, 0.04, 0.04],         #3
>>>        [0.04, 0.04, 0.04, 0.04, 0.04],         #3
>>>        [0.04, 0.04, 0.04, 0.04, 0.04]])        #3

Inspect a normalized 5×5 blur kernel whose entries are all 0.04. section 3.1.4

How Deep Learning with JAX covers it

How deep it goes
Explains windowed multiplication, summation, channel handling, and clipping, but does not cover compiled executable kernels.
Examples
Demonstrates blur, Gaussian denoising, sharpening, per-channel color convolution, and comparisons of noisy, blurred, restored, and original images.
What it assumes
Assumes basic image arrays and channels while explaining convolution and filter weights through concrete image-processing steps.
What you can do after
Apply it via 2D convolution to construct blur, denoising, and sharpening image filters.
How it connects
Connects kernels with convolution, finite impulse response filters, digital signal processing, image processing, and convolutional neural networks.

Also explained in

Compare how 3 books explain GPU kernel →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with JAX. The section links point to the parts of the book it draws on.