Image recognition-based sample data generation method, device, equipment and medium

By adjusting the hue, saturation, and brightness of images, sample images adapted to the new environment are generated, solving the problem of insufficient training data in the new environment and achieving efficient training data acquisition and saving annotation costs.

CN115861691BActive Publication Date: 2026-07-24西安超越申泰信息科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
西安超越申泰信息科技有限公司
Filing Date
2022-11-25
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

In new environments, it is difficult to obtain training data that matches or is better than the samples, which makes it difficult for image recognition models to learn.

Method used

By acquiring multiple sample images of the first hue, adjusting the hue, saturation, and brightness of the images using probability distribution functions and inverse functions, a third sample image adapted to the new environment is generated, and a corresponding annotation file is generated.

Benefits of technology

Easily obtain training data that matches or is better than the samples in the new environment, increase the availability of sample images, and save time and cost of manual annotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115861691B_ABST
    Figure CN115861691B_ABST
Patent Text Reader

Abstract

A sample data generation method and device based on image recognition are disclosed, which comprises: obtaining a plurality of first sample images of a first color tone; obtaining a probability distribution function and an inverse function of the probability distribution function according to the plurality of first sample images and a plurality of second sample images of a standard color tone; obtaining a second color tone according to the standard color tone, the probability distribution function and the inverse function of the probability distribution function; and adjusting the plurality of second sample images according to the second color tone to obtain a plurality of third sample images. In the case of small sample size or difficult sample data collection, the sample images of the new environment are collected, and the original sample images are processed based on the sample images of the new environment to obtain sample images suitable for the new environment. The usability of the original sample images for the sample images of the new environment is increased, and the training data meeting or better than the sample can be easily obtained in the new environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and medium for generating sample data based on image recognition. Background Technology

[0002] Artificial intelligence (AI) technology involves learning from a large number of image samples to create an AI model. This model can then identify images with similar features. During image recognition, the model's perceptual mechanism needs to filter out redundant information and extract key details. The model's neural network also requires a large number of parameters, often millions, for training.

[0003] In practical applications, during the data collection process in new environments, some environments present challenges in collecting samples, making it difficult to find sufficient training data that matches or surpasses the existing samples. Therefore, how to obtain training data that matches or surpasses the existing samples in new environments is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] This invention proposes a method and apparatus for generating sample data based on image recognition, which can easily obtain training data that conforms to or is superior to the sample in a new environment.

[0005] To achieve the above objectives, one aspect of the present invention provides a method for generating sample data based on image recognition, comprising:

[0006] Obtain multiple first sample images of the first tone;

[0007] Based on multiple first sample images and multiple second sample images with standard tones, the probability distribution function and the inverse function of the probability distribution function are obtained.

[0008] The second hue is obtained based on the standard hue, the probability distribution function, and the inverse function of the probability distribution function;

[0009] Multiple second sample images are adjusted based on the second hue to obtain multiple third sample images.

[0010] In one specific implementable method, multiple second sample images are adjusted according to a second hue to obtain multiple third sample images, including:

[0011] Based on the second hue, the hue, saturation, and brightness of multiple second sample images are adjusted to obtain multiple third sample images.

[0012] In one specific implementable method, a probability distribution function and its inverse function are obtained based on multiple first sample images and multiple second sample images with standard tones, including:

[0013] By fitting multiple first sample images with multiple second sample images of standard color, a probability distribution function and its inverse function are obtained.

[0014] In one specific implementation, the expression for the probability distribution function is:

[0015] y new =F new (x)=∫f new (x)dx

[0016]

[0017] Where μ, π, and σ (σ>0) are constants; specifically, π is 3.14, μ is the mean, σ is the standard deviation, and x is the brightness value of the image. new and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue.

[0018] In one feasible implementation, the expression for the inverse function of the probability distribution function is:

[0019] x = F Λ (-1)(y)

[0020] Where x depends on y new =F new (x)=∫f new The result is obtained by dx of (x), y new, y and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue, where x is the hue.

[0021] In one specific implementable method, the second hue is obtained based on the standard hue, the probability distribution function, and the inverse function of the probability distribution function, including:

