Image data enhancement method based on adaptive scaling

By using an adaptive scaling image data augmentation method, the problem of decreased detection performance caused by uneven target scale distribution in existing technologies is solved. Enhanced images that conform to the optimal recognition range of the target detection model are generated, thereby improving the multi-scale adaptability of the model.

CN121962629APending Publication Date: 2026-05-01AIPARK TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511918655.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing image enhancement methods cannot adaptively select scaling strategies based on the actual scale distribution of the target, resulting in small targets being further shrunk and becoming unrecognizable, or large targets being over-enlarged, causing information loss and affecting the detection performance of the model in multi-scale scenes.

Method used

By statistically analyzing the targets in the input image, calculating the median area ratio, dynamically calculating the scaling ratio and mode, generating an enhanced image, and synchronously updating the annotation information, an adaptive scaling strategy is implemented to generate an enhanced image with a natural scene.

Benefits of technology

It improves the model's detection performance in multi-scale scenarios, generates effective training samples, and enhances the robustness and generalization ability of object detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962629A_ABST
    Figure CN121962629A_ABST
Patent Text Reader

Abstract

The invention discloses an image data enhancement method based on adaptive scaling, and relates to the technical field of data processing, and the method comprises the steps: carrying out the statistical analysis of a target in an input image, carrying out the statistics of the bounding box area proportion of each target instance, and calculating the median of the area proportion; based on the median of the area ratio, the scaling ratio and the scaling mode of the image are dynamically calculated, geometric transformation processing is carried out on the input image, an enhanced image is generated, and after annotation adjustment is carried out, a target detection model is trained by utilizing the enhanced image and corresponding annotation information. The technical problem that the detection performance of the model in a multi-scale scene is affected due to the fact that the existing image enhancement method cannot adaptively select a scaling strategy according to the actual scale distribution of the target and the distortion of the training sample is easily caused is solved, the adaptive scaling strategy based on the median of the area ratio of the target is achieved, the effective training sample is generated, and the detection performance of the model in the multi-scale scene is improved. Therefore, the target detection performance of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

An image data augmentation method based on adaptive scaling Technical Field

[0001] This invention relates to the field of data processing technology, and more specifically to an image data enhancement method based on adaptive scaling. Background Technology

[0002] In object detection tasks, the diversity of training data and the balanced distribution of object scales have a crucial impact on the detection accuracy of the model. Existing data augmentation methods typically use techniques such as fixed-ratio scaling, random cropping, and random scaling jitter to process images. However, most of these methods do not adaptively adjust according to the actual scale distribution of objects in the image, which can easily lead to small objects being further shrunk and becoming unrecognizable, or large objects being over-enlarged, resulting in information loss, thus affecting the model's learning effect on multi-scale objects. In addition, existing augmentation methods often directly paste into blank areas or fixed backgrounds after scaling, making it difficult to maintain scene consistency and naturalness, and reducing the realism of the augmented image. Summary of the Invention

[0003] This application provides an image data augmentation method based on adaptive scaling, which solves the technical problem that existing image augmentation 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.

[0004] The first aspect of 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 to determine the image scaling ratio and scaling mode, wherein the scaling mode includes zooming in and zooming out, automatically selected according to the scaling ratio; performing geometric transformation 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 augmentation method based on adaptive scaling, belonging to the field of data processing technology. By introducing scale features based on the median proportion of target area, the method adaptively analyzes the target scale distribution of the input image and dynamically calculates the scaling ratio and automatically selects the magnification or reduction mode accordingly. It generates augmented images with reasonable scale and natural scene through two paths: magnification-cropping and reduction-background filling, and updates the annotation information simultaneously. This achieves differentiated enhancement for targets of different scales, solving the technical problem that existing image augmentation methods cannot adaptively select scaling strategies according to the actual scale distribution of the target, which easily leads to the distortion of training samples and thus affects the detection performance of the model in multi-scale scenes. The method realizes an adaptive scaling strategy based on the median proportion of target area, generates effective training samples, and thus improves the target detection performance of the model. Attached Figure Description

