A parking space training sample generation method

By automatically generating parking space training samples, the problem of high cost of parking space training data collection and annotation in existing technologies is solved, achieving efficient data generation and improved deep learning training results.

CN115439717BActive Publication Date: 2026-07-21FORYOU GENERAL ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
FORYOU GENERAL ELECTRONICS
Filing Date
2022-09-24
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies have high costs for collecting and labeling training data for parking spaces, and are difficult to meet the requirements of scene diversity and data quantity, especially for uncommon parking space types such as solid line angled T parking spaces, which cannot effectively generate a large amount of labeled data.

Method used

By creating a single-sided T-shaped parking space line with labeled information, rotating it to form a single-sided oblique T-shaped parking space line with different orientations and angles, and combining them on a black background image to generate oblique T-shaped parking spaces, the foreground parking space image and the background image are synthesized to automatically generate parking space training samples.

Benefits of technology

It enables the automatic generation of parking space training samples, reduces manual annotation, improves the training effect of deep learning, and meets the needs of data volume and scenario diversity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115439717B_ABST
    Figure CN115439717B_ABST
Patent Text Reader

Abstract

The application provides a parking space training sample generation method, comprising the following steps: step 1, a single-side T-shaped parking line with labeled information is made according to a first preset rule; step 2, a long side of the initial single-side T-shaped parking line is rotated according to a second preset rule to form single-side inclined T-shaped parking lines with different orientations and angles; step 3, the single-side inclined T-shaped parking lines are combined on a black background picture according to a third preset rule to generate a second preset number of inclined T-shaped parking spaces, and a foreground parking space picture is obtained; and step 4, the foreground parking space picture is combined with a background picture to generate a parking space training sample. The application realizes automatic generation of the parking space training sample and improves the training effect of deep learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine learning technology, and in particular to a method for generating training samples for parking spaces. Background Technology

[0002] Currently, deep learning methods have been widely applied in parking space recognition technology, achieving good results. Deep learning networks can automatically discover hidden features in data, but they must be trained using a large amount of data; the more complex the deep learning network, the more prominent the role of data becomes. To ensure the model's recognition accuracy and generalization ability, the required amount of labeled data is generally in the hundreds of thousands or even millions.

[0003] In current technologies, parking space training data is still collected from actual vehicles in real-world locations. When collecting raw data, numerous factors need to be considered, including weather, location, and parking space type, while ensuring a sufficient quantity of data collected. Furthermore, for some uncommon parking space types, such as solid-line angled T-shaped parking spaces, it is difficult to find actual examples in different locations, thus failing to meet the requirements for scene diversity and data volume. Moreover, after initial image processing, the collected raw data requires manual labeling of parking spaces in the images according to specific rules. When dealing with millions of data points, both data collection and labeling require significant time, manpower, and material resources, and cannot cope with changes in labeling requirements. Summary of the Invention

[0004] This invention provides a method for generating parking space training samples, aiming to overcome the shortcomings of existing technologies, realize the automatic generation of parking space training samples, and improve the training effect of deep learning.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0006] This invention provides a method for generating training samples for parking spaces, comprising:

[0007] Step 1: Create a single-sided T-shaped parking space line with labeled information according to the first preset rule.

[0008] Step 2: Rotate the long side of the initial single-sided T-shaped parking space line according to the second preset rule to form single-sided oblique T-shaped parking space lines with different orientations and angles;

[0009] Step 3: Combine the single-sided oblique T-shaped parking space lines on the black background according to the third preset rule to generate a second preset number of oblique T-shaped parking spaces, and obtain the foreground parking space image;

[0010] Step 4: Combine the foreground parking space image with the background image to generate parking space training samples.

[0011] Specifically, step 1 includes:

[0012] Step 101: Read the original T-shaped parking space image and extract the long side and short side of the T-shaped parking space from the original T-shaped parking space image;

[0013] Step 102: On a black background, recombine the long and short sides to form an initial single-sided T-shaped parking space line, wherein the long side of the initial single-sided T-shaped parking space line intersects with the edge of the black background.

[0014] Step 103: Establish an image coordinate system with the upper left corner of the black background image as the origin, downward as the positive vertical axis, and right as the positive horizontal axis.

[0015] Step 104: Use the annotation tool to determine the first preset number of parking space line annotation points on the initial single-sided T-shaped parking space line.

[0016] Specifically, the annotation information is saved as a JSON file.

[0017] Specifically, step 2 includes:

