Nested and covered data enhancement method
Through the nested structure of nested occlusion and anti-occlusion operations, the existing data enhancement methods are solved in the problem of insufficient flexibility in feature structure damage and grid occlusion, improving the generalization ability and classification accuracy of the model, avoiding feature map calculation Time-consuming, achieving more efficient data enhancement effects.
Patent Information
- Application Number
- CN202410988381.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-07-23
AI Technical Summary
Existing data enhancement methods can easily destroy the original image feature structure when alleviating the overfitting problem. Mesh occlusion lacks random flexibility, and feature map calculation is long, which affects the model generalization ability and classification accuracy.
Using the nested occlusion data enhancement method, the nested edge length is calculated based on the preset nesting ratio and number of times through random occlusion and reverse occlusion, and alternately occlusion and reverse occlusion until the preset nesting times are reached to form a nesting. structure.
The generalization ability and classification accuracy of the model are improved, randomness and structural persistence are maintained, additional time-consuming calculation of feature maps are avoided, and classification accuracy and model generalization ability are generally improved.
Smart Images

Figure CN119006887A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of visual detection, and in particular to a nested masking data enhancement method. Background Art
[0002] In the prior art, data enhancement methods include the following:
[0003] 1. Cutout (proposed in 2017): The Cutout algorithm randomly cuts out a square mask area of a fixed size from the image and assigns a fixed value (usually black);
[0004] 2. Random Erasing (proposed in 2017): Random Erasing is similar to the Cutout algorithm, but the difference is that the length and width of the mask area randomly intercepted by the Random Erasing algorithm are not fixed, and the replacement value of the mask area is also not fixed;
[0005] 3. Hide-and-Seek (proposed in 2018): The HaS algorithm divides the original image into small blocks, and each small block becomes a masked area with a certain probability;
[0006] 4. GridMask (proposed in 2020): The GridMask algorithm uses a grid method for equidistant masking, so that the target area is not completely covered by the mask area;
[0007] 5. FenceMask (proposed in 2020): Similar to GridMask, FenceMask replaces the equidistant grid of GridMask with a tilted equidistant grid;
[0008] 6. KeepAugment (proposed in 2020): The KeepAugment algorithm locates the mask area through the feature map, thereby preventing the target area from being covered by the mask.
[0009] However, the above prior art has the following defects:
[0010] 1. Cutout (proposed in 2017), Random Erasing (proposed in 2017), and Hide-and-Seek (proposed in 2018) masks easily destroy the feature structure of the original image;
[0011] 2. GridMask (proposed in 2020), FenceMask (proposed in 2020): The grid mask isometric problem makes the mask lack of random flexibility;
[0012] 3. KeepAugment (proposed in 2020): The training time caused by feature map calculation is time-consuming. Summary of the invention
[0013] The technical problem to be solved by the present invention is to provide a nested masking data enhancement method, which solves the problem of completely occluding targets when alleviating overfitting problems in existing data enhancement algorithms, improves the generalization ability of the model, and effectively improves the classification accuracy of small targets.
[0014] The technical solution adopted by the present invention to solve the technical problem is: a nested masking data enhancement method, comprising the following steps:
[0015] S1. Obtain an image and set initial parameters; the initial parameters include initial masking side length, nesting ratio and nesting times;
[0016] S2, randomly masking the image according to the set initial masking side length to obtain a masking area;
[0017] S3, calculating the nesting side length of the anti-masking area according to a preset nesting ratio in the masking area and performing random anti-masking;
[0018] S4, calculating the nesting side length of the next covering area according to a preset nesting ratio in the random anti-covering area and performing random covering;
[0019] S5, repeating step S3 and step S4 alternately;
[0020] S6. Repeat until the preset nesting times are met.
[0021] Furthermore, in step S5 of the present invention, if the last operation was a covering operation, then the next operation is an anti-covering operation; if the last operation was an anti-covering operation, then the next operation is a covering operation.
[0022] Furthermore, the calculation method of the nesting side length of each nesting of the present invention is: n =c*r n ; Where c is the initial edge length, r is the nesting ratio, and n is the number of nesting times.
[0023] The beneficial effects of the present invention are that the defects existing in the background technology are solved, a random nested structure is added on the basis of the existing data enhancement method, and a part of the masked area is released through a random anti-masking operation; the present invention can be used to preprocess different classified image data, and the generalization ability and classification accuracy of the classification model are improved without affecting the model training and reasoning efficiency; at the same time, the present invention retains the randomness of the cutout algorithm and the structural continuity of GridMask and FenceMask, avoids the time-consuming calculation of the additional feature map brought by KeepAugment, and generally improves the classification accuracy and model generalization ability on the data set. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a schematic flow chart of the method of the present invention;
[0025] Figure 2 It is a schematic diagram of the effect of the present invention. DETAILED DESCRIPTION
[0026] The present invention will now be described in further detail in conjunction with the accompanying drawings and preferred embodiments. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.
[0027] like Figure 1 A nested masking data enhancement method is shown, which is used to enhance image data, by randomly selecting a small square area M1 from the M0 area for anti-masking, and then randomly selecting a smaller square area M2 from the M1 area for masking; and repeating this process, the masking and anti-masking process is nested and cycled several times;
[0028] The specific steps include:
[0029] Get an image m, and perform random masking on the image m according to the preset initial masking side length c, then calculate the side length c1 of the anti-masking area in the masked area according to the preset nesting ratio r, and then perform random anti-masking, and then calculate the side length c2 of the masked area according to the preset nesting ratio r in the random anti-masking area, and then perform random masking. If the last operation was a masking operation, then the next operation is an anti-masking operation, and if the last operation was an anti-masking operation, then the next operation is a masking operation. Repeat this process until the preset number of nesting times n is met. In particular, when n is 0, the algorithm evolves into the Cutout algorithm.
[0030] like Figure 2 As shown, a 16*16 area is randomly selected from a 128*128 image for masking, and then an 8*8 area is randomly selected from the 16*16 area for unmasking, and this is repeated;
[0031] The calculation method is:
[0032] 1. Set the initial side length c, the number of nesting times n, and the nesting ratio r:
[0033] (1) The initial side length c is the side length of the outermost mask;
[0034] (2) When n = 0, nestcutout degenerates into cutout;
[0035] (3) r is the nesting side length of each layer. The calculation formula for the side length of the nth layer of nesting is c n =c*r n ;
[0036] 2. Alternate between covering and anti-covering;
[0037] When n>0, masking and anti-masking are alternating; for example, n=0 is masking, n=1 is anti-masking, n=2 is masking, and so on. The calculation formula is as follows:
[0038] M n =(n+2)%2
[0039] Perform modulo operation on each layer n to obtain M n As the fill value of the mask area;
[0040] 3. Obtain the final NestCutout image;
[0041] Multiply the synthesized M by the original image to obtain the final required NestCutout image.
[0042] The above description only describes the specific implementation mode of the present invention. Various examples do not limit the essential content of the present invention. After reading the description, ordinary technicians in the relevant technical field can modify or deform the specific implementation modes described above without departing from the essence and scope of the invention.
Claims
1. A nested masking data enhancement method, characterized in that: The following steps are included: S1. Obtain an image and set initial parameters; the initial parameters include initial masking side length, nesting ratio and nesting times; S2, randomly masking the image according to the set initial masking side length to obtain a masking area; S3, calculating the nesting side length of the anti-masking area according to a preset nesting ratio in the masking area and performing random anti-masking; S4, calculating the nesting side length of the next covering area according to a preset nesting ratio in the random anti-covering area and performing random covering; S5, repeating step S3 and step S4 alternately; S6. Repeat until the preset nesting times are met.
2. A nested masking data enhancement method as claimed in claim 1, characterized in that: In the step S5, if the last operation was a covering operation, then the next operation is an anti-covering operation; if the last operation was an anti-covering operation, then the next operation is a covering operation.
3. The nested masking data enhancement method according to claim 1, characterized in that: The calculation method of the nesting edge length of each nesting is: c n =c*r n ; Where c is the initial edge length, r is the nesting ratio, and n is the number of nesting times.
Citation Information
Patent Citations
Multi-scale generative adversarial network-based shielded pedestrian re-identification method
CN110135366A
Method and device for generating occlusion image, computer equipment and storage medium
CN112001983A
Shielded tunnel surface crack identification method
CN116883831A
