Image Data Augmentation Method, Apparatus, Device, and Storage Medium

By randomizing the image to be processed, analyzing and matching operations, different types of occlusion information are generated, which solves the problem of insufficient network model recognition and generalization capabilities in the prior art, and achieves a more efficient data enhancement effect.

CN114463169BActive Publication Date: 2025-07-29SHENZHEN WONDERSHARE SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111600585.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2025-07-29
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

Existing image enhancement technologies cannot effectively improve the generalization ability of the model while ensuring the recognition ability of the network model. Too many data enhancement methods lead to degradation of the recognition ability, and too few will reduce the generalization ability.

Method used

By obtaining the images to be processed, randomize the processing according to the preset parameters, parse the width and height information of the image file, and paste or crop it. Combined with the annotation map matching process, different types of occlusion information are randomly generated to enhance the training database.

Benefits of technology

Improve the recognition and generalization capabilities of network models, generate more complete data training databases, increase the types of occluded information in the database, and improve the generalization capabilities of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114463169B_ABST
    Figure CN114463169B_ABST
Patent Text Reader

Abstract

The present invention discloses an image data enhancement method, apparatus, device and storage medium. The image data enhancement method of the present invention includes obtaining a picture to be processed; performing randomization processing on the picture to be processed according to a preset first parameter and a preset second parameter to obtain a first picture file; parsing the first picture file to obtain first width information and first height information; parsing the picture to be processed to obtain second width information and second height information; obtaining a second processed file according to the first width information, the first height information, the second width information, the second height information and the picture to be processed; obtaining a second annotation map according to the picture to be processed, and performing matching processing on the second processed file and the second annotation map to obtain a second picture file; performing randomization processing on the second picture file to obtain a third picture file, thereby improving the generalization ability of the model on the premise of ensuring the recognition ability of the network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image enhancement, and in particular, to an image data enhancement method, apparatus, device, and storage medium. Background Art

[0002] Existing image enhancement technologies often cannot balance the impact of the number of types of data enhancement methods on the model. Too many data enhancement methods will cause the recognition ability of the network model to degrade, and too few data enhancement methods will reduce the generalization ability of the network model. Therefore, how to provide an image data enhancement method that can improve the generalization ability of the model while ensuring the recognition ability of the network model has become an urgent problem to be solved. Summary of the Invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes an image data enhancement method that can improve the generalization ability of the model while ensuring the recognition ability of the network model.

[0004] The present invention also proposes an image data enhancement system having the above image data enhancement method.

[0005] The present invention also proposes an image data enhancement device having the above image data enhancement method.

[0006] The present invention also proposes a computer-readable storage medium.

[0007] The image data enhancement method according to the first aspect embodiment of the present invention includes:

[0008] Obtain a picture to be processed;

[0009] Randomize the picture to be processed according to a preset first parameter and a preset second parameter to obtain a first picture file;

[0010] Parse the first picture file to obtain the first width information and the first height information of the first picture file;

[0011] Parse the picture to be processed to obtain second width information and second height information;

[0012] Paste-process or crop-process the picture to be processed according to the first width information, the first height information, the second width information, and the second height information to obtain a second processed file;

[0013] Obtain a second annotation map according to the picture to be processed, and perform matching processing on the second processed file and the second annotation map to obtain a second picture file;

[0014] Randomize the second picture file to obtain a third picture file.

[0015] According to the communication data enhancement method of the embodiments of the present invention, it has at least the following beneficial effects:

[0016] The image data enhancement method provided by the present invention can obtain a picture to be processed, and randomly process the data to be processed according to preset first parameters and second parameters, so that the picture to be processed is changed to a random size according to a random width and a random width-to-height ratio to generate a first picture file, and obtain the first width information and the first height information of the first picture file by parsing the first picture file; this method can also parse the picture to be processed to obtain the original width and height information of the picture to be processed, so as to obtain the second width information and the second height information; furthermore, this method can perform different operations according to the numerical relationship between the first width information, the first height information, the second width information and the second height information obtained, such as pasting the picture to be processed or cropping the picture to be processed to generate a second processed file; this method can also parse the obtained picture to be processed to obtain a second annotation map corresponding to the picture to be processed and including occlusion information in the picture to be processed, and match the second annotation map with the second processed file to obtain a second picture file, and thus perform a preset randomization processing operation on the second picture file to obtain a third picture file. Through this method, the present invention can randomly occlude and change the picture to be processed, and randomly change the size of the picture according to the preset first parameters and second parameters, so as to increase different types of occlusion information in the database and obtain a more complete training database, thereby effectively improving the recognition ability and generalization ability of the network model.

[0017] According to some embodiments of the present invention, the randomly processing the picture to be processed according to the preset first parameters and the preset second parameters to obtain a first picture file includes:

[0018] Randomly obtain first width information according to the first parameter;