[0018] The long side of the initial single-sided T-shaped parking line is rotated clockwise around the first intersection point by a preset angle, and the short side of the initial single-sided T-shaped parking line is translated so that the midpoint of the short side coincides with the original endpoint of the long side, thereby generating a downward-sloping single-sided oblique T-shaped parking line.

[0019] The long side of the initial single-sided T-shaped parking line is rotated counterclockwise by a preset angle around the second intersection point, and then the short side of the initial single-sided T-shaped parking line is translated so that the midpoint of the short side coincides with the original endpoint of the long side, thereby generating an upward-sloping single-sided oblique T-shaped parking line.

[0020] Specifically, step 3 includes:

[0021] Step 301: Set the range of the longitudinal coordinates of the single-sided inclined T-shaped parking space line;

[0022] Step 302: Set the length range and width range of the inclined side of the T-shaped parking space;

[0023] Step 303: Set the arrangement mode and copy mode of the angled T-shaped parking spaces;

[0024] Step 304: Determine the initial parameters for parking space generation in a random manner, read the arrangement mode and copy mode, calculate the maximum number of parking spaces, and determine the second preset number based on the maximum number of parking spaces. The initial parameters for parking space generation include the longitudinal coordinate of the single-sided inclined T-shaped parking space line, the length and width of the inclined side of the inclined T-shaped parking space.

[0025] Step 305: Generate a second preset number of angled T-shaped parking spaces according to the third preset rule to obtain a foreground parking space image;

[0026] Step 306: Calculate and combine the coordinates of the marking points on the two long sides of each angled T-parking space, and save them as the marking point information of the angled T-parking space.

[0027] Specifically, step 301 includes:

[0028] If the single-sided inclined T-shaped parking line is an upward-sloping single-sided inclined T-shaped parking line, then the intersection of the long side and the short side of the single-sided inclined T-shaped parking line is determined as the longitudinal coordinate of the single-sided inclined T-shaped parking line.

[0029] If the single-sided oblique T-shaped parking line is a downward-sloping single-sided oblique T-shaped parking line, then the intersection of the long side of the single-sided oblique T-shaped parking line and the edge of the black background map is determined as the longitudinal coordinate of the single-sided oblique T-shaped parking line.

[0030] Specifically, step 305 includes:

[0031] Step 305a: Based on the longitudinal coordinates of the single-sided inclined T-shaped parking line, translate and copy the single-sided inclined T-shaped parking line to a preset position in the longitudinal direction.

[0032] Step 305b: Divide the length of the inclined side of the inclined T-shaped parking space with the length of the long side of the initial single-sided T-shaped parking space line to determine the translation amount of the single-sided inclined T-shaped parking space line in the horizontal axis direction;

[0033] Step 305c: Based on the width of the inclined side of the inclined T-parking space and the angle of the single-sided inclined T-parking space line, determine the distance of the single-sided inclined T-parking space line to be copied and translated in the longitudinal direction according to a preset formula.

[0034] Specifically, the preset formula is:

[0035]

[0036] Where offsetd represents the distance of copy translation, d represents the width of the hypotenuse of the T-shaped parking space, and θ represents the angle of the single-sided T-shaped parking space line.

[0037] Specifically, step 4 includes: replacing the pixel value at the corresponding position in the background image with the pixel value of the parking line position in the foreground parking space image.

[0038] Specifically, the black background image has a size of 640×640 pixels, and the initial single-sided T-shaped parking space line has a long side length of 300 pixels and a short side length of 254 pixels.

[0039] The beneficial effects of this invention are as follows: This invention improves the production of single-sided T-shaped parking space lines with annotation information, thereby forming single-sided oblique T-shaped parking space lines with different orientations and angles. The single-sided oblique T-shaped parking space lines are combined on a black background to generate oblique T-shaped parking spaces, resulting in a foreground parking space image. Then, the foreground parking space image is combined with the background image to generate parking space training samples. Thus, the final parking space training samples depend only on the number of background images, saving a lot of manual annotation operations, realizing the automatic generation of parking space training samples, and improving the training effect of deep learning. Attached Figure Description

[0040] Figure 1 This is a flowchart illustrating the parking space training sample generation method of the present invention;

[0041] Figure 2 This is a schematic diagram of a single-sided T-shaped parking space line according to the present invention;

[0042] Figure 3 This is a schematic diagram of the single-sided oblique T-shaped parking space line of the present invention;

[0043] Figure 4 This is a schematic diagram of the angled T-shaped parking space of the present invention;

[0044] Figure 5 This is a schematic diagram of the parking space training sample of the present invention. Detailed Implementation

