Image correction method, device, equipment and computer-readable storage medium

By performing rotation correction on the image, the shelf layer and its left and right endpoints are identified to determine the rotation angle, which solves the problem of low product recognition accuracy in unmanned supermarkets and achieves higher recognition accuracy and convenient image processing.

CN113392673BActive Publication Date: 2024-10-18SF TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202010168852.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-12
Publication Date
2024-10-18
Estimated Expiration
2040-03-12

AI Technical Summary

Technical Problem

The existing product recognition model has poor recognition accuracy when it comes to image recognition in unmanned supermarkets, which affects operational efficiency.

Method used

By performing rotation correction on the image, the shelf layer and its left and right endpoints are identified, the inclination and rotation angle are determined, and then the image is rotated to improve the recognition accuracy of the product recognition model.

Benefits of technology

It improves the recognition accuracy of the product recognition model, simplifies image rotation angle processing, is suitable for PDA and other equipment applications on supermarket sites, and improves the accuracy of product recognition results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113392673B_ABST
    Figure CN113392673B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide an image correction method, device, equipment, and computer-readable storage medium, which corrects the image by rotating it, so as to improve the recognition accuracy of the commodity recognition result of the image to a certain extent. The image correction method provided by the embodiments of the present application includes: obtaining an image to be corrected, wherein the image content of the image to be corrected includes commodities and the shelf layer carrying the commodities; identifying the left endpoints and the right endpoints at both ends of the shelf layer from the image to be corrected; detecting the angle between the line segment and the horizontal line, wherein the line segment is composed of the left endpoint and the right endpoint; determining the rotation angle of the image to be corrected according to the angle; rotating the image to be corrected according to the rotation angle to obtain a corrected image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition, and in particular to an image correction method, device, equipment and computer-readable storage medium. Background Art

[0002] In recent years, the construction of the Internet of Things is in full swing, and the Internet of Things is rapidly penetrating into various fields. At the same time, with the continuous increase in labor costs, unmanned supermarkets have become a development trend in the construction of the Internet of Things. Replacing traditional manual management with technological intelligence is expected to become a new breakthrough in the retail industry.

[0003] The operation of unmanned supermarkets cannot be separated from the monitoring of goods. At the scene of unmanned supermarkets, the deployed cameras can monitor the many goods in the supermarket and upload them to the backend server to provide rich data support for the stock keeping unit (SKU) information of the goods in real time. In this process, the server needs to identify the goods in the images collected by the camera and identify the goods contained in the images.

[0004] Among them, the server can use the product recognition model to identify products. It can be seen that the recognition accuracy of the product recognition model plays an important role in the operation of unmanned supermarkets. At the same time, it is found in actual applications that in the existing related technologies, the recognition results of the product recognition model have poor accuracy and still need to be improved. Summary of the invention

[0005] The embodiments of the present application provide an image correction method, apparatus, device, and computer-readable storage medium, which correct an image by rotating it, thereby improving the recognition accuracy of a subsequent product recognition model for a product recognition result of the image to a certain extent.

[0006] In a first aspect, an embodiment of the present application provides a method for correcting an image, the method comprising:

[0007] Acquire an image to be corrected, wherein the image content of the image to be corrected includes commodities and a shelf layer carrying the commodities;

[0008] Identify the left endpoints and the right endpoints at both ends of the shelf layer from the image to be corrected;

[0009] Detecting the angle between a line segment and a horizontal line, wherein the line segment is composed of a left endpoint and a right endpoint;

[0010] According to the included angle, determining the rotation angle of the image to be corrected;

[0011] The image to be corrected is rotated according to the rotation angle to obtain a corrected image.

[0012] In combination with the first aspect of the embodiment of the present application, in a first possible implementation manner of the embodiment of the present application, when the shelf layer includes multiple sub-shelf layers, the left endpoint includes multiple sub-left endpoints, the right endpoint includes multiple sub-right endpoints, and the angle between the detection line segment and the horizontal line includes:

[0013] From the point sets of the left endpoint and the right endpoint, the endpoint groups corresponding to the sub-shelf layers are identified, wherein each endpoint group includes a sub-left endpoint and a sub-right endpoint belonging to the same sub-shelf layer;

[0014] Detect multiple angles between the line segment formed by the endpoint group and the horizontal line;

[0015] According to the included angle, determining the rotation angle of the image to be corrected includes:

[0016] The average of multiple angles is used as the rotation angle of the corrected image.

[0017] In combination with the first possible implementation of the first aspect of the embodiment of the present application, in a second possible implementation of the first aspect of the embodiment of the present application, identifying the endpoint groups corresponding to each sub-shelf layer from the point sets of the left endpoint and the right endpoint includes:

[0018] sequentially detecting the distance between any endpoint among the plurality of left sub-endpoints and any endpoint among the plurality of right sub-endpoints;

[0019] From the plurality of right sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of left sub-endpoints, and from the plurality of left sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of right sub-endpoints;

[0020] The endpoint groups with the shortest distance are summarized and used as the endpoint groups corresponding to each sub-shelf layer.

[0021] In combination with the second possible implementation of the first aspect of the embodiment of the present application, in a third possible implementation of the first aspect of the embodiment of the present application, the endpoint groups with the shortest distances are summarized as the endpoint groups corresponding to the respective sub-shelf layers, including:

[0022] Summarize and obtain the first endpoint group with the shortest distance;

[0023] When there are repeated target endpoints in the first endpoint group, the first endpoint group is optimized, wherein the optimization process is used to eliminate the endpoint groups other than the one with the shortest distance from the multiple endpoint groups corresponding to the target endpoint;