[0019] Randomly obtain width-to-height ratio information according to the second parameter, and obtain first height information according to the width-to-height ratio information and the first width information;

[0020] Scale the width value of the picture to be processed to the first width information, and scale the height value of the picture to be processed to the first height information to generate a first picture file.

[0021] According to some embodiments of the present invention, after obtaining the picture to be processed, the image data enhancement method further includes:

[0022] Perform a scaling operation on the to-be-processed picture according to a preset width-to-height ratio to obtain the second picture file.

[0023] According to some embodiments of the present invention, the step of performing a pasting process or a cropping process on the to-be-processed picture according to the first width information, the first height information, the second width information, and the second height information to obtain a second processed file includes:

[0024] Execute one of the following steps according to the size relationship among the first width information, the first height information, the second width information, and the second height information:

[0025] When at least one of the first width information and the first height information is greater than at least one of the second width information and the second height information, randomly generate a background picture file;

[0026] Perform a pasting process on the to-be-processed picture according to the background picture file to obtain a second intermediate file;

[0027] Perform a scaling process on the second intermediate file to obtain a second processed file;

[0028] Or,

[0029] When any one of the first width information and the first height information is less than any one of the second width information and the second height information, randomly generate cropping ratio data;

[0030] Perform a cropping process on the to-be-processed picture according to the cropping ratio data to obtain a cropped file;

[0031] Perform a scaling process on the cropped file to obtain a second processed file.

[0032] According to some embodiments of the present invention, the step of obtaining a second labeled picture according to the to-be-processed picture and performing a matching process on the second processed file and the second labeled picture to obtain a second picture file includes:

[0033] Obtain a preset first labeled picture according to the to-be-processed picture file;

[0034] Perform a pasting process on the first labeled picture according to the background picture file to obtain a first processed picture;

[0035] Obtain a preset scaling ratio and perform a scaling process on the first processed picture according to the scaling ratio to obtain a second labeled picture;

[0036] Perform a matching process on the second labeled picture and the second processed file to obtain a second picture file;

[0037] Alternatively,

[0038] obtain a preset first annotation map according to the to-be-processed picture file;

[0039] Crop the first annotation map according to the cropping file to obtain a second processed map;

[0040] Obtain a preset scaling ratio, and perform a scaling process on the second processed map according to the scaling ratio to obtain a second annotation map;

[0041] Perform a matching process on the second annotation map and the second processed file to obtain a second picture file.

[0042] According to some embodiments of the present invention, the randomizing process on the second picture file to obtain a third picture file includes:

[0043] Perform a color jitter process on the second picture file to obtain a second sub-picture file;

[0044] Perform a flipping process on the second sub-picture file to obtain a third processed file;

[0045] Parse the second picture file to obtain a second annotation map;

[0046] Perform a randomizing process on the second annotation map to obtain a third annotation map;

[0047] Perform a matching process on the third annotation map and the third processed file to generate a third picture file.

[0048] According to some embodiments of the present invention, the randomizing process on the second annotation map to obtain a third annotation map includes:

[0049] Perform a color jitter process and a flipping process on the second annotation map to obtain a third annotation map.

[0050] An image data enhancement device according to an embodiment of the second aspect of the present invention includes:

[0051] An acquisition module, configured to acquire a to-be-processed picture;

[0052] A first processing module, configured to perform a randomizing process on the to-be-processed picture according to a preset first parameter and a preset second parameter to obtain a first picture file;

[0053] A first parsing module, configured to parse the first picture file to obtain first width information and first height information of the first picture file;

[0054] A second parsing module, configured to parse the to-be-processed picture to obtain second width information and second height information;

[0055] A second processing module, configured to perform pasting or cropping on the to-be-processed picture according to the first width information, the first height information, the second width information, and the second height information to obtain a second processed file;

[0056] A third processing module, configured to obtain a second annotation map according to the to-be-processed picture, and perform matching processing on the second processed file and the second annotation map to obtain a second picture file;

[0057] An output module, configured to perform randomization processing on the second picture file to obtain a third picture file.

[0058] The image data enhancement device according to an embodiment of the present invention has at least the following beneficial effects:

