A layout diagram generation method and device, electronic equipment and storage medium

CN122597580APending Publication Date: 2026-08-18HANGZHOU EZVIZ SOFTWARE CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611088385.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-21
Publication Date
2026-08-18

AI Technical Summary

Benefits of technology

[0054]In the solution provided in this application embodiment, the electronic device can acquire a hand-drawn layout diagram of the target space, wherein the hand-drawn layout diagram includes: the outline of the target space and the outlines of each element in the target space; identify key points on each outline, and determine two key points located on the same outline, and where there are no other key points on the outline between them, as key point pairs, wherein key points include: turning points, or, turning points and endpoints; for each key point pair, when the key point pair meets the adjustment conditions, adjust the two key points in the key point pair to be horizontally or vertically aligned, wherein the adjustment conditions are: the angle between the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than an angle threshold, and the angle is not 0; connect the key points in each key point pair with straight lines to obtain the target outline of the target space and each element; generate the target layout diagram of the target space based on each target outline. In the solution provided in this application embodiment, the user only needs to upload a simple hand-drawn layout diagram, and the electronic device can convert the hand-drawn layout diagram into a standard layout diagram through operations such as key point detection, key point position adjustment, and connecting key points with straight lines, thereby greatly reducing the dependence on human professional skills when generating layout diagrams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597580A_ABST
    Figure CN122597580A_ABST
Patent Text Reader

Abstract

This application provides a layout diagram generation method, apparatus, electronic device, and storage medium, relating to the field of image generation technology. The method includes: acquiring a hand-drawn layout diagram of a target space; identifying key points on each contour in the hand-drawn layout diagram, and determining two key points located on the same contour where no other key points exist on the contour line between them, as key point pairs; for each key point pair, if the angle between the direction of the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than a threshold and not 0, adjusting the two key points to be horizontally or vertically aligned; and connecting the key points in each key point pair with straight lines to generate a target layout diagram. Users only need to upload a simple hand-drawn layout diagram, and the electronic device can convert it into a standard layout diagram through operations such as key point detection, key point position adjustment, and connecting key points with straight lines, thereby greatly reducing the reliance on human professional skills when generating layout diagrams.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image generation technology, and in particular to a layout drawing generation method, apparatus, electronic device, and storage medium. Background Technology

[0002] A layout diagram can clearly show the overall framework of a space and the location distribution of various elements within it, and is widely used in scenarios such as shopping guides and indoor positioning.

[0003] The traditional method for generating layout diagrams involves professional staff conducting an on-site survey to record the overall framework of the space and the location and distribution of various elements within it. Based on this information, they then manually create a standard spatial layout diagram using specialized drawing software. This method demands a high level of skill from the staff. Summary of the Invention

[0004] The purpose of this application is to provide a layout diagram generation method, apparatus, electronic device, and storage medium to reduce the reliance on human expertise when generating layout diagrams. The specific technical solution is as follows:

[0005] In a first aspect, embodiments of this application provide a layout diagram generation method, the method comprising:

[0006] Obtain a hand-drawn layout diagram of the target space, wherein the hand-drawn layout diagram includes: the outline of the target space and the outlines of each element within the target space;

[0007] Identify key points on each contour and determine two key points located on the same contour and on the contour line between them that have no other key points, as key point pairs, wherein the key points include: turning points, or turning points and endpoints;

[0008] For each key point pair, when the key point pair meets the adjustment conditions, the two key points in the key point pair are adjusted to be horizontally or vertically aligned. The adjustment conditions are: the angle between the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than an angle threshold and the angle is not 0.

[0009] By connecting the key points of each key point pair with straight lines, the target space and the target contour of each element are obtained.

[0010] Based on the outlines of each target, a target layout diagram of the target space is generated.

[0011] Optionally, for each keypoint pair, when the adjustment conditions are met, adjusting the two keypoints in the keypoint pair to be horizontally or vertically aligned includes:

[0012] Perform the following operations for each contour:

[0013] Designate any key point on the contour as a reference point;

[0014] Find the target key point pair that contains the reference point and satisfies the adjustment conditions;

[0015] If the target key point pair is successfully found, the positions of the other key points in the target key point pair, except for the reference point, are adjusted so that the other key points are horizontally or vertically aligned with the reference point.

[0016] The reference point is updated to a neighboring key point, and the step of finding a target key point pair that contains the reference point and meets the adjustment conditions is returned until each key point pair on the contour does not meet the adjustment conditions. The neighboring key point is: among the key points on the contour, the key point that belongs to the same key point pair as the reference point and does not belong to the historical reference point.

[0017] Optionally, before adjusting the two key points in each key point pair to horizontal or vertical alignment when the key point pair meets the adjustment conditions, the method further includes:

[0018] Based on the relative positions of each key point in the hand-drawn layout, map each key point onto a blank layer;

[0019] For each keypoint pair, when the adjustment conditions are met, the two keypoints in the keypoint pair are adjusted to be horizontally or vertically aligned. Straight lines are then used to connect the keypoints in each keypoint pair to obtain the target space and the target contours of each element, including:

[0020] The key points in the key point pairs that meet the adjustment conditions in the blank layer are repositioned so that the two key points in the key point pair are horizontally or vertically aligned. The key points in each key point pair in the blank layer are connected by straight lines to obtain the target space and the target outline of each element.

[0021] Optionally, for each keypoint pair, when the adjustment conditions are met, the two keypoints in the keypoint pair are adjusted to be horizontally or vertically aligned, and the keypoints in each keypoint pair are connected by straight lines to obtain the target space and the target contour of each element, including:

[0022] The key points in the key point pairs that meet the adjustment conditions in the hand-drawn layout are repositioned so that the two key points in the key point pairs are horizontally or vertically aligned. The outline lines between the key points in the hand-drawn layout are deleted, and the key points in the key point pairs in the hand-drawn layout are connected by straight lines to obtain the target space and the target outline of each element.

[0023] Optionally, the hand-drawn layout diagram further includes: descriptive information of each element, and the method further includes:

[0024] For each element in the hand-drawn layout diagram, semantic recognition is performed on the descriptive information of that element;

[0025] Determine the annotation position of each element based on the area where the target outline of each element is located;

[0026] Annotate the semantic recognition results of each element at the designated annotation locations;

[0027] The step of generating a target layout map of the target space based on each target contour includes:

[0028] Based on the semantic recognition results of each target contour and each labeled element, a target layout map of the target space is generated.

[0029] Optionally, the description information includes at least one of the following: element type, shelf level of the shelf element, and number of display faces of the shelf element;

[0030] The step of annotating the semantic recognition results of each element at its designated location includes:

[0031] If the description information includes element type, then the element type of each element is marked at the marked position of each element;

[0032] If the description information includes the shelf level of the shelf element, then the shelf level of the shelf element is marked at the marked position of the shelf element;

