Image data augmentation method based on adaptive scaling
Patent Information
- Application Number
- HK42026128273
- Authority / Receiving Office
- HK · HK
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2026-09-01
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2045-12-17
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
(19) State Intellectual Property Office (12) Invention Patent Application (10) Application Publication Number (43) Application Publication Date (21) Application Number 202511918655.1 (22) Application Date 2025.12.18 (71) Applicant Aipark Technology Co., Ltd. Address 1202, 12th Floor, No. 27 Zhongguancun Street, Haidian District, Beijing 100010 (72) Inventors Yan Jun Wang Xin (51) Int.Cl. G06V 10 / 32 (2022.01) G06V 10 / 774 (2022.01) G06V 10 / 25 (2022.01) (54) Invention Title: An Image Data Enhancement Method Based on Adaptive Scaling (57) Abstract: This invention discloses an image data enhancement method based on adaptive scaling, relating to the field of data processing technology. The method includes: statistically analyzing the targets in the input image, calculating the bounding box area ratio of each target instance, and calculating the median area ratio; dynamically calculating the scaling ratio and scaling mode of the image based on the median area ratio, performing geometric transformation processing on the input image to generate an enhanced image, adjusting the annotations, and using the enhanced image and its corresponding annotation information to train a target detection model. This invention solves the technical problem that existing image enhancement methods cannot adaptively select scaling strategies according to the actual scale distribution of the target, which easily leads to distortion of training samples and thus affects the detection performance of the model in multi-scale scenes. It achieves the technical effect of generating effective training samples based on the adaptive scaling strategy of the median area ratio of the target, thereby improving the target detection performance of the model. Claims (2 pages), Description (9 pages), Drawings (2 pages), CN 121962629 A, 2026.05.01, CN 1 21 96 26 29 A. 1. An image data enhancement method based on adaptive scaling, characterized in that the method comprises: performing statistical analysis on targets in an input image, calculating the bounding box area ratio of each target instance, and calculating the median area ratio; dynamically calculating adaptive scaling parameters based on the median area ratio, determining the scaling ratio and scaling mode of the image, wherein the scaling mode includes magnification and reduction processing, automatically selected according to the scaling ratio; performing geometric transformation processing on the input image according to the scaling ratio and scaling mode to generate an enhanced image; after adjusting the annotations of the enhanced image, training a target detection model using the enhanced image and its corresponding annotation information. 2. The image data enhancement method based on adaptive scaling as described in claim 1, characterized in that, statistical analysis of the targets in the input image includes: setting the size of the input image to H×W, which contains N labeled target instances, wherein the bounding box of each target instance is represented as , where represents the center coordinates of the bounding box, and and represent the width and height, respectively;3. The image data enhancement method based on adaptive scaling as described in claim 1, characterized in that, based on the median area proportion, the adaptive scaling parameters are dynamically calculated, including: defining a basic scaling ratio calculation function: , where k is a scale control parameter, is the median area proportion, and is a very small positive number to prevent division by zero; calculating the scaling ratio boundary based on the basic scaling ratio calculation function: ; ; where and are the preset lower and upper bounds of the scaling ratio, respectively, and is a cropping function; based on the calculated scaling ratio boundary, uniformly distributed sampling is performed in the logarithmic space to determine the final scaling ratio, and the corresponding scaling mode is selected according to the scaling ratio. 4. The image data enhancement method based on adaptive scaling as described in claim 1, characterized in that, according to the scaling ratio and scaling mode, geometric transformation processing is performed on the input image, and the selection of the scaling mode includes: when the scaling ratio s≥1, the input image is enlarged; when the scaling ratio s<1, the input image is reduced. 5. The image data enhancement method based on adaptive scaling as described in claim 4, characterized in that the magnification process includes: (Claim 1 / 2 page 2 CN 121962629 A) Enlarging the original image using the difference method to obtain an enlarged image; Synchronously enlarging the bounding box coordinates of the target instances in the enlarged image to generate a new bounding box for each target instance; Randomly selecting a new bounding box from the enlarged image and determining a cropping region centered on it; Randomly selecting cropping coordinates within the cropping region and cropping the enlarged image to obtain a cropped image; Adjusting the annotation information of the target instances in the cropped image according to the cropping region, filtering out target instances completely outside the cropping region, retaining other target instances, and generating the enhanced image. 6. The image data augmentation method based on adaptive scaling as described in claim 4, characterized in that the reduction process includes: reducing the original image using the interpolation method to obtain a reduced image; randomly selecting a background image from a pre-constructed background image library, cropping and scaling it to the target size as the background image; if the background image library is empty, creating a gray background image of a specified size; filling the reduced image onto the background image to generate a filled image; adjusting the bounding box coordinates of all target instances in the original image to the coordinate system of the filled image to generate the augmented image. 7. The image data augmentation method based on adaptive scaling as described in claim 6, characterized in that the construction of the background image library includes: caching images without labeled target instances in the input training images into the background image library to construct the background image library. Claims 2 / 2 pages 3 CN121962629 A An Image Data Enhancement Method Based on Adaptive Scaling Technical Field
[0001] This invention relates to the field of data processing technology, specifically to an image data enhancement method based on adaptive scaling. Background Art
[0002] In target detection tasks, the diversity of training data and the balanced distribution of target scales have a key impact on the detection accuracy of the model. Existing data enhancement methods usually use fixed scaling, random cropping, random scaling jitter, etc. to process images, but most of these methods do not adaptively adjust according to the actual scale distribution of the target in the image, which easily leads to small targets being further reduced and unable to be identified, or large targets being over-enlarged, causing information loss, thereby affecting the model's learning effect on multi-scale targets. In addition, existing enhancement methods often directly paste blank areas or fixed backgrounds after scaling, making it difficult to maintain the consistency and naturalness of the scene, reducing the realism of the enhanced image. Summary of the Invention
[0003] This application provides an image data enhancement method based on adaptive scaling to solve the technical problem that existing image enhancement methods cannot adaptively select scaling strategies according to the actual scale distribution of the target, which easily causes training sample distortion, thereby affecting the detection performance of the model in multi-scale scenes.
[0004] In a first aspect, this application provides an image data augmentation method based on adaptive scaling. The method includes: performing statistical analysis on targets in an input image, calculating the bounding box area ratio of each target instance, and calculating the median area ratio; dynamically calculating adaptive scaling parameters based on the median area ratio, determining the scaling ratio and scaling mode of the image, wherein the scaling mode includes zooming in and zooming out, and is automatically selected according to the scaling ratio; performing geometric transformation processing on the input image according to the scaling ratio and scaling mode to generate an enhanced image; and training a target detection model using the enhanced image and its corresponding annotation information after adjusting the annotations on the enhanced image.
[0005] One or more technical solutions provided in this application have at least the following technical effects or advantages:
[0006] This application provides an image data enhancement method based on adaptive scaling, which relates to the field of data processing technology. By introducing scale features based on the median of the target area ratio, the target scale distribution of the input image is adaptively analyzed, and the scaling ratio is dynamically calculated and the zoom-in or zoom-out mode is automatically selected accordingly. Two paths, zoom-cropping and zoom-background filling, are used to generate enhanced images with reasonable scale and natural scenes, and the annotation information is updated synchronously. This achieves differentiated enhancement for targets of different scales, solving the technical problem that existing image enhancement methods cannot adaptively select scaling strategies according to the actual scale distribution of the target, which easily causes training sample distortion and thus affects the detection performance of the model in multi-scale scenes.An adaptive scaling strategy based on the median of the target area ratio is presented to generate effective training samples, thereby improving the target detection performance of the model.
[0007] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0008] Figure 1 is a schematic flowchart of an image data enhancement method based on adaptive scaling provided in an embodiment of this application;
[0009] Figure 2 is a schematic flowchart of the process of magnifying the input image in an image data enhancement method based on adaptive scaling provided in an embodiment of this application. Detailed Description
[0010] This application provides an image data enhancement method based on adaptive scaling to solve the technical problem that existing image enhancement methods cannot adaptively select scaling strategies according to the actual scale distribution of the target, easily causing training sample distortion, thereby affecting the detection performance of the model in multi-scale scenes.
[0011] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0012] It should be noted that the terms "first," "second," etc., in the specification and the above-mentioned drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. In addition, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices.
[0013] Example 1, as shown in Figure 1, this application provides an image data enhancement method based on adaptive scaling. The method includes:
[0014] P10: Performing statistical analysis on the targets in the input image, calculating the bounding box area ratio of each target instance, and calculating the median area ratio.
[0015] Further, step P10 in this embodiment of the application also includes:
[0016] P11: Set the size of the input image to H×W, which contains N labeled target instances. The bounding box of each target instance is represented as , where represents the center coordinates of the bounding box, and and represent the width and height, respectively. P12: Calculate the area ratio of the bounding box of each target instance and calculate the median area ratio.
[0017] It should be understood that statistical analysis is performed on the targets in the input image to obtain the area ratio of the target bounding boxes and their distribution characteristics.
[0018] First, set the size of the input image to H×W, where H and W represent the height and width of the image, respectively. The image contains N labeled target instances, and the bounding box of each target instance is represented as , where represents the center coordinates of the bounding box, and and represent the width and height, respectively. This method of representing bounding boxes is widely used in the field of target detection because it can concisely describe the position and size of the target in the image.
[0019] Next, calculate the area ratio of the bounding box of each target instance. Specifically, the formula for calculating the bounding box area ratio R is: , where represents the bounding box area of the i-th target instance, and H×W represents the total area of the input image. By calculating the ratio of the bounding box area of each target instance to the total area of the image, the relative area size of each target in the image can be obtained. This area ratio can provide key data support for subsequent adaptive scaling strategies, enabling the system to dynamically adjust scaling parameters according to the actual size distribution of the targets.
[0020] Further, based on the area ratio set R obtained above, its median area ratio is calculated. The median, as a statistic, has robustness to outliers and can effectively reflect the dominant scale characteristics of targets in the image. Specifically, the formula for calculating the median area ratio is: .
[0021] By calculating the median area ratio, the system can dynamically perceive the overall size distribution of targets in the image. For example, when it is small, it indicates that small targets dominate in the image; while when it is large, it indicates that large targets dominate in the image. This statistical feature can provide an important basis for the selection of scaling strategies in subsequent steps, enabling the system to dynamically select appropriate scaling modes and corresponding scaling ratios according to the actual size distribution of the target, thereby achieving adaptive enhancement of image data.
[0022] P20: Based on the median area proportion, dynamically calculate the adapted scaling parameters, determine the scaling ratio and scaling mode of the image, wherein the scaling mode includes magnification and reduction processing, which are automatically selected according to the scaling ratio.
[0023] Further, based on the median area proportion, dynamically calculate the adapted scaling parameters. In this embodiment, step P20 further includes:
[0024] P21: Define a basic scaling ratio calculation function:
[0025] , where k is a scale control parameter,, where is the median of the area ratio, and is a very small positive number to prevent division by zero; P22: Based on the basic scaling ratio calculation function, calculate the scaling ratio boundary:
[0026] ; ; where and are the preset lower and upper bounds of the scaling ratio, respectively, and is the cropping function; P23: Based on the calculated scaling ratio boundary, perform uniform distribution sampling in the logarithmic space to determine the final scaling ratio, and select the corresponding scaling mode according to the scaling ratio.
[0027] Optionally, based on the median of the area ratio, dynamically calculate the scaling parameters of the input image to generate a scaling ratio that can adapt to the current target scale distribution of the image, and automatically determine the scaling mode accordingly. The aim is to realize a content-driven geometric enhancement mechanism, so that images with different target scale features can obtain the optimal enhancement method that matches their features, thereby improving the model's learning ability and generalization ability for multi-scale targets.
[0028] To convert the median area proportion into a continuous parameter that can be used for scaling decisions, a basic scaling ratio calculation function is first defined as shown in the above formula; where k is a scaling control coefficient used to adjust the overall scaling intensity, is the median area proportion, and is a very small positive number to prevent the denominator from being zero.
[0029] Through the above function, when the typical target size in the image is relatively small, i.e., small, the basic scaling ratio is larger, prompting subsequent magnification enhancement; conversely, when the targets in the image are generally large, the basic scaling ratio adaptively decreases, making the final enhancement tend to be a reduction process. This function design can naturally respond sensitively to different scale distributions, realizing consistency with the easily detectable scale requirements in actual detection tasks.
[0030] After obtaining the basic scaling ratio, to avoid geometric distortion or image quality degradation caused by excessively large or small scaling ratios, this embodiment further calculates the scaling ratio boundary and the above formula based on the basic scaling ratio, where and are the preset lower and upper bounds of the scaling ratio, respectively, used to ensure that the scaling ratio falls within a reasonable range, and is the clipping function used to limit the value within the range of [a, b]. The design of the above boundary is based on the characteristics of the multi-scale detection head (1 / 8, 1 / 16, 1 / 32 downsampling resolution), so that the scaling ratio is mathematically adapted to the target scale region that the model can recognize, thereby ensuring that the enhancement result has practical training value at different size levels.
[0031] Finally, based on the calculated scaling ratio boundary and , uniform distribution sampling is performed in the logarithmic space to determine the final scaling ratio s. The specific sampling formula is: ; where is a random number sampled from the uniform distribution in the logarithmic space. In specific execution, uniform sampling can be performed in the logarithmic domain, and then the final scaling ratio can be obtained by exponential restoration. Compared to linear space sampling, logarithmic space sampling better reflects the natural statistical characteristics of the target scale exhibiting a power-law distribution, resulting in a smoother and more balanced scaling ratio over large scales, avoiding...To avoid abnormal extreme scaling.
[0032] P30: Perform geometric transformation processing on the input image according to the scaling ratio and scaling mode to generate an enhanced image.
[0033] Further, the selection of the scaling mode in this embodiment of the application also includes step P30 as follows:
[0034] P31: When the scaling ratio s≥1, the input image is magnified; when the scaling ratio s<1, the input image is reduced.
[0035] Specifically, after obtaining the final scaling ratio s and its corresponding scaling mode, the input image is subjected to geometric transformation processing that matches the ratio to generate an enhanced image for training. By driving the selection of the magnification path or the reduction path, the enhancement process can be adaptively adjusted according to the original target scale features of the image, thereby avoiding the information loss or target scale offset problem caused by traditional fixed scaling.
[0036] For example, the scaling mode is automatically selected according to the value of the scaling ratio: when the scaling ratio s≥1, the system determines that magnification processing should be performed; when the scaling ratio s<1, reduction processing is performed. The above-mentioned mode division and scaling ratio have the same physical meaning, which can achieve logical natural segmentation and algorithmic executability.
[0037] Specifically, in the magnification mode (s≥1), the input image and its corresponding labeled bounding box are first magnified and interpolated according to the ratio s, so that the target that was originally small in scale occupies a higher pixel spatial resolution in the image, thereby enhancing the structural details of the target. Considering that the size of the magnified image usually exceeds the standard training size, this embodiment adopts a random cropping strategy combined with the target center constraint to extract a fixed-size region consistent with the model input from the magnified image, so that the enhanced image contains the key target and maintains the randomness of the spatial layout, thereby enhancing the generalization ability of the model.
[0038] In the reduction mode (s<1), the input image and its labeled bounding box are reduced according to the scaling ratio s, so that the target that originally occupied a large area is reduced to a more suitable scale. Subsequently, the scaled-down image is randomly placed on a background area cropped from a pre-built library of real background images, and the position of the target in the background is controlled by random offset, so that the final enhanced image has both a real scene structure and diverse spatial combinations, avoiding the problem of blank edges or single target position caused by direct scaling.
[0039] Through the above-mentioned mode selection and geometric transformation processing based on scaling ratio, this embodiment can achieve differentiated enhancement between images with different target scale distributions, making the generated enhanced image more in line with the optimal scale requirements of the target detection model, effectively improving the sample quality and multi-scale adaptability of the model during the training phase.
[0040] Further, as shown in FIG2, the scaling-up processing, step P31 of this embodiment further includes:
[0041] P31-1: The original image is magnified using the difference method to obtain the magnified image; P31-2: The bounding box coordinates of the target instances in the magnified image are synchronously magnified to generate a new bounding box for each target instance; P31-3: A new bounding box is randomly selected from the magnified image, and the cropping region is determined with it as the center; P31-4: Cropping coordinates are randomly selected within the cropping region, and the magnified image is cropped to obtain the cropped image; P31-5: According to the cropping region, the annotation information of the target instances in the cropped image is adjusted, and target instances completely outside the cropping region are filtered out, while other target instances are retained to generate the enhanced image.
[0042] It should be understood that when the scaling ratio satisfies s≥1 and the magnification mode is triggered, the magnification processing flow is performed on the input image to maintain the realism of the scene structure and the trainability of the cropping result while improving the target resolution.
[0043] First, the original input image is magnified according to the scaling ratio s. Specifically, common interpolation methods such as bilinear interpolation, bicubic interpolation, or Lanczos interpolation can be used to perform continuous scale transformation on the image to obtain the magnified image. The magnification achieved through interpolation can ensure the continuity of image content and edge smoothness at the pixel level, so that targets with smaller scales in the original image are magnified to a size range that is easier for the model to learn.
[0044] Next, in order to maintain the consistency between image content and target annotation, the bounding box of each target instance in the magnified image is synchronously scaled. That is, the center point coordinates and width and height of the original bounding box are linearly magnified by a ratio s to generate the corresponding new bounding box after magnification, thereby maintaining the true correspondence between the spatial position and geometric relationship of each target instance relative to the image.
[0045] Next, in order to ensure that the cropping region can effectively contain key target information, while maintaining the randomness and diversity of cropping, this application randomly selects a target box from all the magnified new bounding boxes, and constructs the feasible range of the cropping region based on the center of the bounding box. For example, the coordinates of the upper left and lower right corners are calculated as follows; the reasonable range of values for the coordinates of the upper left corner of the cropping region is as follows:
[0046] , ensuring that it is within the cropping box; the cropping coordinates are randomly selected within this range. If there is no labeled detection instance in the image, the cropping is performed near the center of the image, with the following coordinates: .
[0047] The above design can achieve a balance between randomness and target integrity, ensuring that the cropping region contains at least one valid target instance, while guaranteeing that the cropping position can freely change within a reasonable range, thus enhancing sample diversity.
[0048] Next, the cropping start coordinates are randomly sampled within the cropping feasible region constructed with the new bounding box as the center, and the magnified image is cropped according to the preset output size to obtain the cropped image. This step makes the magnified image re-Returning to the standard input size of the object detection model, the spatial diversity of the training samples is further improved by randomly cropping the position.
[0049] Finally, according to the spatial position relationship of the cropping region, the annotation information of all target instances in the cropped image is updated synchronously: the bounding boxes that overlap with the cropping region are offset by coordinates and truncated by boundaries; target instances that fall completely outside the cropping region are directly removed. For example, for the new bounding box of each target instance, the center point coordinates are modified to be ; then the coordinates are effectively cropped to obtain , the calculation steps are as follows:
[0050] , where, calculate the x-coordinate of the left edge of the cropped bounding box to ensure that it does not exceed the left boundary of the image; calculate the y-coordinate of the upper edge of the cropped bounding box to ensure that it does not exceed the upper boundary of the image; calculate the x-coordinate of the right edge of the cropped bounding box to ensure that it does not exceed the right boundary of the image; calculate the y-coordinate of the lower edge of the cropped bounding box to ensure that it does not exceed the lower boundary of the image.
[0051] , where is the center point coordinate of the new bounding box after cropping. Finally, is the intersection-union ratio (IU / R) between the original adjusted bounding box and the cropped bounding box. Target instances are removed, and other instances are retained. Here, 0.3 is a threshold used to determine whether the target instance is still valid after cropping. If the IU / R is lower than this threshold, it means that the target instance lost most of its information during the cropping process and is therefore filtered out.
[0052] In this way, the generated enhanced image not only retains valid target information but also removes redundant or invalid annotations through filtering operations, ensuring that it can be directly used for subsequent target detection model training.
[0053] Further, the reduction processing, in step P31 of this embodiment, further includes:
[0054] P31-6: Reducing the original image using the difference method to obtain a reduced image; P31-7: Randomly selecting a background image from a pre-built background image library, cropping and scaling it to the target size, and using it as the background image; if the background image library is empty, creating a gray background image of a specified size; P31-8: Filling the reduced image onto the background image to generate a filled image; P31-9: Adjusting the bounding box coordinates of all target instances in the original image to the coordinate system of the filled image to generate the enhanced image.
[0055] Optionally, if the scaling ratio satisfies s<1 and enters the reduction mode, the reduction processing flow is executed to solve the problem that the target scale in the original image is too large and occupies too much pixel space, making it difficult for the model to learn multi-scale features.
[0056] First, the input image is scaled down according to the final determined scaling ratio s. This can be achieved using interpolation methods such as bilinear interpolation, bicubic interpolation, or Lanczos interpolation to perform continuous scaling down, resulting in the scaled-down image.The reduction process compresses target instances that originally occupied a large area in the image to a suitable size, which is beneficial for the model to learn representation features at different scales.
[0057] Next, to avoid directly placing the reduced image into a blank area and destroying the overall scene structure, a background image is randomly selected from the pre-built background image library (pages 6 / 9 of the specification, CN 121962629 A). This background image library is collected from images without targets and dynamically supplemented and maintained during subsequent training. It contains diverse real background scenes, which can effectively improve the realism of the enhanced image. The selected background image is cropped and scaled to make its size consistent with the target output image size, so that it can be used as the background for the reduced image. For example, an image can be randomly selected from the background library G, and then a region can be randomly cropped and scaled to serve as the background image; if the background image library is empty, for example, when no images without targets have been collected in the early stage of training, a gray background image of a specified size is directly created, such as a neutral background with pixel values of 1, 2, and 7 and a size of , to ensure the continuity and executability of the reduction process.
[0058] Next, the reduced image is filled into a certain position of the background image according to a randomly selected offset, thereby generating a filled image. In a specific implementation, the selection range of the offset is determined according to the difference between the size of the reduced image and the size of the background image, ensuring that the reduced image is completely placed inside the background image and allowing random placement, thereby enhancing the diversity of the image spatial layout. For example, a set of offsets for placement positions are randomly generated, all of which are sampled from a uniform distribution:
[0059] , and then the scaled image is filled into the background image:, that is, the pixel values of the reduced image are copied to the corresponding positions of the background image, thereby generating a filled image containing target and background information.
[0060] Finally, according to the filling position and scaling ratio, the bounding boxes of all target instances in the original image are transformed to map them from the original image coordinate system to the coordinate system of the filled image. Specifically, the bounding box coordinates are first scaled down proportionally according to the scaling ratio s; then, translation correction is performed according to the offset of the reduced image in the background image. For example, for the bounding box of each target instance, its new bounding box coordinates in the filled image can be expressed as: , where s is the scaling ratio of the reduction process, and ( , ) is the placement offset of the reduced image on the background image. In this way, the bounding box of the target instance can be kept consistent with the coordinate system of the filled image, ensuring the accuracy of the annotation information, thereby generating an enhanced image.
[0061] Through the above geometric transformation, the new position of each target instance in the filled image can be accurately obtained. For bounding boxes that partially exceed the image boundary due to scaling and filling, a real background image or a gray background image can be introduced to enhance the image.To increase the diversity of targets, the computational burden is reduced and the generalization ability of the target detection model in different background environments is improved.
[0062] Further, the construction of the background image library, step P31 of this application embodiment also includes:
[0063] P31-71: Cache the images without labeled target instances in the input training images into the background image library to construct the background image library.
[0064] In a possible embodiment of this application, in order to ensure that the shrinking process can be fitted and combined on the real scene background, the construction of the background image library is described in detail. Using the naturally existing targetless images in the training data as background sources, the background image library is constructed by automatic collection and caching to ensure the authenticity of the background material and its relevance to the task.
[0065] Specifically, when preprocessing each input image in the training set, it is first determined whether the image contains labeled target instances. When it is detected that there are no labeled targets in an image, that is, the number of target instances N=0, the image is regarded as a pure background image. Compared with artificially generated or regularized backgrounds, real backgrounds from training data have advantages such as natural textures, diverse lighting, and realistic scene structures, which can significantly improve the semantic consistency of enhanced images. Therefore, in this embodiment, such targetless images are directly cached in the background image library for background filling in subsequent downsizing modes.
[0066] To ensure the controllable size and efficiency of the background library, this application can set a capacity limit for the background image library, such as 500 images. When the number in the library reaches the limit, the old background images can be updated using a first-in-first-out (FIFO) or random replacement strategy. This mechanism not only ensures the continuous diversity of background materials, but also ensures the controllable occupation of system memory resources. Through the above construction method, the background image library can be dynamically expanded and continuously updated throughout the training process, providing a rich and constantly evolving source of real backgrounds for downsizing processing.
[0067] P40: After the enhanced image is labeled and adjusted, the target detection model is trained using the enhanced image and its corresponding label information.
[0068] Specifically, the enhanced images after geometric transformation are annotated and adjusted, and these enhanced images and their corresponding annotation information are used to train the target detection model to ensure that the generated enhanced images can be effectively used to improve the performance of the target detection model.
[0069] After the input image is enlarged or reduced, the generated enhanced images need to be annotated to ensure that the annotation information is consistent with the content of the enhanced image. For the enlarged image, the cropping operation may cause some target instances to be cropped, so it is necessary to adjust the bounding box coordinates of the target instances according to the cropping area and filter out target instances that are completely outside the cropping area. For the reduced image, since the target instances are placed in the background image...First, the bounding box coordinates of the target instance need to be adjusted to the coordinate system of the filled image. These annotation adjustment operations ensure that the annotation information of the enhanced image is accurate, providing a reliable data foundation for subsequent model training.
[0070] After the annotation adjustment is completed, the target detection model is trained using the enhanced image and its corresponding annotation information. The enhanced image is generated through an adaptive scaling strategy, which can better reflect the characteristics of the target at different scales, while increasing the diversity of the target through dynamic background filling. These characteristics enable the enhanced image to provide the model with richer learning samples during training, thereby improving the model's ability to detect targets and its generalization performance. During training, the target detection model will learn the feature representation of the target in different scales and background environments, thereby improving the model's adaptability to various complex scenarios in practical applications.
[0071] Finally, the target detection model trained with this enhanced data can detect targets more accurately in various practical scenarios, showing higher performance and reliability.
[0072] In summary, the embodiments of this application have at least the following technical effects:
[0073] This application adaptively determines the scaling method based on the actual scale distribution of the target in the image, which can avoid the loss of small targets or the distortion of large targets caused by traditional fixed scaling; through two enhancement paths, namely enlargement-cropping and reduction-background filling, the target scale of the generated image is more in line with the optimal recognition range of the detection model; by introducing a real background image library, the naturalness of the scene and the authenticity of the samples in the reduction mode are improved; the annotation information is updated synchronously during the geometric transformation process, which can ensure that the enhanced sample annotation is accurate and usable, thereby improving the robustness and generalization ability of the target detection model in multi-scale and complex scenes.
[0074] The technical effect of generating effective training samples based on the adaptive scaling strategy of the median target area ratio is achieved, thereby improving the target detection performance of the model.
[0075] It should be noted that the order of the embodiments of this application above is only for description and does not represent the superiority or inferiority of the embodiments. Moreover, the above describes specific embodiments of this specification. In addition, the process depicted in the drawings does not necessarily require a specific order or continuous order to achieve the desired result. In some implementations, multitasking and parallel processing specification page 8 / 9 11 CN 121962629 A is also possible or may be advantageous.
[0076] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0077] This specification and drawings are merely exemplary descriptions of this application and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Obviously, those skilled in the art can make various modifications and...Modifications may be made without departing from the scope of this application. Thus, if such modifications and variations fall within the scope of this application and its equivalents, this application intends to include such modifications and variations. Specification 9 / 9 page 12 CN 121962629 A Figure 1 Description description page 1 / 2 page 13 CN 121962629 A Figure 2 Description description page 2 / 2 page 14 CN 121962629 A Abstract The present invention discloses an image data augmentation method based on adaptive scaling, relating to the technical field of data processing. The method consists: performing statistical analysis on targets in an input image, calculating an area ratio of a bounding box for each target instance, and computing a median of the area ratios; dynamically calculating a scaling ratio and a scaling mode of the image based on the median of the area ratios, performing geometric transformation processing on the input image to generate an augmented image, and after adjusting annotations, training an object detection model using the augmented image and corresponding annotation information thereof. The present invention solves the technical problem that existing image augmentation methods cannot adaptively select ascaling strategy according to an actual scale distribution of targets, which easily causes distortion of training samples and thereby affects the detection performance of the model in multi-scale scenarios. The present invention achieves the technical effect of generating effective training samples through an adaptive scaling strategy based on the median of the target area ratios, thereby improving the object detection performance of the model.
Claims
1. An image data enhancement method based on adaptive scaling, characterized in that, The method includes: performing statistical analysis on targets in the input image, calculating the bounding box area ratio of each target instance, and calculating the median area ratio; dynamically calculating suitable scaling parameters based on the median area ratio to determine the scaling ratio and scaling mode of the image, wherein the scaling mode includes zooming in and zooming out, which is automatically selected according to the scaling ratio; performing geometric transformation processing on the input image according to the scaling ratio and scaling mode to generate an enhanced image; and training the target detection model using the enhanced image and its corresponding annotation information after adjusting the annotations on the enhanced image.
2. The image data enhancement method based on adaptive scaling as described in claim 1, characterized in that, Perform statistical analysis on the targets in the input image, including: setting the input image size to H×W, containing N labeled target instances, where the bounding box of each target instance is represented as... ,in Indicates the coordinates of the bounding box center. and Represent the width and height respectively; calculate the percentage of the border area for each target instance. And calculate the median area percentage.
3. The image data enhancement method based on adaptive scaling as described in claim 1, characterized in that, Based on the median area percentage, dynamically calculate the appropriate scaling parameters, including: defining a basic scaling ratio calculation function: Where k is the scale control parameter. This represents the median percentage of the area. To prevent division by zero for extremely small positive numbers; based on the aforementioned basic scaling function, calculate the scaling boundary: ; ;in, and These are the preset lower and upper bounds of the scaling ratio, respectively. The scaling function is used to determine the final scaling ratio based on the calculated scaling ratio boundary. Then, the corresponding scaling mode is selected according to the scaling ratio.
4. The image data enhancement method based on adaptive scaling as described in claim 1, characterized in that, According to the scaling ratio and scaling mode, the input image is subjected to geometric transformation processing. The selection of the scaling mode includes: when the scaling ratio s≥1, the input image is enlarged; when the scaling ratio s<1, the input image is reduced.
5. The image data enhancement method based on adaptive scaling as described in claim 4, characterized in that, The magnification process includes: magnifying the original image using the difference method to obtain a magnified image; synchronously magnifying the bounding box coordinates of the target instances in the magnified image to generate a new bounding box for each target instance; randomly selecting a new bounding box from the magnified image and determining a cropping region centered on it; randomly selecting cropping coordinates within the cropping region and cropping the magnified image to obtain a cropped image; adjusting the annotation information of the target instances in the cropped image according to the cropping region, filtering out target instances completely outside the cropping region, retaining other target instances, and generating the enhanced image.
6. The image data enhancement method based on adaptive scaling as described in claim 4, characterized in that, The reduction process includes: reducing the original image using the interpolation method to obtain a reduced image; randomly selecting a background image from a pre-built background image library, cropping and scaling it to the target size to serve as the background image; if the background image library is empty, creating a gray background image of a specified size; filling the reduced image onto the background image to generate a filled image; and adjusting the bounding box coordinates of all target instances in the original image to the coordinate system of the filled image to generate the enhanced image.
7. The image data enhancement method based on adaptive scaling as described in claim 6, characterized in that, The construction of the background image library includes: caching images of unlabeled target instances in the input training images into the background image library, thereby constructing the background image library.