[0022] Based on the standard hue and the probability distribution function, the probability distribution value of the standard hue is obtained;

[0023] The second hue is obtained by using the probability distribution values ​​of the standard hue and the inverse function of the probability distribution function.

[0024] In some specific implementation methods, the approach also includes:

[0025] Generate annotation files corresponding to multiple third sample images.

[0026] In another aspect, the present invention provides an apparatus for generating sample data based on image recognition, the apparatus comprising an acquisition unit, a first acquisition unit, a second acquisition unit, and an adjustment unit.

[0027] The acquisition unit is used to acquire multiple first sample images of the first tone;

[0028] The first obtaining unit is used to obtain a probability distribution function and an inverse function of the probability distribution function based on multiple first sample images and multiple second sample images of standard tones.

[0029] The second obtaining unit is used to obtain the second hue based on the first hue, the probability distribution function, and the inverse function of the probability distribution function;

[0030] The adjustment unit is used to adjust multiple second sample images according to the second hue to obtain multiple third sample images.

[0031] In one specific implementable manner, the adjustment unit is used for:

[0032] Based on the second hue, the hue, saturation, and brightness of the plurality of second sample images are adjusted to obtain the plurality of third sample images.

[0033] In one specific implementable manner, the first obtaining unit is used for:

[0034] The plurality of first sample images are fitted with a plurality of second sample images of standard hue to obtain a probability distribution function and an inverse function of the probability distribution function.

[0035] In one specific implementation, the expression for the probability distribution function is:

[0036] y new =F new (x)=∫f new (x)dx

[0037]

[0038] Where μ, π, and σ (σ>0) are constants; specifically, π is 3.14, μ is the mean, σ is the standard deviation, and x is the brightness value of the image. new and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue. y old and F old (x) is the probability value of the standard hue, f old (x) is the normal distribution function of the standard hue.

[0039] In one specific implementation, the expression for the inverse function of the probability distribution function is:

[0040] x = F Λ (-1)(y)

[0041] Where x depends on y new =F new (x)=∫f new The result is obtained by dx of (x), y new, y and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue. y new and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue.

[0042] In one specific implementable manner, the second obtaining unit is used for:

[0043] Based on the standard hue and the probability distribution function, the probability distribution value of the standard hue is obtained;

[0044] The second hue is obtained based on the probability distribution value of the standard hue and the inverse function of the probability distribution function.

[0045] In some embodiments, the apparatus further includes: a generation unit, wherein,

[0046] The generation unit is used to generate annotation files corresponding to the plurality of third sample images.

[0047] In another aspect of the present invention, a computer device is provided, comprising: at least one processor; and a memory storing computer instructions executable on the processor, wherein the instructions, when executed by the processor, implement the steps of a method including:

[0048] In another aspect, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method steps.

[0049] The present invention has at least the following beneficial technical effects:

[0050] In this embodiment of the application, when the sample size is small or the sample data is difficult to collect, sample images of the new environment are collected, and the original sample images are processed based on the sample images of the new environment to obtain sample images adapted to the new environment. This increases the usability of the original sample images for sample images of the new environment, and training data that conforms to or is better than the samples can be easily obtained in the new environment.

[0051] In this embodiment, the sample image is derived and expanded to generate a new sample image and a corresponding annotation file, thus saving the time cost of manual annotation. Attached Figure Description