[0059] The image data enhancement device provided by the present invention can obtain a to-be-processed picture through an acquisition module, and the first processing module randomly processes the to-be-processed data according to preset first parameters and second parameters, so that the to-be-processed picture is changed to a random size according to a random width and a random width-to-height ratio to generate a first picture file, and the first parsing module parses the first picture file to obtain the first width information and the first height information of the first picture file; the device can also parse the to-be-processed picture through the second parsing module to obtain the original width and height information of the to-be-processed picture, so as to obtain second width information and second height information; furthermore, the device can perform different operations on the numerical relationship between the obtained first width information, first height information, second width information, and second height information through the second processing module, such as performing pasting processing on the to-be-processed picture, or performing cropping processing on the to-be-processed picture, to generate a second processed file; the device can also parse the obtained to-be-processed picture through the third processing module to obtain a second annotation map corresponding to the to-be-processed picture and including occlusion information in the to-be-processed picture, and perform matching processing on the second annotation map and the second processed file to obtain a second picture file, so that the output module processes the second picture file according to a preset randomization processing operation to obtain a third picture file. Through this device, the present invention can randomly occlude and change the to-be-processed picture, and randomly change the size of the picture according to the preset first parameters and second parameters, so as to increase different types of occlusion information in the database, obtain a more complete training database, and effectively improve the recognition ability and generalization ability of the network model.

[0060] An image data enhancement device according to a third aspect embodiment of the present invention includes:

[0061] A memory, and

[0062] at least one processor communicatively connected to the memory, wherein

[0063] the memory stores instructions that are executed by the at least one processor, so that when the at least one processor executes the instructions, the image data enhancement method described in the embodiment of the first aspect of the present invention is implemented.

[0064] The image data enhancement device according to the embodiment of the present invention has at least the following beneficial effects:

[0065] Through the image data enhancement device provided by this method, the present invention can implement the image data enhancement method described in the embodiment of the first aspect of the present invention by executing instructions stored in a memory communicatively connected to at least one processor by at least one processor, so as to obtain a picture to be processed, and randomly process the data to be processed according to preset first parameters and second parameters, so that the picture to be processed is changed to a random size according to a random width and a random width-to-height ratio to generate a first picture file, and obtain the first width information and the first height information of the first picture file by parsing the first picture file; this device can also parse the picture to be processed to obtain the original width and height information of the picture to be processed, so as to obtain second width information and second height information; furthermore, this device can perform different operations according to the numerical relationship between the first width information, the first height information, the second width information and the second height information obtained, such as performing a pasting process on the picture to be processed, or performing a cropping process on the picture to be processed to generate a second processed file; this device can also parse the obtained picture to be processed to obtain a second annotation map corresponding to the picture to be processed and including occlusion information in the picture to be processed, and perform a matching process on the second annotation map and the second processed file to obtain a second picture file, so as to process the second picture file through a preset randomization process operation to obtain a third picture file. Through this device, the present invention can randomly occlude and change the picture to be processed, and randomly change the size of the picture according to the preset first parameters and second parameters, so as to increase different types of occlusion information in the database and obtain a more complete training database, thereby effectively improving the recognition ability and generalization ability of the network model.

[0066] A computer-readable storage medium according to the embodiment of the fourth aspect of the present invention, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute the image data enhancement method described in the embodiment of the first aspect of the present invention.

[0067] The computer-readable storage medium according to the embodiment of the present invention has at least the following beneficial effects:

[0068] By executing the computer-executable instructions stored in the computer-readable storage medium provided by this method, this method can control a computer to implement the image data enhancement method according to the embodiments of the first aspect of the present invention, thereby obtaining a picture to be processed, and randomly processing the data to be processed according to preset first parameters and second parameters, so that the picture to be processed is changed to a random size according to a random width and a random width-to-height ratio to generate a first picture file, and obtaining the first width information and the first height information of the first picture file by parsing the first picture file; this method can also parse the picture to be processed to obtain the original width and height information of the picture to be processed, so as to obtain the second width information and the second height information; furthermore, this method can perform different operations according to the numerical relationship among the obtained first width information, first height information, second width information, and second height information, such as performing a pasting process on the picture to be processed, or performing a cropping process on the picture to be processed to generate a second processed file; this method can also parse the obtained picture to be processed to obtain a second annotation map corresponding to the picture to be processed and containing occlusion information in the picture to be processed, and perform a matching process on the second annotation map and the second processed file to obtain a second picture file, and thus perform a preset randomization process operation on the second picture file to obtain a third picture file. Through this method, the present invention can randomly occlude and change the picture to be processed, and randomly change the size of the picture according to the preset first parameters and second parameters, so as to increase different types of occlusion information in the database and obtain a more complete training database, thereby effectively improving the recognition ability and generalization ability of the network model.

[0069] Additional aspects and advantages of the present invention will be given in part in the following description, become apparent in part from the following description, or be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] The following further describes the present invention with reference to the drawings and embodiments, where:

[0071] Figure 1 is a schematic flowchart of the image data enhancement method of the present invention;

[0072] Figure 2 is Figure 1 a specific flowchart of step S200 in

[0073] Figure 3 is Figure 1 a specific flowchart of step S500 in

[0074] Figure 4 is Figure 1 a specific flowchart of step S600 in

[0075] Figure 5 Another specific process schematic diagram of step S600 in Figure 1 ;

[0076] Figure 6 Another Figure 1 specific process schematic diagram of step S700 in