[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 diagram 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 Implementation

[0010] This application provides an image data augmentation method based on adaptive scaling, which solves the technical problem that existing image augmentation 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.

[0011] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application 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 accompanying 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. Furthermore, 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 such 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 comprising:

[0014] P10: Perform statistical analysis on the targets in the input image, calculate the bounding box area ratio of each target instance, and calculate the median area ratio.

[0015] Furthermore, step P10 in this embodiment of the application also includes:

[0016] P11: Set 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; P12: Calculate the percentage of the border area for each target instance. And calculate the median area percentage.

[0017] It should be understood that statistical analysis is performed on targets in the input image to obtain the area proportion and distribution characteristics of the target bounding boxes.

[0018] First, the input image is defined as having dimensions H×W, where H and W represent the image's height and width, respectively. This image contains N labeled object instances, and the bounding box of each object instance is represented as... ,in Indicates the coordinates of the bounding box center. and These represent the width and height, respectively. This bounding box representation is widely used in object detection because it concisely describes the position and size of the object in an image.

[0019] Next, the bounding box area percentage for each target instance is calculated. Specifically, the formula for calculating the bounding box area percentage R is: , among which, among which, Let H represent the bounding box area of ​​the i-th target instance, and H×W represent the total area of ​​the input image. By calculating the ratio of the bounding box area of ​​each target instance to the total image area, the relative area occupied by each target in the image can be obtained. This area ratio provides crucial data support for subsequent adaptive scaling strategies, enabling the system to dynamically adjust scaling parameters based on the actual size distribution of the targets.

[0020] Furthermore, based on the area percentage set R obtained above, the median area percentage is calculated. The median, as a statistical measure, is robust to outliers and effectively reflects the dominant scale characteristics of objects in an image. Specifically, it represents the median area proportion. The calculation formula is: .

[0021] By calculating the median area proportion, the system can dynamically perceive the overall size distribution of targets in an image. For example, when When the value is smaller, it indicates that small objects dominate the image; while when A larger value indicates that large targets dominate the image. This statistical characteristic provides an important basis for selecting scaling strategies in subsequent steps, enabling the system to dynamically select appropriate scaling modes and corresponding scaling ratios based on the actual size distribution of the targets, thereby achieving adaptive enhancement of image data.

[0022] P20: Based on the median area ratio, dynamically calculate the appropriate scaling parameters to determine the scaling ratio and scaling mode of the image. The scaling mode includes zoom-in and zoom-out processing, which are automatically selected according to the scaling ratio.

[0023] Furthermore, based on the median area percentage, the appropriate scaling parameters are dynamically calculated. In this embodiment, step P20 further includes:

[0024] P21: Define the basic scaling function:

[0025] 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; P22: Calculate the scaling ratio boundary based on the aforementioned basic scaling ratio calculation function:

[0026] ; ;in, and These are the preset lower and upper bounds of the scaling ratio, respectively. P23: Based on the calculated scaling ratio boundary, uniformly sample the logarithmic space to determine the final scaling ratio, and select the corresponding scaling mode according to the scaling ratio.

[0027] Optionally, scaling parameters for the input image are dynamically calculated based on the median area proportion to generate a scaling ratio that adapts to the current target scale distribution of the image, and the scaling mode is automatically determined accordingly. The aim is to implement a content-driven geometric enhancement mechanism that enables images with different target scale features to obtain the optimal enhancement method matching their features, thereby improving the model's learning and generalization abilities for multi-scale targets.

[0028] To transform the median area percentage into a continuous parameter usable for scaling decisions, a basic scaling ratio calculation function is first defined as shown in the equation above; where k is a scaling control coefficient used to adjust the overall scaling intensity. This represents the median percentage of the area. To prevent extremely small positive numbers with a denominator of zero.

[0029] Using the above function, when the typical target size in the image is relatively small, i.e. At a smaller scale, the base scaling ratio A larger base scaling ratio prompts subsequent scaling enhancement; conversely, when targets in the image are generally large, the base scaling ratio adaptively decreases, causing the final enhancement to tend towards scaling down. This function design allows for a natural and sensitive response to different scale distributions, achieving consistency with the easily detectable scale requirements in practical detection tasks.

[0030] After obtaining the base 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 based on the base scaling ratio. and As shown in the above formula, where, and These are the preset lower and upper bounds for the scaling ratio, used to ensure that the scaling ratio falls within a reasonable range. This is a clipping function used to restrict values ​​to the range [a, b]. The design of the above boundaries is based on the characteristics of multi-scale detectors (1 / 8, 1 / 16, 1 / 32 downsampling resolution), ensuring that the scaling ratio is mathematically adapted to the target scale region that the model can recognize, thereby guaranteeing that the enhancement results have practical training value at different size levels.

[0031] Finally, based on the calculated scaling boundary and Uniformly distributed sampling is performed within the logarithmic space to determine the final scaling factor s. The specific sampling formula is as follows: ;in, It is a random number sampled from a uniform distribution in the logarithmic space. In practice, uniform sampling can be performed in the logarithmic domain, and then the final scaling ratio can be obtained through exponential restoration. Compared with linear space sampling, logarithmic space sampling can better conform to the natural statistical characteristics of the target scale exhibiting a power-law distribution, making the scaling ratio smoother and more balanced over a large scale range, and avoiding abnormal extreme scaling.

[0032] P30: Perform geometric transformation on the input image according to the scaling ratio and scaling mode to generate an enhanced image.

[0033] Furthermore, regarding the selection of the scaling mode, step P30 in this embodiment of the application further includes:

[0034] P31: When the scaling ratio s ≥ 1, the input image is enlarged; 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, a geometric transformation matching that ratio is performed on the input image to generate an enhanced image for training. By driving the selection of the magnification or reduction path, the enhancement process can adaptively adjust according to the original target scale features of the image, thereby avoiding the information loss or target scale shift problems caused by traditional fixed scaling.

[0036] For example, the scaling mode is automatically selected based on the scaling ratio: when the scaling ratio s ≥ 1, the system determines that zooming in should be performed; when the scaling ratio s < 1, zooming out should be performed. The above mode division is consistent with the physical meaning of the scaling ratio, which can achieve logical natural segmentation and algorithmic executability.

[0037] Specifically, in the magnification mode (s≥1), the input image and its corresponding bounding box are first magnified and interpolated by a ratio s, so that the originally small-scale target 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 target center constraints, which extracts a fixed-size region consistent with the model input from the magnified image, so that the enhanced image contains the key target while maintaining the randomness of the spatial layout, thereby enhancing the model's generalization ability.

[0038] In the scaling-down mode (s<1), the input image and its bounding box are scaled down by a scaling ratio s, reducing the target, which originally occupied a large area, to a more suitable scale. Then, the scaled-down image is randomly placed onto a background region cropped from a pre-built library of real background images, and the target's position in the background is controlled by random offsets. This results in an enhanced image that possesses both realistic scene structure and diverse spatial combinations, avoiding the problems of blank edges or monotonous target positions caused by direct scaling.

[0039] Through the above-described scaling-based mode selection and geometric transformation processing, this embodiment can achieve differentiated enhancement between images with different target scale distributions, making the generated enhanced images 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] Furthermore, as shown in Figure 2, the magnification process, in step P31 of this embodiment, further includes:

[0041] P31-1: The original image is magnified using the interpolation 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 a cropping region is determined centered on it; P31-4: Cropping coordinates are randomly selected within the cropping region, and the magnified image is cropped to obtain the cropped image; P31-5: Based on 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 process is performed on the input image to improve the target resolution while maintaining the realism of the scene structure and the trainability of the cropping results.

[0043] First, the original input image is enlarged according to a scaling factor *s*. Specifically, common interpolation methods such as bilinear interpolation, bicubic interpolation, or Lanczos interpolation can be used to perform continuous scaling transformations on the image, resulting in the enlarged image. Enlargement achieved through interpolation maintains the continuity of image content and edge smoothness at the pixel level, allowing smaller targets in the original image to be enlarged to a size range more easily learned by the model.

[0044] Next, to maintain consistency between image content and target annotations, the bounding boxes of each target instance in the magnified image are synchronously scaled. That is, the original bounding boxes are... The center point coordinates, width, and height are all linearly enlarged by a ratio s to generate the corresponding new bounding box. This ensures that the spatial position and geometric relationship of each target instance relative to the image are maintained in a true manner.

[0045] Next, to ensure that the cropping region effectively includes key target information while maintaining the randomness and diversity of the cropping, this application randomly selects a target box from all the enlarged new bounding boxes. The feasible range of the clipping region is then constructed based on the center of this bounding box. For example, the coordinates of the top-left and bottom-right corners are calculated as follows: ; Calculate the coordinates of the top left corner of the clipping region The reasonable range of values ​​is as follows:

[0046] ,make sure Within the cropping box; cropping coordinates are randomly selected within this range. If there are unlabeled detection instances in the image, cropping is performed near the image center, with the following coordinates: .

[0047] The above design achieves 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 vary freely 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 enlarged image is cropped according to the preset output size to obtain the cropped image. This step brings the magnified image back to the standard input size of the object detection model, while further enhancing the spatial diversity of the training samples by randomly cropping the location.

[0049] Finally, based on the spatial relationships of the cropping regions, the annotation information of all target instances in the cropped image is updated synchronously: bounding boxes that overlap with the cropping regions are offset and truncated; target instances that fall completely outside the cropping regions are directly removed. For example, for each target instance, a new bounding box... After modifying the center point coordinates, it becomes Then, the coordinates are clipped for validity, resulting in... The calculation steps are as follows:

[0050] ,in, Calculate the x-coordinate of the left edge of the cropped bounding box to ensure it does not exceed the left boundary of the image; Calculate the y-coordinate of the top edge of the cropped bounding box to ensure that it does not exceed the top 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 bottom edge of the cropped bounding box to ensure it does not exceed the bottom boundary of the image.

[0051] , The coordinates of the center point of the new bounding box after clipping are calculated last. , Original adjusted bounding box With the cropped bounding box The intersection-union ratio between them will The target instance is removed, and other instances are retained. Here, 0.3 is a threshold used to determine whether the target instance remains valid after pruning. If the intersection-union ratio (IU) is below this threshold, it means that the target instance lost most of its information during pruning and is therefore filtered out.

[0052] In this way, the generated enhanced images not only retain valid target information, but also remove redundant or invalid annotations through filtering operations, ensuring that they can be directly used for subsequent target detection model training.

[0053] Furthermore, the reduction process, in step P31 of this embodiment, further includes:

[0054] P31-6: Reduce the size of the original image using the interpolation method to obtain the reduced image; P31-7: Randomly select a background image from a pre-built background image library, crop and scale it to the target size to serve as the background image; if the background image library is empty, create a gray background image of a specified size; P31-8: Fill the reduced image onto the background image to generate the filled image; P31-9: Adjust 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 scaling-down mode, a scaling-down process 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 scale reduction, resulting in a scaled-down image. This scaling down 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 representational features at different scales.

[0057] Next, to avoid directly placing the scaled-down image into a blank area and disrupting the overall scene structure, a background image is randomly selected from a pre-built background image library. This library is compiled from collected images without a target and dynamically supplemented and maintained during subsequent training, containing diverse real-world background scenes to effectively improve the realism of the enhanced image. The selected background image is cropped and scaled to match the size of the target output image, thus serving as the background for the scaled-down image. For example, an image can be randomly selected from the background library G. Then randomly crop a region and scale it to... As a background image If the background image library is empty, for example, when no target images have been collected in the early stages of training, a gray background image of a specified size will be created directly, such as 127 pixels and a size of [missing information]. A neutral background color is used to ensure the continuity and executability of the narrowing process.

[0058] Next, the reduced image is filled into a position in the background image according to a randomly selected offset, thus generating the filled image. In the specific implementation, the range of offsets is determined based on the difference between the size of the reduced image and the size of the background image, ensuring that the reduced image is completely placed within the background image while allowing for randomized placement, thereby enhancing the diversity of the image's spatial layout. For example, a set of offsets for the placement positions is randomly generated. They are all sampled from a uniform distribution:

[0059] Then, the scaled image is filled into the background image: This means copying the pixel values ​​of the scaled-down image to the corresponding positions in the background image, thereby generating a filled image that contains both target and background information.