[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.

[0053] Figure 1 A flowchart illustrating a method for generating sample data based on image recognition, provided as an embodiment of the present invention;

[0054] Figure 2 A schematic diagram of a sample image of a new environment provided for embodiments of the present invention;

[0055] Figure 3 A tonal diagram of sample images of a new environment provided for embodiments of the present invention;

[0056] Figure 4 A schematic diagram of a sample image of an old environment provided for an embodiment of the present invention;

[0057] Figure 5 A tonal diagram of sample images of an old environment provided for embodiments of the present invention;

[0058] Figure 6 A schematic diagram of a sample data generation device based on image recognition provided for an embodiment of the present invention;

[0059] Figure 7 A schematic diagram of an embodiment of the computer device provided by the present invention;

[0060] Figure 8 A schematic diagram illustrating an embodiment of the computer-readable storage medium provided by the present invention. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to specific examples and the accompanying drawings.

[0062] It should be noted that all uses of "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two entities or parameters with the same name but different names. It is clear that "first" and "second" are only for the convenience of expression and should not be construed as limiting the embodiments of the present invention. Subsequent embodiments will not explain this in detail.

[0063] To achieve the above objectives, a first aspect of the present invention provides an embodiment of a method for generating sample data based on image recognition. Figure 1 The diagram shown is an embodiment of a method for generating sample data based on image recognition provided by the present invention. Figure 1 As shown in the embodiment of the present invention, a method for generating sample data based on image recognition includes the following execution entities:

[0064] S101. Obtain multiple first sample images of the first tone.

[0065] The first hue includes the first hue, the first saturation, and the first brightness.

[0066] Multiple first sample images of a first tone can be different images of a single tone acquired in a new environment. For example, such as Figure 2 The image shown is of the traffic lights at location A at the first moment. Correspondingly, as... Figure 3 As shown Figure 2 The image shown is a color tone diagram of the traffic light.

[0067] S102. Based on multiple first sample images and multiple second sample images with standard tones, obtain the probability distribution function and the inverse function of the probability distribution function.

[0068] Standard hue can include standard hue, standard saturation, and standard brightness.

[0069] Multiple second-sample images of a standard tone can be different images of a single tone acquired in an older environment. For example, such as... Figure 4 The image shown is of the traffic lights at location A at a second time. The second time differs from the first time. Correspondingly, as... Figure 5 As shown Figure 4 The image shown is a color tone diagram of the traffic light.

[0070] In one specific implementation, S102 can be implemented by fitting multiple first sample images to multiple second sample images with standard tones to obtain a probability distribution function and its inverse function. Specifically, a normal distribution function is used. By fitting the brightness distribution of multiple second sample images of the standard hue to multiple first sample images of the first hue, the normal distribution functions of the standard hue and the first hue are obtained, respectively. Their expressions can be:

[0071]

[0072]

[0073] Where μ, π, and σ (σ>0) are constants; specifically, π is 3.14, μ is the mean, σ is the standard deviation, and x is the brightness value of the image. new and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue; y old and F old (x) is the probability value of the standard hue, f old (x) is the normal distribution function of the standard hue.

[0074] Based on Formulas 1 and 2, the probability distribution functions for the standard hue and the first hue are obtained respectively, and their expressions can be:

[0075] y old =F old (x)=∫f old (x)dx (Formula 3)

[0076] y new =F new (x)=∫f new (x)dx (Formula 4)

[0077] Where μ, π, and σ (σ>0) are constants; specifically, π is 3.14, μ is the mean, σ is the standard deviation, and x is the brightness value of the image. new and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue; y old and F old (x) is the probability value of the standard hue, f old (x) is the normal distribution function of the standard hue.

[0078] Furthermore, according to Formula 4, the inverse function of the probability distribution function corresponding to the first hue can be obtained, and its expression can be:

[0079] x = F Λ (-1)(y)

[0080] Where x depends on y new =F new (x)=∫fnew The result is obtained by dx of (x), y new, y and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue, and x is the brightness value of the image.

[0081] S103. Based on the standard hue, probability distribution function, and inverse function of probability distribution function, the second hue is obtained.

[0082] In one specific implementation, S103 can be as follows: Obtain the probability distribution value of the standard hue based on the standard hue and the probability distribution function; obtain the second hue based on the probability distribution value of the standard hue and the inverse function of the probability distribution function. Specifically, the brightness value of the standard brightness in the standard hue is input into the probability distribution function of the standard hue to obtain the probability distribution value of the standard hue; this probability distribution value is then input into the inverse function of the probability distribution function of the first hue to obtain the second hue, which is the second brightness value of the first hue.

[0083] For example, will Figure 4 The brightness value V1 of the sample image is input into the probability distribution function y of the standard hue. old =F old (x)=∫f old dx(x) yields the probability distribution value y of the brightness value V1. The probability distribution value y is then input into the inverse function x = F of the probability distribution function of the first hue. Λ (-1)(y) yields the brightness value V2 of the first hue.

[0084] S104. Adjust multiple second sample images according to the second tone to obtain multiple third sample images.

[0085] In one specific implementation, S104 can be: adjusting the hue, saturation, and brightness of multiple second sample images based on the second hue to obtain multiple third sample images. For example, following the above example, multiple second sample images of the standard hue are adjusted based on the brightness value V2 of the obtained first hue, that is, the standard hue, standard saturation, and standard brightness of the standard hue are adjusted sequentially to generate a new image, i.e., the third sample image.

[0086] In this embodiment of the application, when the sample size is small or the sample data is difficult to collect, sample images of the new environment are collected, and the original sample images are processed based on the sample images of the new environment to obtain sample images adapted to the new environment. This increases the usability of the original sample images for sample images of the new environment, and training data that conforms to or is better than the samples can be easily obtained in the new environment.

[0087] In some specific implementations, the method further includes: S105, generating annotation files corresponding to multiple third sample images. That is, while executing S104, multiple annotation files corresponding to third sample images are generated. This effectively saves the time cost of manual annotation.

[0088] To achieve the above objectives, a second aspect of the present invention provides an apparatus for generating sample data based on image recognition, such as... Figure 6 As shown, the device 600 may include an acquisition unit 601, a first acquisition unit 602, a second acquisition unit 603, and an adjustment unit 604. Among them,

[0089] The acquisition unit 601 is used to acquire multiple first sample images of the first tone;

[0090] The first obtaining unit 602 is used to obtain a probability distribution function and an inverse function of the probability distribution function based on multiple first sample images and multiple second sample images of standard color.

[0091] The second obtaining unit 603 is used to obtain the second hue based on the first hue, the probability distribution function, and the inverse function of the probability distribution function;

[0092] The adjustment unit 604 is used to adjust multiple second sample images according to the second tone to obtain multiple third sample images.

[0093] In this embodiment of the application, when the sample size is small or the sample data is difficult to collect, sample images of the new environment are collected, and the original sample images are processed based on the sample images of the new environment to obtain sample images adapted to the new environment. This increases the usability of the original sample images for sample images of the new environment, and training data that conforms to or is better than the samples can be easily obtained in the new environment.

[0094] In one specific implementation, the adjustment unit 604 is used to:

[0095] Based on the second hue, the hue, saturation, and brightness of the plurality of second sample images are adjusted to obtain the plurality of third sample images.

[0096] In one specific implementation, the first obtaining unit 602 is used for:

[0097] The plurality of first sample images are fitted with a plurality of second sample images of standard hue to obtain a probability distribution function and an inverse function of the probability distribution function.

[0098] In one specific implementation, the expression for the probability distribution function is:

[0099] y new=F new (x)=∫f new (x)dx

[0100]

[0101] Where μ and σ (σ>0) are constants. Specifically, π is 3.14, μ is the mean, σ is the standard deviation, and x is the image brightness value. new and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue.

[0102] In one specific implementation, the expression for the inverse function of the probability distribution function is:

[0103] x = F Λ (-1)(y)

[0104] Where x depends on y new =F new (x)=∫f new The value is obtained by dx(x). Specifically, π is 3.14, μ is the mean, σ is the standard deviation, and x is the brightness value of the image.

[0105] In one specific implementation, the second obtaining unit 603 is used for:

[0106] Based on the standard hue and the probability distribution function, the probability distribution value of the standard hue is obtained;

[0107] The second hue is obtained based on the probability distribution value of the standard hue and the inverse function of the probability distribution function.

[0108] In some embodiments, the apparatus 600 further includes: a generation unit 605, wherein,

[0109] The generation unit 605 is used to generate annotation files corresponding to the plurality of third sample images.

[0110] In this embodiment, the sample image is derived and expanded to generate a new sample image and a corresponding annotation file, thus saving the time cost of manual annotation.

[0111] Computer equipment. Figure 7 The diagram shown is a schematic representation of an embodiment of the computer device provided by the present invention. Figure 7 As shown, the computer device in this embodiment of the invention performs the above method.

[0112] The present invention also provides a computer-readable storage medium. Figure 8The diagram shown is a schematic representation of an embodiment of the computer-readable storage medium provided by the present invention. Figure 8 As shown, computer-readable storage medium 031 stores a computer program 032 that, when executed by a processor, performs the methods described above.

[0113] Finally, it should be noted that those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The storage medium for the program can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. The above computer program embodiments can achieve the same or similar effects as any of the corresponding foregoing method embodiments.

[0114] The above are exemplary embodiments disclosed in this invention. However, it should be noted that various changes and modifications can be made without departing from the scope of the embodiments of this invention as defined by the claims. The functions, steps, and / or actions of the methods according to the disclosed embodiments described herein do not need to be performed in any particular order. Furthermore, although the elements disclosed in the embodiments of this invention may be described or claimed individually, they may be understood as multiple unless explicitly limited to a singular number.

[0115] It should be understood that, as used herein, the singular form “a” is intended to include the plural form as well, unless the context clearly supports an exception. It should also be understood that, as used herein, “and / or” refers to any and all possible combinations of one or more of the associated listed items.

[0116] The embodiment numbers disclosed in the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0117] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a hard disk, or an optical disk.