[0077] Figure 7 Structural schematic diagram of the image data enhancement device of the present invention.

[0078] Reference numerals:

[0079] Acquisition module 100, first processing module 200, first parsing module 300, second parsing module 400, second processing module 500, third processing module 600, output module 700. Detailed implementation manners

[0080] The embodiments of the present invention will be described in detail below. The examples of the embodiments are shown in the drawings, where the same or similar reference numerals indicate the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation to the present invention.

[0081] In the description of the present invention, it should be understood that for the orientation description, such as the orientation or positional relationship indicated by up, down, front, back, left, right, etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present invention.

[0082] In the description of the present invention, the meaning of several is more than one, the meaning of multiple is more than two, greater than, less than, exceeding, etc. are understood as not including the present number, above, below, within, etc. are understood as including the present number. If there is a description of first and second, it is only for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features or implicitly indicating the sequence relationship of the indicated technical features.

[0083] In the description of the present invention, unless otherwise clearly defined, words such as setting, installing, connecting, etc. should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above words in the present invention in combination with the specific content of the technical solution.

[0084] In the description of the present invention, the description referring to terms such as "one embodiment", "some embodiments", "schematic embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0085] In a first aspect, with reference to Figure 1 , the present invention provides an image data enhancement method, including but not limited to the following steps:

[0086] Step S100: Obtain the picture to be processed;

[0087] Step S200: Randomize the picture to be processed according to a preset first parameter and a preset second parameter to obtain a first picture file;

[0088] Step S300: Parse the first picture file to obtain the first width information and the first height information of the first picture file;

[0089] Step S400: Parse the picture to be processed to obtain the second width information and the second height information;

[0090] Step S500: Paste or crop the picture to be processed according to the first width information, the first height information, the second width information, and the second height information to obtain a second processed file;

[0091] Step S600: Obtain a second annotation map according to the picture to be processed, and perform a matching process on the second processed file and the second annotation map to obtain a second picture file;

[0092] Step S700: Randomize the second picture file to obtain a third picture file.

[0093] The image data enhancement method provided by the present invention can obtain a picture to be processed, and randomly process the data to be processed according to a preset first parameter and a second parameter, so that the picture to be processed is changed to a random size according to a random width and a random width-to-height ratio to generate a first picture file, and obtain the first width information and the first height information of the first picture file by parsing the first picture file; this method can also parse the picture to be processed to obtain the original width and height information of the picture to be processed, so as to obtain the second width information and the second height information; furthermore, this method can perform different operations according to the numerical relationship between the obtained first width information, first height information, second width information and second height information, such as pasting the picture to be processed or cropping the picture to be processed to generate a second processed file; this method can also parse the obtained picture to be processed to obtain a second annotation map corresponding to the picture to be processed and containing occlusion information in the picture to be processed, and match the second annotation map with the second processed file to obtain a second picture file, and then process the second picture file through a preset randomization processing operation to obtain a third picture file. Through this method, the present invention can randomly occlude and change the picture to be processed, and randomly change the size of the picture according to the preset first parameter and second parameter, so as to increase different types of occlusion information in the database, obtain a more complete training database, and effectively improve the recognition ability and generalization ability of the network model.

[0094] In some embodiments, referring to Figure 2 , step S200: Randomly process the picture to be processed according to a preset first parameter and a preset second parameter to obtain a first picture file, including but not limited to the following steps:

[0095] Step S210: Randomly obtain first width information according to the first parameter;

[0096] Step S220: Randomly obtain first width information according to the first parameter;

[0097] Step S230: Scale the width value of the picture to be processed to the first width information, and scale the height value of the picture to be processed to the first height information to generate a first picture file.

[0098] This method can randomly change the image size of the image to be processed through preset first and second parameters. Specifically, this method first obtains the first parameter and obtains the first width information corresponding to the first parameter; this method can also obtain the second parameter and obtain the width-to-height ratio information corresponding to the second parameter, so as to obtain the first height information according to the width-to-height ratio information and the first width information, and scale the image to be processed according to the first width information and the first height information, scale the width of the processed image file to the width value corresponding to the first width information, and scale the height to the height value corresponding to the first height information, so as to generate a first image file with the width value corresponding to the first width information as the width of the image file and the height value corresponding to the first height information as the height of the image file. Through this method, the present invention can randomly change the image file according to different width values and different width-to-height ratios corresponding to the preset first parameter and the second parameter, thereby effectively increasing the types of image files in the training database, and providing higher generalization ability for the network model through this image file data augmentation method.

[0099] In some specific embodiments, the width value corresponding to the first parameter can be any width value from 0.5 times the width value corresponding to the image to be processed to 2 times the width value corresponding to the image to be processed; the width-to-height ratio information corresponding to the second parameter can be any one of 2:1, 16:9, 4:3, 1:1, 3:4, 9:16. The selection methods of the first parameter and the second parameter are completely random, and the specific random algorithm exists in the related art and will not be elaborated here.

