1. An image processing apparatus configured to process an image, the image processing apparatus comprising: a calculator configured to calculate a parameter for each of a plurality of areas add for each of a plurality of models describing a plurality of body shapes, each of the plurality of models having the plurality of areas, and probabilities indicating to which of the plurality of models input images input for learning belong; and a comparator configured to compare an input inspection image with the plurality of models whose parameters are optimized based on the probabilities.
7. The image processing apparatus according to claim 1 , further comprising a detector configured to detect a defect area in the inspection image based on a result of comparison made by the comparator.