Additionally, by default, the UpSampling2D layer will use a nearest neighbor algorithm to fill in the new rows and columns. This has the effect of simply doubling rows and columns, as described and is specified by the ‘interpolation‘ argument set to ‘nearest‘. Alternately, a bilinear interpolation method can be used which draws upon multiple surrounding points. This can be specified via setting the ‘interpolation‘ argument to ‘bilinear‘.
How exactly does the nearest neighbor algorithm mentioned above work? Also, what does interpolation mean in this context (nearest and bilinear)?
Source: Section on Upsampling2D layer