[0033] If the description information includes the number of display faces of the shelf element, then among the edges included in the target outline of the shelf element, the edges that do not coincide with the target outline of the target space are determined as candidate edges. Target edges are selected from the candidate edges in descending order of edge length, and the identification information of the display face is marked at the target edges. The number of target edges is equal to the number of display faces.

[0034] Optionally, after generating the target layout map of the target space, the method further includes:

[0035] Obtain the shelf image of the real shelf corresponding to the shelf element in the target layout diagram, and identify the shelf image to determine the type of goods in the shelf image. The shelf image includes: images of each shelf level in each display face of the real shelf.

[0036] For each shelf level in each display face of the shelf element, establish a correspondence between the shelf level and the type of goods identified from the image corresponding to that shelf level.

[0037] Secondly, embodiments of this application provide a layout diagram generation apparatus, the apparatus comprising:

[0038] An image acquisition module is used to acquire a hand-drawn layout diagram of a target space, wherein the hand-drawn layout diagram includes: the outline of the target space and the outlines of each element in the target space;

[0039] The key point recognition module is used to identify key points on each contour and determine two key points located on the same contour and on the contour line between them that have no other key points, as a key point pair. The key points include: turning points, or turning points and endpoints.

[0040] The key point adjustment module is used to adjust the two key points in each key point pair to be horizontally or vertically aligned when the key point pair meets the adjustment conditions. The adjustment conditions are: the angle between the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than an angle threshold and the angle is not 0.

[0041] The key point connection module is used to connect the key points of each key point pair with straight lines to obtain the target space and the target contour of each element.

[0042] The image generation module is used to generate a target layout map of the target space based on the contours of each target.

[0043] Optionally, the key point adjustment module is specifically used to perform the following operations for each contour: determine any key point on the contour as a reference point; find a target key point pair that contains the reference point and satisfies the adjustment conditions; if the target key point pair is successfully found, adjust the positions of other key points in the target key point pair except the reference point so that the other key points are horizontally or vertically aligned with the reference point; update the reference point to a neighboring key point of the reference point, and return to the step of finding a target key point pair that contains the reference point and satisfies the adjustment conditions, until each key point pair on the contour no longer satisfies the adjustment conditions, wherein the neighboring key point is: among the key points on the contour, the key point that belongs to the same key point pair as the reference point and does not belong to a historical reference point.

[0044] Optionally, the device further includes: a mapping module, used to map each key point to a blank layer according to the relative positional relationship of each key point in the hand-drawn layout drawing; a key point adjustment module, specifically used to adjust the position of key points in key point pairs in the blank layer that meet the adjustment conditions, so that the two key points in the key point pair are horizontally or vertically aligned; and a key point connection module, specifically used to connect the key points in each key point pair in the blank layer with straight lines to obtain the target space and the target outline of each element.

[0045] Optionally, the key point adjustment module is specifically used to adjust the position of key points in key point pairs that meet the adjustment conditions in the hand-drawn layout diagram, so that the two key points in the key point pair are horizontally or vertically aligned; the key point connection module is specifically used to delete the outline lines between each key point in the hand-drawn layout diagram, and connect the key points in each key point pair in the hand-drawn layout diagram with straight lines to obtain the target space and the target outline of each element.

[0046] Optionally, the hand-drawn layout diagram further includes: description information of each element; the device further includes: a semantic recognition module, used to perform semantic recognition on the description information of each element in the hand-drawn layout diagram; a labeling position determination module, used to determine the labeling position of each element based on the area where the target contour of each element is located; a labeling module, used to label the semantic recognition result of each element at the labeling position of each element; and the image generation module, specifically used to generate a target layout diagram of the target space based on the semantic recognition results of each target contour and the labeled elements.

[0047] Optionally, the description information includes at least one of: element type, shelf level of shelf element, and number of display faces of shelf element; the annotation module is specifically used for: if the description information includes element type, then annotating the element type of each element at the annotation position of each element; if the description information includes shelf level of shelf element, then annotating the shelf level of the shelf element at the annotation position of the shelf element; if the description information includes number of display faces of shelf element, then among the edges included in the target outline of the shelf element, determining the edges that do not coincide with the target outline of the target space as candidate edges, selecting target edges from each candidate edge in descending order of edge length, and annotating the display face identification information at the target edge, wherein the number of target edges is equal to the number of display faces.

[0048] Optionally, after generating the target layout diagram of the target space, the device further includes: a goods type identification module, used to acquire a shelf image of a real shelf corresponding to a shelf element in the target layout diagram, and to identify the goods type in the shelf image, wherein the shelf image includes: an image of each shelf level in each display face of the real shelf; and a correspondence establishment module, used to establish a correspondence between each shelf level in each display face of the shelf element and the goods type identified from the image corresponding to that shelf level.

[0049] Thirdly, embodiments of this application provide an electronic device, including:

[0050] Memory, used to store computer programs;

[0051] When a processor executes a program stored in memory, it implements any of the methods described in the first aspect above.

[0052] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the methods described in the first aspect above.

[0053] Beneficial effects of the embodiments in this application:

[0054] In the solution provided in this application embodiment, the electronic device can acquire a hand-drawn layout diagram of the target space, wherein the hand-drawn layout diagram includes: the outline of the target space and the outlines of each element in the target space; identify key points on each outline, and determine two key points located on the same outline, and where there are no other key points on the outline between them, as key point pairs, wherein key points include: turning points, or, turning points and endpoints; for each key point pair, when the key point pair meets the adjustment conditions, adjust the two key points in the key point pair to be horizontally or vertically aligned, wherein the adjustment conditions are: the angle between the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than an angle threshold, and the angle is not 0; connect the key points in each key point pair with straight lines to obtain the target outline of the target space and each element; generate the target layout diagram of the target space based on each target outline. In the solution provided in this application embodiment, the user only needs to upload a simple hand-drawn layout diagram, and the electronic device can convert the hand-drawn layout diagram into a standard layout diagram through operations such as key point detection, key point position adjustment, and connecting key points with straight lines, thereby greatly reducing the dependence on human professional skills when generating layout diagrams.

[0055] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0056] To more clearly illustrate the technical solutions in the embodiments of this application 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 this application. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0057] Figure 1 A schematic flowchart of a layout diagram generation method provided in an embodiment of this application;

[0058] Figure 2 For based on Figure 1 A schematic diagram of a hand-drawn layout of the embodiment shown;

[0059] Figure 3 For based on Figure 1 A schematic diagram of key points in the hand-drawn layout diagram of the illustrated embodiment;

[0060] Figure 4 For based on Figure 1 Another schematic diagram of key points in the hand-drawn layout diagram of the illustrated embodiment;

[0061] Figure 5 For based on Figure 1 A schematic diagram of the target layout generated in the illustrated embodiment;