[0045] The embodiments of the present invention are described in detail below with reference to the accompanying drawings. The drawings are for reference and illustration only and do not constitute a limitation on the scope of protection of the present invention.

[0046] In the process described in the specification, claims, or drawings of this invention, each step is numbered (e.g., step 10, 20, etc.). These numbers are used only to distinguish the steps and do not represent any execution order. It should be noted that the terms "first," "second," etc., used herein are only for distinguishing the objects being described and do not represent a chronological order, nor do they indicate that "first," "second," etc., are different types.

[0047] like Figure 1 As shown, this embodiment provides a method for generating parking space training samples, including:

[0048] Step 1: Create a single-sided T-shaped parking space line with labeled information according to the first preset rule.

[0049] In this embodiment, step 1 includes:

[0050] Step 101: Read the original T-shaped parking space image and extract the long side and short side of the T-shaped parking space from the original T-shaped parking space image.

[0051] Step 102: On a black background, recombine the long and short sides to form an initial single-sided T-shaped parking space line, wherein the long side of the initial single-sided T-shaped parking space line intersects with the edge of the black background.

[0052] like Figure 2 As shown, in this embodiment, the size of the black background image is 640×640 pixels, and each pixel represents an actual length of 2 cm; wherein, the long side of the initial single-sided T-shaped parking space line is 300 pixels and the short side is 254 pixels.

[0053] Step 103: Establish an image coordinate system with the upper left corner of the black background image as the origin, downward as the positive vertical axis, and right as the positive horizontal axis.

[0054] Step 104: Use the annotation tool to determine the first preset number of parking space line annotation points on the initial single-sided T-shaped parking space line.

[0055] In practice, the first preset quantity can be set according to actual requirements, such as 5, 6 or 7.

[0056] A complete parking space marker information includes two pairs of parking space line markers.

[0057] Subsequent image position changes will simultaneously calculate the coordinates of the parking space line markers after the changes, to ensure that no additional parking space lines need to be marked in the final obtained parking space image.

[0058] In this embodiment, the annotation information is saved as a JSON file.

[0059] Step 2: Rotate the long side of the initial single-sided T-shaped parking space line according to the second preset rule to form single-sided oblique T-shaped parking space lines with different orientations and angles.

[0060] In this embodiment, step 2 includes:

[0061] The long side of the initial single-sided T-shaped parking line is rotated clockwise around the first intersection point by a preset angle, and the short side of the initial single-sided T-shaped parking line is translated so that the midpoint of the short side coincides with the original endpoint of the long side, thereby generating a downward-sloping single-sided oblique T-shaped parking line.

[0062] The long side of the initial single-sided T-shaped parking line is rotated counterclockwise by a preset angle around the second intersection point, and then the short side of the initial single-sided T-shaped parking line is translated so that the midpoint of the short side coincides with the original endpoint of the long side, thereby generating an upward-sloping single-sided oblique T-shaped parking line.

[0063] The first intersection point is the upper intersection point of the long side of the initial single-sided T-shaped parking space line and the edge of the black background image, such as... Figure 2Point A in the diagram; the second intersection point is the lower intersection point of the long side of the initial single-sided T-shaped parking space line and the edge of the black background image, as shown below. Figure 2 Point B in the diagram; the original endpoint is the endpoint where the long side intersects the short side before rotation, such as... Figure 2 Point C in the diagram.

[0064] In practice, the preset angle can be set according to actual needs, such as 30°, 45° and 60°.

[0065] In this embodiment, the angle of the single-sided oblique T-shaped parking space line is an angle less than 90° between the long side and the short side, such as... Figure 3 In (a) ∠ACD, Figure 3 (b) ∠BCD angle.

[0066] Step 3: Combine the single-sided oblique T-shaped parking space lines on the black background according to the third preset rule to generate a second preset number of oblique T-shaped parking spaces, and obtain the foreground parking space image.

[0067] In this embodiment, step 3 includes:

[0068] Step 301: Set the range of the longitudinal coordinates of the single-sided inclined T-shaped parking space line.

[0069] In this embodiment, step 301 includes:

[0070] If the single-sided inclined T-shaped parking line is an upward-sloping single-sided inclined T-shaped parking line, then the intersection of the long side and the short side of the single-sided inclined T-shaped parking line is determined as the longitudinal coordinate of the single-sided inclined T-shaped parking line.

[0071] If the single-sided oblique T-shaped parking line is a downward-sloping single-sided oblique T-shaped parking line, then the intersection of the long side of the single-sided oblique T-shaped parking line and the edge of the black background map is determined as the longitudinal coordinate of the single-sided oblique T-shaped parking line.