[0024] The first endpoint group after the optimization process is used as the endpoint group corresponding to each sub-shelf layer.

[0025] In combination with the second possible implementation of the first aspect of the embodiment of the present application, in a fourth possible implementation of the first aspect of the embodiment of the present application, the endpoint groups with the shortest distances are summarized as the endpoint groups corresponding to the respective sub-shelf layers, including:

[0026] Summarize and obtain the second endpoint group with the shortest distance;

[0027] When there is a target endpoint group formed by a line segment intersecting the second endpoint group, the second endpoint group is optimized, wherein the optimization is used to eliminate the endpoint groups other than the target endpoint group that obtains the shortest distance;

[0028] The second endpoint groups after the optimization process are used as the endpoint groups corresponding to the sub-shelf layers.

[0029] In combination with the second possible implementation manner of the first aspect of the embodiment of the present application, in a fifth possible implementation manner of the first aspect of the embodiment of the present application, the method further includes:

[0030] Acquire an image labeled with endpoint groups corresponding to each of a plurality of shelf layers;

[0031] The images with endpoint groups corresponding to multiple shelf layers are used as training sets, and the neural network model is trained in combination with the loss function, wherein the loss function includes an endpoint positioning loss function, an endpoint category loss function, and an endpoint grouping loss function;

[0032] From the point sets of the left and right endpoints, the endpoint groups corresponding to the sub-shelf layers are identified as follows:

[0033] By completing the training of the neural network model, the endpoint groups corresponding to each sub-shelf layer are identified from the point sets of the left endpoint and the right endpoint.

[0034] In combination with the first aspect of the embodiment of the present application, in a sixth possible implementation manner of the first aspect of the embodiment of the present application, after rotating the image to be corrected according to the rotation angle to obtain the corrected image, the method further includes:

[0035] The corrected image is processed for product recognition by using a product recognition model to recognize the products contained in the corrected image.

[0036] In a second aspect, an embodiment of the present application provides an image correction device, the device comprising:

[0037] An acquisition unit, used for acquiring an image to be corrected, wherein the image content of the image to be corrected includes commodities and a shelf layer carrying the commodities;

[0038] A recognition unit, used for recognizing the left end point and the right end point at both ends of the shelf layer from the image to be corrected;

[0039] A detection unit, used for detecting an angle between a line segment and a horizontal line, wherein the line segment is composed of a left endpoint and a right endpoint;

[0040] A determination unit, used to determine the rotation angle of the image to be corrected according to the included angle;

[0041] The rotation unit is used to rotate the image to be corrected according to a rotation angle to obtain a corrected image.

[0042] In combination with the second aspect of the embodiment of the present application, in a second possible implementation manner of the embodiment of the present application, when the shelf layer includes multiple sub-shelf layers, the left endpoint includes multiple sub-left endpoints, the right endpoint includes multiple sub-right endpoints, and the detection unit is specifically used to:

[0043] From the point sets of the left endpoint and the right endpoint, the endpoint groups corresponding to the sub-shelf layers are identified, wherein each endpoint group includes a sub-left endpoint and a sub-right endpoint belonging to the same sub-shelf layer;

[0044] Detect multiple angles between the line segment formed by the endpoint group and the horizontal line;

[0045] Determine the unit, specifically for:

[0046] The average of multiple angles is used as the rotation angle of the corrected image.

[0047] In conjunction with the first possible implementation of the second aspect of the embodiment of the present application, in a second possible implementation of the second aspect of the embodiment of the present application, the detection unit is specifically used to:

[0048] sequentially detecting the distance between any endpoint among the plurality of left sub-endpoints and any endpoint among the plurality of right sub-endpoints;

[0049] From the plurality of right sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of left sub-endpoints, and from the plurality of left sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of right sub-endpoints;

[0050] The endpoint groups with the shortest distance are summarized and used as the endpoint groups corresponding to each sub-shelf layer.

[0051] In combination with the second possible implementation manner of the second aspect of the embodiment of the present application, in a third possible implementation manner of the second aspect of the embodiment of the present application, the detection unit is specifically used to:

[0052] Summarize and obtain the first endpoint group with the shortest distance;

[0053] When there are repeated target endpoints in the first endpoint group, the first endpoint group is optimized, wherein the optimization process is used to eliminate the endpoint groups other than the one with the shortest distance from the multiple endpoint groups corresponding to the target endpoint;

[0054] The first endpoint group after the optimization process is used as the endpoint group corresponding to each sub-shelf layer.

[0055] In combination with the second possible implementation manner of the second aspect of the embodiment of the present application, in a fourth possible implementation manner of the second aspect of the embodiment of the present application, the detection unit is specifically used to:

[0056] Summarize and obtain the second endpoint group with the shortest distance;

[0057] When there is a target endpoint group formed by a line segment intersecting the second endpoint group, the second endpoint group is optimized, wherein the optimization is used to eliminate the endpoint groups other than the target endpoint group that obtains the shortest distance;

[0058] The second endpoint groups after the optimization process are used as the endpoint groups corresponding to the sub-shelf layers.

[0059] In conjunction with the second possible implementation manner of the second aspect of the embodiment of the present application, in a fifth possible implementation manner of the second aspect of the embodiment of the present application, the apparatus further includes a training unit, which is used to:

[0060] Acquire an image labeled with endpoint groups corresponding to each of a plurality of shelf layers;