[0062] Figure 6 For based on Figure 1 A flowchart illustrating a key point adjustment method in the illustrated embodiment;

[0063] Figure 7a For based on Figure 6 The first schematic diagram in the key point adjustment process of the embodiment shown;

[0064] Figure 7b For based on Figure 6 The second schematic diagram in the key point adjustment process of the embodiment shown;

[0065] Figure 7c For based on Figure 6 The third schematic diagram in the key point adjustment process of the illustrated embodiment;

[0066] Figure 7d For based on Figure 6 The fourth schematic diagram in the key point adjustment process of the illustrated embodiment;

[0067] Figure 7e For based on Figure 6 The fifth schematic diagram in the key point adjustment process of the illustrated embodiment;

[0068] Figure 8 For based on Figure 1 A schematic diagram illustrating a specific process of the layout diagram generation method in the illustrated embodiment;

[0069] Figure 9 For based on Figure 8 A schematic diagram of the target layout generated in the illustrated embodiment;

[0070] Figure 10 For based on Figure 1 Another specific flowchart of the layout diagram generation method of the embodiment shown is illustrated.

[0071] Figure 11 A schematic diagram of a layout diagram generation apparatus provided in an embodiment of this application;

[0072] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0073] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.

[0074] To reduce the reliance on human expertise when generating layout diagrams, this application provides a layout diagram generation method, apparatus, electronic device, computer-readable storage medium, and computer program product. The layout diagram generation method provided in this application will be described first.

[0075] The layout diagram generation method provided in this application can be applied to any electronic device that needs to generate a standard layout diagram, such as mobile phones, computers, servers, etc., without specific limitations. For clarity, it will be referred to as an electronic device below.

[0076] like Figure 1 As shown, a layout diagram generation method includes:

[0077] S101, Obtain a hand-drawn layout of the target space.

[0078] The hand-drawn layout diagram includes: the outline of the target space and the outlines of each element within the target space.

[0079] S102, identify key points on each contour, and determine two key points located on the same contour and on the contour line between them that have no other key points, as key point pairs.

[0080] Key points include: turning point, or, turning point and endpoint.

[0081] S103, for each keypoint pair, when the keypoint pair meets the adjustment conditions, adjust the two keypoints in the keypoint pair to be horizontally or vertically aligned.

[0082] The adjustment conditions are as follows: the angle between the line connecting the two key points in a key point pair and the horizontal or vertical direction is less than the angle threshold and the angle is not 0.

[0083] S104 uses straight lines to connect the key points in the center of each key point to obtain the target space and the target contour of each element.

[0084] S105, Generate a target layout map of the target space based on the outlines of each target.

[0085] In the solution provided in this application embodiment, the electronic device can acquire a hand-drawn layout diagram of the target space, wherein the hand-drawn layout diagram includes: the outline of the target space and the outlines of each element in the target space; identify key points on each outline, and determine two key points located on the same outline, and where there are no other key points on the outline between them, as key point pairs, wherein key points include: turning points, or, turning points and endpoints; for each key point pair, when the key point pair meets the adjustment conditions, adjust the two key points in the key point pair to be horizontally or vertically aligned, wherein the adjustment conditions are: the angle between the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than an angle threshold, and the angle is not 0; connect the key points in each key point pair with straight lines to obtain the target outline of the target space and each element; generate the target layout diagram of the target space based on each target outline. In the solution provided in this application embodiment, the user only needs to upload a simple hand-drawn layout diagram, and the electronic device can convert the hand-drawn layout diagram into a standard layout diagram through operations such as key point detection, key point position adjustment, and connecting key points with straight lines, thereby greatly reducing the dependence on human professional skills when generating layout diagrams.

[0086] When a layout diagram needs to be generated, the user can manually draw the outline of the target space and the outline of each element in the target space to obtain a hand-drawn layout diagram. The electronic device can obtain the hand-drawn layout diagram manually drawn by the user and then execute the layout diagram generation method provided in the embodiments of this application.

[0087] Electronic devices can obtain hand-drawn layout diagrams in, but are not limited to, the following ways:

[0088] In one implementation, a user can draw a hand-drawn layout on paper with a pen and paper, take a picture of the hand-drawn layout, and then upload the picture to an electronic device, thereby allowing the electronic device to obtain the hand-drawn layout of the target space.

[0089] In another implementation, the user can draw a hand-drawn layout diagram on the interactive interface provided by the electronic device (e.g., the interactive interface displayed on the screen of the electronic device itself, or the interactive interface displayed on the screen of other devices that are communicatively connected to the electronic device), thereby allowing the electronic device to also obtain the hand-drawn layout diagram of the target space.

[0090] After acquiring a hand-drawn layout diagram, the electronic device can first identify the contours in the diagram (the contours of the target space and the contours of the elements within the target space), and then identify the "turning points" or "turning points and endpoints" on each contour as key points. The methods for identifying contours, turning points, and endpoints can employ existing recognition algorithms, which will not be elaborated upon here.

[0091] For example, the hand-drawn layout diagram uploaded by the user is Figure 2 The electronic device performs contour recognition on the hand-drawn layout map, obtaining the contours of each shelf, beverage cabinet, cash register, cigarette cabinet, freezer, and target space. Furthermore, the electronic device performs further recognition on the key points of each contour, resulting in... Figure 3 The key points are shown in black dots.

[0092] After obtaining each key point, the electronic device can divide the identified key points into key point pairs, each consisting of two key points, according to the principle that "the key points are located on the same contour and there are no other key points on the contour line between them".

[0093] by Figure 4 Taking the six key points shown as points 1, 2, 3, 4, 5, and 6 as examples, the key point pairs in the embodiments of this application will be illustrated.

[0094] For point 1, since point 2 and point 1 share the same common contour as the target space and the top-left shelf, and there are no other keypoints on the contour line between them, point 1 and point 2 can be considered a keypoint pair. Similarly, point 3 and point 1 share the same common contour as the target space and the top-left shelf, and there are no other keypoints on the contour line between them, so point 1 and point 3 can also be considered a keypoint pair. However, for points 4, 5, or 6, although they share the same contour as point 1 (either the target space or the top-left shelf), there are other keypoints (point 2 or point 3) on the contour line between them and point 1, so points 4, 5, or 6 cannot be considered a keypoint pair with point 1.

[0095] Similarly, point 2 can form a key pair with points 1, 4, or 5. Point 3 can form a key pair with points 1, 5, or 6. Point 4 can form a key pair with point 2. Point 5 can form a key pair with either point 2 or 3. Point 6 can form a key pair with point 3.

[0096] Finally, the key point pairs that can be formed by points 1, 2, 3, 4, 5, and 6 are: (point 1, point 2), (point 1, point 3), (point 2, point 4), (point 2, point 5), (point 3, point 5), (point 3, point 6).