[0100] In some embodiments, after step S100: obtaining the image to be processed, this method includes but is not limited to the following steps:

[0101] Scale the image to be processed according to the preset width-to-height ratio to obtain a second image file.

[0102] This method can also scale the obtained image to be processed according to the preset width-to-height ratio. Specifically, this method can parse the image to be processed to obtain the width and height information of the image to be processed, and scale the width and height of the image to be processed to the size of 352*352 to obtain a second image file. This method can increase the types of the obtained second image file, and at the same time, can effectively simplify the scaling process of the image to be processed when obtaining the second image file, effectively improving the scaling efficiency of the image to be processed, thereby improving the processing efficiency of the image data augmentation method.

[0103] In some embodiments, step S500: paste-process or crop-process the image to be processed according to the first width information, the first height information, the second width information and the second height information to obtain a second processed file, includes but is not limited to the following steps:

[0104] Step S510: According to the size relationship between the first width information, the first height information, the second width information, and the second height information, perform one of the following steps:

[0105] Step S511: When at least one of the first width information and the first height information is greater than at least one of the second width information and the second height information, randomly generate a background image file;

[0106] Step S512: According to the background image file, perform a pasting process on the image to be processed to obtain a second processed file;

[0107] Step S513: Perform a scaling process on the second processed file to obtain a second image file;

[0108] Or,

[0109] Step S521: When any one of the first width information and the first height information is less than at least one of the second width information and the second height information, randomly generate cropping ratio data;

[0110] Step S522: According to the cropping ratio data, perform a cropping process on the image to be processed to obtain a cropped file;

[0111] Step S523: Perform a scaling process on the cropped file to obtain a second image file.

[0112] This method can perform different operations according to the size relationships among the first width information, the first height information, the second width information, and the second height information. Specifically, this method can determine whether at least one of the first width information and the first height information is greater than at least one of the second width information and the second height information. When at least one of the first width information and the first height information is greater than the second width information or the second height information, the present invention can determine that the size of the scaled first picture file exceeds the original picture to be processed, and randomly generate a background picture file to paste the picture to be processed on the background picture file to obtain a second intermediate file, and then perform a scaling process on the second intermediate file according to a preset scaling ratio to obtain a second processed file; or, when this method determines that any one of the first width information and the first height information is less than any one of the second width information and the second height information, it can randomly obtain preset cropping ratio data and perform a cropping process on the picture to be processed according to the cropping ratio data to obtain a cropped file containing some information in the picture to be processed, and then perform a scaling process on the cropped file according to the preset scaling ratio to obtain a second processed file. Through this method, the present invention can effectively process the file to be processed according to the size relationship between the scaled first picture file and the file to be processed, so as to obtain a second processed file containing all the information of the file to be processed and random information of the background picture file through the pasting process, or obtain a second processed file containing some information in the file to be processed through the cropping process, and then effectively provide a second processed file containing information types such as different types of occlusion information, and while ensuring the recognition ability of the network model, improve the generalization ability of the network model through the image data enhancement method provided by the present invention.

[0113] In some specific embodiments, the picture size of the randomly generated background picture file is the same as the size of the first picture file corresponding to the case where at least one of the first width information and the first height information is greater than at least one of the second width information and the second height information, that is, the width of the generated background picture file is the width value corresponding to the first width information, and the height of the background picture file is the height value corresponding to the first height information. In some other embodiments, the color of the generated background picture file is completely random, and the related random algorithm belongs to the prior art and will not be elaborated here.

[0114] In some embodiments, referring to Figure 4 and Figure 5 , step S600: Obtain a second annotation map according to the picture to be processed, and perform a matching process on the second processed file and the second annotation map to obtain a second picture file, including but not limited to the following steps:

[0115] Step S611: Obtain a preset first annotation map according to the picture file to be processed;

[0116] Step S612: Perform a pasting process on the first marked diagram according to the background diagram file to obtain a first processed diagram;

[0117] Step S613: Obtain a preset scaling ratio, and perform a scaling process on the first processed diagram according to the scaling ratio to obtain a second marked diagram;

[0118] Step S614: Perform a matching process on the second marked diagram and the second processed file to obtain a second picture file;

[0119] Or,

[0120] Step S621: Obtain a preset first marked diagram according to the picture file to be processed;

[0121] Step S622: Crop the first marked diagram according to the cropping file to obtain a second processed diagram;

[0122] Step S623: Obtain a preset scaling ratio, and perform a scaling process on the second processed diagram according to the scaling ratio to obtain a second marked diagram;

[0123] Step S624: Perform a matching process on the second marked diagram and the second processed file to obtain a second picture file.