[0118] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples. Within the framework of the invention, technical features of the above embodiments or different embodiments can be combined, and many other variations of different aspects of the invention exist, which are not provided in the details for the sake of brevity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.

Claims

1. A method for generating sample data based on image recognition, characterized in that, The method includes: Obtain multiple first sample images of the first tone; Based on the plurality of first sample images and the plurality of second sample images with standard tones, a probability distribution function and an inverse function of the probability distribution function are obtained, wherein the expression of the probability distribution function is: Where μ, π, and σ are constants, σ ​​> 0, and x is the brightness value of the image; y new and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue; The expression for the inverse function of the probability distribution function is: Where x is based on The result is y new, y and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue, and x is the brightness value of the image; Obtaining a second hue based on the standard hue, the probability distribution function, and the inverse function of the probability distribution function includes: obtaining the probability distribution value of the standard hue based on the standard hue and the probability distribution function; and obtaining the second hue based on the probability distribution value of the standard hue and the inverse function of the probability distribution function. Adjusting the multiple second sample images according to the second hue yields multiple third sample images; Generate annotation files corresponding to the multiple third sample images.

2. The method according to claim 1, characterized in that, The step of adjusting the plurality of second sample images according to the second hue to obtain a plurality of third sample images includes: Based on the second hue, the hue, saturation, and brightness of the plurality of second sample images are adjusted to obtain the plurality of third sample images.