[0097] Due to errors in manual drawing, users may draw horizontal and vertical lines with an angle. However, the angle between this angled line and the horizontal or vertical direction is generally not too large. Therefore, to correct these errors, after obtaining each keypoint pair, the electronic device can determine whether the keypoint pair meets the adjustment conditions. Specifically, it determines whether the angle between the line connecting the two keypoints in the pair and the horizontal or vertical direction is less than an angle threshold and is not zero. The angle threshold can be set according to the specific usage scenario. This application does not limit the angle threshold; for example, it can be 5°, 10°, or 15°.

[0098] If the angle between the line connecting two keypoints in a keypoint pair and the horizontal or vertical direction is less than the angle threshold and is not 0, it means that the two keypoints are likely to need to be horizontally or vertically aligned. In this case, the electronic device can adjust the position of one of the two keypoints, or adjust the position of the two keypoints in a certain way, to make the two keypoints horizontally or vertically aligned.

[0099] If the angle between the line connecting two keypoints in a keypoint pair and the horizontal or vertical direction is greater than an angle threshold, it means the line connecting these two keypoints should already be at an angle to the horizontal or vertical direction. In this case, it's not necessary to adjust the two keypoints to be horizontally or vertically aligned. The electronic device can also leave the two keypoints in their positions unchanged. If the angle between the line connecting two keypoints in a keypoint pair and the horizontal or vertical direction is 0, it means the two keypoints are already horizontally or vertically aligned. In this case, the electronic device also doesn't need to adjust the positions of these two keypoints.

[0100] For each key point pair that meets the adjustment conditions, after the electronic device completes the position adjustment of the key points in each key point pair, it can use straight lines to connect the key points in all key point pairs to obtain the target space and the target contour of each element.

[0101] For example, for Figure 3 The keypoint pairs, represented by black dots, can be connected by straight lines by the electronic device after the adjustment operation is completed, to obtain the desired result. Figure 5 The target space and the target outlines of each element are shown.

[0102] Finally, the electronic device can generate a target layout map of the target space based on each target contour. For example, it can directly use the image including each target contour as the target layout map of the target space, or it can add annotation information to the image including each target contour, and then use the image with added annotation information as the target layout map of the target space.

[0103] In the solution provided in this application embodiment, users only need to upload a simple hand-drawn layout diagram, and the electronic device can convert the hand-drawn layout diagram into a standard layout diagram through operations such as key point detection, key point position adjustment, and straight line connection of key points, thereby greatly reducing the dependence on personnel's professional skills when generating layout diagrams.

[0104] As one implementation method of this application, such as Figure 6 As shown, when the electronic device adjusts two key points in a keypoint pair to be horizontally or vertically aligned, it can specifically perform steps S601-S605 for each contour:

[0105] S601, designate any key point on the contour as a reference point.

[0106] For each contour, the electronic device first selects one key point from the key points on that contour as a reference point. For example, the electronic device selects the key point located at the upper left corner of the contour as the reference point.

[0107] S602, find a pair of target key points that contain a reference point and meet the adjustment conditions. If a pair of target key points is successfully found, proceed to step S603; if a pair of target key points is not successfully found, proceed to step S604.

[0108] After selecting a reference point, the electronic device can first find key point pairs that include the reference point, and then determine whether the found key point pairs meet the adjustment conditions, thereby determining whether each key point adjacent to the reference point and on the same contour needs to be adjusted when the reference point is used as the adjustment reference.

[0109] If the found keypoint pair meets the adjustment conditions (i.e., the target keypoint pair is successfully found), the electronic device can execute step S603 to adjust the position of the keypoint. If the found keypoint pair does not meet the adjustment conditions (i.e., the target keypoint pair is not successfully found), it means that none of the keypoints adjacent to the reference point and on the same contour need to be adjusted. In this case, the electronic device can execute step S604 to determine whether the reference point needs to be updated and continue to adjust other keypoints.

[0110] S603, adjust the position of other key points in the target key point pair except the reference point, so that the other key points are horizontally or vertically aligned with the reference point.

[0111] When a target key point pair is successfully found, the electronic device does not adjust the position of the reference point (i.e., keeps the position of the reference point unchanged), but adjusts the positions of other key points in the target key point pair except the reference point so that the other key points are horizontally or vertically aligned with the reference point.

[0112] S604, determine if there are any neighboring key points to the reference point. If the result is yes, proceed to step S605; if the result is no, end.

[0113] If the target keypoint pair is not successfully found, the electronic device can determine whether there is a keypoint belonging to the same keypoint pair as the reference point but not to a historical reference point. If so, it means that there are still unadjusted keypoints on the contour. Based on this, the electronic device can execute step S605 to update the reference point and continue to adjust other keypoints. If not, it means that all keypoints on the contour have been adjusted. At this point, the adjustment operation of the keypoints on the contour is completed, and the adjustment ends.

[0114] S605 updates the reference point to the nearest key point of the reference point.

[0115] The electronic device can update key points that belong to the same key point pair as the reference point but do not belong to the historical reference point to new reference points, and return to step S602, thereby using the new reference point as the adjustment reference, and determining whether each key point adjacent to the new reference point and on the same contour needs to be adjusted.

[0116] by Figure 4 Taking the six key points shown (points 1, 2, 3, 4, 5, and 6) as an example, we will illustrate steps S601-S605 above. The relative positions of points 1, 2, 3, 4, 5, and 6 at this point are as follows: Figure 7a As shown, points 1, 2, 3, 4, and 6 belong to the outline of the target space. Therefore, for points 1, 2, 3, 4, and 6, steps S601-S605 can be performed for adjustment. Furthermore, points 1, 2, 3, and 5 belong to the outline of the upper left shelf. Therefore, for points 1, 2, 3, and 5, steps S601-S605 can also be performed for adjustment. Assuming the adjustment process for the target space outline comes first, the specific adjustment processes for the target space outline and the upper left shelf outline are as follows.

[0117] The process of adjusting the outline of the target space.

[0118] 1. The electronic device can identify point 1 as a reference point on the contour of the target space. At this point, the key point pairs including the reference point are (point 1, point 2) and (point 1, point 3). Because the angle between the line connecting points 1 and 2 and the horizontal direction is 0, and the angle between the line connecting points 1 and 3 and the vertical direction is less than the angle threshold and not 0, the electronic device can identify (point 1, point 3) as the target key point pair. Then, the electronic device can adjust the position of point 3 to vertically align it with point 1. The adjustment result can be as follows: Figure 7b As shown. At this point, for point 1, points 2 and 3 are both its neighboring key points, so points 2 and 3 can be used as new reference points respectively.