[0072] In this embodiment, the longitudinal coordinate range of the single-sided oblique T-shaped parking space line is 10~350 pixels.

[0073] Step 302: Set the length range and width range of the inclined side of the inclined T-shaped parking space.

[0074] In this embodiment, the length of the inclined side of the T-shaped parking space ranges from 200 to 300 pixels, and the width ranges from 115 to 125 pixels.

[0075] Step 303: Set the arrangement mode and copy mode of the angled T-shaped parking space.

[0076] In this embodiment, the arrangement pattern includes unilateral, left-right symmetrical, and left-right asymmetrical, and the replication pattern includes downward and / or downward.

[0077] For example, if the arrangement pattern is a single-sided downward-sloping parking space, only a single-sided downward-sloping T-shaped parking space line needs to be loaded; if it is a left-right symmetrical single-sided downward-sloping parking space, then left-right mirror symmetry is performed; if it is a left-right asymmetrical parking space, then both a single-sided downward-sloping T-shaped parking space line and a single-sided upward-sloping T-shaped parking space line are loaded simultaneously.

[0078] Step 304: Determine the initial parameters for parking space generation in a random manner, read the arrangement mode and copy mode, calculate the maximum number of parking spaces, and determine the second preset quantity based on the maximum number of parking spaces. The initial parameters for parking space generation include the longitudinal coordinate of the single-sided inclined T-shaped parking space line, the length of the inclined side of the inclined T-shaped parking space, and the width.

[0079] The second preset number is the sum of all parking spaces, with the number of parking spaces increasing from 1 in increments of 1 to the maximum number of parking spaces.

[0080] Step 305: Generate a second preset number of angled T-shaped parking spaces according to the third preset rule to obtain a foreground parking space image.

[0081] In this embodiment, step 305 includes:

[0082] Step 305a: Based on the longitudinal coordinates of the single-sided inclined T-shaped parking line, translate and copy the single-sided inclined T-shaped parking line to a preset position in the longitudinal direction.

[0083] Step 305b: Divide the length of the inclined side of the inclined T-shaped parking space with the length of the long side of the initial single-sided T-shaped parking space line to determine the translation amount of the single-sided inclined T-shaped parking space line in the horizontal axis direction;

[0084] Step 305c: Based on the width of the inclined side of the inclined T-parking space and the angle of the single-sided inclined T-parking space line, determine the distance of the single-sided inclined T-parking space line to be copied and translated in the longitudinal direction according to a preset formula.

[0085] In this embodiment, the preset formula is:

[0086]

[0087] Where offsetd represents the distance of copy translation, d represents the width of the hypotenuse of the T-shaped parking space, and θ represents the angle of the single-sided T-shaped parking space line.

[0088] Step 306: Calculate and combine the coordinates of the marking points on the two long sides of each angled T-parking space, and save them as the marking point information of the angled T-parking space.

[0089] like Figure 4As shown in (a) and 4(b), based on the image pixel size of the base map, the number of single-sided angled T-parking spaces generally does not exceed 4. The larger the angle of the angled T-parking space, the more parking spaces can be placed side by side.

[0090] Depend on Figure 4 As shown in (a) and 4(b), the length and width of the T-shaped parking spaces are different in different pictures. Randomly determining the length and width of the parking spaces can effectively prevent the deep learning network from learning fixed length and width of the parking spaces as features.

[0091] In addition, the starting point of the diagonal T-shaped parking space arrangement in different images is also randomly determined within a certain range, and the number of parking spaces that can be arranged in each image is also different. This is used to simulate the different relative positions between vehicles and parking spaces in actual situations, and can also avoid deep learning networks from learning the position of parking spaces in the image as features during the learning process.

[0092] Step 4: Combine the foreground parking space image with the background image to generate parking space training samples.

[0093] In this embodiment, step 4 includes: replacing the pixel value at the corresponding position in the background image with the pixel value of the parking line position in the foreground parking space image.

[0094] The synthesis results are as follows Figure 5 As shown in (a) and 5(b).

[0095] After calculating the parking space marker information, there is no need to update the parking space marker information during the compositing process because the parking space location does not change.

[0096] The above-disclosed embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Therefore, any equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.

Claims