[0124] The image data enhancement method provided by the present invention can generate corresponding second picture files according to the second processed files generated in different ways. Specifically, referring to Figure 4 , when the second processed file generated through steps S511, S512, and S513 is obtained, this method can obtain a preset first marked diagram according to the file to be processed, and perform a pasting process on the first marked diagram according to the background diagram file in the process of generating the second processed file to obtain a first processed diagram containing occlusion information; this method can also obtain a preset scaling ratio to perform a scaling process on the first processed diagram, thereby generating a second marked diagram, and further perform a matching process on the second marked diagram and the second processed file to obtain a second picture file; or, referring to Figure 5, after the first labeled image is obtained from the image to be processed according to this method, the method can also obtain the cropped file obtained through steps S521, S522, and S523 to crop the first labeled image to obtain a second processed image, and then scale the second processed image according to the obtained preset scaling ratio to obtain a second labeled image, and further perform matching processing on the second labeled image and the second processed file to generate a second image file. Through this method, the present invention can effectively retain the occlusion information contained in the first labeled image corresponding to the image to be processed, and scale it to a fixed size according to the preset scaling ratio to obtain a second processed image containing the occlusion information in the second processed file, and then realize the matching of the second processed image with the second processed file obtained by different methods, and obtain a second image file containing the randomly processed image information and the corresponding occlusion information, while ensuring the recognition ability of the network model, and realizing the improvement of the generalization ability of the network model through the image data enhancement method provided by the present invention.

[0125] In some specific embodiments, the pasting process of the first labeled image in step S612 can be performed in the same pasting manner as when pasting the image to be processed in step S512, where the pasting manner includes the pasting position. The cropping process of the first labeled image in step S622 can be performed in the same cropping manner as when cropping the image to be processed in step S522, where the cropping manner includes the cropping position. The preset scaling ratio in step S613 can be the width-to-height ratio of the background image file; the preset scaling ratio in step S623 can be the width-to-height ratio of the cropped file.

[0126] In some embodiments, referring to Figure 6 , step S700: Randomize the second image file to obtain a third image file, including but not limited to the following steps:

[0127] Step S710: Perform color jitter processing on the second image file to obtain a second sub-image file;

[0128] Step S720: Perform flipping processing on the second sub-image file to obtain a third processed file;

[0129] Step S730: Parse the second image file to obtain a second labeled image;

[0130] Step S740: Randomize the second labeled image to obtain a third labeled image;

[0131] Step S750: Generate a third image file according to the third labeled image and the third processed file.

[0132] The image enhancement method provided by the present invention can obtain a third picture file from the second annotation map and the third processing file. Specifically, this method can perform color dithering on the obtained second picture file to obtain a second sub-picture file, thereby enhancing the randomness of the image information included in the sub-picture file, and perform flipping processing on the second sub-picture file to obtain a third processing file with further enhanced randomness of the image information; this method can also parse the second picture file to obtain the second annotation map included in the second picture file, and then perform random processing on the obtained second annotation map to generate a corresponding third annotation map, and obtain the third picture file by performing matching processing on the third annotation map and the third processing file. Through this method, the present invention can further enhance the randomness of the image information included in the obtained second picture file, thereby effectively increasing the types of data information of the training data set provided by this method, and further realizing improving the generalization ability of the network model through the image data enhancement method provided by the present invention.

[0133] In some embodiments, step S740: Randomizing the second annotation map to obtain the third annotation map further includes:

[0134] Performing color dithering and flipping on the second annotation map to obtain the third annotation map.

[0135] This method performs the same color dithering and flipping on the second annotation map as the third processing file generated in step S720 to obtain the third annotation map after the same random processing as the third processing file, thereby realizing the matching processing between the third annotation map and the third processing file, and further providing the third annotation map containing correct occlusion information.

[0136] In a second aspect, referring to Figure 7 , the present invention provides an image data enhancement device, including an acquisition module 100, a first processing module 200, a first parsing module 300, a second parsing module 400, a second processing module 500, a third processing module 600, and an output module 700.

[0137] The acquisition module 100 is used to acquire the picture to be processed; the first processing module 200 is used to perform randomization processing on the picture to be processed according to a preset first parameter and a preset second parameter to obtain a first picture file; the first parsing module 300 is used to parse the first picture file to obtain the first width information and the first height information of the first picture file; the second parsing module 400 is used to parse the picture to be processed to obtain the second width information and the second height information; the second processing module 500 is used to perform pasting processing or cropping processing on the picture to be processed according to the first width information, the first height information, the second width information and the second height information to obtain a second processed file; the third processing module 600 is used to obtain a second annotation map according to the picture to be processed, and perform matching processing on the second processed file and the second annotation map to obtain a second picture file; the output module 700 is used to perform randomization processing on the second picture file to obtain a third picture file.