[0119] 2. Using point 2 as the reference point, the key point pairs including the reference point are (point 1, point 2) and (point 2, point 4). Since the angle between the line connecting point 1 and point 2 and the horizontal direction is 0, and the angle between the line connecting point 2 and point 4 and the horizontal direction is also 0, the electronic device can determine that the target key point pair has not been successfully found. At this point, for point 2, point 4 is a neighboring key point, so point 4 can be used as the new reference point (for simplicity, the subsequent adjustment process using point 4 as the reference point will not be elaborated).

[0120] 3. Using the adjusted point 3 as the reference point, the key point pairs including the reference point are now (point 1, point 3) and (point 3, point 6). Because the angle between the line connecting points 1 and 3 and the vertical direction is 0, and the angle between the line connecting points 3 and 6 and the vertical direction is less than the angle threshold and not 0, the electronic device can determine (point 3, point 6) as the target key point pair. Then, the electronic device can adjust the position of point 6 to vertically align it with point 3. The adjustment result can be as follows: Figure 7c As shown. At this point, for point 3, point 6 is a neighboring key point, so point 6 can be used as the new reference point (for the sake of brevity, the subsequent adjustment process with point 6 as the reference point will not be described in detail).

[0121] The process of adjusting the outline of the shelf in the upper left corner.

[0122] 1. The electronic device can designate point 1 as the reference point on the outline of the upper left shelf. At this point, the key point pair including the reference point is (point 1, point 2) and (point 1, point 3). Because the position of point 3 has already been adjusted during the adjustment process of the target space outline, the angle between the line connecting point 1 and point 2 and the horizontal direction is 0, and the angle between the line connecting point 1 and point 3 and the vertical direction is also 0. Therefore, the electronic device can determine that the target key point pair has not been successfully found. At this point, for point 1, points 2 and 3 are both its neighboring key points, so points 2 and 3 can be used as new reference points respectively.

[0123] 2. Using point 2 as the reference point, the key point pair including the reference point is (point 1, point 2) and (point 2, point 5). Because the angle between the line connecting points 1 and 2 and the horizontal direction is 0, and the angle between the line connecting points 2 and 5 and the vertical direction is less than the angle threshold and not 0, the electronic device can determine (point 2, point 5) as the target key point pair. Then, the electronic device can adjust the position of point 5 to vertically align it with point 2. The adjustment result can be as follows: Figure 7d As shown. At this point, for point 2, point 5 is a neighboring key point, so point 5 can be used as the new reference point.

[0124] 3. Using point 3 as the reference point, the key point pairs including the reference point are (point 1, point 3) and (point 3, point 5). Because the angle between the line connecting points 1 and 3 and the vertical direction is 0, and the angle between the line connecting points 3 and 5 and the horizontal direction is less than the angle threshold and not 0, the electronic device can determine (point 3, point 5) as the target key point pair. Then, the electronic device can adjust the position of point 5 to make point 5 horizontally aligned with point 3. The adjustment result can be as follows: Figure 7e As shown. At this point, for point 3, during the above adjustment process, points 1 and 5, which belong to the same key point pair, have been determined as reference points. Therefore, for point 3, there are no adjacent key points, so the execution of this adjustment branch can be terminated.

[0125] 4. Using point 5 as the reference point, the key point pairs including the reference point are (point 2, point 5) and (point 3, point 5). Since the angle between the line connecting points 2 and 5 and the vertical direction is 0, and the angle between the line connecting points 3 and 5 and the horizontal direction is 0, the electronic equipment can determine that the target key point pair was not successfully found. At this point, for point 5, during the above adjustment process, points 2 and 3, which belong to the same key point pair, have already been determined as reference points. Therefore, point 5 has no adjacent key points, and the execution of this adjustment branch can be terminated.

[0126] It should be noted that when there are multiple neighboring keypoints, the example above uses all of them as reference points for subsequent adjustments. Alternatively, one neighboring keypoint can be selected as the reference point for subsequent adjustments.

[0127] In the solution provided in this application embodiment, when the electronic device adjusts two key points in a key point pair to be horizontally or vertically aligned, it can achieve full coverage adjustment of key points on each contour by sequentially determining the reference point, the target key point pair, and the adjacent key points. At the same time, it can avoid repeated adjustments and achieve accurate and efficient key point position adjustment.

[0128] As one implementation method of this application, when an electronic device generates a target layout diagram, it can adjust a hand-drawn layout diagram to generate the target layout diagram, or it can use the hand-drawn layout diagram as a reference to draw the target layout diagram on a blank layer. Specifically:

[0129] "Using the hand-drawn layout as a reference, draw the target layout on a blank layer."

[0130] Before adjusting the positions of keypoints, the electronic device can map each keypoint to a blank layer according to their relative positions in the hand-drawn layout. Correspondingly, when adjusting the positions and connecting keypoints, the electronic device can specifically adjust the positions of keypoints in keypoint pairs that meet the adjustment conditions in the blank layer, ensuring that the two keypoints in the pair are horizontally or vertically aligned. Straight lines are then used to connect the keypoints in each keypoint pair in the blank layer, thus obtaining the target space and the target outline of each element.

[0131] "Adjustments are made to the hand-drawn layout to generate the target layout."

[0132] When adjusting the position of key points and connecting key points, electronic devices can specifically adjust the position of key points in key point pairs that meet the adjustment conditions in the hand-drawn layout drawing, so that the two key points in the key point pair are horizontally or vertically aligned, delete the outline lines between each key point in the hand-drawn layout drawing, and connect the key points in each key point pair in the hand-drawn layout drawing with straight lines to obtain the target space and the target outline of each element.

[0133] In one implementation, the electronic device can select from the two methods described above to generate the target layout image based on whether the hand-drawn layout image is editable. Specifically, if the hand-drawn layout image is not editable, the electronic device can use the hand-drawn layout image as a reference to draw the target layout image on a blank layer. If the hand-drawn layout image is editable, the electronic device can use the hand-drawn layout image as a reference to draw the target layout image on a blank layer, or it can make adjustments based on the hand-drawn layout image to generate the target layout image.

[0134] In the solution provided in this application embodiment, if the hand-drawn layout diagram is an uneditable image, the electronic device can use it as a reference to draw the target layout diagram on a blank layer, thereby ensuring the successful generation of the target layout diagram. If the hand-drawn layout diagram is an editable image, the electronic device can use it as a reference to draw the target layout diagram on a blank layer, or it can make adjustments based on the hand-drawn layout diagram to generate the target layout diagram, thereby improving the flexibility of target layout diagram generation.

[0135] As one implementation method of this application, the hand-drawn layout diagram may further include: descriptive information for each element, and based on this, such as... Figure 8 As shown, before executing step S105, the electronic device may also execute steps S801-S803:

[0136] S801 performs semantic recognition on the descriptive information of each element in the hand-drawn layout diagram.

