Commodity recognition method, system, device and storage medium based on dynamic vision
By installing a camera on the top of the smart vending cabinet door to record shopping videos and using product detection algorithms and coding neural network modules for analysis, it solves the problems of high product identification cost and low space utilization in the existing technology, and achieves fast and accurate product identification. Identify and automate settlement.
Patent Information
- Application Number
- CN202311293469.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-30
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2043-09-30
AI Technical Summary
The product identification technology of existing smart vending cabinets has problems such as high labeling costs and high labor costs. In addition, static vision technology has low space utilization due to the camera installation distance requirements, and has strict requirements for product placement, which cannot effectively improve space utilization. and the ability to quickly and accurately identify products.
By installing a camera on the top of the smart vending cabinet door to record the shopping video, perform frame segmentation and cutout processing, and use the product detection algorithm, rotating target detection algorithm and coding neural network module to analyze the shopping video to achieve rapid and accurate identification of products.
It improves the space utilization of smart vending cabinets, reduces product identification costs, removes restrictions on product placement, and enables fast and accurate automated product identification and settlement.
Smart Images

Figure CN117354449B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a commodity recognition method, system, device and storage medium based on dynamic vision. Background Art
[0002] The rise of the unmanned retail industry has brought vending machines into the public eye, and more and more people are pouring into this industry. Compared with convenience stores, unmanned vending machine retail can save a considerable amount of rent, water and electricity costs, and is a high-yield project for those who want to start a small business. At present, there are two types of vending machines on the market for entrepreneurs to choose from. One is the traditional spring machine, which drives the spring to rotate through the motor after coin insertion or code scanning, and the goods are transferred out and dropped to the delivery port for buyers to get the goods; the other is the smart door-opening cabinet, which opens the cabinet door and picks up the goods by scanning the code / face. The spring machine has been gradually eliminated by the market due to the problems of high replenishment cost, high equipment cost, and single saleable goods. The door-opening vending cabinet is gradually accepted and welcomed by the market due to its low cost, high customer unit price, rich variety of saleable goods, and easy use. Among them, the main technical solutions used in the door-opening cabinet are radio frequency identification (RFID), weighing, static vision, etc.
[0003] RFID product identification technology is the earliest darling in the field of smart cabinets. Whether it is a high-frequency solution or an ultra-high-frequency solution, the essence is to use RFID radio frequency technology to bind RFID tags and products, so as to achieve the purpose of identifying tags and identifying products. However, RFID technology has prominent problems such as high tag costs and high labor costs.
[0004] The principle behind gravity sensing is actually the "scale". There are many businesses developing gravity sensing cabinets, and each business uses the "gravity sensor" differently, including single sensor, dual sensor, single scale plate, and multiple scale plates. However, the gravity sensing sensor will produce "creep" after a period of use, resulting in data distortion and incorrect identification. The gravity sensing device needs to be calibrated after half a year, and the subsequent service life of the gravity device is also a factor that needs to be considered. In addition, gravity sensing cannot directly determine the difference between 1 pound of apples and 1 pound of pears, and can only be judged by the gravity difference. Therefore, the SKUs of goods that can be sold in gravity sensing smart cabinets are limited, and their commercial applicability is questionable.
[0005] The static vision technology is characterized in that the original image is obtained through the camera when the user opens the cabinet door, and the current image is obtained through the camera when the user closes the cabinet door. By comparing the original image with the current image, the types of goods on sale and the quantity of goods corresponding to each type of goods on sale are obtained. It not only requires 1-2 cameras to be installed on each layer of sales shelves in the sales cabinet, but also, in order to be able to capture the full picture of the goods on the sales shelves, the camera installation distance has a certain height requirement from the placed goods, that is, a larger spacing space is required between the sales shelves on two adjacent layers, resulting in low overall space utilization of the cabinet and fewer goods that can be placed. In addition, the placement of goods has high requirements. The goods need to be placed neatly and cannot be stacked. Not only is the placement more troublesome, but only fewer goods can be placed.
[0006] Therefore, how to improve the space utilization of smart vending machines while quickly and accurately identifying the goods being sold has become an urgent problem to be solved.
[0007] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0008] The main purpose of the present invention is to provide a commodity recognition method, system, device and storage medium based on dynamic vision, aiming to solve the technical problem of how to quickly and accurately identify the commodities being sold while improving the space utilization rate of smart vending cabinets.
[0009] To achieve the above object, the present invention provides a commodity recognition method based on dynamic vision, and the commodity recognition method based on dynamic vision comprises:
[0010] When the user opens the door of the merchandise cabinet, a shopping video is recorded by a camera installed on the top of the merchandise cabinet door, and the shopping video is frame-processed to obtain multiple shopping images;
[0011] Performing cutout processing on a plurality of shopping images respectively to obtain a plurality of cutout product images;
[0012] Matching the multiple extracted product images with the multiple product images in the product image matching library respectively to obtain image matching similarity information;
[0013] Commodity identification is performed based on the image matching similarity information.
[0014] Optionally, the step of performing cutout processing on the multiple shopping images respectively to obtain multiple cutout product images includes:
[0015] Locate products in multiple shopping images respectively to obtain product location information;
[0016] The plurality of shopping images are respectively subjected to cutout processing according to the commodity position information to obtain a plurality of cutout commodity images.
[0017] Optionally, the step of locating commodities in the plurality of shopping images respectively to obtain commodity location information includes:
[0018] Input multiple shopping images into a preset semantic segmentation model to obtain multiple marked frame images;
[0019] Perform mask covering processing on multiple marked frame images respectively to obtain multiple commodity images to be detected;
[0020] The rotating target detection algorithm is used to locate the products in multiple product images to obtain the product location information.
[0021] Optionally, the step of performing cutout processing on a plurality of shopping images respectively according to the commodity position information to obtain a plurality of cutout commodity images comprises:
[0022] According to the commodity position information, a plurality of commodity images to be detected are subjected to cutout processing by a commodity detection algorithm to obtain a plurality of cutout commodity images.
[0023] Optionally, before the step of matching the plurality of cropped product images with the plurality of product images in the product image matching library to obtain image matching similarity information, the step further includes:
[0024] Determine the vending cabinet number according to the shopping video;
[0025] The corresponding commodity image matching library is loaded according to the vending cabinet number, and the commodity image matching library stores a plurality of commodity images.
[0026] Optionally, the step of matching the plurality of cropped product images with the plurality of product images in the product image matching library to obtain image matching similarity information comprises:
[0027] Preprocessing the plurality of cropped product images respectively to obtain a plurality of preprocessed product images, wherein the preprocessing includes rotation, edge filling and scaling;
[0028] Match multiple preprocessed product images with multiple product images in the product image matching library respectively to obtain image matching similarity information.
[0029] Optionally, the step of matching the plurality of pre-processed product images with the plurality of product images in the product image matching library to obtain image matching similarity information includes:
[0030] Inputting a plurality of preprocessed product images and a plurality of product images in a product image matching library into an encoding neural network model respectively, and obtaining Euclidean distances between the plurality of preprocessed product images and the plurality of product images in the product image matching library;
[0031] The image matching similarity information is determined according to the Euclidean distance.
[0032] In addition, to achieve the above-mentioned purpose, the present invention further proposes a commodity recognition system based on dynamic vision, and the commodity recognition system based on dynamic vision comprises:
[0033] A framing module, used to record a shopping video through a camera installed on the top of the merchandise cabinet door, and perform frame processing on the shopping video to obtain multiple shopping images;
[0034] A processing module, used to perform cutout processing on the multiple shopping images respectively to obtain multiple cutout commodity images;
[0035] A matching module, used to match the multiple extracted product images with the multiple product images in the product image matching library to obtain image matching similarity information;
[0036] The recognition module is used to recognize commodities according to the image matching similarity information.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also proposes a dynamic vision-based commodity identification device, which includes: a memory, a processor, and a dynamic vision-based commodity identification program stored in the memory and executable on the processor, wherein the dynamic vision-based commodity identification program is configured to implement the steps of the dynamic vision-based commodity identification method as described above.
[0038] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a dynamic vision-based commodity recognition program is stored. When the dynamic vision-based commodity recognition program is executed by a processor, the steps of the dynamic vision-based commodity recognition method as described above are implemented.
[0039] When the user opens the door of the commodity cabinet, the present invention first records the shopping video through the camera installed on the top of the commodity cabinet door, and performs frame processing on the shopping video to obtain multiple shopping images, and then performs image clipping processing on the multiple shopping images to obtain multiple clipped commodity images, and then matches the multiple clipped commodity images with multiple commodity images in the commodity image matching library to obtain image matching similarity information, and finally performs commodity identification according to the image matching similarity information. Compared with the prior art of commodity identification through RFID commodity identification technology and static vision technology, the RFID technology has the problems of high label cost and high labor cost, and the static vision technology has a certain height requirement for the installation distance of the camera to be able to capture the full view of the commodities on the shelf, resulting in low overall space utilization, and high requirements for the placement of commodities, and the commodities need to be placed neatly and cannot be stacked. In the present invention, the shopping video is processed through the commodity detection algorithm, the rotating target detection algorithm and the encoding neural network module, so as to achieve rapid and accurate identification of commodities while improving the space utilization of the intelligent vending cabinet. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a structural diagram of a dynamic vision-based commodity recognition device in a hardware operating environment involved in an embodiment of the present invention;
[0041] Figure 2 It is a flow chart of the first embodiment of the commodity recognition method based on dynamic vision of the present invention;
[0042] Figure 3 It is a frame-by-frame sample diagram of a shopping video according to the first embodiment of the commodity recognition method based on dynamic vision of the present invention;
[0043] Figure 4 It is a marking frame image of the first embodiment of the commodity recognition method based on dynamic vision of the present invention;
[0044] Figure 5 This is an example diagram of the main detection area of the first embodiment of the commodity recognition method based on dynamic vision of the present invention;
[0045] Figure 6 This is an example diagram of the commodity detection effect of the first embodiment of the commodity recognition method based on dynamic vision of the present invention;
[0046] Figure 7 The purchased commodity picture is extracted according to the first embodiment of the commodity recognition method based on dynamic vision of the present invention;
[0047] Figure 8 This is a comparison diagram of the effects before and after rotation and scaling of the first embodiment of the commodity recognition method based on dynamic vision of the present invention;
[0048] Fig. 9 It is a feature graph under different weights of the first embodiment of the commodity recognition method based on dynamic vision of the present invention;
[0049] Fig.10 This is a structural diagram of an image similarity measurement algorithm of a first embodiment of a commodity recognition method based on dynamic vision of the present invention;
[0050] Fig.11 It is a structural block diagram of the first embodiment of the commodity recognition system based on dynamic vision of the present invention.
[0051] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0052] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0053] Reference Figure 1 , Figure 1 The figure is a schematic diagram of the structure of a commodity recognition device based on dynamic vision in the hardware operating environment involved in the embodiment of the present invention.
[0054] like Figure 1 As shown, the commodity recognition device based on dynamic vision may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage system independent of the aforementioned processor 1001.
[0055] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the commodity identification device based on dynamic vision, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.
[0056] like Figure 1As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a commodity recognition program based on dynamic vision.
[0057] exist Figure 1 In the commodity recognition device based on dynamic vision shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the commodity recognition device based on dynamic vision of the present invention can be set in the commodity recognition device based on dynamic vision, and the commodity recognition device based on dynamic vision calls the commodity recognition program based on dynamic vision stored in the memory 1005 through the processor 1001, and executes the commodity recognition method based on dynamic vision provided by the embodiment of the present invention.
[0058] The embodiment of the present invention provides a commodity recognition method based on dynamic vision, referring to Figure 2 , Figure 2 It is a flowchart of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0059] In this embodiment, the commodity recognition method based on dynamic vision includes the following steps:
[0060] Step S10: When the user opens the door of the merchandise cabinet, a shopping video is recorded by a camera installed on the top of the door of the merchandise cabinet, and the shopping video is frame-processed to obtain multiple shopping images.
[0061] It is easy to understand that the execution subject of this embodiment can be a dynamic vision-based product identification system with functions such as data processing, network communication and program running, or it can be other computer devices with similar functions, etc., and this embodiment is not limited.
[0062] It should also be understood that in the prior art, not only is it necessary to install 1-2 cameras on each shelf in the vending cabinet, but also in order to be able to capture the full view of the goods on the shelves, the camera installation distance from the placed goods has a certain height requirement, that is, a larger spacing space is required between two adjacent shelves, resulting in low overall space utilization. In the present invention, only 1-2 cameras need to be installed on the top of the cabinet door, and the shopping video is recorded during the shopping process, and then uploaded to the server, and the image recognition algorithm is called to analyze the shopping video, so that the automatic identification and settlement of shopping goods can be realized, and there is no restriction on the placement of goods, and no additional investment cost is required to increase the weighing, and the automatic identification of sales goods can be realized quickly and accurately.
[0063] It should also be noted that the camera starts recording the video when the user opens the cabinet door, and ends the shopping video recording when the user closes the cabinet door to obtain the shopping video. After the shopping video is recorded, it is automatically sent to the algorithm recognition server, and the commodity detection algorithm is called on the server to perform commodity detection. Opencv is used to read the shopping video data frame by frame, and the video is divided into shopping video frame by frame sample images, i.e., multiple shopping images. Figure 3 , Figure 3 This is a frame-by-frame sample diagram of a shopping video of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0064] Step S20: performing cutout processing on the plurality of shopping images respectively to obtain a plurality of cutout product images.
[0065] Furthermore, the multiple shopping images are cut out separately to obtain multiple cut out product images by locating the products in the multiple shopping images separately to obtain product location information; the multiple shopping images are cut out separately according to the product location information to obtain multiple cut out product images.
[0066] In this embodiment, commodity positioning is performed on multiple shopping images respectively, and a processing method for obtaining commodity location information is as follows: the multiple shopping images are respectively input into a preset semantic segmentation model to obtain multiple marked frame images; the multiple marked frame images are respectively subjected to mask covering processing to obtain multiple commodity images to be detected; and the multiple commodity images to be detected are respectively positioned for commodity positioning by a rotating target detection algorithm to obtain commodity location information.
[0067] In the specific implementation, refer to Figure 4 and Figure 5 , Figure 4 is a marking frame image of the first embodiment of the commodity recognition method based on dynamic vision of the present invention, Figure 5 This is an example diagram of the main detection area of the first embodiment of the commodity recognition method based on dynamic vision of the present invention. Since the shopping image contains a container body, noise data may be intercepted during commodity detection. For example, commodities such as corn sausage in the figure are easily mistaken for purchased commodities and misdetected. Therefore, in this step, it is necessary to mark the shopping image with a black frame to obtain a marked frame image, and then perform mask covering processing on the area in the black marked frame in the marked frame image to obtain the commodity to be detected image. The commodity detection algorithm can only detect commodities from the non-black frame area in the commodity to be detected image.
[0068] In order to improve the overall recognition efficiency of the video, the black marked area of the shopping video frame was removed to reduce unnecessary recognition areas. For the video frame processed in the previous step, the non-recognition area at the top was cropped. At the same time, the processed four frames (i.e., four product images to be detected) (the length and width of each frame were reduced to half of the original, and the four reduced images were spliced together, and the size of the spliced image was equal to that of the original frame image) were spliced together and put into the product detection model for detection, which improved the recognition efficiency (equivalent to recognizing 4 images at a time).
[0069] In this embodiment, considering the large number of frames to be recognized, a cluster computing method is adopted to distribute multiple video frames in a task to multiple servers, and the producer-consumer model is used for effective processing to ensure the effectiveness of shopping video recognition.
[0070] Furthermore, the processing method for implementing the black box marking is as follows: collect 500 pictures of the smart door opening vending machine scene; annotate these 500 samples, and use the polygon annotation tool to mark the cabinet part; build the solov2 semantic segmentation algorithm model, and use the above-mentioned annotation data to train the algorithm with the basic model weights; use mosaic enhancement, image rotation and other methods to expand the sample library, and use the expanded sample library to train the model based on the basic model, and perform multi-scale training on the model to enhance the robustness of the model; verify the model, input the cabinet picture, and confirm that the cabinet shown in the black area can be correctly marked, otherwise increase the sample and train the model again; publish the model to obtain the preset semantic segmentation model.
[0071] It should also be noted that in this embodiment, a black frame or the like can be marked in the camera image by manual marking.
[0072] It should also be understood that many purchased products are close together. If a horizontal frame is used for detection, multiple objects are easily framed together, resulting in a high error rate and difficulty in identification. Therefore, during the product detection process, a rotating target detection algorithm is needed to detect and locate the product. Figure 6 , Figure 6 This is an example diagram of the commodity detection effect of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0073] Furthermore, multiple shopping images are cut out according to the product location information, and a processing method for obtaining multiple cut out product images is to cut out multiple product images to be detected by a product detection algorithm according to the product location information to obtain multiple cut out product images.
[0074] In this embodiment, all suspected products are cut out according to the detected product location information x, y, w, h, theta (where x, y represent the center coordinates of the rotation box, w, h represent the width and height of the detection box, and theta represents the rotation angle of the box) to obtain multiple cut-out product images. Figure 7 , Figure 7 This is a picture of purchased goods extracted according to the first embodiment of the method for identifying goods based on dynamic vision of the present invention.
[0075] It should also be understood that the steps for building a product detection algorithm include: collecting 10,000 pictures of smart door vending machines, selecting at least 1,000 pictures containing shopping products, and if there are insufficient pictures, supplementing the corresponding samples, labeling these 1,000 samples, using a rotating box to select the products, building an algorithm model, and using the above-mentioned labeled data to train and tune the algorithm.
[0076] Step S30: matching the plurality of cropped product images with the plurality of product images in the product image matching library respectively to obtain image matching similarity information.
[0077] Before respectively matching the multiple extracted product images with the multiple product images in the product image matching library to obtain the image matching similarity information, the vending machine number is determined according to the shopping video; and the corresponding product image matching library is loaded according to the vending machine number, and the product image matching library stores multiple product images.
[0078] The steps of building a product search matching library, namely, a product image matching library, include: collecting and organizing all the products on the sales platform; taking photos of each product to generate samples, taking photos of each side and angle of each product, and taking at least 20 sample photos of each product; assigning product ID numbers and picture numbers to the photographed products, and storing each product in a folder; extracting a list of all product IDs sold in the cabinet according to the cabinet number; exporting all product sample photos according to the product ID list; and generating a search matching library, namely, a product image matching library, according to the product sample photos.
[0079] Furthermore, the multiple extracted product images are matched with the multiple product images in the product image matching library respectively, and the processing method for obtaining image matching similarity information is as follows: the multiple extracted product images are preprocessed respectively to obtain multiple preprocessed product images, and the preprocessing includes rotation, edge filling and scaling; the multiple preprocessed product images are matched with the multiple product images in the product image matching library respectively to obtain image matching similarity information.
[0080] In this embodiment, the extracted product image is rotated according to the rotation and other detection information returned previously, and the direction of the recognized image is guaranteed to be positive as much as possible. At the same time, the edge of the image is filled or scaled to ensure the consistency of the image scale as much as possible, and finally the preprocessed product image is obtained. Figure 8 , Figure 8 This is a comparison diagram of the effects before and after rotation and scaling of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0081] Furthermore, a plurality of preprocessed product images are matched with a plurality of product images in a product image matching library respectively, and a processing method for obtaining image matching similarity information is to input a plurality of preprocessed product images and a plurality of product images in a product image matching library into an encoding neural network model respectively, and obtain the Euclidean distance between the plurality of preprocessed product images and the plurality of product images in the product image matching library; and determine the image matching similarity information according to the Euclidean distance.
[0082] In this embodiment, the original channel attention mechanism module of the encoding neural network model is changed to a channel and space dual hybrid attention mechanism. The channel attention calculation is performed first, and then the spatial attention calculation is performed, which can more effectively extract and fuse features.
[0083] In a product cutout, obviously not every pixel is equally important for image classification. Only the area where the product is located is the effective area that needs to be focused on. Relatively speaking, the surrounding areas, such as the black background, are noise.
[0084] The role of the attention mechanism is to determine the weight relationship between different channels and different pixel spaces. For example, the channel attention mechanism is to increase the weight of the key channel and suppress the channels with little effect; the spatial attention mechanism is to determine the weight relationship between different pixels in the spatial neighborhood, increase the weight of the pixels in the key area, so that the algorithm pays more attention to the research area we need and reduces the weight of unnecessary areas. Adding the attention mechanism can make the model pay more attention to the effective information area rather than the noise area.
[0085] Among them, the channel structure calculation steps are divided into the following three steps:
[0086] ①: By squeezing the feature map, this step uses global average pooling to convert the feature map from size (N, C, H, W) to (N, C, 1, 1), thus achieving the fusion of global context information.
[0087] ②: Perform MLP (multi-layer perceptron) operation on the global average pooling result. The definition of MLP here is the same as the operation of SE, which is two fully connected layers, with ReLU activation in the middle, and finally the two are added together and activated using the Sigmoid function.
[0088] ③: Multiply the reshaped weight value with the original feature map (this step uses Python's broadcast mechanism) to obtain feature maps under different weights.
[0089] The spatial structure calculation steps are divided into the following two steps:
[0090] ①: The result of the above channel attention operation is convolved in the channel dimension, with the output channel as 1, the convolution kernel size as 3, and the number of channels as C. Finally, the output result is activated by the Sigmoid function, that is, the feature map after the channel attention mechanism is converted from (N, C, H, W) to (N, 1, H, W), so as to achieve the effect of fusing information from different channels.
[0091] ②: Multiply the weight value with the original feature map (this step uses Python's broadcast mechanism) to obtain feature maps with different weights. Fig. 9 , Fig. 9 It is a feature graph under different weights of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0092] It should also be understood that there are many types of goods, up to hundreds of thousands of types. In this model, the encoding vector dimension of the model is optimized and the encoding vector dimension is expanded to 2048 dimensions, giving it better feature expression capabilities.
[0093] In this embodiment, reference Fig.10 , Fig.10 This is a structural diagram of the image similarity measurement algorithm of the first embodiment of the product recognition method based on dynamic vision of the present invention. Two product images x1 (a preprocessed product image) and x2 (a product image in the product image matching library) are respectively input into the encoding neural network model, and high-dimensional (such as 2048) vectors f(x1) and f(x2) are obtained. By calculating the Euclidean distance between f(x1) and f(x2), the similarity between the two vectors is determined, that is, the similarity between the images x1 and x2, that is, the image matching similarity information.
[0094] Step S40: identifying commodities according to the image matching similarity information.
[0095] It should also be noted that the purchased product image is matched and compared with every image in the product gallery to obtain the similarity relationship between the purchased product and all the products on sale in the cabinet, and the label category corresponding to the image with the greatest similarity and the highest match in the search library is used as the final recognition result of the product.
[0096] In this embodiment, when the user opens the door of the commodity cabinet, the shopping video is first recorded by the camera installed on the top of the commodity cabinet door, and the shopping video is framed to obtain multiple shopping images, and then the multiple shopping images are cut out to obtain multiple cut out commodity images, and then the multiple cut out commodity images are matched with multiple commodity images in the commodity image matching library to obtain image matching similarity information, and finally the commodity is identified according to the image matching similarity information. Compared with the prior art of commodity identification through RFID commodity identification technology and static vision technology, the RFID technology has the problems of high label cost and high labor cost, and the static vision technology has a certain height requirement for the installation distance of the camera to be able to capture the full view of the commodities on the shelf, resulting in low overall space utilization, and high requirements for the placement of commodities, and the commodities need to be placed neatly and cannot be stacked. In this embodiment, the shopping video is processed through the commodity detection algorithm, the rotating target detection algorithm and the encoding neural network module, so as to achieve rapid and accurate identification of commodities while improving the space utilization of the intelligent vending cabinet.
[0097] Reference Fig.11 , Fig.11 It is a structural block diagram of the first embodiment of the commodity recognition system based on dynamic vision of the present invention.
[0098] like Fig.11 As shown, the commodity recognition system based on dynamic vision proposed in the embodiment of the present invention includes:
[0099] The framing module 1101 is used to record a shopping video through a camera installed on the top of the merchandise cabinet door, and perform frame processing on the shopping video to obtain multiple shopping images.
[0100] It should also be understood that in the prior art, not only is it necessary to install 1-2 cameras on each shelf in the vending cabinet, but also in order to be able to capture the full view of the goods on the shelves, the camera installation distance from the placed goods has a certain height requirement, that is, a larger spacing space is required between two adjacent shelves, resulting in low overall space utilization. In the present invention, only 1-2 cameras need to be installed on the top of the cabinet door, and the shopping video is recorded during the shopping process, and then uploaded to the server, and the image recognition algorithm is called to analyze the shopping video, so that the automatic identification and settlement of shopping goods can be realized, and there is no restriction on the placement of goods, and no additional investment cost is required to increase the weighing, and the automatic identification of sales goods can be realized quickly and accurately.
[0101] It should also be noted that the camera starts recording the video when the user opens the cabinet door, and ends the shopping video recording when the user closes the cabinet door to obtain the shopping video. After the shopping video is recorded, it is automatically sent to the algorithm recognition server, and the commodity detection algorithm is called on the server to perform commodity detection. Opencv is used to read the shopping video data frame by frame, and the video is divided into shopping video frame by frame sample images, i.e., multiple shopping images. Figure 3 , Figure 3 This is a frame-by-frame sample diagram of a shopping video of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0102] The processing module 1102 is used to perform cutout processing on the multiple shopping images respectively to obtain multiple cutout product images.
[0103] Furthermore, the multiple shopping images are cut out separately to obtain multiple cut out product images by locating the products in the multiple shopping images separately to obtain product location information; the multiple shopping images are cut out separately according to the product location information to obtain multiple cut out product images.
[0104] In this embodiment, commodity positioning is performed on multiple shopping images respectively, and a processing method for obtaining commodity location information is as follows: the multiple shopping images are respectively input into a preset semantic segmentation model to obtain multiple marked frame images; the multiple marked frame images are respectively subjected to mask covering processing to obtain multiple commodity images to be detected; and the multiple commodity images to be detected are respectively positioned for commodity positioning by a rotating target detection algorithm to obtain commodity location information.
[0105] In the specific implementation, refer to Figure 4 and Figure 5 , Figure 4 is a marking frame image of the first embodiment of the commodity recognition method based on dynamic vision of the present invention, Figure 5 This is an example diagram of the main detection area of the first embodiment of the commodity recognition method based on dynamic vision of the present invention. Since the shopping image contains a container body, noise data may be intercepted during commodity detection. For example, commodities such as corn sausage in the figure are easily mistaken for purchased commodities and misdetected. Therefore, in this step, it is necessary to mark the shopping image with a black frame to obtain a marked frame image, and then perform mask covering processing on the area in the black marked frame in the marked frame image to obtain the commodity to be detected image. The commodity detection algorithm can only detect commodities from the non-black frame area in the commodity to be detected image.
[0106] In order to improve the overall recognition efficiency of the video, the black marked area of the shopping video frame was removed to reduce unnecessary recognition areas. For the video frame processed in the previous step, the non-recognition area at the top was cropped. At the same time, the processed four frames (i.e., four product images to be detected) (the length and width of each frame were reduced to half of the original, and the four reduced images were spliced together, and the size of the spliced image was equal to that of the original frame image) were spliced together and put into the product detection model for detection, which improved the recognition efficiency (equivalent to recognizing 4 images at a time).
[0107] In this embodiment, considering the large number of frames to be recognized, a cluster computing method is adopted to distribute multiple video frames in a task to multiple servers, and the producer-consumer model is used for effective processing to ensure the effectiveness of shopping video recognition.
[0108] Furthermore, the processing method for implementing the black box marking is as follows: collect 500 pictures of the smart door opening vending machine scene; annotate these 500 samples, and use the polygon annotation tool to mark the cabinet part; build the solov2 semantic segmentation algorithm model, and use the above-mentioned annotation data to train the algorithm with the basic model weights; use mosaic enhancement, image rotation and other methods to expand the sample library, and use the expanded sample library to train the model based on the basic model, and perform multi-scale training on the model to enhance the robustness of the model; verify the model, input the cabinet picture, and confirm that the cabinet shown in the black area can be correctly marked, otherwise increase the sample and train the model again; publish the model to obtain the preset semantic segmentation model.
[0109] It should also be noted that in this embodiment, a black frame or the like can be marked in the camera image by manual marking.
[0110] It should also be understood that many purchased products are close together. If a horizontal frame is used for detection, multiple objects are easily framed together, resulting in a high error rate and difficulty in identification. Therefore, during the product detection process, a rotating target detection algorithm is needed to detect and locate the product. Figure 6 , Figure 6 This is an example diagram of the commodity detection effect of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0111] Furthermore, multiple shopping images are cut out according to the product location information, and a processing method for obtaining multiple cut out product images is to cut out multiple product images to be detected by a product detection algorithm according to the product location information to obtain multiple cut out product images.
[0112] In this embodiment, all suspected products are cut out according to the detected product location information x, y, w, h, theta (where x, y represent the center coordinates of the rotation box, w, h represent the width and height of the detection box, and theta represents the rotation angle of the box) to obtain multiple cut-out product images. Figure 7 , Figure 7 This is a picture of purchased goods extracted according to the first embodiment of the method for identifying goods based on dynamic vision of the present invention.
[0113] It should also be understood that the steps for building a product detection algorithm include: collecting 10,000 pictures of smart door vending machines, selecting at least 1,000 pictures containing shopping products, and if there are insufficient pictures, supplementing the corresponding samples, labeling these 1,000 samples, using a rotating box to select the products, building an algorithm model, and using the above-mentioned labeled data to train and tune the algorithm.
[0114] The matching module 1103 is used to match the multiple extracted product images with the multiple product images in the product image matching library respectively to obtain image matching similarity information.
[0115] Before respectively matching the multiple extracted product images with the multiple product images in the product image matching library to obtain the image matching similarity information, the vending machine number is determined according to the shopping video; and the corresponding product image matching library is loaded according to the vending machine number, and the product image matching library stores multiple product images.
[0116] The steps of building a product search matching library, namely, a product image matching library, include: collecting and organizing all the products on the sales platform; taking photos of each product to generate samples, taking photos of each side and angle of each product, and taking at least 20 sample photos of each product; assigning product ID numbers and picture numbers to the photographed products, and storing each product in a folder; extracting a list of all product IDs sold in the cabinet according to the cabinet number; exporting all product sample photos according to the product ID list; and generating a search matching library, namely, a product image matching library, according to the product sample photos.
[0117] Furthermore, the multiple extracted product images are matched with the multiple product images in the product image matching library respectively, and the processing method for obtaining image matching similarity information is as follows: the multiple extracted product images are preprocessed respectively to obtain multiple preprocessed product images, and the preprocessing includes rotation, edge filling and scaling; the multiple preprocessed product images are matched with the multiple product images in the product image matching library respectively to obtain image matching similarity information.
[0118] In this embodiment, the extracted product image is rotated according to the rotation and other detection information returned previously, and the direction of the recognized image is guaranteed to be positive as much as possible. At the same time, the edge of the image is filled or scaled to ensure the consistency of the image scale as much as possible, and finally the preprocessed product image is obtained. Figure 8 , Figure 8 This is a comparison diagram of the effects before and after rotation and scaling of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0119] Furthermore, a plurality of preprocessed product images are matched with a plurality of product images in a product image matching library respectively, and a processing method for obtaining image matching similarity information is to input a plurality of preprocessed product images and a plurality of product images in a product image matching library into an encoding neural network model respectively, and obtain the Euclidean distance between the plurality of preprocessed product images and the plurality of product images in the product image matching library; and determine the image matching similarity information according to the Euclidean distance.
[0120] In this embodiment, the original channel attention mechanism module of the encoding neural network model is changed to a channel and space dual hybrid attention mechanism. The channel attention calculation is performed first, and then the spatial attention calculation is performed, which can more effectively extract and fuse features.
[0121] In a product cutout, obviously not every pixel is equally important for image classification. Only the area where the product is located is the effective area that needs to be focused on. Relatively speaking, the surrounding areas, such as the black background, are noise.
[0122] The role of the attention mechanism is to determine the weight relationship between different channels and different pixel spaces. For example, the channel attention mechanism is to increase the weight of the key channel and suppress the channels with little effect; the spatial attention mechanism is to determine the weight relationship between different pixels in the spatial neighborhood, increase the weight of the pixels in the key area, so that the algorithm pays more attention to the research area we need and reduces the weight of unnecessary areas. Adding the attention mechanism can make the model pay more attention to the effective information area rather than the noise area.
[0123] Among them, the channel structure calculation steps are divided into the following three steps:
[0124] ①: By squeezing the feature map, this step uses global average pooling to convert the feature map from size (N, C, H, W) to (N, C, 1, 1), thus achieving the fusion of global context information.
[0125] ②: Perform MLP (multi-layer perceptron) operation on the global average pooling result. The definition of MLP here is the same as the operation of SE, which is two fully connected layers, with ReLU activation in the middle, and finally the two are added together and activated using the Sigmoid function.
[0126] ③: Multiply the reshaped weight value with the original feature map (this step uses Python's broadcast mechanism) to obtain feature maps under different weights.
[0127] The spatial structure calculation steps are divided into the following two steps:
[0128] ①: The result of the above channel attention operation is convolved in the channel dimension, with the output channel as 1, the convolution kernel size as 3, and the number of channels as C. Finally, the output result is activated by the Sigmoid function, that is, the feature map after the channel attention mechanism is converted from (N, C, H, W) to (N, 1, H, W), so as to achieve the effect of fusing information from different channels.
[0129] ②: Multiply the weight value with the original feature map (this step uses Python's broadcast mechanism) to obtain feature maps with different weights. Fig. 9 , Fig. 9 It is a feature graph under different weights of the first embodiment of the commodity recognition method based on dynamic vision of the present invention.
[0130] It should also be understood that there are many types of goods, up to hundreds of thousands of types. In this model, the encoding vector dimension of the model is optimized and the encoding vector dimension is expanded to 2048 dimensions, giving it better feature expression capabilities.
[0131] In this embodiment, reference Fig.10 , Fig.10 This is a structural diagram of the image similarity measurement algorithm of the first embodiment of the product recognition method based on dynamic vision of the present invention. Two product images x1 (a preprocessed product image) and x2 (a product image in the product image matching library) are respectively input into the encoding neural network model, and high-dimensional (such as 2048) vectors f(x1) and f(x2) are obtained. By calculating the Euclidean distance between f(x1) and f(x2), the similarity between the two vectors is determined, that is, the similarity between the images x1 and x2, that is, the image matching similarity information.
[0132] The identification module 1104 is used to identify commodities according to the image matching similarity information.
[0133] It should also be noted that the purchased product image is matched and compared with every image in the product gallery to obtain the similarity relationship between the purchased product and all the products on sale in the cabinet, and the label category corresponding to the image with the greatest similarity and the highest match in the search library is used as the final recognition result of the product.
[0134] In this embodiment, when the user opens the door of the commodity cabinet, the shopping video is first recorded by the camera installed on the top of the commodity cabinet door, and the shopping video is framed to obtain multiple shopping images, and then the multiple shopping images are cut out to obtain multiple cut out commodity images, and then the multiple cut out commodity images are matched with multiple commodity images in the commodity image matching library to obtain image matching similarity information, and finally the commodity is identified according to the image matching similarity information. Compared with the prior art of commodity identification through RFID commodity identification technology and static vision technology, the RFID technology has the problems of high label cost and high labor cost, and the static vision technology has a certain height requirement for the installation distance of the camera to be able to capture the full view of the commodities on the shelf, resulting in low overall space utilization, and high requirements for the placement of commodities, and the commodities need to be placed neatly and cannot be stacked. In this embodiment, the shopping video is processed through the commodity detection algorithm, the rotating target detection algorithm and the encoding neural network module, so as to realize the function of quickly and accurately identifying commodities while improving the space utilization of the intelligent vending cabinet.
[0135] Other embodiments or specific implementations of the commodity identification system based on dynamic vision of the present invention can refer to the above-mentioned method embodiments, which will not be described in detail here.
[0136] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0137] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0138] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0139] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A commodity recognition method based on dynamic vision, It is characterized in that The commodity recognition method based on dynamic vision comprises the following steps: When a user opens a merchandise cabinet door, a shopping video is recorded by a camera installed on the top of the merchandise cabinet door, and the shopping video is sent to an algorithm recognition server. On the algorithm recognition server, opencv in the merchandise detection algorithm is called to read the shopping video frame by frame, and the shopping video is processed by frame division. Multiple video frames are distributed to multiple servers for processing through cluster computing to obtain multiple shopping images. Performing cutout processing on a plurality of shopping images respectively to obtain a plurality of cutout product images; Determine the vending cabinet number according to the shopping video; Loading a corresponding product image matching library according to the vending cabinet number, wherein the product image matching library stores a plurality of product images; Preprocessing the plurality of cropped product images respectively to obtain a plurality of preprocessed product images, wherein the preprocessing includes rotation, edge filling and scaling; Inputting a plurality of preprocessed product images and a plurality of product images in a product image matching library into an encoding neural network model respectively, obtaining the Euclidean distances between the plurality of preprocessed product images and the plurality of product images in the product image matching library, wherein the encoding neural network model changes the original channel attention mechanism module into a channel and space dual hybrid attention mechanism, first performing channel attention calculation, and then performing space attention calculation; The step of inputting the plurality of pre-processed product images and the plurality of product images in the product image matching library into the encoding neural network model to obtain the Euclidean distances between the plurality of pre-processed product images and the plurality of product images in the product image matching library comprises: The multiple pre-processed product images are compressed with the multiple product images in the product image matching library through the global average pooling in the channel attention mechanism to obtain the global average pooling result; The global average pooling result is subjected to an MLP operation, and the reshaped weight values are multiplied by the multiple preprocessed product images and the multiple product images in the product image matching library through the broadcast mechanism of Python to obtain feature maps under different weights under the channel attention mechanism, wherein the MLP operation includes using ReLu activation in the middle, and activating the results of the two fully connected layers by adding them together and then using the Sigmoid function; The feature maps with different weights under the channel attention mechanism are convolved on the channel dimension of the spatial attention mechanism, and the output results are activated by the Sigmoid function; The weight values are multiplied by the plurality of preprocessed product images and the plurality of product images in the product image matching library to obtain feature maps with different weights under the spatial attention mechanism; Determine high-dimensional vectors corresponding to the plurality of pre-processed product images and the plurality of product images in the product image matching library respectively; Calculating the Euclidean distances between the plurality of preprocessed product images and the plurality of product images in the product image matching library according to the high-dimensional vector; Determine image matching similarity information according to the Euclidean distance; Commodity identification is performed based on the image matching similarity information.
2. The method according to claim 1, It is characterized in that The step of performing cutout processing on the multiple shopping images to obtain multiple cutout product images comprises: Locate products in multiple shopping images respectively to obtain product location information; The plurality of shopping images are respectively subjected to cutout processing according to the commodity position information to obtain a plurality of cutout commodity images.
3. The method according to claim 2, It is characterized in that The step of locating commodities in the plurality of shopping images respectively to obtain commodity location information comprises: Input multiple shopping images into a preset semantic segmentation model to obtain multiple marked frame images; Perform mask covering processing on multiple marked frame images respectively to obtain multiple commodity images to be detected; The rotating target detection algorithm is used to locate the products in multiple product images to obtain the product location information.
4. The method according to claim 2, It is characterized in that The step of performing cutout processing on the plurality of shopping images according to the commodity position information to obtain a plurality of cutout commodity images comprises: According to the commodity position information, a plurality of commodity images to be detected are subjected to cutout processing by a commodity detection algorithm to obtain a plurality of cutout commodity images.
5. A commodity recognition system based on dynamic vision, It is characterized in that The commodity recognition system based on dynamic vision includes: A framing module is used to record a shopping video through a camera installed on the top of the commodity cabinet door when a user opens the commodity cabinet door, send the shopping video to an algorithm recognition server, call opencv in the commodity detection algorithm on the algorithm recognition server to read the shopping video frame by frame, perform frame processing on the shopping video, distribute multiple video frames to multiple servers for processing through cluster computing, and obtain multiple shopping images; A processing module, used to perform cutout processing on the multiple shopping images respectively to obtain multiple cutout commodity images; A matching module, used to match the multiple extracted product images with the multiple product images in the product image matching library to obtain image matching similarity information; An identification module, used for identifying commodities according to the image matching similarity information; The matching module is further used to determine the vending cabinet number according to the shopping video; load the corresponding product image matching library according to the vending cabinet number, wherein the product image matching library stores a plurality of product images; The matching module is further used to preprocess the multiple extracted product images respectively to obtain multiple preprocessed product images, wherein the preprocessing includes rotation, edge filling and scaling; input the multiple preprocessed product images and the multiple product images in the product image matching library into the encoding neural network model respectively to obtain the Euclidean distance between the multiple preprocessed product images and the multiple product images in the product image matching library, wherein the encoding neural network model changes the original channel attention mechanism module into a channel and space dual hybrid attention mechanism, first performing channel attention calculation and then performing space attention calculation; determining image matching similarity information according to the Euclidean distance; The matching module is also used to compress multiple pre-processed product images and multiple product images in the product image matching library through global average pooling in the channel attention mechanism to obtain global average pooling results; perform MLP operation on the global average pooling result, and multiply the reshaped weight values with the multiple pre-processed product images and the multiple product images in the product image matching library through the broadcast mechanism of Python to obtain feature maps under different weights under the channel attention mechanism. The MLP operation includes using ReLu activation in the middle, and adding the results of the two fully connected layers and then using Si gmoid function activation; convolution operation is performed on the feature maps under different weights under the channel attention mechanism through the channel dimension of the spatial attention mechanism, and the output result is activated by the Sigmoid function; the weight values are multiplied by the multiple preprocessed product images and the multiple product images in the product image matching library to obtain the feature maps under different weights under the spatial attention mechanism; high-dimensional vectors corresponding to the multiple preprocessed product images and the multiple product images in the product image matching library are determined respectively; and the Euclidean distances between the multiple preprocessed product images and the multiple product images in the product image matching library are calculated according to the high-dimensional vectors.
6. A commodity recognition device based on dynamic vision, It is characterized in that The device includes: a memory, a processor, and a dynamic vision-based commodity recognition program stored in the memory and executable on the processor, wherein the dynamic vision-based commodity recognition program is configured to implement the steps of the dynamic vision-based commodity recognition method as described in any one of claims 1 to 4.
7. A storage medium, It is characterized in that The storage medium stores a dynamic vision-based commodity recognition program, and when the dynamic vision-based commodity recognition program is executed by the processor, the steps of the dynamic vision-based commodity recognition method according to any one of claims 1 to 4 are implemented.