3. The method according to claim 1, characterized in that, The step of obtaining a probability distribution function and its inverse function based on the plurality of first sample images and the plurality of second sample images with standard tones includes: The plurality of first sample images are fitted with a plurality of second sample images of standard hue to obtain a probability distribution function and an inverse function of the probability distribution function.

4. A device for generating sample data based on image recognition, characterized in that, include: The unit comprises an acquisition unit, a first acquisition unit, a second acquisition unit, and an adjustment unit, wherein, The acquisition unit is used to acquire multiple first sample images of a first tone; The first obtaining unit is used to obtain a probability distribution function and an inverse function of the probability distribution function based on the plurality of first sample images and the plurality of second sample images of standard hues; The second obtaining unit is used to obtain a second hue based on the first hue, the probability distribution function, and the inverse function of the probability distribution function; The adjustment unit is used to adjust the plurality of second sample images according to the second hue to obtain a plurality of third sample images; The expression for the probability distribution function is: Where μ, π, and σ are constants, σ ​​> 0, and x is the brightness value of the image; y new and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue; The expression for the inverse function of the probability distribution function is: Where x is based on The result is y new, y and F new (x) is the probability value of the first hue, f new (x) is the normal distribution function of the first hue, and x is the brightness value of the image; The second obtaining unit is further configured to: obtain the probability distribution value of the standard hue based on the standard hue and the probability distribution function; and obtain the second hue based on the probability distribution value of the standard hue and the inverse function of the probability distribution function. And a unit for performing the following function: generating annotation files corresponding to the plurality of third sample images.

5. A computer device, characterized in that, include: At least one processor; as well as A memory storing computer instructions executable on the processor, which, when executed by the processor, implement the steps of the method according to any one of claims 1-3.

6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-3.