[0137] A hand-drawn layout diagram includes not only the outline of the target space and the outlines of each element within that space, but also descriptive information about each element. For example, Figure 2 The hand-drawn layout diagram also includes the element type of each element, as well as the shelf levels and the number of display faces for each shelf element. Based on this, when generating the target layout diagram, the electronic device can also add descriptive information for each element to the target layout diagram.

[0138] Therefore, for each element in the hand-drawn layout diagram, the electronic device performs semantic recognition on the descriptive information of that element to obtain the semantic recognition result of each element.

[0139] S802, determine the annotation position of each element based on the area where the target outline of each element is located.

[0140] Electronic devices can pre-store the relative annotation positions corresponding to various semantic recognition results. For example, the element type, shelf level, and number of display surfaces need to be annotated within the element's outline, and the labeling information of the display surfaces needs to be annotated on the element's outline.

[0141] Based on this, after obtaining the semantic recognition results of each element, the electronic device can determine the annotation position of each element according to the region where the target contour of each element is located, the type of semantic recognition result of each element, and the relative annotation position corresponding to the pre-stored semantic recognition results of various types.

[0142] S803, annotate the semantic recognition results of each element at the annotation position of each element.

[0143] After determining the semantic recognition results and annotation positions of each element, the electronic device can annotate the semantic recognition results of each element at the annotation positions. Specifically:

[0144] If the description information includes element type, then the element type of each element is indicated at the annotation position of each element.

[0145] If the description information includes the shelf level of the shelf element, then the shelf level of the shelf element will be marked at the label location of the shelf element.

[0146] If the description information includes the number of display faces of the shelf element, then among the edges included in the target outline of the shelf element, the edges that do not coincide with the target outline of the target space are identified as candidate edges. Target edges are selected from the candidate edges in descending order of edge length, and the display face identification information is marked at the target edges. The number of target edges is equal to the number of display faces.

[0147] by Figure 2 Taking the hand-drawn layout diagram shown as an example, after determining the outlines of each target through steps S101-S104 and annotating the semantic recognition results of each element through steps S801-S803, the target layout diagram can now be as follows: Figure 9 The diagram shows: "the outline of each shelf, beverage cabinet, cash register, cigarette cabinet, freezer, and target space", "the type of each element (shelf 1, shelf 2, shelf 3, shelf 4, beverage cabinet, cash register, cigarette cabinet, freezer, door)", "the level of each shelf (4 levels) and the identification information of each display surface (A side, B side, C side and D side)".

[0148] Accordingly, when the electronic device performs step S105, it can specifically achieve this through step S804:

[0149] S804 generates a target layout map of the target space based on the semantic recognition results of each target contour and each labeled element.

[0150] When electronic devices generate a target layout map of the target space based on the semantic recognition results of each target contour and labeled element, they can generate descriptive data in a data format according to the dimensions of the overall framework (target contour of the target space) + key devices (elements) and store it in the database.

[0151] In the solution provided in this application embodiment, when generating a target layout diagram, the electronic device can not only generate the target space and the target outline of each element, but also add the description information of each element to the target layout diagram, thereby meeting more diverse generation needs of the target layout diagram.

[0152] As one implementation method of this application, such as Figure 10 As shown, after generating the target layout diagram of the target space, the electronic device can also perform steps S1001-S1002:

[0153] S1001, Obtain the actual shelf image corresponding to the shelf element in the target layout diagram, and identify the shelf image to determine the type of goods in the shelf image.

[0154] Users can upload images of actual shelves that correspond to the shelf elements in the target layout diagram to an electronic device. The images of goods can include images of each shelf level in each display face of the actual shelf.

[0155] For example, after a user takes pictures of each shelf level on each display side of a real shelf, they can add a label to each image when uploading it to an electronic device to indicate which shelf level on which display side of the real shelf the image belongs to. Users can also upload the corresponding images through the upload channels for each shelf level on each display side of the shelf.

[0156] After acquiring an image of a shelf, the electronic device can perform goods recognition on the image to determine the type of each item included in the shelf image. The goods recognition method can employ existing recognition algorithms, which will not be elaborated upon here.

[0157] S1002, for each shelf level in each display face of a shelf element, establish a correspondence between the shelf level and the type of goods identified from the image corresponding to the shelf level.

[0158] The shelf element includes various display surfaces, and each display surface can include various shelf levels. Based on this, the electronic device can determine the type of goods identified from the image corresponding to each shelf level in each display surface of the shelf element, and establish a correspondence between the goods level and the identified goods type.

[0159] In one implementation, after establishing the correspondence between the aforementioned cargo shelves and cargo types, the electronic device can respond to cargo search requests based on this correspondence. Specifically:

[0160] Electronic devices can acquire a goods search request that includes the type of goods to be searched. Then, based on the above correspondence, the electronic devices can determine which shelf, which display surface, and which shelf level of which shelf contains the goods to be searched. That is, they can determine the target shelf level of the target display surface of the target shelf where the goods to be searched are placed, and then return it as the placement location information of the goods to be searched.

