Computer-implemented method for providing training image data for training an object recognition function, wherein the method comprises the following steps: S1 Providing at least one annotated image, wherein the annotated image has a multiplicity of electronic components to be detected (O1, O2, 031, O32, 041, O42, O43, O5) on a background designed as a printed circuit board with annotations (L1, L2) assigned to the electronic components to be detected, wherein each annotation (L1, L2) describes an image area in which the corresponding electronic component to be detected (O1, O2, 031, O32, 041, O42, O43, O5) is contained, and a further image, in which no electronic components to be detected (O1, O2, 031, O32, 041, O42, O43, O5) are contained, S2 Selecting an electronic component to be detected (O1, O2, 031, O32, 041, O42, O43, O5) in the annotated image, S3 Replacing the image area described by the annotation (L1, L2) by overwriting said image area with an area of the further image that corresponds to said image area in order to remove the electronic component (O1, O2, 031, O32, 041, O42, O43, O5) together with the annotation (L1, L2) assigned to the selected electronic component (O1, O2, 031, O32, 041, O42, O43, O5) from the annotated image and produce a modified annotated image, wherein, in order to generate a plurality of different modified annotated images, the steps S2 and S3 are repeated until the modified annotated image no longer has any more electronic components to be detected (O1, O2, 031, O32, 041, O42, O43, O5), wherein the different modified annotated images are added to the training image data, S4 Providing the training image data containing the modified annotated image. S1 Providing at least one annotated image, wherein the annotated image has a multiplicity of electronic components to be detected (O1, O2, 031, O32, 041, O42, O43, O5) on a background designed as a printed circuit board with annotations (L1, L2) assigned to the electronic components to be detected, wherein each annotation (L1, L2) describes an image area in which the corresponding electronic component to be detected (O1, O2, 031, O32, 041, O42, O43, O5) is contained, and a further image, in which no electronic components to be detected (O1, O2, 031, O32, 041, O42, O43, O5) are contained, S2 Selecting an electronic component to be detected (O1, O2, 031, O32, 041, O42, O43, O5) in the annotated image, S3 Replacing the image area described by the annotation (L1, L2) by overwriting said image area with an area of the further image that corresponds to said image area in order to remove the electronic component (O1, O2, 031, O32, 041, O42, O43, O5) together with the annotation (L1, L2) assigned to the selected electronic component (O1, O2, 031, O32, 041, O42, O43, O5) from the annotated image and produce a modified annotated image, wherein, in order to generate a plurality of different modified annotated images, the steps S2 and S3 are repeated until the modified annotated image no longer has any more electronic components to be detected (O1, O2, 031, O32, 041, O42, O43, O5), wherein the different modified annotated images are added to the training image data, S4 Providing the training image data containing the modified annotated image.