[0061] The images with endpoint groups corresponding to multiple shelf layers are used as training sets, and the neural network model is trained in combination with the loss function, wherein the loss function includes an endpoint positioning loss function, an endpoint category loss function, and an endpoint grouping loss function;

[0062] Identification unit, specifically used for:

[0063] By completing the training of the neural network model, the endpoint groups corresponding to each sub-shelf layer are identified from the point sets of the left endpoint and the right endpoint.

[0064] In combination with the second aspect of the embodiment of the present application, in a sixth possible implementation manner of the second aspect of the embodiment of the present application, the apparatus further includes an application unit, which is configured to:

[0065] The corrected image is processed for product recognition by using a product recognition model to recognize the products contained in the corrected image.

[0066] In a third aspect, an embodiment of the present application further provides an image correction device, including a processor and a memory, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps of any method provided in the embodiment of the present application are executed.

[0067] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the steps of any method provided in an embodiment of the present application.

[0068] From the above content, it can be concluded that the embodiments of the present application have the following beneficial effects:

[0069] Before the commodity images collected from the field are used for commodity identification by the commodity identification model, preprocessing is performed first, that is, the commodity images are rotated and the position of the commodities in the images is corrected, which can facilitate commodity identification by the commodity identification model to a certain extent, thereby improving the commodity identification accuracy of the commodity identification model and obtaining commodity identification results with higher recognition accuracy.

[0070] Furthermore, by combining the identification of the shelf layer and its left and right endpoints, and then determining the inclination and rotation angle based on the left and right endpoints, this not only combines the application scenario of product recognition, but also makes the processing of the image rotation angle more convenient and effective under such a setting, and is more convenient for devices such as PDAs that collect images on-site in supermarkets to apply the image correction method provided in the embodiment of the present application. Subsequently, the corrected image can be uploaded to the cloud server for the product recognition model to perform product recognition processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0072] Figure 1 A schematic diagram of a flow chart of an image correction method in an embodiment of the present application;

[0073] Figure 2 For this application Figure 1 A flow chart of step S103 of the corresponding embodiment;

[0074] Figure 3 For this application Figure 2 A flow chart of step S201 of the corresponding embodiment;

[0075] Figure 4 For this application Figure 3 A flow chart of step S303 of the corresponding embodiment;

[0076] Figure 5 For this application Figure 3 Another flowchart diagram corresponding to step S303 of the embodiment;

[0077] Figure 6 A schematic diagram of the structure of an image correction device according to an embodiment of the present application;

[0078] Figure 7 A schematic diagram of the structure of an image correction device according to an embodiment of the present application. DETAILED DESCRIPTION

[0079] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0080] In the following description, the specific embodiments of the present application will be described with reference to the steps and symbols performed by one or more computers, unless otherwise stated. Therefore, these steps and operations will be mentioned several times as being performed by a computer, and the computer execution referred to herein includes the operation of a computer processing unit by an electronic signal representing data in a structured form. This operation converts the data or maintains it at a location in the memory system of the computer, which can be reconfigured or otherwise change the operation of the computer in a manner familiar to testers in the field. The data structure maintained by the data is a physical location in the memory, which has specific characteristics defined by the data format. However, the principles of the present application are described in the above text, which does not represent a limitation, and testers in the field will understand that the various steps and operations described below can also be implemented in hardware.

[0081] The principles of the present application may be operated using many other general or specific purpose computing, communication environments or configurations. Examples of well-known computing systems, environments and configurations suitable for use with the present application may include, but are not limited to, handheld phones, personal computers, servers, multiprocessor systems, microcomputer-based systems, mainframe computers, and distributed computing environments, including any of the above systems or devices.

[0082] The terms "first", "second", and "third" in this application are used to distinguish different objects rather than to describe a specific order. In addition, the terms "include", "have", and any variations thereof are intended to cover non-exclusive inclusions.

[0083] First of all, before introducing the embodiments of the present application, the relevant content about the application background of the embodiments of the present application is introduced.

[0084] In the existing related technologies, since the images collected at the supermarket site are affected by actual conditions such as limited on-site shooting space, limited shooting positions or staff shooting technology, the arrangement of goods in the image is often distorted and tilted. In this case, when the image is based on artificial intelligence (AI) technology, that is, when it is input into a product recognition model for product recognition, it is easy to increase the difficulty of recognition and affect the accuracy of recognition, thereby interfering with the application of the product recognition model.

[0085] Based on the above-mentioned defects in the existing related technologies, the embodiments of the present application provide an image correction method, which at least overcomes the defects in the existing related technologies to a certain extent.

[0086] The image correction method mentioned in the embodiment of the present application may be executed by an image correction device, or a server device, a physical host, or a user equipment (UE) or other different types of image correction devices integrated with the image correction device, wherein the image correction device may be implemented in hardware or software, and the UE may be a terminal device such as a smart phone, a tablet computer, a laptop computer, a PDA, a handheld computer, a desktop computer, or a personal digital assistant (PDA). The image correction device may also be divided into multiple devices, which jointly execute the image correction method provided in the embodiment of the present application.

[0087] Next, the image correction method provided by the embodiment of the present application is introduced.

[0088] See also Figure 1 , Figure 1 A schematic diagram of a flow chart of an image correction method in an embodiment of the present application is shown. Figure 1 As shown, the image correction method provided in the embodiment of the present application may specifically include the following steps:

[0089] Step S101, obtaining an image to be corrected, wherein the image content of the image to be corrected includes commodities and a shelf layer carrying the commodities;

[0090] Step S102, identifying the left endpoints and the right endpoints at both ends of the shelf layer from the image to be corrected;