[0161] For example, in a cloud-based monitoring service scenario (where remote customer service personnel provide remote store monitoring and sales guidance services to customers through IoT smart hardware such as cameras, smart speakers, and smart access control, enabling customers' business premises to continue operating even without staff on-site), when a user in the business premises wants to find goods A, they can send a goods search request for goods A to an electronic device. After the electronic device determines the placement information of goods A as "the second shelf on side A of shelf one" through the above correspondence, it can send the placement information to the display device or voice playback device in the business premises, and announce to the user through the display device or voice playback device that "goods A is placed on the second shelf on side A of shelf one".

[0162] In another implementation, to further improve the accuracy of goods retrieval, the shelf hierarchy can be further divided into hierarchical areas (e.g., the left side area of ​​the first layer, the middle area of ​​the first layer, and the right side area of ​​the first layer). Correspondingly, when recognizing the shelf image, the corresponding image area for each hierarchical area can be determined within the shelf image. Then, each image area is identified to determine the shelf type within that area. When establishing the correspondence, for each shelf layer within each display surface of the shelf element, a correspondence is established between that hierarchical area and the goods type identified from the corresponding image area.

[0163] In the solution provided in this application embodiment, after generating the target layout diagram, the electronic device can further establish a correspondence between the shelf level in the display surface of the shelf element and the type of goods identified from the image corresponding to the shelf level. In this way, the device can respond to the goods query request based on the correspondence, which improves the user experience in business premises without staff, especially in the scenario of cloud-attended service.

[0164] Corresponding to the above-described layout diagram generation method, this application embodiment also provides a layout diagram generation device, which will be described below.

[0165] like Figure 11 As shown, a layout diagram generation apparatus includes:

[0166] Image acquisition module 1101 is used to acquire a hand-drawn layout diagram of the target space, wherein the hand-drawn layout diagram includes: the outline of the target space and the outlines of each element in the target space;

[0167] The key point recognition module 1102 is used to identify key points on each contour and determine two key points located on the same contour and on the contour line between them that do not contain other key points, as a key point pair, wherein the key points include: turning points, or turning points and endpoints;

[0168] The key point adjustment module 1103 is used to adjust the two key points in each key point pair to be horizontally or vertically aligned when the key point pair meets the adjustment conditions. The adjustment conditions are: the angle between the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than the angle threshold and the angle is not 0.

[0169] The key point connection module 1104 is used to connect the key points of each key point pair with straight lines to obtain the target space and the target contour of each element.

[0170] Image generation module 1105 is used to generate a target layout map of the target space based on the contours of each target.

[0171] In the solution provided in this application embodiment, users only need to upload a simple hand-drawn layout diagram, and the electronic device can convert the hand-drawn layout diagram into a standard layout diagram through operations such as key point detection, key point position adjustment, and straight line connection of key points, thereby greatly reducing the dependence on personnel's professional skills when generating layout diagrams.

[0172] As one implementation of this application, the key point adjustment module 1103 can be specifically used for:

[0173] For each contour, perform the following operations: designate any keypoint on the contour as a reference point; find a target keypoint pair that contains the reference point and meets the adjustment conditions; if a target keypoint pair is successfully found, adjust the positions of other keypoints in the target keypoint pair except the reference point so that the other keypoints are horizontally or vertically aligned with the reference point; update the reference point to a neighboring keypoint, and return to the step of finding a target keypoint pair that contains the reference point and meets the adjustment conditions, until every keypoint pair on the contour no longer meets the adjustment conditions. A neighboring keypoint is a keypoint on the contour that belongs to the same keypoint pair as the reference point and does not belong to a historical reference point.

[0174] As one embodiment of this application, the above-described apparatus may further include:

[0175] The mapping module is used to map each key point to a blank layer according to the relative position of each key point in the hand-drawn layout.

[0176] The key point adjustment module 1103 can be specifically used to adjust the position of key points in a key point pair that meets the adjustment conditions in a blank layer, so that the two key points in the key point pair are horizontally or vertically aligned.

[0177] The key point connection module 1104 can be specifically used to connect the key points of each key point pair in the blank layer with straight lines to obtain the target space and the target outline of each element.

[0178] As one embodiment of this application, the key point adjustment module 1103 can be specifically used to adjust the position of key points in a key point pair that meets the adjustment conditions in a hand-drawn layout drawing, so that the two key points in the key point pair are horizontally or vertically aligned.

[0179] The key point connection module 1104 can be specifically used to delete the outline lines between key points in the hand-drawn layout drawing, and connect the key points in the center of each key point in the hand-drawn layout drawing with straight lines to obtain the target space and the target outline of each element.

[0180] As one embodiment of this application, the above-mentioned hand-drawn layout diagram may further include: descriptive information of each element, and the above-mentioned device may further include:

[0181] The semantic recognition module is used to perform semantic recognition on the descriptive information of each element in the hand-drawn layout diagram.

[0182] The annotation location determination module is used to determine the annotation location of each element based on the area where the target outline of each element is located;

[0183] The annotation module is used to annotate the semantic recognition results of each element at the designated annotation positions.

[0184] The image generation module 1105 is specifically used to generate a target layout map of the target space based on the semantic recognition results of each target contour and each labeled element.

[0185] As one embodiment of this application, the above description information may include at least one of: element type, shelf level of the shelf element, and number of display faces of the shelf element; the annotation module may be specifically used for:

[0186] If the description information includes element type, then the element type of each element is marked at the annotation position of each element;

[0187] If the description information includes the shelf level of the shelf element, then the shelf level of the shelf element will be marked at the label position of the shelf element.

[0188] If the description information includes the number of display faces of the shelf element, then among the edges included in the target outline of the shelf element, the edges that do not coincide with the target outline of the target space are identified as candidate edges. Target edges are selected from the candidate edges in descending order of edge length, and the display face identification information is marked at the target edges. The number of target edges is equal to the number of display faces.

[0189] As one embodiment of this application, the above-described apparatus may further include:

[0190] The goods type recognition module is used to acquire the actual shelf images corresponding to the shelf elements in the target layout diagram, and to recognize the shelf images to determine the goods type in the shelf images. The shelf images include: images of each shelf level in each display face of the actual shelf.

[0191] The correspondence establishment module is used to establish a correspondence between each shelf level in each display face of a shelf element and the type of goods identified from the image corresponding to that shelf level.

[0192] This application also provides an electronic device, such as... Figure 12 As shown, it includes:

[0193] Memory 1201 is used to store computer programs;

[0194] The processor 1202, when executing the program stored in the memory 1201, implements the layout diagram generation method described in any of the above embodiments.

[0195] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 1202, the communication interface, and the memory 1201 communicating with each other via the communication bus.

[0196] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0197] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0198] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0199] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0200] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of the layout diagram generation method described in any of the above embodiments.

[0201] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the layout diagram generation method described in any of the above embodiments.

[0202] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.

[0203] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0204] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0205] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. A method for generating a layout diagram, characterized in that, The method includes: Obtain a hand-drawn layout diagram of the target space, wherein the hand-drawn layout diagram includes: the outline of the target space and the outlines of each element within the target space; Identify key points on each contour and determine two key points located on the same contour and on the contour line between them that have no other key points, as key point pairs, wherein the key points include: turning points, or turning points and endpoints; For each key point pair, when the key point pair meets the adjustment conditions, the two key points in the key point pair are adjusted to be horizontally or vertically aligned. The adjustment conditions are: the angle between the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than an angle threshold and the angle is not 0. By connecting the key points of each key point pair with straight lines, the target space and the target contour of each element are obtained. Based on the outlines of each target, a target layout diagram of the target space is generated.

2. The method according to claim 1, characterized in that, For each keypoint pair, when the adjustment conditions are met, the two keypoints in the keypoint pair are adjusted to be horizontally or vertically aligned, including: Perform the following operations for each contour: Designate any key point on the contour as a reference point; Find the target key point pair that contains the reference point and satisfies the adjustment conditions; If the target key point pair is successfully found, the positions of the other key points in the target key point pair, except for the reference point, are adjusted so that the other key points are horizontally or vertically aligned with the reference point. The reference point is updated to a neighboring key point, and the step of finding a target key point pair that contains the reference point and meets the adjustment conditions is returned until each key point pair on the contour does not meet the adjustment conditions. The neighboring key point is: among the key points on the contour, the key point that belongs to the same key point pair as the reference point and does not belong to the historical reference point.