1. A method for generating training samples for parking spaces, characterized in that, include: Step 1: Create initial single-sided T-shaped parking space lines with annotation information according to the first preset rule; Step 2: Rotate the long side of the initial single-sided T-shaped parking space line according to the second preset rule to form single-sided oblique T-shaped parking space lines with different orientations and angles; Step 3: Combine the single-sided oblique T-shaped parking space lines on the black background according to the third preset rule to generate a second preset number of oblique T-shaped parking spaces, and obtain the foreground parking space image; Step 4: Combine the foreground parking space image with the background image to generate parking space training samples; Step 1 includes: Step 101: Read the original T-shaped parking space image and extract the long side and short side of the T-shaped parking space from the original T-shaped parking space image; Step 102: On a black background, recombine the long and short sides to form an initial single-sided T-shaped parking space line, wherein the long side of the initial single-sided T-shaped parking space line intersects with the edge of the black background. Step 103: Establish an image coordinate system with the upper left corner of the black background image as the origin, downward as the positive vertical axis, and right as the positive horizontal axis. Step 104: Use the annotation tool to determine the first preset number of parking space line annotation points on the initial single-sided T-shaped parking space line; Step 2 includes: The long side of the initial single-sided T-shaped parking line is rotated clockwise around the first intersection point by a preset angle, and the short side of the initial single-sided T-shaped parking line is translated so that the midpoint of the short side coincides with the original endpoint of the long side, thereby generating a downward-sloping single-sided oblique T-shaped parking line. The long side of the initial single-sided T-shaped parking line is rotated counterclockwise around the second intersection point by a preset angle, and the short side of the initial single-sided T-shaped parking line is translated so that the midpoint of the short side coincides with the original endpoint of the long side, thereby generating an upward-sloping single-sided oblique T-shaped parking line. The first intersection point is the upper intersection point of the long side of the initial single-sided T-shaped parking space line and the edge of the black background image; the second intersection point is the lower intersection point of the long side of the initial single-sided T-shaped parking space line and the edge of the black background image; and the original endpoint is the endpoint where the long side intersects with the short side before rotation. Step 3 includes: Step 301: Set the range of the longitudinal coordinates of the single-sided inclined T-shaped parking space line; Step 302: Set the length range and width range of the inclined side of the T-shaped parking space; Step 303: Set the arrangement mode and copy mode of the angled T-shaped parking spaces; Step 304: Determine the initial parameters for parking space generation in a random manner, read the arrangement mode and copy mode, calculate the maximum number of parking spaces, and determine the second preset number based on the maximum number of parking spaces. The initial parameters for parking space generation include the longitudinal coordinate of the single-sided inclined T-shaped parking space line, the length and width of the inclined side of the inclined T-shaped parking space. Step 305: Generate a second preset number of angled T-shaped parking spaces according to the third preset rule to obtain a foreground parking space image; Step 306: Calculate and combine the coordinates of the marking points on the two long sides of each angled T-parking space, and save them as the marking point information of the angled T-parking space; Step 301 includes: If the single-sided inclined T-shaped parking line is an upward-sloping single-sided inclined T-shaped parking line, then the intersection of the long side and the short side of the single-sided inclined T-shaped parking line is determined as the longitudinal coordinate of the single-sided inclined T-shaped parking line. If the single-sided inclined T-shaped parking line is a downward-sloping single-sided inclined T-shaped parking line, then the intersection of the long side of the single-sided inclined T-shaped parking line and the edge of the black background image is determined as the longitudinal coordinate of the single-sided inclined T-shaped parking line. Step 305 includes: Step 305a: Based on the longitudinal coordinates of the single-sided inclined T-shaped parking line, translate and copy the single-sided inclined T-shaped parking line to a preset position in the longitudinal direction. Step 305b: Divide the length of the inclined side of the inclined T-shaped parking space with the length of the long side of the initial single-sided T-shaped parking space line to determine the translation amount of the single-sided inclined T-shaped parking space line in the horizontal axis direction; Step 305c: Based on the width of the inclined side of the inclined T-parking space and the angle of the single-sided inclined T-parking space line, determine the distance of the single-sided inclined T-parking space line to be copied and translated in the longitudinal direction according to a preset formula; The preset formula is: Among them, offset d d represents the distance of the copy translation, d represents the width of the hypotenuse of the T-shaped parking space, and θ represents the angle of the single-sided T-shaped parking space line.

2. The parking space training sample generation method according to claim 1, characterized in that, The annotation information is saved as a JSON file.

3. The method for generating parking space training samples according to claim 1, characterized in that, Step 4 includes replacing the pixel value at the corresponding position in the background image with the pixel value of the parking line position in the foreground parking space image.

4. The method for generating parking space training samples according to any one of claims 1 to 3, characterized in that, The black background image has a size of 640×640 pixels, and the long side of the initial single-sided T-shaped parking space line has a length of 300 pixels and a short side has a length of 254 pixels.