[0091] Step S103, detecting the angle between the line segment and the horizontal line, wherein the line segment is composed of a left endpoint and a right endpoint;

[0092] Step S104, determining the rotation angle of the image to be corrected according to the included angle;

[0093] Step S105: rotating the image to be corrected according to the rotation angle to obtain a corrected image.

[0094] exist Figure 1 It can be seen from the technical solution proposed in the illustrated embodiment that before the commodity image collected from the scene is used for commodity identification by the commodity identification model, preprocessing is performed first, that is, the commodity image is rotated and the position of the commodity in the image is corrected, which can facilitate the commodity identification by the commodity identification model to a certain extent, thereby improving the commodity identification accuracy of the commodity identification model and obtaining a commodity identification result with higher recognition accuracy.

[0095] Furthermore, by combining the identification of the shelf layer and its left and right endpoints, and then determining the inclination and rotation angle based on the left and right endpoints, this not only combines the application scenario of product recognition, but also makes the processing of the image rotation angle more convenient and effective under such a setting, and is more convenient for devices such as PDAs that collect images on-site in supermarkets to apply the image correction method provided in the embodiment of the present application. Subsequently, the corrected image can be uploaded to the cloud server for the product recognition model to perform product recognition processing.

[0096] The following continues Figure 1 The specific implementation methods of each step of the illustrated embodiment are described in detail:

[0097] In the embodiment of the present application, the image to be corrected refers to an image obtained by photographing the goods on site in the supermarket, and the image may include the shelf layer and the goods carried thereon. The acquisition of the image to be corrected may be the act of photographing the goods on site in the supermarket; or it may be understood as the act of receiving the image to be corrected uploaded by the on-site device on the cloud server; or it may be understood as the act of extracting the image to be corrected from the device or memory storing the image to be corrected.

[0098] The identification of the left and right endpoints at both ends of the shelf layer can be achieved based on the image recognition of the shelf layer. It is easy to understand that the shelf mainly includes the shelf layer directly used to carry the goods and other supporting structures. For example, a common shelf has four columns, and the multi-layer shelf layer is arranged between the four columns to form a multi-layer structure. The shelf layer is often a regular shape in the image, generally a rectangle, or a flat, elongated square. Therefore, compared with the goods, the difficulty of identification is lower. The shelf layer and the partial image of the two ends of the shelf layer can be quickly identified. In the identified image, the endpoints at both ends of the upper edge of the shelf layer can be identified as the left and right endpoints of the shelf layer; or, in the identified image, the two ends of the lower edge of the shelf layer can be identified as the left and right endpoints of the shelf layer; or, in the identified image, the center line that divides the shelf layer into upper and lower parts can also be extracted, and the two ends of the center line can be identified as the left and right endpoints of the shelf layer. The left endpoint and the right endpoint of the shelf layer can be specifically the upper edge, the lower edge or the middle position of each shelf layer, preferably the same position is used at the ends. After the shelf layer is identified, the left endpoint and the right endpoint of the shelf layer can be simply identified according to the preset endpoint position. The identified left endpoint and the right endpoint of the shelf layer can exist in the form of pixels or vectors.

[0099] Taking the neural network model to identify shelf layers and their left and right endpoints as an example, images with endpoint groups corresponding to multiple shelf layers are labeled in advance; then, the images with endpoint groups corresponding to multiple shelf layers are labeled as training sets, and the neural network model is trained in combination with the loss function. The trained neural network model can be used to identify the shelf layers and their left and right endpoints in the image to be corrected.

[0100] In practical applications, the shelf layer contained in the image to be corrected may be only one layer or multiple layers. In the case of multiple layers, an endpoint set containing multiple endpoints can be identified, and the set contains multiple left and right endpoints, that is, the left endpoint includes multiple sub-left endpoints, and the right endpoint includes multiple sub-right endpoints.

[0101] At the same time, in an exemplary embodiment, as a specific implementation of the above step S102, as shown in FIG. Figure 2 This application shown Figure 1 A flowchart of step S103 of the corresponding embodiment may include:

[0102] Step S201, identifying endpoint groups corresponding to respective sub-shelf layers from the point sets of the left endpoint and the right endpoint, wherein each endpoint group includes a sub-left endpoint and a sub-right endpoint belonging to the same sub-shelf layer;

[0103] It should be understood that when multiple endpoints are initially identified, the resulting point set is unprocessed and only contains basic information about the endpoints, such as corresponding pixels or vectors. The left and right endpoints can be simply divided into left and right endpoints based on their positions in the image to be corrected. For multi-layer shelves, it is also necessary to identify the corresponding endpoint groups for each shelf layer.

[0104] It can be understood that the endpoint group of each shelf layer can be combined with the positions of the left and right endpoints in the image to be corrected, and the image range of the shelf layer in the image to be corrected to identify the correspondence between the left and right endpoints and the shelf layer. Specifically, if a left endpoint and a right endpoint are both located in the image range of a shelf layer, the two endpoints can be identified as an endpoint group, and in view of the correspondence between the endpoint group and the shelf layer.

[0105] Alternatively, you can start directly from the endpoint itself. It should be understood that the left and right endpoints belonging to the same shelf layer have a shorter distance between points. Therefore, you can consider connecting lines and combining the distance between points to identify the endpoint group belonging to the same shelf layer, avoiding the more complex image recognition involved in the first recognition method.

[0106] Step S202, detecting multiple angles between the line segment formed by the endpoint group and the horizontal line;

[0107] When multiple endpoint groups are identified, multiple line segments can be constructed and the angles between these line segments and the horizontal line can be detected.

