A data generation apparatus comprising: an acquisition unit configured to acquire a measurement image, the measurement image being an image of an object to be inspected; a determination unit communicatively linked to an identification device (a, b, c, A, B) that has been generated by performing training with a machine learning model using learning data, the learning data having been generated by associating each of a number of sample images with information indicating whether a defect is included in the respective sample image, the sample images being images of the object to be inspected that have been collected in advance, the determination unit being configured to determine whether or not the object to be inspected includes a defect by inputting the measurement image to the identification device (a, b, c, A, B) and receiving attribute information from the identification device (a, b, c, A, B), the attribute information including information indicating whether or not the measurement image includes a defect; an input unit configured to accept an input indicating whether or not the determination result is correct; an extraction unit configured to, if the determination unit has determined that the measurement image includes a defect, extract a partial image of the measurement image, the partial image including a region of the measurement image based on which region the determination that the measurement image includes a defect has been made; and characterized by : a generation unit configured to, if the determination unit has determined that the measurement image includes a defect, and if the input unit has accepted an input indicating that the determination result is not correct, generate a composite image by combining the partial image and one of the sample images, and generate new learning data for further training of the identification device (a, b, c, A, B) by associating the composite image with information indicating that no defect is included. an acquisition unit configured to acquire a measurement image, the measurement image being an image of an object to be inspected; a determination unit communicatively linked to an identification device (a, b, c, A, B) that has been generated by performing training with a machine learning model using learning data, the learning data having been generated by associating each of a number of sample images with information indicating whether a defect is included in the respective sample image, the sample images being images of the object to be inspected that have been collected in advance, the determination unit being configured to determine whether or not the object to be inspected includes a defect by inputting the measurement image to the identification device (a, b, c, A, B) and receiving attribute information from the identification device (a, b, c, A, B), the attribute information including information indicating whether or not the measurement image includes a defect; an input unit configured to accept an input indicating whether or not the determination result is correct; an extraction unit configured to, if the determination unit has determined that the measurement image includes a defect, extract a partial image of the measurement image, the partial image including a region of the measurement image based on which region the determination that the measurement image includes a defect has been made; and characterized by : a generation unit configured to, if the determination unit has determined that the measurement image includes a defect, and if the input unit has accepted an input indicating that the determination result is not correct, generate a composite image by combining the partial image and one of the sample images, and generate new learning data for further training of the identification device (a, b, c, A, B) by associating the composite image with information indicating that no defect is included. <EOS>