This article describes the process of creating a training sample of an artificial neural network (hereinafter – ANN) of a vision system. Training the ANN was carried out on the basis of annotated images of real apples containing a description of various defects in the form of separate polygons using the LabelMe program. On the image of the fruit, the apple itself and its pomological features, such as receptacle, stalk and leaf, were marked, as well as 10 different fruit defects, each of which was given an appropriate name: mesh, pressure, cut, rot, scab, hailstone, etc. The obtained labeled images of fetuses with defects formed a reference training set for the ANN. The performance of the ANN was tested by evaluating the correctness of recognition of fetal images when comparing them with reference images. Training the ANN for each of the defects in apples was stopped when 95 % of the probability of correct assessment of the defect was reached. The ANN trained on the created training sample was used in the vision system of the LSP-4 production line, which sorted apples into three commercial varieties by size and defects from mechanical damage, diseases, and pests. The accuracy of sorting by size was 75.4 %, and by the presence of defects – 73.1 %.