[0108] Correspondingly, Figure 1 The determination process of the rotation angle in step S104 of the corresponding embodiment may include:

[0109] The average of multiple angles is used as the rotation angle of the corrected image.

[0110] It can be understood that in the present application, the average of the multiple angles obtained as described above can be directly used as the rotation angle, and data processing is relatively simple, wherein the rotation direction of the rotation angle is the direction of rotation toward the horizontal line.

[0111] It should be understood that in the embodiment of the present application, the rotation processing of the image is performed in the plane where the image to be corrected is located. While ensuring a low data processing amount, it can also avoid the influence of complex image transformation on the deformation of the goods in the image to be corrected, thereby effectively achieving the correction effect on the image to be corrected and improving the recognition accuracy of the subsequent product recognition model.

[0112] Furthermore, as mentioned above Figure 2 For a specific implementation of step S201 in the corresponding embodiment, see Figure 3 This application shown Figure 2A flowchart of step S201 of the corresponding embodiment may include:

[0113] Step S301, sequentially detecting the distance between any endpoint among a plurality of left sub-endpoints and any endpoint among a plurality of right sub-endpoints;

[0114] When dividing endpoint groups directly based on endpoints, first calculate the point spacing between different left and right endpoints for use in the following data processing.

[0115] Step S302, sequentially determining, from among the plurality of right sub-endpoints, an endpoint that has the shortest distance to each of the plurality of left sub-endpoints, and sequentially determining, from among the plurality of left sub-endpoints, an endpoint that has the shortest distance to each of the plurality of right sub-endpoints;

[0116] It can be understood that when obtaining the point distance between any left and right endpoints, each endpoint and the endpoint on the other side where the shortest point distance is obtained can be determined in turn.

[0117] Step S303: Summarize the endpoint groups with the shortest distances and use them as the endpoint groups corresponding to the sub-shelf layers.

[0118] By combining each endpoint on both sides and the endpoint with the shortest point distance, the endpoint group belonging to the same shelf layer can be matched.

[0119] Taking a set of data as an example, for the left side, multiple sub-left endpoints and the endpoints on the other side where the shortest point spacing is achieved are {(L1,R2),(L2,R3),(L3,R4),(L4,R5)}, and for the right side, multiple sub-right endpoints and the endpoints on the other side where the shortest point spacing is achieved are {(R2,L1),(R3,L2),(R4,L3),(R5,L4)}. The data on both sides are consistent. In this case, {(L1,R2),(L2,R3),(L3,R4),(L4,R5)} can be used as the identified endpoint group.

[0120] Of course, in actual applications, there may be errors in the identified endpoint groups. Based on the actual situation that each shelf layer corresponds to only one set of left and right endpoints, the endpoint groups can be optimized to eliminate the incorrectly identified endpoint groups to ensure the validity of the endpoint groups, such as the following two cases:

[0121] First case

[0122] Figure 4 This application shown Figure 3 A flow chart of step S303 of the corresponding embodiment, the above Figure 3 In step S303 of the corresponding embodiment, optimization of the endpoint group may also be introduced, such as Figure 4 As shown, it may include:

[0123] Step S401, summarizing and obtaining the first endpoint group with the shortest distance;

[0124] Similar to the above, when each endpoint on both sides and the first endpoint with the shortest point spacing are initially obtained, they can be summarized, and the endpoint groups that fit each other are considered to be valid endpoint groups for identification. When repeated endpoints appear, at least two groups of endpoint groups corresponding to the endpoint are incorrectly identified.

[0125] It is easy to understand that each shelf layer must correspond to a set of left and right endpoints. Even due to the inclination, there will only be a special case where there is only one left or right endpoint of the shelf layer, and there will not be two left endpoints or two right endpoints. Similarly, the same endpoint corresponds to a shelf layer, and there will not be a situation where it belongs to two endpoint groups and corresponds to two shelf layers.

[0126] Step S402, when there are repeated target endpoints in the first endpoint group, the first endpoint group is optimized, wherein the optimization process is used to eliminate the endpoint groups other than the one with the shortest distance from the multiple endpoint groups corresponding to the target endpoint;

[0127] For repeated endpoints, the point distances between the two endpoints in the endpoint groups may be extracted for at least two endpoint groups to which the endpoint currently belongs, and only the endpoint group with the shortest distance is retained.

[0128] For example, if an endpoint A is connected to two endpoints B and C, then according to the vector distances d(VA, VB) and d(VA, VC), delete the line with the longer distance. That is, if d(VA, VB)>(VA, VC), delete the line between endpoints A and B, otherwise delete the line between endpoints A and C.

[0129] Step S403: The first endpoint group after the optimization process is used as the endpoint group corresponding to each sub-shelf layer.

[0130] After the above optimization processing, the output can be the endpoint groups corresponding to each sub-shelf layer.

[0131] Second case

[0132] Similar to the first case, Figure 5 This application shown Figure 3 Another flow chart of step S303 of the corresponding embodiment, the above Figure 3 In step S303 of the corresponding embodiment, the following may also be included:

[0133] Step S501, summarizing and obtaining the second endpoint group with the shortest distance;

[0134] Among them, step S501 and the following step S503 can refer to the above Figure 4 The corresponding steps S401 and S403 are not described in detail here.

[0135] Step S502, when there is a target endpoint group formed by the line segments intersecting in the second endpoint group, the second endpoint group is optimized, wherein the optimization process is used to eliminate the endpoint groups other than the target endpoint group that obtains the shortest distance;

