Intelligent identification method, system and equipment based on bread image and medium
By performing image quality evaluation and edge device deployment of pre-trained models in bread intelligent recognition system, combining path enhancement structure and multi-scale pooling, the identification reliability and stability problems in the prior art are solved, achieving more accurate and efficient bread identification.
Patent Information
- Application Number
- CN202411062380.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-11-22
AI Technical Summary
The existing bread intelligent identification technology has challenges in recognition reliability and stability in actual applications. The traditional image acquisition method is affected by external factors such as light, angle, and occlusion, resulting in errors in recognition results, and complex data set acquisition and model training.
Acquire bread image data through store cameras, perform image quality evaluation and exception processing, use pre-trained convolutional neural network model to perform feature extraction and target recognition on edge devices, combine path enhancement structure and multi-scale pooling, and train and optimize model parameters in real time. , realize the identification and classification of bread.
It improves image data quality, reduces the impact of noise, reduces the demand for cloud data transmission, enhances the spatial positioning ability and generalization performance of the model, and improves the accuracy and real-time recognition.
Smart Images

Figure CN119007192A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to an intelligent recognition method, system, device and medium based on bread images. Background Art
[0002] Bread intelligent recognition technology mainly relies on advanced technologies such as AI image recognition, machine learning and deep learning. These technologies can capture the shape, color and size of bread through the camera, and quickly and accurately identify the type and price of bread. This technology is widely used in the retail industry, especially in 24-hour unmanned smart bakeries. Customers only need to place the selected bread in the designated area, and the system will automatically identify and display the price within a few seconds, thus realizing self-service checkout.
[0003] Although deep learning has achieved remarkable results in the field of image recognition, the reliability and stability of the technology are still a challenge in practical applications; the traditional image acquisition method has the problem of untimely feedback, which may cause producers to be unable to adjust the image acquisition environment and conditions in time, thus affecting the final recognition effect; in practical applications, external factors such as light, angle, and occlusion have a great impact on the accuracy of image recognition. These factors may cause errors in recognition results; the recognition and classification of bread requires a large amount of data sets for model training and optimization, and requires detailed labeling and classification for different types of bread, which poses certain challenges to the acquisition of data sets and model training. Summary of the invention
[0004] In order to solve the above problems existing in the prior art, the present invention provides a method, system, device and medium for intelligent recognition of bread images.
[0005] The purpose of the present invention can be achieved through the following technical solutions:
[0006] S1: Obtain bread image data through store cameras, preset image quality evaluation indicators and image validity verification rules, perform abnormal image recognition processing and noise interference processing on the bread image data that meets the image validity verification rules according to the image quality evaluation indicators to obtain pre-processed image data; calibrate the recognition range of the pre-processed image data and unify the data format;
[0007] S2: Preset an initial training set according to the data standard library, use a convolutional neural network as a feature value extraction model for bread images, pre-train the feature value extraction model using the initial training set to obtain a pre-trained model, and compress and optimize the pre-trained model before deploying it to an edge computing device;
[0008] S3: constructing a target recognition model in the edge computing device, wherein the target recognition model extracts a feature map of the preprocessed image data through the pretrained model, retains the spatial information of the feature map and enhances the spatial positioning capability of the feature map through a path enhancement structure, performs multi-scale pooling on the feature map through a pooling module and concatenates and fuses the feature map to obtain a multi-scale feature map of the preprocessed image data; classifies and regresses the position of the bread detection target according to the multi-scale feature map to obtain an output vector;
[0009] S4: construct a target training set through bread image data obtained by the store in real time every day, preset a target loss function, train the target recognition model through the target training set, calculate the loss value of the current training data according to the output vector output by the target recognition model and the loss function, calculate the loss gradient of the model parameters of the target recognition model through the back propagation algorithm, and update the model parameters according to the loss gradient using the stochastic gradient descent method;
[0010] S5: Obtain settlement product images through the bread detection system of the store automatic settlement platform, perform target recognition on the settlement product images through the target recognition model to obtain bread identification types and quantities, and feed back to the store automatic settlement platform.
[0011] Specifically, the image quality evaluation indicators include natural image evaluation indicators, visual information fidelity, and perception evaluation indicators; the natural image evaluation indicator is the pixel-level difference between the standard image and the processed image, the visual information fidelity is the image distortion evaluation index affected by brightness, contrast, color, and structure of the human eye's perception of the image, and the perception evaluation indicator is the brightness, contrast, and structural information of the processed image.
[0012] Specifically, the image validity verification rule is a qualified judgment threshold of the image quality assessment index.
[0013] Specifically, the compression optimization method is: structured pruning of the convolutional layer and the fully connected layer of the pre-trained model, and converting the floating-point parameters into 8-bit integers.
[0014] Specifically, the path enhancement structure aggregates three groups of feature vectors at a time, and adjusts the number of channels of the feature vector with the lowest dimension to the number of channels of the feature vector with the middle dimension through a one-dimensional convolution layer, and then converts the dimension of the feature vector with the lowest dimension to the dimension of the feature vector with the middle dimension by upsampling. The calculation formula is:
[0015]
[0016] Among them, Y2 is the fused feature vector, UpSample is the upsampling operation, using the nearest interpolation method, Y1 is the lowest dimensional feature vector, and Y2 is the middle layer feature vector. For splicing operation.
[0017] Specifically, the multi-scale feature performs weighted processing on each channel of the feature map through a multi-layer perceptron, and obtains a weight coefficient through an activation function calculation, multiplies the weight coefficient with the original feature map to obtain a channel feature map, performs maximum pooling and average pooling on the channel feature map, and performs convolution processing after splicing and fusion to obtain a spatial attention feature map, and multiplies the spatial attention feature map with the channel feature map to obtain the multi-scale feature map. The calculation formula is: F′=F×σ(MLP(Avgpool(F))+MLP(Maxpool(F)))×σ(f n×n (f c (Avgpool(F)),MLP(Maxpool(F)))),
[0018] Among them, F′ is a multi-scale feature map, F is the original feature map, Avgpool(F) is the average pooling operation, Maxpool(F) is the maximum pooling operation, and f n×n To filter using n×n convolution kernel, f c is a combination, σ is an activation function, and MLP is a multi-layer perceptron.
[0019] Specifically, the target loss function includes confidence loss, classification loss and position loss. The confidence loss and the classification loss are calculated by a binary cross entropy function, and the calculation formula is:
[0020]
[0021] Among them, L obj is the confidence loss, L cls is the classification loss, S represents the number of cells; B represents the number of candidate boxes in each cell, Indicates that the value is 1 when a positive sample appears in the jth prediction box in the i-th cell, otherwise it is 0; I ij Indicates that the value is 1 when there is no positive sample in the jth prediction box in the i-th cell, otherwise it is 0; C i represents the true target confidence in the i-th cell, represents the confidence of the predicted target in the i-th cell; λ is the weight coefficient, classes is the number of categories of the training target, and p i (c) represents the probability value of the true box of this category, The probability value of the predicted box for this category;
[0022] The position loss is calculated by the overlap between the predicted frame and the real frame, and the calculation formula is:
[0023]
[0024] Among them, L coord is the position loss, IoU is the intersection over union of the predicted bounding box and the actual bounding box, b is the center of the predicted bounding box, and b gt is the center of the actual bounding box, c is the diagonal length of the minimum rectangle covering the predicted bounding box and the actual bounding box, a is the weight function, and v is the consistency parameter for measuring the aspect ratio.
[0025] An intelligent recognition system based on bread images, comprising: a preprocessing module, a pretraining module, a target recognition module, a model training module, and an application module;
[0026] The preprocessing module is used to obtain bread image data through a store camera, preset image quality evaluation indicators and image validity verification rules, and perform abnormal image recognition processing and noise interference processing on the bread image data that meets the image validity verification rules according to the image quality evaluation indicators to obtain preprocessed image data; calibrate the recognition range of the preprocessed image data and unify the data format;
[0027] The pre-training module is used to preset an initial training set according to a data standard library, use a convolutional neural network as a feature value extraction model for a bread image, pre-train the feature value extraction model through the initial training set to obtain a pre-trained model, and compress and optimize the pre-trained model before deploying it to an edge computing device;
[0028] The target recognition module is used to build a target recognition model in the edge computing device, the target recognition model extracts the feature map of the preprocessed image data through the pre-trained model, retains the spatial information of the feature map and enhances the spatial positioning ability of the feature map through the path enhancement structure, performs multi-scale pooling on the feature map through the pooling module and splices and fuses the feature map to obtain a multi-scale feature map of the preprocessed image data; classifies and regresses the position of the bread detection target according to the multi-scale feature map to obtain an output vector;
[0029] The model training module is used to construct a target training set through bread image data obtained by the store in real time every day, preset a target loss function, train the target recognition model through the target training set, calculate the loss value of the current training data according to the output vector output by the target recognition model and the loss function, calculate the loss gradient of the model parameters of the target recognition model through the back propagation algorithm, and update the model parameters using the stochastic gradient descent method according to the loss gradient;
[0030] The application module is used to obtain settlement commodity pictures through the bread detection system of the store automatic settlement platform, perform target recognition on the settlement commodity pictures through the target recognition model to obtain the bread identification type and quantity and feed back to the store automatic settlement platform.
[0031] The beneficial effects of the present invention are:
[0032] Through image quality evaluation indicators and image validity verification rules, abnormal image recognition and noise interference processing are performed on real-time data source images to detect whether there are problems such as pixel damage, blur, distortion, etc. in the image, verify the content, size, format, etc. of the image, exclude non-standard or abnormal image data, identify and filter out non-standard image data, reduce the impact of noise data, improve data quality, and enhance the reliability of subsequent processing and analysis; by pre-training feature extraction models according to data standard libraries and deploying them to edge computing devices, complex model training on edge devices is avoided, the computing efficiency of edge devices is improved, data can be processed and analyzed locally, and the demand for data transmission to the cloud is reduced, which helps to reduce network transmission volume and delay, especially for application scenarios of store settlement platforms with high real-time requirements; by retaining the spatial information of the feature map through the path enhancement structure and enhancing the spatial positioning ability of the feature map, it helps to retain the spatial information of the original feature map. Through more precise path enhancement operations, the spatial resolution of the feature map can be improved, making the feature map more detailed, which helps to accurately represent the spatial structure and pattern in the image, improve the model's visual representation ability of the image, and enable the model to better capture and transmit key information in the image, which helps to improve the performance and generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.
[0034] Figure 1 The figure is a flow chart of an intelligent bread image recognition method according to the present invention. DETAILED DESCRIPTION
[0035] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments.
[0036] See also Figure 1 , an intelligent recognition method based on bread images:
[0037] S1: Obtain bread image data through store cameras, preset image quality evaluation indicators and image validity verification rules, perform abnormal image recognition processing and noise interference processing on the bread image data that meets the image validity verification rules according to the image quality evaluation indicators to obtain pre-processed image data; calibrate the recognition range of the pre-processed image data and unify the data format;
[0038] S2: Preset an initial training set according to the data standard library, use a convolutional neural network as a feature value extraction model for bread images, pre-train the feature value extraction model using the initial training set to obtain a pre-trained model, and compress and optimize the pre-trained model before deploying it to an edge computing device;
[0039] S3: constructing a target recognition model in the edge computing device, wherein the target recognition model extracts a feature map of the preprocessed image data through the pretrained model, retains the spatial information of the feature map and enhances the spatial positioning capability of the feature map through a path enhancement structure, performs multi-scale pooling on the feature map through a pooling module and concatenates and fuses the feature map to obtain a multi-scale feature map of the preprocessed image data; classifies and regresses the position of the bread detection target according to the multi-scale feature map to obtain an output vector;
[0040] S4: construct a target training set through bread image data obtained by the store in real time every day, preset a target loss function, train the target recognition model through the target training set, calculate the loss value of the current training data according to the output vector output by the target recognition model and the loss function, calculate the loss gradient of the model parameters of the target recognition model through the back propagation algorithm, and update the model parameters according to the loss gradient using the stochastic gradient descent method;
[0041] S5: Obtain settlement product images through the bread detection system of the store automatic settlement platform, perform target recognition on the settlement product images through the target recognition model to obtain bread identification types and quantities, and feed back to the store automatic settlement platform.
[0042] Specifically, the image quality evaluation indicators include natural image evaluation indicators, visual information fidelity, and perception evaluation indicators; the natural image evaluation indicator is the pixel-level difference between the standard image and the processed image, the visual information fidelity is the image distortion evaluation index affected by brightness, contrast, color, and structure of the human eye's perception of the image, and the perception evaluation indicator is the brightness, contrast, and structural information of the processed image.
[0043] Specifically, the image validity verification rule is a qualified judgment threshold of the image quality assessment index.
[0044] Specifically, the compression optimization method is: structured pruning of the convolutional layer and the fully connected layer of the pre-trained model, and converting the floating-point parameters into 8-bit integers.
[0045] Specifically, the path enhancement structure aggregates three groups of feature vectors at a time, and adjusts the number of channels of the feature vector with the lowest dimension to the number of channels of the feature vector with the middle dimension through a one-dimensional convolution layer, and then converts the dimension of the feature vector with the lowest dimension to the dimension of the feature vector with the middle dimension by upsampling. The calculation formula is:
[0046]
[0047] Among them, Y2 is the fused feature vector, UpSample is the upsampling operation, using the nearest interpolation method, Y1 is the lowest dimensional feature vector, and Y2 is the middle layer feature vector. For splicing operation.
[0048] Specifically, the multi-scale feature performs weighted processing on each channel of the feature map through a multi-layer perceptron, and obtains a weight coefficient through an activation function calculation, multiplies the weight coefficient with the original feature map to obtain a channel feature map, performs maximum pooling and average pooling on the channel feature map, and performs convolution processing after splicing and fusion to obtain a spatial attention feature map, and multiplies the spatial attention feature map with the channel feature map to obtain the multi-scale feature map. The calculation formula is: F′=F×σ(MLP(Avgpool(F))+MLP(Maxpool(F)))×σ(f n×n (f c (Avgpool(F)),MLP(Maxpool(F)))),
[0049] Among them, F′ is a multi-scale feature map, F is the original feature map, Avgpool(F) is the average pooling operation, Maxpool(F) is the maximum pooling operation, and f n×n To filter using n×n convolution kernel, f c is a combination, σ is an activation function, and MLP is a multi-layer perceptron.
[0050] In this embodiment, the target recognition model adopts the YOLOv4 model structure, wherein the structural unit of the backbone network consists of a convolutional layer, a batch normalization layer, and an activation function layer, and residual connections and cross-region local network connections are added thereto; the neck network consists of a spatial pyramid pooling module and a path aggregation network; and the detection head network processes the scale and shape changes of the object with the help of a predefined anchor box to generate a final output vector with class probability, confidence, and anchor box position.
[0051] Specifically, the target loss function includes confidence loss, classification loss and position loss. The confidence loss and the classification loss are calculated by a binary cross entropy function, and the calculation formula is:
[0052]
[0053]
[0054] Among them, L obj is the confidence loss, L cls is the classification loss, S represents the number of cells; B represents the number of candidate boxes in each cell, Indicates that the value is 1 when a positive sample appears in the jth prediction box in the i-th cell, otherwise it is 0; I ij Indicates that the value is 1 when there is no positive sample in the jth prediction box in the i-th cell, otherwise it is 0; C i represents the true target confidence in the i-th cell, represents the confidence of the predicted target in the i-th cell; λ is the weight coefficient, classes is the number of categories of the training target, and p i (c) represents the probability value of the true box of this category, The probability value of the predicted box for this category;
[0055] The position loss is calculated by the overlap between the predicted frame and the real frame, and the calculation formula is:
[0056]
[0057] Among them, L coord is the position loss, IoU is the intersection over union of the predicted bounding box and the actual bounding box, b is the center of the predicted bounding box, and b gt is the center of the actual bounding box, c is the diagonal length of the minimum rectangle covering the predicted bounding box and the actual bounding box, a is the weight function, and v is the consistency parameter for measuring the aspect ratio.
[0058] An intelligent recognition system based on bread images, comprising: a preprocessing module, a pretraining module, a target recognition module, a model training module, and an application module;
[0059] The preprocessing module is used to obtain bread image data through a store camera, preset image quality evaluation indicators and image validity verification rules, and perform abnormal image recognition processing and noise interference processing on the bread image data corresponding to the image validity verification rules according to the image quality evaluation indicators to obtain preprocessed image data; calibrate the recognition range of the preprocessed image data and unify the data format;
[0060] The pre-training module is used to preset an initial training set according to a data standard library, use a convolutional neural network as a feature value extraction model for a bread image, pre-train the feature value extraction model through the initial training set to obtain a pre-trained model, and compress and optimize the pre-trained model before deploying it to an edge computing device;
[0061] The target recognition module is used to build a target recognition model in the edge computing device, the target recognition model extracts the feature map of the preprocessed image data through the pre-trained model, retains the spatial information of the feature map and enhances the spatial positioning ability of the feature map through the path enhancement structure, performs multi-scale pooling on the feature map through the pooling module and splices and fuses the feature map to obtain a multi-scale feature map of the preprocessed image data; classifies and regresses the position of the bread detection target according to the multi-scale feature map to obtain an output vector;
[0062] The model training module is used to construct a target training set through bread image data obtained by the store in real time every day, preset a target loss function, train the target recognition model through the target training set, calculate the loss value of the current training data according to the output vector output by the target recognition model and the loss function, calculate the loss gradient of the model parameters of the target recognition model through the back propagation algorithm, and update the model parameters using the stochastic gradient descent method according to the loss gradient;
[0063] The application module is used to obtain settlement commodity pictures through the bread detection system of the store automatic settlement platform, perform target recognition on the settlement commodity pictures through the target recognition model to obtain the bread identification type and quantity and feed back to the store automatic settlement platform.
[0064] In this embodiment, the overall process architecture of the system provides a Browser User Interface based on practical needs. Its functions include a product list - providing users with customized product names applicable to stores, and mapping the ID after model recognition to the bread name that is commonly used and easy to identify by customers through association, and then displaying it on the operation interface; setting cameras - users can add, delete, and modify cameras according to the needs of each store's cameras; ROI recognition - multiple RTSP cameras recognize the richness and quantity of goods in a specific area of the screen, and calculate the proportion of bread within a specific range. The edge computing device is the system architecture scenario for the actual application and deployment of the AI model. Cameras are installed on the bread shelves; "AIObjectDetection" and "Web User Interface" are deployed on the edge devices. Users call the bread model according to actual needs to identify the type of bread and its Bounding Box, and calculate the proportion of bread based on the calibrated range. Finally, the obtained bread type, quantity and proportion are returned and displayed on the page.
[0065] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device.
[0066] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0067] The program code included on the computer readable medium can be transmitted with any appropriate medium, including but not limited to wireless, electric wire, optical cable, RF, etc., or any suitable combination of the above. The computer program code for performing the operation of the present invention can be written in one or more programming languages or their combinations, and the programming language includes object-oriented programming languages-such as Java, Smalltalk, C++, and also includes conventional procedural programming languages-such as "C" language or similar programming languages. The program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0068] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technical personnel in this field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.
Claims
1. An intelligent recognition method based on bread images, characterized in that: include: S1: Obtain bread image data through store cameras, preset image quality evaluation indicators and image validity verification rules, perform abnormal image recognition processing and noise interference processing on the bread image data that meets the image validity verification rules according to the image quality evaluation indicators to obtain pre-processed image data; calibrate the recognition range of the pre-processed image data and unify the data format; S2: Preset an initial training set according to the data standard library, use a convolutional neural network as a feature value extraction model for bread images, pre-train the feature value extraction model using the initial training set to obtain a pre-trained model, and compress and optimize the pre-trained model before deploying it to an edge computing device; S3: constructing a target recognition model in the edge computing device, wherein the target recognition model extracts a feature map of the preprocessed image data through the pretrained model, retains the spatial information of the feature map and enhances the spatial positioning capability of the feature map through a path enhancement structure, performs multi-scale pooling on the feature map through a pooling module and concatenates and fuses the feature map to obtain a multi-scale feature map of the preprocessed image data; classifies and regresses the position of the bread detection target according to the multi-scale feature map to obtain an output vector; S4: construct a target training set through bread image data obtained by the store in real time every day, preset a target loss function, train the target recognition model through the target training set, calculate the loss value of the current training data according to the output vector output by the target recognition model and the loss function, calculate the loss gradient of the model parameters of the target recognition model through the back propagation algorithm, and update the model parameters according to the loss gradient using the stochastic gradient descent method; S5: Obtain settlement product images through the bread detection system of the store automatic settlement platform, perform target recognition on the settlement product images through the target recognition model to obtain bread identification types and quantities, and feed back to the store automatic settlement platform.
2. The method according to claim 1, characterized in that The image quality evaluation index includes a natural image evaluation index, visual information fidelity, and a perception evaluation index; the natural image evaluation index is the pixel-level difference between the standard image and the processed image, the visual information fidelity is an image distortion evaluation index affected by brightness, contrast, color, and structure of the human eye's perception of the image, and the perception evaluation index is the brightness, contrast, and structural information of the processed image.
3. The method according to claim 1, characterized in that The image validity verification rule is a qualified judgment threshold of the image quality assessment index.
4. The method according to claim 1, characterized in that The compression optimization method is: structured pruning of the convolutional layer and the fully connected layer of the pre-trained model, and converting the floating-point parameters into 8-bit integers.
5. The method according to claim 1, characterized in that: The path enhancement structure aggregates three groups of feature vectors at a time, and adjusts the number of channels of the feature vector with the lowest dimension to the number of channels of the feature vector with the middle dimension through a one-dimensional convolution layer, and then converts the dimension of the feature vector with the lowest dimension to the dimension of the feature vector with the middle dimension by upsampling. The calculation formula is: Among them, Y′2 is the fused feature vector, UpSample is the upsampling operation, using the nearest interpolation method, Y1 is the lowest dimensional feature vector, and Y2 is the middle layer feature vector. For splicing operation.
6. The method according to claim 1, characterized in that The multi-scale feature performs weighted processing on each channel of the feature map through a multi-layer perceptron, and obtains a weight coefficient through an activation function calculation, and multiplies the weight coefficient with the original feature map to obtain a channel feature map, performs maximum pooling and average pooling on the channel feature map, and performs convolution processing after splicing and fusion to obtain a spatial attention feature map, and multiplies the spatial attention feature map with the channel feature map to obtain the multi-scale feature map. The calculation formula is: F′=F×σ(MLP(Avgpool(F))+MLP(Maxpool(F)))×σ(f n×n (f c (Avgpool(F)),MLP(Maxpool(F)))), Among them, F' is a multi-scale feature map, F is the original feature map, Avgpool(F) is the average pooling operation, Maxpool(F) is the maximum pooling operation, and f n×n To filter using n×n convolution kernel, f c is a combination, σ is an activation function, and MLP is a multi-layer perceptron.
7. The method according to claim 1, characterized in that The target loss function includes confidence loss, classification loss and position loss. The confidence loss and the classification loss are calculated by a binary cross entropy function, and the calculation formula is: Among them, L obj is the confidence loss, L cls is the classification loss, S represents the number of cells; B represents the number of candidate boxes in each cell, Indicates that the value is 1 when a positive sample appears in the jth prediction box in the i-th cell, otherwise it is 0; I ij Indicates that the value is 1 when there is no positive sample in the jth prediction box in the i-th cell, otherwise it is 0; C i represents the true target confidence in the i-th cell, represents the confidence of the predicted target in the i-th cell; λ is the weight coefficient, classes is the number of categories of the training target, and p i (c) represents the probability value of the true box of this category, The probability value of the predicted box for this category; The position loss is calculated by the overlap between the predicted frame and the real frame, and the calculation formula is: Among them, L coord is the position loss, IoU is the intersection over union of the predicted bounding box and the actual bounding box, b is the center of the predicted bounding box, and b gt is the center of the actual bounding box, c is the diagonal length of the minimum rectangle covering the predicted bounding box and the actual bounding box, α is the weight function, and v is the consistency parameter of the aspect ratio.
8. An intelligent recognition system based on bread images, used to execute the method according to claims 1-7, characterized in that: include: Preprocessing module, pretraining module, target recognition module, model training module, application module; The preprocessing module is used to obtain bread image data through a store camera, preset image quality evaluation indicators and image validity verification rules, and perform abnormal image recognition processing and noise interference processing on the bread image data that meets the image validity verification rules according to the image quality evaluation indicators to obtain preprocessed image data; calibrate the recognition range of the preprocessed image data and unify the data format; The pre-training module is used to preset an initial training set according to a data standard library, use a convolutional neural network as a feature value extraction model for a bread image, pre-train the feature value extraction model through the initial training set to obtain a pre-trained model, and compress and optimize the pre-trained model before deploying it to an edge computing device; The target recognition module is used to build a target recognition model in the edge computing device, the target recognition model extracts the feature map of the preprocessed image data through the pre-trained model, retains the spatial information of the feature map and enhances the spatial positioning ability of the feature map through the path enhancement structure, performs multi-scale pooling on the feature map through the pooling module and splices and fuses the feature map to obtain a multi-scale feature map of the preprocessed image data; classifies and regresses the position of the bread detection target according to the multi-scale feature map to obtain an output vector; The model training module is used to construct a target training set through bread image data obtained by the store in real time every day, preset a target loss function, train the target recognition model through the target training set, calculate the loss value of the current training data according to the output vector output by the target recognition model and the loss function, calculate the loss gradient of the model parameters of the target recognition model through the back propagation algorithm, and update the model parameters using the stochastic gradient descent method according to the loss gradient; The application module is used to obtain settlement commodity pictures through the bread detection system of the store automatic settlement platform, perform target recognition on the settlement commodity pictures through the target recognition model to obtain the bread identification type and quantity and feed back to the store automatic settlement platform.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the bread image intelligent recognition method as described in any one of claims 1-7 is implemented.
10. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions are used to execute the bread image intelligent recognition method as claimed in any one of claims 1 to 7 when executed by a computer processor.
Citation Information
Cited By
Finished pastry appearance analysis method and device based on AI image analysis and recognition
CN120747953A
