Vegetable and fruit type pattern recognition method combined with visual target detection
By combining the visual neural network based on the convolutional neural network with visual target detection and using historical data to train the model, the problem of low recognition accuracy and low efficiency in vegetable and fruit type recognition is solved, and fast and accurate recognition and adaptability to illumination changes are achieved. .
Patent Information
- Application Number
- CN202410697001.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-05-31
AI Technical Summary
The existing technology has the problems of low recognition accuracy, low efficiency, sensitivity to changes in illumination and angle, high computational complexity, and poor generalization ability in vegetable and fruit category recognition, making it difficult to achieve rapid and accurate recognition.
A visual neural network based on a convolutional neural network is used, combined with visual target detection, and the historical data of vegetable and fruit type recognition is used to train the model. This replaces the manual feature extraction step and uses a gradient optimization strategy to optimize feature extraction and improve recognition efficiency and accuracy.
It improves the accuracy and efficiency of vegetable and fruit category recognition, reduces the sensitivity to image noise and illumination changes, realizes real-time processing, and enhances the ability to recognize unseen species.
Smart Images

Figure CN118570794A
Abstract
Description
Technical Field
[0001] The present invention relates to two major fields, pattern recognition and agricultural technology, and mainly relates to a vegetable and fruit type pattern recognition algorithm combined with visual target detection. Background Art
[0002] In recent years, with the development of science and technology and the diversification of consumer demand, the retail industry has faced many challenges and opportunities. For example, in terms of fruit and vegetable type recognition, how to accurately and quickly identify the type and quality of fruits and vegetables and check out is an urgent problem that needs to be solved in new retail models such as unmanned supermarkets. However, fruit and vegetable type recognition is a complex problem with low recognition accuracy and low efficiency, making it difficult to effectively identify.
[0003] Traditional pattern recognition algorithms are a common and effective means of solving complex recognition problems. They have been widely used in a variety of image recognition problems. For the problem of fruit and vegetable species recognition, the best recognition model can be found from a global perspective. However, these algorithms have some challenges in fruit and vegetable classification. First, they usually require manual extraction of features such as color, shape, texture, etc., which requires professional knowledge, and may not be able to extract effective features in complex environments. Secondly, these methods are sensitive to the illumination, angle, scale, etc. of the image, and if the environmental conditions change, the recognition effect may not be affected. Furthermore, the traditional pattern recognition method has high computational complexity and may not be able to process large-scale fruit and vegetable classification problems in real time. Finally, due to its reliance on manually extracted features and specific classifiers, the generalization ability of traditional pattern recognition methods may be poor, and it may not be able to accurately recognize unseen fruit and vegetable species. Therefore, how to use traditional pattern recognition algorithms to accurately identify fruit and vegetable species within an acceptable time while overcoming their sensitivity to image noise and illumination changes is a problem that still needs to be solved. Summary of the invention
[0004] In view of the above-mentioned prior art, the present invention provides a fruit and vegetable type pattern recognition algorithm combined with visual target detection to solve the problems in the prior art of poor fruit and vegetable type recognition results and low search efficiency due to poor generalization ability and long evaluation time.
[0005] In order to solve the above technical problems, the present invention proposes a method for fruit and vegetable type pattern recognition combined with visual target detection. The method for fruit and vegetable type pattern recognition combined with visual target detection is used to solve the problems of poor fruit and vegetable type recognition results and low search efficiency caused by poor generalization ability and long evaluation time in existing fruit and vegetable type recognition methods; the visual neural network constructed based on the convolutional neural network includes two convolutional layers, two pooling layers, a fully connected layer and a linear classification layer, wherein the two convolutional layers and the two pooling layers are arranged alternately, and the above pooling layers are both followed by a nonlinear layer; the convolutional layers and the pooling layers connected in sequence are used to extract local features of the image and reduce the tensor dimension; the fully connected layer is used to process the complex internal relations in the hidden variables; the linear classification layer is used to obtain the estimated probabilities of various categories corresponding to the image; wherein the visual neural network uses historical data training for fruit and vegetable type recognition as an auxiliary, and uses a neural network to replace the step of manually extracting features, thereby saving feature processing time; a gradient optimization strategy is used as an optimization operator, and the generated image features are predicted in the algorithm optimization process, and the gradient optimizer is driven by the classification results of the visual neural network to optimize the visual neural network.
[0006] Furthermore, the vegetable and fruit type pattern recognition method described in the present invention mainly includes a training process and an inference process.
[0007] The training process of the vegetable and fruit type pattern recognition method of the present invention includes:
[0008] Step 1-1) Initializing a database, obtaining historical data of fruit and vegetable image recognition from a database, wherein the database includes fruit and vegetable image information and types of fruits and vegetables corresponding to the fruit and vegetable images, wherein the types of fruits and vegetables are type labels;
[0009] Step 1-2) preprocessing the image data and the category information to obtain image data of a uniform shape and preprocessing the category labels corresponding to the image data, and converting the category labels into a one-hot encoding form;
[0010] Step 1-3) The visual neural network is used to process the fruit and vegetable pictures to obtain picture features, and the linear classification layer is used to identify the picture features to obtain the estimated probabilities of various categories of the fruit and vegetable pictures; minimizing the cross entropy between the model's category output and the actual category is taken as the optimization goal, and the cross entropy between the estimated probability and the label is calculated as the loss, and the network parameters are updated after the loss is gradiented, and the steps after the picture feature extraction are repeated until the model converges; at this point, a visual neural network model that can effectively extract image information and classify fruits and vegetables is trained; in the present invention, the visual neural network feature extraction strategy is to train the visual neural network with historical data of fruit and vegetable category recognition, and to predict the category of the generated image features during the algorithm optimization process, thereby replacing the step of manually extracting features and saving algorithm optimization time.
[0011] Furthermore, the specific steps of step 1-3) include:
[0012] 1-3-1) using the preprocessed image data as the input of the convolutional neural network model, and obtaining an embedding vector representing the fruit and vegetable image after processing, wherein the embedding vector represents the image features;
[0013] 1-3-2) Using the embedding vector corresponding to each image data as the input of the linear classification layer to obtain the estimated probability of each class corresponding to the image data;
[0014] 1-3-3) Based on the one-hot encoding of the image data and the estimated probability, the cross entropy between the two is calculated as the loss;
[0015] 1-3-4) Derivative the loss to obtain the gradient of the visual neural network and the linear classification layer;
[0016] 1-3-5) According to the gradient of each parameter, the adaptive moment estimation optimizer Adam is used to optimize the parameters of the model and calculate the updated value of each parameter;
[0017] 1-3-6) Update the parameters of the visual convolutional neural network and the linear classification layer according to the updated value;
[0018] 1-3-7) Loop through steps 1-3-1) to 1-3-6) until the visual neural network and linear classification layer converge, indicating that the loss fluctuates within a stable range, and the training is terminated.
[0019] Among them, in step 1-3-5), the obtained fruit and vegetable type recognition data is used as a mathematical model for establishing fruit and vegetable type recognition, and the fruit and vegetable type recognition design is quantified and calculated. The fruit and vegetable type reasoning accuracy is used as the objective function. Based on the deep learning optimization model, the adaptive moment estimation optimizer Adam is used to optimize the parameters of the model. The formula is: Among them, θ represents the parameters of the model, Represents the gradient of the loss function; the update strategy is as follows:
[0020] h=W1(W2(Pool1(Conv1(Pool2(Conv2(I))))))
[0021]
[0022]
[0023] Among them, I represents the input image, W represents the fully connected layer, Pool represents the pooling layer followed by the nonlinear layer, Conv represents the convolutional layer, softmax represents the softmax function, L represents the loss, CE represents the cross entropy function, and θ represents the parameters of the model. represents the gradient of the loss function, and Adam represents the adaptive moment estimation optimizer.
[0024] The reasoning process of the vegetable and fruit type pattern recognition method of the present invention includes:
[0025] Step 2-1) Initializing the database, obtaining historical data of fruit and vegetable image recognition from the database, the database containing fruit and vegetable image information;
[0026] Step 2-2) Pre-process and crop the input fruit and vegetable images into images of the same size as in the training process;
[0027] Step 2-3) The preprocessed image information is used as the input of the visual neural network, and after processing, an embedding vector representing the image information is obtained; the embedding vector corresponding to each image is used as the input of the linear classification layer of the trained visual neural network model, and the linear classification layer is used to identify the image features to obtain the estimated probabilities of various classes of the fruit and vegetable image;
[0028] Step 2-4) Determine whether the estimated probability of each category reaches the threshold; if no category estimated probability value reaches the threshold, it is considered that the credibility of the image classification result is low and an error is reported; otherwise, the category with the highest probability is used as an index to retrieve the unit price corresponding to the category of fruits and vegetables as the output result; return the unit price corresponding to the category;
[0029] Step 2-5) loops through steps 2-1) to 2-4) until the unit prices corresponding to all the fruit and vegetable images are obtained.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] In the method of the present invention, the obtained fruit and vegetable type recognition data is used as a mathematical model for establishing fruit and vegetable type recognition, the fruit and vegetable type recognition design is quantified and calculated, the fruit and vegetable type reasoning accuracy is used as the objective function, and a deep learning optimization algorithm is used to improve the ability to extract global information from the image space, thereby solving the problem of poor globality in the prior art when solving the fruit and vegetable type recognition problem.
[0032] In the method of the present invention, historical data of vegetable and fruit type recognition are used to train a visual neural network as an auxiliary, and the neural network is used to replace most of the vegetable and fruit type feature extraction processes in the traditional pattern recognition algorithm process, thereby saving performance simulation analysis time and solving the problem that the prior art is difficult to obtain real-time results when solving the vegetable and fruit type recognition problem.
[0033] In the method of the present invention, the classification characteristics of the visual neural network are combined with the optimization characteristics of the deep learning algorithm, and the classification results are used to drive the deep learning optimization, thereby improving the ability to identify the types of fruits and vegetables, and solving the problems of poor optimization results and low search efficiency in the prior art when solving the problem of identifying the types of fruits and vegetables. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.
[0035] Figure 1 It is an algorithm flow chart of an embodiment of the vegetable and fruit type pattern recognition method of the present invention;
[0036] Figure 2 It is a flowchart of an embodiment of the method for recognizing vegetable and fruit types pattern of the present invention;
[0037] Figure 3 Schematic diagram of a visual neural network according to an embodiment of the method for recognizing vegetable and fruit types in accordance with the present invention. DETAILED DESCRIPTION
[0038] The design idea of a fruit and vegetable species pattern recognition method combined with visual target detection proposed by the present invention is to solve the problems of poor regular fruit and vegetable species recognition results and low search efficiency caused by poor generalization ability and long evaluation time of existing fruit and vegetable species recognition methods; the present invention uses a convolutional neural network and a deep learning algorithm, adopts a visual neural network as a feature extractor, uses historical data of fruit and vegetable images with species information to train the model, and uses a neural network to replace the manual feature extraction step to save feature processing time; the classification result drives the gradient optimizer to optimize the visual neural network and the feature extractor. The visual neural network uses the historical data training of fruit and vegetable species recognition as an aid, predicts the species of the generated image features during the algorithm optimization process, and uses a neural network to replace the manual feature extraction step to save feature processing time, wherein the gradient optimization strategy is used as the optimization operator, and the classification result of the visual neural network drives the gradient optimizer to optimize the visual neural network.
[0039] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] In this embodiment, the fruit and vegetable type recognition can be applied to different types of fruits and vegetables, such as apples, bananas, oranges, etc. The recognition goal is to accurately and quickly identify the types of fruits and vegetables and return the unit price. In the embodiment, a deep learning optimization algorithm based on the assistance of a visual neural network is implemented. After deep learning, a set of relatively optimized fruit and vegetable type recognition visual neural network parameters is found.
[0041] Figure 1 The flowchart of the embodiment of the method for recognizing the type of fruits and vegetables of the present invention comprises the following steps:
[0042] S1: Obtain historical data of vegetable and fruit image recognition, including image file data and corresponding vegetable and fruit category information;
[0043] S2: Preprocess the image file data and the information of the types of fruits and vegetables to obtain the image data of uniform shape and the unique hot encoding of the type information;
[0044] S3: A fruit and vegetable category pattern recognition algorithm combined with visual target detection is used to minimize the cross entropy between the category output of the model and the actual category, and a convolutional neural network model is trained that can effectively extract image information and classify fruits and vegetables.
[0045] S4: Combine the trained visual neural network to extract information from unlabeled fruit and vegetable images and output an estimate of the types of fruits and vegetables in the image. After obtaining the estimated types, output the unit price of the corresponding types of fruits and vegetables.
[0046] In this embodiment, fruit and vegetable type recognition can be applied to different types of fruits and vegetables, such as apples, bananas, oranges, etc. The recognition goal is to accurately and quickly identify the types of fruits and vegetables and return the unit price. In Example 1, a deep learning optimization algorithm based on the assistance of a visual neural network is implemented. After deep learning, a set of relatively optimized fruit and vegetable type recognition visual neural network parameters is found.
[0047] See also Figure 2 The method steps implemented in this embodiment include: first, initializing the database: for the reasoning process, the database contains the information of fruit and vegetable images, and for the training process, it also contains the types of fruit and vegetable; preprocessing the data, cutting the images into square images with the same side length and converting the type labels into one-hot encoding form; using a convolutional neural network to process the images to obtain image features; using a linear classification layer to identify the image features to obtain the estimated probabilities of various types of the image; if it is a training process, the cross entropy of the estimated probability and the label is calculated as the loss, the gradient of the loss is calculated, and the parameters of the network are updated, and the steps after the image feature extraction are repeated until the model converges; if it is an inference process, it is determined whether the estimated probability of various types reaches the threshold; if no type estimate reaches the threshold, it is considered that the credibility of the image classification result is low and an error is reported; if there is a type that reaches the threshold, the type with the maximum probability is used as an index to retrieve the unit price corresponding to the type of fruit and vegetable as the output result.
[0048] In this embodiment, S2 pre-processes the image file data and the fruit and vegetable category information to obtain the image data of uniform shape and the unique hot encoding of the category information, including:
[0049] S21: Process the image file data and convert it into a square image x with the same side length;
[0050] S22: Obtain the number of all types of fruits and vegetables as the encoding length N, and give a corresponding one-hot encoding to each image as the type label y;
[0051] In this embodiment, S3: adopting a fruit and vegetable type pattern recognition algorithm combined with visual target detection, with the optimization goal of minimizing the cross entropy between the type output of the model and the actual type, a convolutional neural network model capable of effectively extracting image information and classifying fruits and vegetables is trained; wherein the specific steps of the training process include:
[0052] S31: taking the preprocessed image information as the input of the convolutional neural network, and obtaining an embedding vector h representing its information after processing;
[0053] S32: Using the embedding vector h corresponding to each image as the input of the linear classification layer to obtain the estimated probability ˉy of each class corresponding to the image;
[0054] S33: According to the label y of the image and the estimated probability, the cross entropy between the two is calculated as the loss l;
[0055] S34: Derivative the loss to obtain the gradient of the convolutional neural network and the linear classification layer;
[0056] S35: Calculate the updated value of each parameter using the optimizer according to the gradient of each parameter;
[0057] S36: updating the parameters of the convolutional neural network and the linear classification layer according to the updated value;
[0058] S37: Loop through steps S31 to S36 until the convolutional neural network and the linear classification layer converge, that is, the loss fluctuates within a stable range.
[0059] In this embodiment, S4: Combine the trained visual neural network to extract information from the unlabeled fruit and vegetable images, output an estimate of the types of fruits and vegetables in the image, and output the unit price of the corresponding types of fruits and vegetables after obtaining the estimated types. The specific steps of the reasoning process include:
[0060] S41: pre-process the input image and cut it into a rectangular image x with the same size as that in the training process;
[0061] S42: using the preprocessed image information as the input of the convolutional neural network, and obtaining an embedding vector h representing its information after processing;
[0062] S43: Using the embedding vector h corresponding to each image as the input of the linear classification layer to obtain the estimated probability y of each class corresponding to the image;
[0063] S44: Determine whether the probability of any category exceeds the threshold. If none of them exceeds the threshold, an error message is displayed. Otherwise, the category with the highest probability is output.
[0064] S45: Return the corresponding unit price according to the category;
[0065] S46: Steps S41 to S45 are executed repeatedly until the algorithm reaches the termination condition, that is, all images have been processed.
[0066] See also Figure 2 , this embodiment provides a flow chart of a pattern recognition algorithm for fruit and vegetable types combined with visual target detection, specifically, including the following steps:
[0067] 1) Database initialization: The database of the present invention mainly includes two parts:
[0068] The class labels Y used in the training process are {y_i|i=1,2,…,N; y_i=1,2,…,D};
[0069] Where N represents the number of labels and D represents the number of types;
[0070] The input fruit and vegetable images I = {x_i|i = 1, 2, ..., N; x_i∈R^(H×W×C)};
[0071] Where H and W represent the length and width of the image, and C represents the number of channels of the image;
[0072] 2) Data preprocessing: Preprocess the label and convert it into a one-hot vector Y^'={y_i^'|y_(i,j)^'=1if y_i=j,else y_(i,j)^'=0,i=1,2,…,N,j=1,2,…,D}; crop the image to get a square image of the same size I^'={x_i|i=1,2,…,N;x_i∈R^(S×S×C)};
[0073] Where S represents the size of the converted image
[0074] 3) Use neural network to extract image features: see Figure 3 , a schematic diagram of a visual neural network based on a convolutional neural network in this embodiment; the visual neural network consists of two convolutional layers, two pooling layers, a fully connected layer and a linear classification layer, wherein each pooling layer is followed by a nonlinear process (not shown in the figure); the convolutional layer is used to extract local features of the image; the pooling layer is connected after the convolutional layer, which can efficiently extract local features and reduce the tensor dimension; the fully connected layer is used to process the complex internal relationship in the latent variable and obtain the feature vector of the image, and the linear classification layer is used to obtain the estimated probability of various classes corresponding to the image; the formula for the whole process of extracting features is as follows:
[0075] h=W_1(W_2(〖Pool〗_1(〖Conv〗_1(〖Pool〗_2(〖Conv〗_2(I^'))))))
[0076] Where W represents a fully connected layer, Pool represents a pooling layer followed by a nonlinear layer, and Conv represents a convolutional layer.
[0077] 4) Predicting category probability: The present invention uses a linear classification layer to map image features into estimated probabilities of various categories, and the formula is described as follows:
[0078] ˉY=softmax(W(h))
[0079] Where W represents the linear classification layer and softmax represents the softmax function.
[0080] 5) Loss calculation: The present invention uses the cross entropy of the unique hot vector of the label and the model prediction probability as the loss function, which is expressed as follows: L = CE (Y^', ˉY);
[0081] Where L represents the loss and CE represents the cross entropy function
[0082] 6) Parameter update: The present invention uses the Adam optimizer to optimize the parameters of the model, and the formula is as follows:
[0083] Where θ represents the parameters of the model, represents the gradient of the loss function, and Adam represents the adaptive moment estimation optimizer;
[0084] 7) Probability threshold judgment and result selection: select the one with the maximum selection probability p_max=max(ˉY) and compare it with the threshold ∈. If p_max<∈, it means that the model is uncertain about the type of image. There may be no known types of fruits and vegetables or there may be multiple types of fruits and vegetables at the same time. At this time, the model will prompt an error; otherwise, the model will output y=argmax(ˉY) as an estimate of the type of image and output the corresponding unit price;
[0085] In summary, in the method of the present invention, the obtained fruit and vegetable species recognition data is used as a mathematical model for establishing fruit and vegetable species recognition, the fruit and vegetable species recognition design is quantified and calculated, the fruit and vegetable species reasoning accuracy is used as the objective function, and a deep learning optimization algorithm is used to improve the ability to extract global information from the image space, thereby solving the problem of poor globality in solving the fruit and vegetable species recognition problem in the prior art. The present invention uses historical data of fruit and vegetable species recognition to train a visual neural network as an auxiliary, and uses a neural network to replace most of the fruit and vegetable species feature extraction processes in the traditional pattern recognition algorithm process, saving performance simulation analysis time, improving the ability to identify fruit and vegetable species, and solving the problem of poor optimization results and low search efficiency in solving the fruit and vegetable species recognition problem in the prior art.
[0086] The method of the present invention can accurately and quickly identify the types and qualities of fruits and vegetables and perform checkout, which has a good conversion prospect, especially in new retail models such as unmanned supermarkets, so as to meet the needs of consumers in the retail industry, save human resource investment, and enhance market competitiveness.
[0087] Although the present invention has been described above in conjunction with the accompanying drawings, the present invention is not limited to the above-mentioned specific embodiments, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can make many improvements and changes without departing from the purpose of the present invention, which are all within the protection of the present invention.
Claims
1. A method for fruit and vegetable type pattern recognition combined with visual target detection, characterized in that: include: A visual neural network is constructed based on a convolutional neural network, wherein the visual neural network includes two convolutional layers, two pooling layers, a fully connected layer and a linear classification layer, wherein the two convolutional layers and the two pooling layers are arranged alternately, and the above-mentioned pooling layers are all connected to a nonlinear layer at the end; the convolutional layers and pooling layers connected in sequence are used to extract local features of the image and reduce the tensor dimension; the fully connected layer is used to process complex internal relationships in hidden variables; The linear classification layer is used to obtain the estimated probabilities of various classes corresponding to the image; The visual neural network uses historical data training for vegetable and fruit type recognition as an aid, adopts a gradient optimization strategy as an optimization operator, predicts the type of the generated image features during the algorithm optimization process, and drives the gradient optimizer with the classification results of the visual neural network to optimize the visual neural network.
2. The method for recognizing vegetable and fruit types according to claim 1, characterized in that: The method includes a training process and an inference process, wherein: The training process includes: Step 1-1) Initializing a database, obtaining historical data of fruit and vegetable image recognition from a database, wherein the database includes fruit and vegetable image information and types of fruits and vegetables corresponding to the fruit and vegetable images, wherein the types of fruits and vegetables are type labels; Step 1-2) preprocessing the image data and the category information to obtain image data of a uniform shape and preprocessing the category labels corresponding to the image data, and converting the category labels into a one-hot encoding form; Step 1-3) The visual neural network is used to process the fruit and vegetable images to obtain image features, and the linear classification layer is used to identify the image features to obtain the estimated probabilities of various categories of the fruit and vegetable images; the optimization goal is to minimize the cross entropy between the model's category output and the actual category, and the cross entropy between the estimated probability and the label is calculated as the loss. After the gradient of the loss is calculated, the parameters of the network are updated, and the steps after the image feature extraction are repeated until the model converges; at this point, a visual neural network model that can effectively extract image information and classify fruits and vegetables is trained; The reasoning process includes: Step 2-1) Initializing the database, obtaining historical data of fruit and vegetable image recognition from the database, the database containing fruit and vegetable image information; Step 2-2) Pre-process and crop the input fruit and vegetable images into images of the same size as in the training process; Step 2-3) The preprocessed image information is used as the input of the visual neural network, and after processing, an embedding vector representing the image information is obtained; the embedding vector corresponding to each image is used as the input of the linear classification layer of the trained visual neural network model, and the linear classification layer is used to identify the image features to obtain the estimated probabilities of various classes of the fruit and vegetable image; Step 2-4) Determine whether the estimated probability of each category reaches the threshold; if no category estimated probability value reaches the threshold, it is considered that the credibility of the image classification result is low and an error is reported; otherwise, the category with the highest probability is used as an index to retrieve the unit price corresponding to the category of fruits and vegetables as the output result; return the unit price corresponding to the category; Step 2-5) loops through steps 2-1) to 2-4) until the unit prices corresponding to all the fruit and vegetable images are obtained.
3. The method for recognizing vegetable and fruit types according to claim 2, characterized in that: The specific steps of steps 1-3) include: 1-3-1) using the preprocessed image data as the input of the convolutional neural network model, and obtaining an embedding vector representing the fruit and vegetable image after processing, wherein the embedding vector represents the image features; 1-3-2) Using the embedding vector corresponding to each image data as the input of the linear classification layer to obtain the estimated probability of each class corresponding to the image data; 1-3-3) Based on the one-hot encoding of the image data and the estimated probability, the cross entropy between the two is calculated as the loss; 1-3-4) Derivative the loss to obtain the gradient of the visual neural network and the linear classification layer; 1-3-5) According to the gradient of each parameter, the adaptive moment estimation optimizer Adam is used to optimize the parameters of the model and calculate the updated value of each parameter; 1-3-6) Update the parameters of the visual convolutional neural network and the linear classification layer according to the updated value; 1-3-7) Loop through steps 1-3-1) to 1-3-6) until the visual neural network and linear classification layer converge, indicating that the loss fluctuates within a stable range, and the training is terminated.
4. The method for recognizing vegetable and fruit types according to claim 3, characterized in that: In step 1-3-5), the obtained fruit and vegetable type recognition data is used as a mathematical model for establishing fruit and vegetable type recognition, and the fruit and vegetable type recognition design is quantified and calculated. The fruit and vegetable type reasoning accuracy is used as the objective function. Based on the deep learning optimization model, the adaptive moment estimation optimizer Adam is used to optimize the model parameters. The formula is: Among them, θ represents the parameters of the model, Represents the gradient of the loss function; the update strategy is as follows: h=W1(W2(Pool1(Conv1(Pool2(Conv2(I)))))) Among them, I represents the input image, W represents the fully connected layer, Pool represents the pooling layer followed by the nonlinear layer, Conv represents the convolutional layer, softmax represents the softmax function, L represents the loss, CE represents the cross entropy function, and θ represents the parameters of the model. represents the gradient of the loss function, and Adam represents the adaptive moment estimation optimizer.
Citation Information
Patent Citations
Vegetable image classification identification method and system
CN108491765A
Vegetable and fruit identification method, settlement equipment and use method
CN111652283A
Method for realizing fruit classification and recognition based on deep learning algorithm
CN114882497A