[0136] It can be understood that in the case of abnormal endpoint group identification, in addition to the case where one endpoint appears in more than two endpoint groups, there may also be a case where the straight lines formed by the identified two endpoint groups form an intersection.

[0137] In practical applications, shelf layers are generally arranged horizontally, and there is no intersection between different shelf layers. Correspondingly, if only horizontally arranged shelf layers are considered, the line segments formed by the identified endpoint groups should not intersect. Therefore, the endpoint groups that form intersections from these line segments can be summarized, and only the line segment length, that is, the endpoint group with the shortest point spacing, is retained.

[0138] For example, if the line connecting endpoints A and B intersects the line connecting endpoints C and D, if the distance d(VA, VB)>d(VC, VD), delete the line connecting endpoints A and B, otherwise delete the line connecting endpoints C and D.

[0139] Step S503: The optimized second endpoint groups are used as endpoint groups corresponding to the sub-shelf layers.

[0140] It should be noted that, in actual applications, the optimization processing corresponding to the two situations in the above examples can be executed one by one, or both can be triggered to eliminate the endpoint groups that are incorrectly identified and ensure the validity of the endpoint groups.

[0141] Through the above processing, after the image to be corrected is corrected by rotation, the corrected image can be applied to continue the subsequent commodity recognition processing. Figure 1 After step S401 of the corresponding embodiment, the image correction method provided by the embodiment of the present application may further include:

[0142] The corrected image is processed for product recognition by using a product recognition model to recognize the products contained in the corrected image.

[0143] The commodity recognition model may be an existing commodity recognition model, or may be a commodity recognition model obtained by improving and optimizing an existing commodity recognition model. These commodity recognition models are used to perform commodity recognition processing on an input image of a commodity to be recognized, and recognize the commodity contained in the image. Since the input image of the commodity recognition model is rotated through the image correction method provided in the embodiment of the present application, the placement posture of the commodity contained in the image is corrected to a certain extent, and thus a correction effect can be achieved to a certain extent, which can make it easier for the commodity recognition model to recognize commodities, thereby improving the commodity recognition accuracy of the commodity recognition model.

[0144] The commodity recognition model is obtained by training with a large number of images containing commodities and carrying commodity annotations. Specifically, during the training process of the model, images containing commodities and carrying commodity annotations can be input into the initial neural network model in sequence for forward propagation. The images can be obtained by manually adding annotations. The loss function is then calculated based on the commodity recognition results output by the model, and back propagation is performed to adjust and optimize the model parameters. After repeated propagation and optimization, the trained model is the commodity recognition model.

[0145] It should be noted that the image correction method provided in the embodiment of the present application can be implemented as a neural network model in whole or in part. The model establishment process can refer to the above content, for example Figure 1 The step S102 of the corresponding embodiment can be implemented in combination with the endpoint recognition model.

[0146] Correspondingly, the image correction method provided in the embodiment of the present application may also include a process of establishing an endpoint recognition model:

[0147] Acquire an image labeled with endpoint groups corresponding to each of a plurality of shelf layers;

[0148] The images with endpoint groups corresponding to multiple shelf layers are used as training sets, and the neural network model is trained in combination with the loss function, wherein the loss function includes an endpoint positioning loss function, an endpoint category loss function, and an endpoint grouping loss function;

[0149] It can be understood that the endpoint positioning loss function is used to indicate the accuracy of the endpoints at both ends of the shelf layer identified by the model, so that the model can be trained to accurately locate the endpoints at both ends of the shelf layer; the endpoint category loss function is used to indicate the accuracy of the left and right ends identified by the model from the initial endpoint set, so that the model can be trained to accurately distinguish the left and right endpoints; the endpoint grouping loss function is used to indicate the accuracy of the endpoint group identified by the model, so that the model can be trained to accurately identify the endpoint group, minimize the distance between endpoints belonging to the same group, and maximize the distance between endpoints belonging to different groups.

[0150] Correspondingly, Figure 1 The corresponding step S102 of the embodiment may be:

[0151] By completing the training of the neural network model, the endpoint groups corresponding to each sub-shelf layer are identified from the point sets of the left endpoint and the right endpoint.

[0152] It should be noted that the model that applies all or part of the steps of the image correction method provided in the embodiment of the present application can not only exist independently, but also be embedded in the existing product recognition model, so as to combine the function of the image correction method provided in the embodiment of the present application to further improve the recognition accuracy of the product recognition model.

[0153] Similarly, the establishment of the model of the embodiment of the present application mentioned in the above content can also be embedded in the process of establishing the existing product recognition model. The product recognition model thus established can also have the functions that can be obtained by the image correction method provided in the embodiment of the present application.

[0154] In order to facilitate better implementation of the image correction method provided in the embodiment of the present application, the embodiment of the present application also provides an image correction device.

[0155] See also Figure 6 , Figure 6 600 is a structural diagram of an image correction device according to an embodiment of the present application. In the embodiment of the present application, the image correction device 600 may specifically include the following structure:

[0156] An acquisition unit 601 is used to acquire an image to be corrected, wherein the image content of the image to be corrected includes commodities and a shelf layer carrying the commodities;

[0157] The identification unit 602 is used to identify the left endpoints and the right endpoints at both ends of the shelf layer from the image to be corrected;

[0158] A detection unit 603, configured to detect an angle between a line segment and a horizontal line, wherein the line segment is composed of a left endpoint and a right endpoint;

[0159] A determination unit 604, configured to determine a rotation angle of the image to be corrected according to the included angle;

