Disclosure of Invention
Aiming at the defects in the prior art, the method, the device, the computer equipment and the storage medium for detecting the goods out-of-stock state solve the problems of low detection efficiency and detection errors in the method for manually detecting the goods out-of-stock state in the prior art, automate and intelligentize the method for detecting the goods out-of-stock, improve the detection efficiency and reduce the labor cost; in addition, the commodity display and the price tag display are fused and matched, so that the out-of-stock position on the goods shelf can be accurately found, the name of the out-of-stock commodity can be still detected in the state that the commodity is completely sold out, the detection precision of the out-of-stock state is improved, and the actual requirement of the excess of the merchant is met.
In a first aspect, the present invention provides a method for detecting a goods out-of-stock state, where the method includes: carrying out detection frame calibration on price tags and commodity targets in the visual image of the goods shelf to obtain each target detection frame; carrying out image recognition on the area image in each target detection frame, and obtaining a virtual shelf display state according to an image recognition result; performing fusion matching on the commodity display in the virtual shelf display state and the price tag display to obtain commodity information bound in each price tag; and comparing the commodity information bound in each price tag with the out-of-stock threshold value, and obtaining a detection result of the out-of-stock state of the commodity according to the comparison result.
Optionally, the image recognition of the area image in each target detection frame and obtaining the virtual shelf display state according to the image recognition result includes: acquiring parameter information of each target detection frame; performing image recognition on the area image in each target detection frame to obtain a target type and a commodity name in each detection frame, wherein the target type comprises commodities and price tags; and binding the parameter information of each target detection frame with the corresponding target type and commodity name to obtain a virtual shelf display state comprising commodity display and price tag display.
Optionally, performing image recognition on the area image in each target detection frame to obtain the target type and the image name in each detection frame, including: obtaining the target type in each detection frame according to the parameter information of each target detection frame; and selecting a corresponding image algorithm to perform image recognition on the area image according to the target type to obtain a corresponding commodity name in each detection frame.
Optionally, the method further comprises: when the price tag identical to the name of the target commodity is not detected, generating a virtual price tag at a position corresponding to the target commodity; and binding the target commodity name and the virtual price tag.
Optionally, when the commodity information includes the quantity of commodities, comparing the commodity information bound in each price tag with an out-of-stock threshold, and obtaining a detection result of the out-of-stock state of the commodity according to the comparison result, including: judging whether the quantity of the commodities is smaller than a first stock shortage threshold value or not; and when the number of the commodities is smaller than the first goods shortage threshold value, the detection result of the current goods shortage state is that the commodities are out of stock.
Optionally, when the commodity information includes a total area of the commodity, comparing the commodity information bound in each price tag with an out-of-stock threshold, and obtaining a detection result of an out-of-stock state of the commodity according to the comparison result, including: judging whether the total area of the commodities is smaller than a second out-of-stock threshold value or not; and when the total area of the commodities is smaller than the second goods shortage threshold value, the detection result of the current goods shortage state is the goods shortage.
Optionally, the method further comprises: and when the detection result of the goods shortage state is the shortage state, controlling the corresponding electronic price tag on the goods shelf to perform flashing prompt or using different colors to prompt the corresponding price tag on the virtual goods shelf display.
In a second aspect, the present invention provides a device for detecting the out-of-stock state of a commodity, the device comprising: the detection frame calibration module is used for carrying out detection frame calibration on the price tags and the commodity targets in the visual image of the goods shelf to obtain each target detection frame; the image recognition module is used for carrying out image recognition on the area image in each target detection frame and obtaining the display state of the virtual goods shelf according to the image recognition result; the fusion matching module is used for performing fusion matching on the commodity display and the price tag display in the virtual shelf display state to obtain the commodity information bound in each price tag; and the threshold comparison module is used for comparing the commodity information bound in each price tag with the out-of-stock threshold and obtaining the detection result of the out-of-stock state of the commodity according to the comparison result.
In a third aspect, the present invention provides a computer device, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: carrying out detection frame calibration on price tags and commodity targets in the visual image of the goods shelf to obtain each target detection frame; carrying out image recognition on the area image in each target detection frame, and obtaining a virtual shelf display state according to an image recognition result; performing fusion matching on the commodity display in the virtual shelf display state and the price tag display to obtain commodity information bound in each price tag; and comparing the commodity information bound in each price tag with the out-of-stock threshold value, and obtaining the detection result of the out-of-stock state of the commodity according to the comparison result.
In a fourth aspect, the present invention provides a readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of: carrying out detection frame calibration on the price tags and commodity targets in the visual image of the shelf to obtain each target detection frame; carrying out image recognition on the area image in each target detection frame, and obtaining a virtual shelf display state according to an image recognition result; performing fusion matching on the commodity display in the virtual shelf display state and the price tag display to obtain commodity information bound in each price tag; and comparing the commodity information bound in each price tag with the out-of-stock threshold value, and obtaining a detection result of the out-of-stock state of the commodity according to the comparison result.
Compared with the prior art, the invention has the following beneficial effects:
in the embodiment, the virtual shelf display state comprising the commodity display and the price tag display is obtained by carrying out detection frame calibration and image recognition on the visual image of the shelf, the price tag information and the commodity information displayed on the virtual shelf are subjected to fusion processing, the matching of the commodity is bound on the specified price tag, and the commodity information bound on the price tag is compared with the set out-of-stock threshold value, so that whether the commodity is in the out-of-stock state is detected according to the comparison result; therefore, the invention solves the problems of low detection efficiency and detection error in the method for manually detecting the goods shortage state in the prior art, and the method for detecting the goods shortage is automated and intelligentized, thereby not only improving the detection efficiency, but also reducing the labor cost; in addition, the commodity display and the price tag display are fused and matched, so that the out-of-stock position on the goods shelf can be accurately found, the name of the out-of-stock commodity can be still detected in the state that the commodity is completely sold out, the detection precision of the out-of-stock state is improved, and the actual requirement of the excess of the merchant is met.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In a first aspect, the present invention provides a method for detecting a merchandise out-of-stock state, which specifically includes the following embodiments:
fig. 1 is a schematic flow chart of a method for detecting a product out-of-stock state according to an embodiment of the present invention, and as shown in fig. 1, the method specifically includes the following steps:
and step S101, calibrating the detection frames of the price tags and the commodity targets in the visual image of the shelf to obtain each target detection frame.
In this embodiment, the front visual image of the shelf shown in fig. 3 can be acquired by a handheld image capturing device, a camera shown in fig. 2a and installed in front of the shelf, or a camera shown in fig. 2b and taken by an inspection robot, and the like, where fig. 3 is not an actual acquired image but a schematic diagram. And then carrying out detection frame calibration on the price tags and the commodities in the visual image of the shelf through a detection algorithm, wherein the detection frame calibration is used for calibrating a single area image in the whole image, and the target detection frame shown in the figure 4 is obtained.
And step S102, carrying out image recognition on the area image in each target detection frame, and obtaining the virtual shelf display state according to the image recognition result.
In an embodiment, the image recognition of the area image in each target detection frame and the obtaining of the virtual shelf display state according to the image recognition result comprise: acquiring parameter information of each target detection frame; performing image recognition on the area image in each target detection frame to obtain a target type and an image name in each detection frame, wherein the target type comprises a commodity and a price tag; and binding the parameter information of each target detection frame with the corresponding target type and image name to obtain a virtual shelf display state comprising commodity display and price tag display.
Optionally, performing image recognition on the area image in each target detection frame to obtain the target type and the image name in each detection frame, including: obtaining the target type in each detection frame according to the parameter information of each target detection frame; and selecting a corresponding image algorithm to perform image recognition on the area image according to the target type to obtain the commodity name in each detection frame, and taking the commodity name as the image name.
It should be noted that after the detection frames of the visual image are calibrated, the position information of each target detection frame may be obtained, where the position information includes four vertex coordinates of each detection frame, the area information of each detection frame is calculated according to the four vertex coordinates of each detection frame, and the parameter information of each target detection frame includes the position information of each detection frame and the area information of each detection frame.
Further, detecting the target type of the current area image according to the coordinates of the four vertexes of each target detection frame; optionally, according to the actual position of the shelf price tag, setting a longitudinal coordinate value in a vertex coordinate of the price tag type as a preset interval in advance; and if all the ordinate values of the current target detection frame are within the preset interval, the target type of the current target detection frame is the price tag, and if not, the current target detection frame is the commodity. According to this method, the type of object within each image detection can be derived.
Furthermore, according to the target type in each target detection frame, extracting the area image of the detection frame, and selecting a corresponding image recognition algorithm to perform image recognition, so that a commodity name matched with each area image can be obtained; specifically, when the area image with the target type of the price tag is identified, a recognition algorithm in computer vision is used for recognizing characters on the image, then the character recognition result is mapped with actual commodity information in a background system, a commodity name corresponding to the price tag is determined, and finally the position information and the commodity name of each price tag are bound to be used as the price tag display of the shelf. In addition, the commodity identification with the target type being commodity uses an image identification or image retrieval method to obtain the commodity name corresponding to each commodity, and finally the position information and the commodity name of each commodity are bound to be used as the commodity display of the goods shelf; the virtual shelf display state shown in fig. 5 can be obtained by acquiring the price tag display and the merchandise display.
And step S103, performing fusion matching on the commodity display in the virtual shelf display state and the price tag display to obtain the commodity information bound in each price tag.
In this embodiment, fig. 5 only shows the display states of the commodities and the price tags on the current shelf, and the current number of the commodities is not known, so that the commodities on the virtual shelf and the corresponding price tags need to be bound to obtain information of the commodities bound in each price tag; the commodity information comprises commodity quantity and commodity total area.
It should be noted that the fused matching in this embodiment refers to binding each commodity on the shelf with its nearby corresponding price tag, for example, binding and recording the commodity a on the price tag a, and if the commodity and its nearby price tag do not belong to the same class, not binding. After final matching, each price tag records that n corresponding commodities exist in the goods shelf, and the number c of the n commodities or the total area s of the n commodity detection frames can be recorded.
And step S104, comparing the commodity information bound in each price tag with the out-of-stock threshold value, and obtaining the detection result of the out-of-stock state of the commodity according to the comparison result.
In this embodiment, when the commodity information is the quantity of commodities, comparing the commodity information bound in each price tag with the stock shortage threshold, and obtaining a detection result of the stock shortage state of the commodity according to the comparison result, the method includes: judging whether the quantity of the commodities is smaller than a first stock shortage threshold value or not; and when the number of the commodities is smaller than the first goods shortage threshold value, the detection result of the current goods shortage state is that the commodities are out of stock.
In this embodiment, when the commodity information is a total area of the commodity, comparing the commodity information bound in each price tag with an out-of-stock threshold, and obtaining a detection result of an out-of-stock state of the commodity according to the comparison result, including: judging whether the total area of the commodities is smaller than a second out-of-stock threshold value or not; and when the total area of the commodities is smaller than the second goods shortage threshold value, the detection result of the current goods shortage state is the goods shortage.
It should be noted that, a stock shortage threshold is set for each type of product, the product information recorded in the price tag is compared with the corresponding stock shortage threshold, and whether stock shortage occurs is determined according to the comparison result. The threshold value can be set to be the minimum quantity a or the minimum area b, and when c is smaller than a or s and b, the commodity is judged to be out of stock.
As shown in fig. 5, the price tag and the commodity in the shelf image are detected and identified; matching and corresponding the commodities near the price tag, for example, matching and corresponding the A commodities to the price tag A; and then judging whether the price tags corresponding to the commodities prompt the out-of-stock state or not according to a preset out-of-stock threshold, for example, setting the out-of-stock threshold as the quantity of the commodities, and judging that the out-of-stock state is prompted if the quantity is less than 2, wherein the price tag of the commodity E is only matched with 1 commodity in the figure, and the price tag of the commodity J is matched with 0 commodity in the figure, so that the goods shortage states are prompted by the E and the J. In the figure, although the areas near the article B and the article F are vacant, the out-of-stock state is not presented.
The image acquisition in the embodiment can be obtained by photographing through the handheld camera device, the camera arranged in front of the goods shelf and the class inspection robot; the recognition and calculation of the image can be carried out on a cloud server, the inside of the robot or an edge computing device; the display of the out-of-stock state of the goods can be embodied on a background system or an actual price tag.
Compared with the prior art, the embodiment has the following beneficial effects:
in the embodiment, the virtual shelf display state comprising the commodity display and the price tag display is obtained by carrying out detection frame calibration and image recognition on the visual image of the shelf, the price tag information and the commodity information displayed on the virtual shelf are subjected to fusion processing, the matching of the commodity is bound on the specified price tag, and the commodity information bound on the price tag is compared with the set out-of-stock threshold value, so that whether the commodity is in the out-of-stock state is detected according to the comparison result; therefore, the invention solves the problems of low detection efficiency and detection error in the method for manually detecting the goods shortage state in the prior art, and the method for detecting the goods shortage is automated and intelligentized, thereby not only improving the detection efficiency, but also reducing the labor cost; in addition, the commodity display and the price tag display are fused and matched, so that the out-of-stock position on the goods shelf can be accurately found, the name of the out-of-stock commodity can be still detected in the state that the commodity is completely sold out, the detection precision of the out-of-stock state is improved, and the actual requirement of the excess of the merchant is met.
In another embodiment of the present invention, the method further comprises: when the price tag which is the same as the name of the target commodity is not detected, generating a virtual price tag at a position corresponding to the target commodity; and binding the target commodity name and the virtual price tag. In the present invention, when all or part of the price tags are not present in the visual image of the shelf, the price tag position may be automatically generated using the display drawing of the shelf.
In another embodiment of the present invention, the method further comprises: and when the detection result of the goods shortage state is the shortage state, controlling the corresponding electronic price tag on the goods shelf to perform flashing prompt or using different colors to prompt the corresponding price tag on the virtual goods shelf display. Note that, the display of the out-of-stock state of the product is performed according to the comparison result in step S104, and for the out-of-stock product, the corresponding price tag on the shelf is displayed in a highlighted manner using a different color, or the price tag is presented by flashing.
In a second aspect, the present invention provides a device for detecting the out-of-stock state of a commodity, the device comprising: the detection frame calibration module is used for carrying out detection frame calibration on the price tags and the commodity targets in the visual image of the goods shelf to obtain each target detection frame; the image recognition module is used for carrying out image recognition on the area image in each target detection frame and obtaining a virtual shelf display state according to an image recognition result; the fusion matching module is used for performing fusion matching on the commodity display and the price tag display in the virtual shelf display state to obtain the commodity information bound in each price tag; and the threshold comparison module is used for comparing the commodity information bound in each price tag with the out-of-stock threshold and obtaining the detection result of the out-of-stock state of the commodity according to the comparison result.
In a third aspect, the present invention provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: carrying out detection frame calibration on price tags and commodity targets in the visual image of the goods shelf to obtain each target detection frame; carrying out image recognition on the area image in each target detection frame, and obtaining a virtual shelf display state according to an image recognition result; performing fusion matching on the commodity display and the price tag display in the virtual shelf display state to obtain commodity information bound in each price tag; and comparing the commodity information bound in each price tag with the out-of-stock threshold value, and obtaining a detection result of the out-of-stock state of the commodity according to the comparison result.
In a fourth aspect, the invention provides a readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of: carrying out detection frame calibration on the price tags and commodity targets in the visual image of the shelf to obtain each target detection frame; carrying out image recognition on the area image in each target detection frame, and obtaining a virtual shelf display state according to an image recognition result; performing fusion matching on the commodity display in the virtual shelf display state and the price tag display to obtain commodity information bound in each price tag; and comparing the commodity information bound in each price tag with the out-of-stock threshold value, and obtaining a detection result of the out-of-stock state of the commodity according to the comparison result.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.