3. The method according to claim 1, characterized in that, Before adjusting the two key points in each key point pair to horizontal or vertical alignment when the key point pair meets the adjustment conditions, the method further includes: Based on the relative positions of each key point in the hand-drawn layout diagram, map each key point onto a blank layer; For each keypoint pair, when the adjustment conditions are met, the two keypoints in the keypoint pair are adjusted to be horizontally or vertically aligned. Straight lines are then used to connect the keypoints in each keypoint pair to obtain the target space and the target contours of each element, including: The key points in the key point pairs that meet the adjustment conditions in the blank layer are repositioned so that the two key points in the key point pair are horizontally or vertically aligned. The key points in each key point pair in the blank layer are connected by straight lines to obtain the target space and the target outline of each element.

4. The method according to claim 1, characterized in that, For each keypoint pair, when the adjustment conditions are met, the two keypoints in the keypoint pair are adjusted to be horizontally or vertically aligned. Straight lines are then used to connect the keypoints in each keypoint pair to obtain the target space and the target contours of each element, including: The key points in the key point pairs that meet the adjustment conditions in the hand-drawn layout are repositioned so that the two key points in the key point pairs are horizontally or vertically aligned. The outline lines between the key points in the hand-drawn layout are deleted, and the key points in the key point pairs in the hand-drawn layout are connected by straight lines to obtain the target space and the target outline of each element.

5. The method according to any one of claims 1-4, characterized in that, The hand-drawn layout diagram also includes: descriptive information for each element, and the method further includes: For each element in the hand-drawn layout diagram, semantic recognition is performed on the descriptive information of that element; Determine the annotation position of each element based on the area where the target outline of each element is located; Annotate the semantic recognition results of each element at the designated annotation locations; The step of generating a target layout map of the target space based on each target contour includes: Based on the semantic recognition results of each target contour and each labeled element, a target layout map of the target space is generated.

6. The method according to claim 5, characterized in that, The description information includes at least one of the following: element type, shelf level of the shelf element, and number of display surfaces of the shelf element; The step of annotating the semantic recognition results of each element at its designated location includes: If the description information includes element type, then the element type of each element is marked at the marked position of each element; If the description information includes the shelf level of the shelf element, then the shelf level of the shelf element is marked at the marked position of the shelf element; If the description information includes the number of display faces of the shelf element, then among the edges included in the target outline of the shelf element, the edges that do not coincide with the target outline of the target space are determined as candidate edges. Target edges are selected from the candidate edges in descending order of edge length, and the identification information of the display face is marked at the target edges. The number of target edges is equal to the number of display faces.

7. The method according to any one of claims 1-4, characterized in that, After generating the target layout map of the target space, the method further includes: Obtain the shelf image of the real shelf corresponding to the shelf element in the target layout diagram, and identify the shelf image to determine the type of goods in the shelf image. The shelf image includes: images of each shelf level in each display face of the real shelf. For each shelf level in each display face of the shelf element, establish a correspondence between the shelf level and the type of goods identified from the image corresponding to that shelf level.

8. A layout diagram generation apparatus, characterized in that, The device includes: An image acquisition module is used to acquire a hand-drawn layout diagram of a target space, wherein the hand-drawn layout diagram includes: the outline of the target space and the outlines of each element in the target space; The key point recognition module is used to identify key points on each contour and determine two key points located on the same contour and on the contour line between them that have no other key points, as a key point pair. The key points include: turning points, or turning points and endpoints. The key point adjustment module is used to adjust the two key points in each key point pair to be horizontally or vertically aligned when the key point pair meets the adjustment conditions. The adjustment conditions are: the angle between the line connecting the two key points in the key point pair and the horizontal or vertical direction is less than an angle threshold and the angle is not 0. The key point connection module is used to connect the key points of each key point pair with straight lines to obtain the target space and the target contour of each element. The image generation module is used to generate a target layout map of the target space based on the contours of each target.

9. The apparatus according to claim 8, characterized in that, The key point adjustment module is specifically used to perform the following operations for each contour: determine any key point on the contour as a reference point; find a target key point pair that contains the reference point and meets the adjustment conditions; if the target key point pair is successfully found, adjust the positions of other key points in the target key point pair except the reference point so that the other key points are horizontally or vertically aligned with the reference point. The reference point is updated to a neighboring key point, and the step of finding a target key point pair that contains the reference point and meets the adjustment conditions is returned until each key point pair on the contour does not meet the adjustment conditions. The neighboring key point is: among the key points on the contour, the key point that belongs to the same key point pair as the reference point and does not belong to the historical reference point. And / or, The device further includes: a mapping module, used to map each key point to a blank layer according to the relative positional relationship of each key point in the hand-drawn layout drawing; a key point adjustment module, specifically used to adjust the position of key points in key point pairs in the blank layer that meet the adjustment conditions, so that the two key points in the key point pair are horizontally or vertically aligned; and a key point connection module, specifically used to connect the key points in each key point pair in the blank layer with straight lines to obtain the target space and the target outline of each element. And / or, The key point adjustment module is specifically used to adjust the position of key points in key point pairs that meet the adjustment conditions in the hand-drawn layout diagram, so that the two key points in the key point pair are horizontally or vertically aligned; the key point connection module is specifically used to delete the outline lines between each key point in the hand-drawn layout diagram, and connect the key points in each key point pair in the hand-drawn layout diagram with straight lines to obtain the target space and the target outline of each element. And / or, The hand-drawn layout diagram further includes: description information of each element; the device further includes: a semantic recognition module, used to perform semantic recognition on the description information of each element in the hand-drawn layout diagram; a labeling position determination module, used to determine the labeling position of each element based on the area where the target outline of each element is located; a labeling module, used to label the semantic recognition result of each element at the labeling position of each element; and the image generation module, specifically used to generate a target layout diagram of the target space based on the semantic recognition results of each target outline and the labeled elements. And / or, The description information includes at least one of the following: element type, shelf level of shelf element, and number of display faces of shelf element; the annotation module is specifically used for: if the description information includes element type, then annotating the element type of each element at the annotation position of each element; if the description information includes shelf level of shelf element, then annotating the shelf level of the shelf element at the annotation position of the shelf element; if the description information includes number of display faces of shelf element, then among the edges included in the target outline of the shelf element, determining the edges that do not coincide with the target outline of the target space as candidate edges, selecting target edges from the candidate edges in descending order of edge length, and annotating the display face identification information at the target edges, wherein the number of target edges is equal to the number of display faces. And / or, After generating the target layout diagram of the target space, the device further includes: a goods type identification module, used to acquire a shelf image of a real shelf corresponding to a shelf element in the target layout diagram, and to identify the goods type in the shelf image, wherein the shelf image includes: an image of each shelf level in each display face of the real shelf; and a correspondence establishment module, used to establish a correspondence between each shelf level in each display face of the shelf element and the goods type identified from the image corresponding to that shelf level.

10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-7.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.