[0138] The image data enhancement device provided by the present invention can acquire the picture to be processed through the acquisition module 100, and randomly process the picture to be processed according to a preset first parameter and a second parameter through the first processing module 200, so that the picture to be processed is changed to a random size according to a random width and a random width-to-height ratio to generate a first picture file, and the first parsing module 300 parses the first picture file to obtain the first width information and the first height information of the first picture file; the device can also parse the picture to be processed through the second parsing module 400 to obtain the original width and height information of the picture to be processed, so as to obtain the second width information and the second height information; furthermore, the device can perform different operations on the numerical relationship among the acquired first width information, first height information, second width information and second height information through the second processing module 500, such as performing pasting processing on the picture to be processed, or performing cropping processing on the picture to be processed to generate a second processed file; the device can also parse the acquired picture to be processed through the third processing module 600 to obtain a second annotation map corresponding to the picture to be processed and containing the occlusion information in the picture to be processed, and perform matching processing on the second annotation map and the second processed file to obtain a second picture file, so that the output module 700 processes the second picture file according to a preset randomization processing operation to obtain a third picture file. Through this device, the present invention can randomly occlude and change the picture to be processed, and randomly change the size of the picture according to a preset first parameter and a second parameter, so as to increase different types of occlusion information in the database and obtain a more complete training database, thereby effectively improving the recognition ability and generalization ability of the network model.

[0139] In a third aspect, the present invention provides an image data enhancement device, including:

[0140] A memory, and

[0141] at least one processor communicatively connected to the memory, wherein

[0142] the memory stores instructions that are executed by the at least one processor so that when the at least one processor executes the instructions, an image data enhancement method according to an embodiment of the first aspect of the present invention is implemented.

[0143] Through the image data enhancement device provided by this method, the present invention can execute, by at least one processor, instructions stored in a memory communicatively connected to the at least one processor, to implement the image data enhancement method according to an embodiment of the first aspect of the present invention, so as to obtain a to-be-processed picture, and randomly process the to-be-processed data according to preset first parameters and second parameters, so that the to-be-processed picture is changed to a random size according to a random width and a random width-to-height ratio to generate a first picture file, and obtain first width information and first height information of the first picture file by parsing the first picture file; this device can also parse the to-be-processed picture to obtain the original width and height information of the to-be-processed picture, so as to obtain second width information and second height information; furthermore, this device can perform different operations according to the numerical relationships among the obtained first width information, first height information, second width information, and second height information, such as performing a pasting process on the to-be-processed picture, or performing a cropping process on the to-be-processed picture to generate a second processed file; this device can also parse the obtained to-be-processed picture to obtain a second annotation map corresponding to the to-be-processed picture and including occlusion information in the to-be-processed picture, and perform a matching process on the second annotation map and the second processed file to obtain a second picture file, and thus perform a processing on the second picture file through a preset randomization process operation to obtain a third picture file. Through this device, the present invention can randomly occlude and change the to-be-processed picture, and randomly change the size of the picture according to the preset first parameters and second parameters, so as to increase different types of occlusion information in the database, obtain a more complete training database, and thus effectively improve the recognition ability and generalization ability of the network model.

[0144] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the image data enhancement method according to an embodiment of the first aspect of the present invention.

[0145] Those of ordinary skill in the art will understand that all or some of the steps and systems disclosed in the above methods can be implemented as software, firmware, hardware, and their appropriate combinations. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include a computer storage medium (or non-transitory medium) and a communication medium (or transitory medium). As is well known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium.

[0146] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made without departing from the spirit of the present invention within the knowledge scope of those of ordinary skill in the art. In addition, the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

Claims

1. An image data enhancement method, characterized in that, Including: Obtain the picture to be processed; Perform randomization processing on the picture to be processed according to a preset first parameter and a preset second parameter to obtain a first picture file; Parse the first picture file to obtain the first width information and the first height information of the first picture file; Parse the picture to be processed to obtain the second width information and the second height information; Perform pasting processing on the picture to be processed or perform cropping processing on the picture to be processed according to the first width information, the first height information, the second width information, and the second height information to obtain a second processed file; wherein, the performing pasting processing on the picture to be processed or performing cropping processing on the picture to be processed according to the first width information, the first height information, the second width information, and the second height information to obtain a second processed file includes: according to the size relationship among the first width information, the first height information, the second width information, and the second height information, perform one of the following steps: when at least one of the first width information and the first height information is greater than at least one of the second width information and the second height information, randomly generate a background picture file, and the width of the background picture file is the width value corresponding to the first width information; perform pasting processing on the picture to be processed according to the background picture file to obtain a second intermediate file; perform scaling processing on the second intermediate file to obtain a second processed file; or, when any one of the first width information and the first height information is less than any one of the second width information and the second height information, randomly generate cropping ratio data; perform cropping processing on the picture to be processed according to the cropping ratio data to obtain a cropped file; perform scaling processing on the cropped file to obtain a second processed file; Obtain a second labeled picture according to the picture to be processed, and perform matching processing on the second processed file and the second labeled picture to obtain a second picture file; Perform randomization processing on the second picture file to obtain a third picture file; wherein, the performing randomization processing on the second picture file to obtain a third picture file includes: perform color jitter processing on the second picture file to obtain a second sub-picture file; perform flipping processing on the second sub-picture file to obtain a third processed file; parse the second picture file to obtain a second labeled picture; perform randomization processing on the second labeled picture to obtain a third labeled picture; perform matching processing on the third labeled picture and the third processed file to generate a third picture file.