[0060] Finally, based on the fill position and scaling ratio, the bounding boxes of all target instances in the original image are transformed to map from the original image coordinate system to the coordinate system of the filled image. Specifically, the bounding box coordinates are first scaled down proportionally by a scaling ratio s; then, translation correction is performed based on the offset of the scaled-down image in the background image. For example, for each target instance's bounding box... The coordinates of its new bounding box in the filled image It can be represented as: Where s is the scaling ratio for the reduction process, ( , () represents the offset of the scaled-down image onto the background image. This ensures that the bounding box of the target instance remains aligned with the coordinate system of the filled image, guaranteeing the accuracy of the annotation information and generating an enhanced image.

[0061] Through the geometric transformations described above, the new position of each target instance in the padded image can be accurately obtained. For bounding boxes that partially extend beyond the image boundaries due to shrinkage and padding, the diversity of targets can be increased by introducing a real background image or a gray background image, thereby reducing the computational burden and improving the generalization ability of the target detection model in different background environments.

[0062] Furthermore, in the construction of the background image library, step P31 of this embodiment further includes:

[0063] P31-71: Cache the unlabeled target instances in the input training images into the background image library to build the background image library.

[0064] In one possible embodiment of this application, to ensure that the downsizing process can be applied and combined on a realistic scene background, the construction of the background image library is described in detail. Using naturally occurring targetless images from the training data as background sources, the background image library is constructed through automatic collection and caching to ensure the realism and task relevance of the background materials.

[0065] Specifically, when preprocessing each input image in the training set, the first step is to determine whether the image contains labeled target instances. When it is detected that an image does not contain any labeled targets, i.e., the number of target instances N=0, the image is considered a pure background image. Compared with artificially generated or regularized backgrounds, real backgrounds from the training data have advantages such as natural textures, diverse lighting, and realistic scene structures, which can significantly improve the semantic consistency of the enhanced image. Therefore, in this embodiment, such targetless images are directly cached in the background image library for background filling in subsequent downscaling mode.

[0066] To ensure the controllable size and efficiency of the background image library, this application allows setting a capacity limit for the background image library, such as 500 images. When the number of images in the library reaches the limit, a first-in-first-out (FIFO) or random replacement strategy can be used to update the old background images. This mechanism not only ensures the continuous diversity of background materials but also ensures the controllable use 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 realistic backgrounds for size reduction processing.

[0067] P40: After adjusting the annotations of the enhanced image, the target detection model is trained using the enhanced image and its corresponding annotation information.

[0068] Specifically, the enhanced images after geometric transformation are labeled and adjusted, and these enhanced images and their corresponding labeling information are used to train the object detection model to ensure that the generated enhanced images can be effectively used to improve the performance of the object detection model.

[0069] After scaling up or down the input image, the resulting augmented image requires annotation adjustments to ensure the annotation information is consistent with the content of the augmented image. For the scaled-up image, cropping may result in some target instances being cut off; therefore, the bounding box coordinates of the target instances need to be adjusted according to the cropped area, and target instances completely outside the cropped area need to be filtered out. For the scaled-down image, since the target instances are placed on the background image, the bounding box coordinates of the target instances need to be adjusted to the coordinate system of the filled image. These annotation adjustments ensure the accuracy of the annotation information in the augmented image, providing a reliable data foundation for subsequent model training.

[0070] After the annotation adjustments are completed, the enhanced images and their corresponding annotation information are used to train the object detection model. The enhanced images are generated using an adaptive scaling strategy, which better reflects the characteristics of the target at different scales, while dynamic background filling increases the diversity of the target. These characteristics allow the enhanced images to provide the model with richer learning samples during training, thereby improving the model's object detection capability and generalization performance. During training, the object detection model learns the feature representations of targets at different scales and in different background environments, thus improving the model's adaptability to various complex scenarios in real-world applications.

[0071] Ultimately, the target detection model trained with this augmented data is able to detect targets more accurately in various real-world scenarios, demonstrating 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. By using two enhancement paths, namely magnification-cropping and reduction-background filling, the target scale of the generated image is made to better match 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 are improved in the reduction mode. 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] This achieves the technical effect of improving the model's target detection performance by generating effective training samples through an adaptive scaling strategy based on the median proportion of the target area.

[0075] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. Additionally, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are 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 accompanying drawings are merely illustrative examples of this application and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from its scope. Therefore, if such modifications and variations fall within the scope of this application and its equivalents, this application intends to include such modifications and variations.

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.