Training method for accelerating visual identification positioning algorithm
By transforming the original image to generate sample images, using the visual recognition positioning algorithm to judge the accuracy, the problem of inaccurate recognition caused by changes in position and light source in traditional methods is solved, and the fast and simple visual recognition positioning algorithm training is achieved, which improves the Development efficiency.
Patent Information
- Application Number
- CN202411314801.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the development of visual algorithms, traditional methods require manual placement of the object to be measured multiple times to create different panels, resulting in changes in camera parameters and lighting, resulting in inaccurate identification, affecting development progress, and increasing investment costs.
By manually labeling with an original image, and rotating and mirroring the center point of the image and the center point of the object to be measured, multiple sample images are generated, and these images are recognized using the visual recognition positioning algorithm, and the recognition results are compared Judge the accuracy of the algorithm.
It realizes the use of only one original image to provide a large number of samples, shield position and light source changes, quickly judge the accuracy of the visual recognition positioning algorithm, save developers time, improve test efficiency and shorten development cycles.
Smart Images

Figure CN119169252A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of visual algorithm development, and more specifically, to a training method for accelerating a visual recognition and positioning algorithm. Background Art
[0002] At present, in the development of visual algorithms, after completing the algorithm testing phase, it is necessary to manually place the object to be tested multiple times to create different samples. In order to create a large number of samples, personnel have to frequently place the object to be tested, and even use a vibration table to create slight vibrations to move the object to be tested, which increases the investment cost. However, in visual recognition, camera parameters and lighting are variables. After the object to be tested is moved, the lighting angle changes, resulting in inaccurate recognition. It is necessary to manually re-adjust the lighting parameters or camera parameters to match the current state. The variables cannot be kept constant, which may cause developers to misjudge and make major adjustments to the positioning and recognition module, affecting the development progress. Summary of the invention
[0003] In response to the defects and shortcomings in the prior art, the present invention provides a method for accelerating the training of visual recognition and positioning algorithms. It uses only one original image to provide a large number of samples, which can shield variables such as light source changes and product shape changes caused by position changes in traditional training. It can quickly obtain the results of whether the visual recognition and positioning algorithm is accurate, saving developers' time.
[0004] In order to solve the above problems, the present invention provides a method for accelerating the training of a visual recognition positioning algorithm, comprising the following steps: Step S1: obtaining an original sample image containing the object to be measured, manually marking the shape of the object to be measured in the original sample image, and inputting the actual number of the object to be measured in the original sample image; Step S2: performing a first round of transformation on the original sample image according to the coordinates of the center point of the original sample image to obtain a plurality of sample images after the first round of transformation, and taking the original sample image and the plurality of sample images after the first round of transformation as a first group of sample images; Step S3: using the visual recognition and positioning algorithm to identify the object to be tested in each sample image in the first group of sample images, and saving the number of identified objects to be tested in each sample image in the first group of sample images, and then calculating the center point coordinates of the object to be tested in the original sample image according to the object to be tested recognition result of the original sample image; Step S4: performing a second round of transformation on the original sample image according to the coordinates of the center point of the object to be measured in the original sample image to obtain a plurality of sample images after the second round of transformation, and using the original sample image and the plurality of sample images after the second round of transformation as a second group of sample images; Step S5: identifying the object to be tested for each sample image in the second group of sample images by using the visual recognition and positioning algorithm, and saving the number of identified objects to be tested in each sample image in the second group of sample images; Step S6: Compare the number of identified objects in each sample image in the first group of sample images and the number of identified objects in each sample image in the second group of sample images with the actual number of objects in the original sample images, and determine whether the visual recognition and positioning algorithm is running accurately based on the comparison results.
[0005] Further, the performing a first round of transformation on the original sample image according to the center point coordinates of the original sample image to obtain a plurality of sample images after the first round of transformation, and using the original sample image and the plurality of sample images after the first round of transformation as a first group of sample images, further includes: The original sample image is rotated 180° with its center point coordinate as the rotation point to obtain a first sample image after the first round of transformation; After mirroring the original sample image, a second sample image after the first round of transformation is obtained; The second sample image after the first round of transformation is rotated 180° with its center point coordinate as the rotation point to obtain a third sample image after the first round of transformation; The original sample image, the first sample image after the first round of transformation, the second sample image after the first round of transformation, and the third sample image after the first round of transformation are taken as the first group of sample images.
[0006] Further, the method further comprises: performing a second round of transformation on the original sample image according to the coordinates of the center point of the object to be measured in the original sample image to obtain a plurality of sample images after the second round of transformation, and using the original sample image and the plurality of sample images after the second round of transformation as the second group of sample images; The original sample image is rotated 180° with the center point coordinates of the object being measured as the rotation point to obtain the first sample image after the second round of transformation; After mirroring the original sample image, a second sample image after a second round of transformation is obtained; The second sample image after the second round of transformation is rotated 180° with the center point coordinates of the measured object as the rotation point to obtain a third sample image after the second round of transformation; The original sample image, the first sample image after the second round of transformation, the second sample image after the second round of transformation, and the third sample image after the second round of transformation are taken as the second group of sample images.
[0007] Furthermore, the step of comparing the number of objects to be detected in each sample image in the first group of sample images and the number of objects to be detected in each sample image in the second group of sample images with the actual number of objects to be detected in the original sample images, and judging whether the visual recognition and positioning algorithm is running accurately according to the comparison results, further includes: The number of objects to be detected in each sample image is set to x, and the actual number of objects to be detected in the original sample image is set to y; When xy≠0, the output comparison result is 1, indicating that the sample image is not accurately recognized; when xy=0, the output comparison result is 0, indicating that the sample image is accurately recognized; The ratio of the number of accurately identified sample images to the total number of sample images is calculated. When the ratio is higher than a preset value, it is considered that the visual recognition and positioning algorithm is running accurately. Otherwise, it is considered that the visual recognition and positioning algorithm is running inaccurately.
[0008] Furthermore, the obtaining of an original sample image containing the object under test further includes: Place the object to be measured within the shooting range of the image acquisition device, adjust the light source and exposure of the image acquisition device, and use the camera of the image acquisition device to capture an original sample image containing the object to be measured.
[0009] The method for accelerating the training of the visual recognition and positioning algorithm provided by the present invention has the following advantages: only one original image is used to provide a large number of samples, which can shield variables such as light source changes and product shape changes caused by position changes in traditional training, and can quickly obtain the results of whether the visual recognition and positioning algorithm is accurate. The algorithm process is simple, which saves time for manually making samples, thereby improving test efficiency and shortening the development cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention, but do not constitute a limitation of the present invention.
[0011] Figure 1 A schematic flow chart of a method for accelerating the training of a visual recognition and positioning algorithm provided by the present invention.
[0012] Figure 2 A schematic diagram of an original sample image with the rotation point provided by the present invention being the image center.
[0013] Figure 3 The present invention provides Figure 2 Schematic diagram of the image after rotating 180° with the image center as the rotation point.
[0014] Figure 4 The present invention provides Figure 2Schematic diagram of the mirror image of .
[0015] Figure 5 The present invention provides Figure 4 Schematic diagram of the image after rotating 180° with the image center as the rotation point.
[0016] Figure 6 A schematic diagram of an original sample image with the rotation point provided by the present invention being the center of the object under test.
[0017] Figure 7 The present invention provides Figure 6 Schematic diagram of the image after rotating 180° with the center of the object being measured as the rotation point.
[0018] Figure 8 The present invention provides Figure 6 Schematic diagram of the mirror image of .
[0019] Fig. 9 The present invention provides Figure 8 Schematic diagram of the image after rotating 180° with the center of the object being measured as the rotation point.
[0020] Fig.10 This is a schematic structural diagram of the image acquisition device provided by the present invention. DETAILED DESCRIPTION
[0021] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation method, structure, characteristics and effects of the training method for accelerating the visual recognition positioning algorithm proposed by the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] In this embodiment, a method for accelerating the training of a visual recognition positioning algorithm is provided, such as Figure 1 As shown, the training method for accelerating the visual recognition positioning algorithm includes the following steps: Step S1: obtaining an original sample image containing the object to be measured, manually marking the shape of the object to be measured in the original sample image, and inputting the actual number of the object to be measured in the original sample image; Preferably, if Fig.10 As shown, the obtaining of an original sample image containing the object under test also includes: Place the object to be measured within the shooting range of the image acquisition device, adjust the light source and exposure of the image acquisition device, and use the camera of the image acquisition device to capture an original sample image containing the object to be measured.
[0023] Step S2: performing a first round of transformation on the original sample image according to the coordinates of the center point of the original sample image to obtain a plurality of sample images after the first round of transformation, and taking the original sample image and the plurality of sample images after the first round of transformation as a first group of sample images; Preferably, performing a first round of transformation on the original sample image according to the coordinates of the center point of the original sample image to obtain a plurality of sample images after the first round of transformation, and using the original sample image and the plurality of sample images after the first round of transformation as a first group of sample images, further comprises: Will be like Figure 2 The original sample image shown in FIG. 1 is rotated 180° with its center point coordinate as the rotation point to obtain the following Figure 3 The first sample image after the first round of transformation is shown; Will be like Figure 2 After the original sample image shown in FIG. 1 is mirrored, the image is obtained as follows: Figure 4 The second sample image after the first round of transformation is shown; Will be like Figure 4 After the second sample image after the first round of transformation is rotated 180° with its center point coordinate as the rotation point, the following is obtained: Figure 5 The third sample image after the first round of transformation is shown; The original sample image, the first sample image after the first round of transformation, the second sample image after the first round of transformation, and the third sample image after the first round of transformation are taken as the first group of sample images.
[0024] Step S3: using the visual recognition and positioning algorithm to identify the object to be tested in each sample image in the first group of sample images, and saving the number of identified objects to be tested in each sample image in the first group of sample images, and then calculating the center point coordinates of the object to be tested in the original sample image according to the object to be tested recognition result of the original sample image; Step S4: performing a second round of transformation on the original sample image according to the coordinates of the center point of the object to be measured in the original sample image to obtain a plurality of sample images after the second round of transformation, and using the original sample image and the plurality of sample images after the second round of transformation as a second group of sample images; Preferably, the step of performing a second round of transformation on the original sample image according to the coordinates of the center point of the object to be measured in the original sample image to obtain a plurality of sample images after the second round of transformation, and using the original sample image and the plurality of sample images after the second round of transformation as the second group of sample images, further comprises: Will be like Figure 6 The original sample image shown in FIG. 1 is rotated 180° with the center coordinate of the object being measured as the rotation point to obtain the following Figure 7 The first sample image after the second round of transformation is shown; Will be like Figure 6 After the original sample image shown in FIG. 1 is mirrored, the image is obtained as follows: Figure 8 The second sample image after the second round of transformation is shown; Will be like Figure 8 The second sample image after the second round of transformation shown in FIG. 1 is rotated 180° with the center point coordinates of the object being measured as the rotation point to obtain the following: Fig. 9 The third sample image after the second round of transformation is shown; The original sample image, the first sample image after the second round of transformation, the second sample image after the second round of transformation, and the third sample image after the second round of transformation are taken as the second group of sample images.
[0025] Step S5: identifying the object to be tested for each sample image in the second group of sample images by using the visual recognition and positioning algorithm, and saving the number of identified objects to be tested in each sample image in the second group of sample images; Step S6: Compare the number of identified objects in each sample image in the first group of sample images and the number of identified objects in each sample image in the second group of sample images with the actual number of objects in the original sample images, and determine whether the visual recognition and positioning algorithm is running accurately based on the comparison results.
[0026] Preferably, the step of comparing the number of objects to be detected in each sample image in the first group of sample images and the number of objects to be detected in each sample image in the second group of sample images with the actual number of objects to be detected in the original sample images, and judging whether the visual recognition and positioning algorithm operates accurately according to the comparison results, further comprises: The number of objects to be detected in each sample image is set to x, and the actual number of objects to be detected in the original sample image is set to y; When xy≠0, the output comparison result is 1, indicating that the sample image is not accurately recognized; when xy=0, the output comparison result is 0, indicating that the sample image is accurately recognized; The ratio of the number of accurately identified sample images to the total number of sample images is calculated. When the ratio is higher than a preset value, it is considered that the visual recognition and positioning algorithm is running accurately. Otherwise, it is considered that the visual recognition and positioning algorithm is running inaccurately.
[0027] For example, there are 4 sample images in the first group of sample images and 4 sample images in the second group of sample images, so the total number of sample images is 8, the number of objects to be measured in 3 sample images in the first group of sample images is accurately identified, and the number of objects to be measured in 4 sample images in the second group of sample images is accurately identified, then there are a total of 7 sample images with accurate identification of the number of objects to be measured, 7 / 8=87.5%, which is less than the preset value of 99.5%, and it is considered that the visual recognition and positioning algorithm is not running accurately.
[0028] The method for accelerating the training of a visual recognition and positioning algorithm provided by the present invention uses only one original image to provide a large number of samples, which can shield variables such as light source changes and product shape changes caused by position changes in traditional training, and can quickly obtain the results of whether the visual recognition and positioning algorithm is accurate. The algorithm flow is simple and saves time for manually making samples, thereby improving test efficiency and shortening the development cycle.
[0029] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A training method to speed up visual recognition and positioning algorithms. It is characterized in that The following steps are involved: Step S1: obtaining an original sample image containing the object to be measured, manually marking the shape of the object to be measured in the original sample image, and inputting the actual number of the object to be measured in the original sample image; Step S2: performing a first round of transformation on the original sample image according to the coordinates of the center point of the original sample image to obtain a plurality of sample images after the first round of transformation, and taking the original sample image and the plurality of sample images after the first round of transformation as a first group of sample images; Step S3: using the visual recognition and positioning algorithm to identify the object to be tested in each sample image in the first group of sample images, and saving the number of identified objects to be tested in each sample image in the first group of sample images, and then calculating the center point coordinates of the object to be tested in the original sample image according to the object to be tested recognition result of the original sample image; Step S4: performing a second round of transformation on the original sample image according to the coordinates of the center point of the object to be measured in the original sample image to obtain a plurality of sample images after the second round of transformation, and using the original sample image and the plurality of sample images after the second round of transformation as a second group of sample images; Step S5: identifying the object to be tested for each sample image in the second group of sample images by using the visual recognition and positioning algorithm, and saving the number of identified objects to be tested in each sample image in the second group of sample images; Step S6: Compare the number of identified objects in each sample image in the first group of sample images and the number of identified objects in each sample image in the second group of sample images with the actual number of objects in the original sample images, and determine whether the visual recognition and positioning algorithm is running accurately based on the comparison results.
2. The method for training a visual recognition positioning algorithm according to claim 1, It is characterized in that The method further comprises: performing a first round of transformation on the original sample image according to the coordinates of the center point of the original sample image to obtain a plurality of sample images after the first round of transformation, and using the original sample image and the plurality of sample images after the first round of transformation as a first group of sample images, further comprising: The original sample image is rotated 180° with its center point coordinate as the rotation point to obtain a first sample image after the first round of transformation; After mirroring the original sample image, a second sample image after the first round of transformation is obtained; The second sample image after the first round of transformation is rotated 180° with its center point coordinate as the rotation point to obtain a third sample image after the first round of transformation; The original sample image, the first sample image after the first round of transformation, the second sample image after the first round of transformation, and the third sample image after the first round of transformation are taken as the first group of sample images.
3. The method for training a visual recognition positioning algorithm according to claim 1, It is characterized in that The method further comprises: performing a second round of transformation on the original sample image according to the coordinates of the center point of the object to be measured in the original sample image to obtain a plurality of sample images after the second round of transformation, and using the original sample image and the plurality of sample images after the second round of transformation as a second group of sample images; The original sample image is rotated 180° with the center point coordinates of the object being measured as the rotation point to obtain the first sample image after the second round of transformation; After mirroring the original sample image, a second sample image after a second round of transformation is obtained; The second sample image after the second round of transformation is rotated 180° with the center point coordinates of the measured object as the rotation point to obtain a third sample image after the second round of transformation; The original sample image, the first sample image after the second round of transformation, the second sample image after the second round of transformation, and the third sample image after the second round of transformation are taken as the second group of sample images.
4. The method for training a visual recognition positioning algorithm according to claim 1, It is characterized in that The step of comparing the number of objects to be detected in each sample image in the first group of sample images and the number of objects to be detected in each sample image in the second group of sample images with the actual number of objects to be detected in the original sample images, and judging whether the visual recognition and positioning algorithm is running accurately according to the comparison results, further includes: The number of objects to be detected in each sample image is set to x, and the actual number of objects to be detected in the original sample image is set to y; When xy≠0, the output comparison result is 1, indicating that the sample image is not accurately recognized; when xy=0, the output comparison result is 0, indicating that the sample image is accurately recognized; The ratio of the number of accurately identified sample images to the total number of sample images is calculated. When the ratio is higher than a preset value, it is considered that the visual recognition and positioning algorithm is running accurately. Otherwise, it is considered that the visual recognition and positioning algorithm is running inaccurately.
5. The method for training a visual recognition positioning algorithm according to claim 1, It is characterized in that The step of obtaining an original sample image containing the object to be measured further includes: Place the object to be measured within the shooting range of the image acquisition device, adjust the light source and exposure of the image acquisition device, and use the camera of the image acquisition device to capture an original sample image containing the object to be measured.
Citation Information
Patent Citations
Method and device for rotating screen of video terminal
CN103901901A
Image classification method
CN107862344A
Semantic segmentation image sample expansion method and device and electronic equipment
CN113989592A
Image recognition method and device, electronic equipment and readable storage medium
CN115050001A