[0160] The rotation unit 605 is used to rotate the image to be corrected according to a rotation angle to obtain a corrected image.

[0161] In an exemplary embodiment, when the shelf layer includes multiple sub-shelf layers, the left endpoint includes multiple sub-left endpoints, and the right endpoint includes multiple sub-right endpoints, the detection unit 603 is specifically used to:

[0162] From the point sets of the left endpoint and the right endpoint, the endpoint groups corresponding to the sub-shelf layers are identified, wherein each endpoint group includes a sub-left endpoint and a sub-right endpoint belonging to the same sub-shelf layer;

[0163] Detect multiple angles between the line segment formed by the endpoint group and the horizontal line;

[0164] Determine the unit, specifically for:

[0165] The average of multiple angles is used as the rotation angle of the corrected image.

[0166] In another exemplary embodiment, the detection unit 603 is specifically configured to:

[0167] sequentially detecting the distance between any endpoint among the plurality of left sub-endpoints and any endpoint among the plurality of right sub-endpoints;

[0168] From the plurality of right sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of left sub-endpoints, and from the plurality of left sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of right sub-endpoints;

[0169] The endpoint groups with the shortest distance are summarized and used as the endpoint groups corresponding to each sub-shelf layer.

[0170] In another exemplary embodiment, the detection unit 603 is specifically configured to:

[0171] Summarize and obtain the first endpoint group with the shortest distance;

[0172] When there are repeated target endpoints in the first endpoint group, the first endpoint group is optimized, wherein the optimization process is used to eliminate the endpoint groups other than the one with the shortest distance from the multiple endpoint groups corresponding to the target endpoint;

[0173] The first endpoint group after the optimization process is used as the endpoint group corresponding to each sub-shelf layer.

[0174] In another exemplary embodiment, the detection unit 603 is specifically configured to:

[0175] Summarize and obtain the second endpoint group with the shortest distance;

[0176] When there is a target endpoint group formed by a line segment intersecting the second endpoint group, the second endpoint group is optimized, wherein the optimization is used to eliminate the endpoint groups other than the target endpoint group that obtains the shortest distance;

[0177] The second endpoint groups after the optimization process are used as the endpoint groups corresponding to the sub-shelf layers.

[0178] In yet another exemplary embodiment, the apparatus further includes a training unit 606, configured to:

[0179] Acquire an image labeled with endpoint groups corresponding to each of a plurality of shelf layers;

[0180] The images with endpoint groups corresponding to multiple shelf layers are used as training sets, and the neural network model is trained in combination with the loss function, wherein the loss function includes an endpoint positioning loss function, an endpoint category loss function, and an endpoint grouping loss function;

[0181] The detection unit 603 is specifically used for:

[0182] By completing the training of the neural network model, the endpoint groups corresponding to each sub-shelf layer are identified from the point sets of the left endpoint and the right endpoint.

[0183] In yet another exemplary embodiment, the apparatus further includes an application unit 607, configured to:

[0184] The corrected image is processed for product recognition by using a product recognition model to recognize the products contained in the corrected image.

[0185] The present application also provides an image correction device, see Figure 7 , Figure 7 A schematic diagram of the structure of an image correction device according to an embodiment of the present application is shown. Specifically, the image correction device provided by the present application includes a processor 701, and the processor 701 is used to execute a computer program stored in a memory 702 to implement the following Figures 1 to 6 Corresponding to each step of the image correction method in any embodiment; or, the processor 701 is used to execute the computer program stored in the memory 702 to implement the following Figure 6 The functions of each unit in the corresponding embodiment.

[0186] Exemplarily, the computer program may be divided into one or more modules / units, one or more modules / units are stored in the memory 702, and executed by the processor 701 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device.

[0187] The image correction device may include, but is not limited to, the processor 701 and the memory 702. Those skilled in the art will appreciate that the illustration is merely an example of the image correction device and does not constitute a limitation on the image correction device. The image correction device may include more or fewer components than shown in the illustration, or may combine certain components, or different components. For example, the image correction device may also include an input / output device, a network access device, a bus, etc. The processor 701, the memory 702, the input / output device, and the network access device are connected via a bus.

[0188] The processor 701 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the image correction device, and uses various interfaces and lines to connect various parts of the entire device.

[0189] The memory 702 can be used to store computer programs and / or modules. The processor 701 implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory 702 and calling the data stored in the memory 702. The memory 702 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc.; the data storage area can store data created according to the use of the image correction device, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0190] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the image correction device, equipment and corresponding units described above can refer to the following. Figures 1 to 6 The description of the method in any embodiment will not be repeated here in detail.

[0191] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0192] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the present application as follows: Figures 1 to 6Corresponding to the steps in the image correction method in any embodiment, the specific operations can be referred to as follows Figures 1 to 6 The description of the image correction method in any embodiment will not be repeated here.

[0193] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0194] Due to the instructions stored in the computer-readable storage medium, the present application can be executed. Figures 1 to 6 Corresponding to the steps in the image correction method in any embodiment, the present application can be implemented as follows Figures 1 to 6 The beneficial effects that can be achieved by the image correction method in any embodiment are detailed in the previous description and will not be repeated here.

