This paper presents an automatic inspection of defects in semiconductor images. We devise a statistical method to find defects on homogeneous background from the observation that it has a log-normal distribution. If computer aided design (CAD) data is available, we use it to construct a signed distance function (SDF) and change the pixel values so that the average of pixel values along the level curve of the SDF is zero, so that the image has a homogeneous background. In the absence of CAD data, we devise a hybrid method consisting of a model-based algorithm and two neural networks. The model-based algorithm uses the first right singular vector to determine whether the image has a linear or complex structure. For an image with a linear structure, we remove the structure using the rank 1 approximation so that it has a homogeneous background. An image with a complex structure is inspected by two neural networks. We provide results of numerical experiments for the proposed methods.