2. The image data enhancement method according to claim 1, wherein The performing randomization processing on the picture to be processed according to a preset first parameter and a preset second parameter to obtain a first picture file includes: Randomly obtain first width information according to the first parameter; Randomly obtain width-to-height ratio information according to the second parameter, and obtain first height information according to the width-to-height ratio information and the first width information; Scale the width value of the to-be-processed picture to the first width information, and scale the height value of the to-be-processed picture to the first height information to generate a first picture file.

3. The image data enhancement method according to claim 1, wherein After obtaining the to-be-processed picture, the image data enhancement method further includes: Perform a scaling operation on the to-be-processed picture according to a preset width-to-height ratio to obtain the second picture file.

4. The image data enhancement method according to claim 1, wherein, The step of obtaining a second annotation map based on the to-be-processed picture and performing a matching process between the second processed file and the second annotation map to obtain a second picture file includes: Obtain a preset first annotation map according to the to-be-processed picture file; Perform a pasting process on the first annotation map according to the background picture file to obtain a first processed picture; Obtain a preset scaling ratio, and perform a scaling process on the first processed picture according to the scaling ratio to obtain a second annotation map; Perform a matching process between the second annotation map and the second processed file to obtain a second picture file; Or, Obtain a preset first annotation map according to the to-be-processed picture file; Crop the first annotation map according to the cropping file to obtain a second processed picture; Obtain a preset scaling ratio, and perform a scaling process on the second processed picture according to the scaling ratio to obtain a second annotation map; Perform a matching process between the second annotation map and the second processed file to obtain a second picture file.

5. The image data enhancement method according to claim 1, wherein The step of performing a randomization process on the second annotation map to obtain a third annotation map includes: Perform a color jitter process and a flipping process on the second annotation map to obtain a third annotation map.

6. An image data enhancement device, characterized in that, Includes: An acquisition module for acquiring a to-be-processed picture; A first processing module for performing a randomization process on the to-be-processed picture according to a preset first parameter and a preset second parameter to obtain a first picture file; A first parsing module for parsing the first picture file to obtain the first width information and the first height information of the first picture file; A second parsing module for parsing the to-be-processed picture to obtain second width information and second height information; A second processing module, configured to perform a pasting process or a cropping process on the image to be processed according to the first width information, the first height information, the second width information, and the second height information, so as to obtain a second processed file; wherein, the performing a pasting process or a cropping process on the image to be processed according to the first width information, the first height information, the second width information, and the second height information, so as to obtain a second processed file includes: according to the size relationship among the first width information, the first height information, the second width information, and the second height information, performing one of the following steps: when at least one of the first width information and the first height information is greater than at least one of the second width information and the second height information, randomly generating a background image file, where the width of the background image file is the width value corresponding to the first width information; performing a pasting process on the image to be processed according to the background image file to obtain a second intermediate file; performing a scaling process on the second intermediate file to obtain a second processed file; or, when any one of the first width information and the first height information is less than any one of the second width information and the second height information, randomly generating cropping ratio data; performing a cropping process on the image to be processed according to the cropping ratio data to obtain a cropped file; performing a scaling process on the cropped file to obtain a second processed file; A third processing module, configured to obtain a second labeled image according to the image to be processed, and perform a matching process on the second processed file and the second labeled image to obtain a second image file; An output module, configured to perform a randomization process on the second image file to obtain a third image file; wherein, the performing a randomization process on the second image file to obtain a third image file includes: performing a color jitter process on the second image file to obtain a second sub-image file; performing a flipping process on the second sub-image file to obtain a third processed file; parsing the second image file to obtain a second labeled image; performing a randomization process on the second labeled image to obtain a third labeled image; performing a matching process on the third labeled image and the third processed file to generate a third image file.

7. An image data enhancement device, characterized in that, Comprising: A memory, and At least one processor communicatively connected to the memory, wherein The memory stores instructions, and when the instructions are executed by the at least one processor, the at least one processor, when executing the instructions, implements the image data enhancement method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute the image data enhancement method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Image acquisition method and device for simulating crowded scene and visual processing method

    CN112200035A