[0195] The image correction method, device, equipment and computer-readable storage medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for correcting an image, characterized in that: The method comprises: Acquire an image to be corrected, wherein the image content of the image to be corrected includes commodities and a shelf layer carrying the commodities; Identify the left endpoints and the right endpoints at both ends of the shelf layer from the image to be corrected; When the shelf layer includes a plurality of sub-shelf layers, the left endpoint includes a plurality of sub-left endpoints, and the right endpoint includes a plurality of sub-right endpoints, from the set of the left endpoints and the right endpoints, the endpoint groups corresponding to the sub-shelf layers are identified, wherein each of the endpoint groups includes the sub-left endpoints and the sub-right endpoints belonging to the same sub-shelf layer; Detecting a plurality of angles between a line segment formed by the endpoint group and a horizontal line, wherein the line segment is formed by both the left endpoint and the right endpoint; Taking the average of the multiple included angles as the rotation angle of the image to be corrected; Rotating the image to be corrected according to the rotation angle to obtain a corrected image; The step of identifying the endpoint groups corresponding to the respective sub-shelf layers from the point sets of the left endpoint and the right endpoint comprises: sequentially detecting the distance between any endpoint of the plurality of left sub-endpoints and any endpoint of the plurality of right sub-endpoints; From the plurality of right sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of left sub-endpoints, and from the plurality of left sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of right sub-endpoints; Summarize and obtain the endpoint groups with the shortest distance as the endpoint groups corresponding to the sub-shelf layers; The endpoint groups obtained by summarizing the shortest distance as the endpoint groups corresponding to the sub-shelf layers include: Summarize and obtain the first endpoint group with the shortest distance; When there are repeated target endpoints in the first endpoint group, the first endpoint group is optimized, wherein the optimization is used to eliminate the endpoint groups other than the one with the shortest distance from the multiple endpoint groups corresponding to the target endpoint; The first endpoint groups after the optimization process are used as the endpoint groups corresponding to the sub-shelf layers.

2. The method according to claim 1, characterized in that The endpoint group obtained by summarizing the shortest distance as the endpoint group corresponding to each of the sub-shelf layers also includes: Summarize the second endpoint group with the shortest distance; When there is a target endpoint group formed by the line segments intersecting in the second endpoint group, the second endpoint group is optimized, wherein the optimization is used to eliminate the endpoint groups other than those that obtain the shortest distance in the target endpoint group; The second endpoint groups after the optimization process are used as the endpoint groups corresponding to the sub-shelf layers.

3. The method according to claim 1, characterized in that The method further comprises: Acquire an image labeled with endpoint groups corresponding to each of a plurality of shelf layers; The images labeled with the endpoint groups corresponding to the multiple shelf layers are used as training sets, and a neural network model is trained in combination with a loss function, wherein the loss function includes an endpoint positioning loss function, an endpoint category loss function, and an endpoint grouping loss function; The step of identifying the endpoint groups corresponding to the respective sub-shelf layers from the point sets of the left endpoint and the right endpoint comprises: By completing the training of the neural network model, the endpoint groups corresponding to each of the sub-shelf layers are identified from the point sets of the left endpoint and the right endpoint.

4. The method according to claim 1, characterized in that: After rotating the image to be corrected according to the rotation angle to obtain a corrected image, the method further includes: The corrected image is subjected to commodity recognition processing by using a commodity recognition model to recognize the commodity contained in the corrected image.

5. An image correction device, characterized in that: The device comprises: An acquisition unit, configured to acquire an image to be corrected, wherein the image content of the image to be corrected includes commodities and a shelf layer carrying the commodities; An identification unit, used for identifying the left endpoint and the right endpoint of both ends of the shelf layer from the image to be corrected; A detection unit, for, when the shelf layer includes a plurality of sub-shelf layers, the left endpoint includes a plurality of sub-left endpoints, and the right endpoint includes a plurality of sub-right endpoints, identifying, from a set of the left endpoints and the right endpoints, endpoint groups corresponding to the sub-shelf layers, wherein each of the endpoint groups includes a sub-left endpoint and a sub-right endpoint belonging to the same sub-shelf layer; detecting a plurality of angles between a line segment formed by the endpoint group and a horizontal line, wherein the line segment is formed by both the left endpoint and the right endpoint; A determination unit, configured to use the average of the multiple included angles as the rotation angle of the image to be corrected; A rotation unit, used for rotating the image to be corrected according to the rotation angle to obtain a corrected image; The step of identifying the endpoint groups corresponding to the respective sub-shelf layers from the point sets of the left endpoint and the right endpoint comprises: sequentially detecting the distance between any endpoint of the plurality of left sub-endpoints and any endpoint of the plurality of right sub-endpoints; From the plurality of right sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of left sub-endpoints, and from the plurality of left sub-endpoints, sequentially determine the endpoint that has the shortest distance to each of the plurality of right sub-endpoints; Summarize and obtain the endpoint groups with the shortest distance as the endpoint groups corresponding to the sub-shelf layers; The endpoint groups obtained by summarizing the shortest distance as the endpoint groups corresponding to the sub-shelf layers include: Summarize and obtain the first endpoint group with the shortest distance; When there are repeated target endpoints in the first endpoint group, the first endpoint group is optimized, wherein the optimization is used to eliminate the endpoint groups other than the one with the shortest distance from the multiple endpoint groups corresponding to the target endpoint; The first endpoint groups after the optimization process are used as the endpoint groups corresponding to the sub-shelf layers.

6. An image correction device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and the processor executes the method according to any one of claims 1 to 4 when calling the computer program in the memory.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Retail terminal goods shelf image intelligent analyzing system based on cloud processing method

    CN102982332A

  • Commodity displaying method and system

    CN107464136A

  • Method for identifying coin year, terminal device, and computer-readable storage medium

    CN108256520A

  • Multi-size shelf commodity detection method

    CN110321769A

  • Two-directions scanning method

    US20030147102A1