Fruit grain code generation method, system and equipment based on fruit spot texture recognition
Through the deep separable convolutional neural network model, it recognizes fruit spot textures and generates fruit patterns, solving the problems of fruit identity recognition and information tampering, and achieving low-cost and efficient fruit identity identification and transaction transparency.
Patent Information
- Application Number
- CN202411886882.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-20
AI Technical Summary
The prior art is difficult to effectively identify the identity of fruits at low cost and prevent information tampering, resulting in fruit farmers and consumers being passive and risky during the transaction process.
Fruit pattern is generated by fruit spot texture recognition technology based on the deep separable convolutional neural network model. The method includes obtaining the top image of the fruit, segmenting the fruit image, identifying and extracting spot patterns, calculating coordinates and distances, forming an angle array, reducing sensitivity processing, and using the Hash function to generate a unique fruit pattern.
It realizes the unique identification of fruit identity, and also has good anti-tampering characteristics, which reduces the risk of packet loss, saves label costs, and improves transaction transparency and stability.
Smart Images

Figure CN119723058A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of artificial intelligence, and in particular to a method, system and equipment for generating a fruit pattern code based on fruit spot texture recognition. Background Art
[0002] As of 2022, my country's annual total fruit planting output exceeds 3 trillion, and the total transaction volume exceeds one trillion. However, under the current fruit trading model, offline transactions in the fruit wholesale market account for more than 90% of the total transaction volume. The traditional offline transaction model centered on the fruit wholesale market is usually based on an acquaintance model and a trust model. In this model, fruit farmers do not know the true process of the transaction activities of the fruits they export in the trading market. This will cause fruit farmers to fall into varying degrees of passivity in the final transaction settlement and formulation of generation plans, and farmers' economic rights and interests are easily damaged.
[0003] At the retail end of fruit consumption, consumers can often only rely on their own experience to judge whether the fruit they are about to buy can meet their needs. However, due to the influence of information asymmetry and knowledge asymmetry, this experience-based judgment often has errors and risks, and sometimes even leads consumers to buy fruit that is completely contrary to their consumption intentions.
[0004] Therefore, from the entire circulation link of fruits, we need to make the real and accurate information of fruits flow in coordination with the fruits, so as to optimize the whole process from production to terminal consumption. However, for this demand, the identity of the fruit needs to be identified first, but there is currently no technology that can achieve the identification of the fruit identity at a very low price and prevent information tampering. Therefore, if the texture of the fruit itself can be used to uniquely encode the identity of the fruit, then the digital information such as the generation time, origin, and specifications of the fruit can be attached to the unique code, which is conducive to promoting the coordinated flow of digital information of fruits and fruits, thereby greatly promoting the development of the fruit production and marketing industry. Summary of the invention
[0005] The present invention provides a method, system and device for generating a fruit pattern code based on fruit spot texture recognition, so as to realize the identification of the fruit identity and prevent information tampering, and provide a premise for attaching more proprietary data and information of fruit objects on the basis of the fruit pattern code.
[0006] The present invention is implemented by the following technical scheme: a method for generating a fruit pattern code based on fruit spot texture recognition comprises the following steps: S1, obtaining the image of the top of the fruit through a camera; S2, using the deep separable convolutional neural network model to segment the fruit image from the image; S3, using a deep separable convolutional neural network model to identify and extract all the spots from the segmented fruit images; S4. Generate an outer rectangle for the fruit object, and use the center of the outer rectangle as the coordinate origin. O ; S5. Calculate the coordinates of the center point of the rectangle surrounding each spot to form a coordinate array ; S6. Calculate the distance between the center point of the rectangle surrounding each spot and the origin to form a distance array , arrange the distance array and its corresponding coordinate array in ascending order from small to large, and get and ; S7, with coordinate array The first coordinate point With origin The straight line between As the reference line, calculate the current coordinate points one by one With origin The angle between the line connecting the two and the directrix ,Right now , forming an angle array ; S8, yes and After desensitization treatment, we can obtain and ; S9, will and Synthesize a new array , use the Hash function to find The hash code is the fruit pattern code.
[0007] Furthermore, in step S2, the fruit object is segmented from the image, and the preferred processing steps are as follows: Process the input image into multiple pixel matrices; MobileNet is used to build a deep separable convolutional neural network model, which performs convolution processing on the pixel matrix to segment the fruit objects from the image.
[0008] Furthermore, step S3 uses a deep separable convolutional neural network model to identify and extract all the spots from the segmented fruit image, including the following processing steps: Process the fruit image into multiple pixel matrices; MobileNet is used to build a deep separable convolutional neural network model, which performs convolution processing on the pixel matrix to segment the spot objects from the image.
[0009] Further, step S8 is described and Perform desensitization treatment, the preferred treatment method is as follows: ; ; in is the desensitization function, is the rounding function, dpi is the image resolution, is a scale parameter, and its value is determined by the recognized fruit category. is the desensitization step length. The larger the desensitization step length is, the lower the data resolution of the calculation result is.
[0010] Further, step S9 is described as and Synthesize a new array , the preferred processing method is as follows: The array and The array element type is converted into a string element; Each element in the array is assigned a value ,Right now .
[0011] Furthermore, the Hash function in step S9 may preferably use the cryptographic hash algorithm SM3 promulgated by the State Cryptography Administration in December 2010.
[0012] The present invention has the following beneficial effects compared with the prior art: 1. Compared with the traditional method of sticking plastic labels on fruits, the present invention can save high label costs and labor costs caused by label customization, procurement, management and sticking during large-scale fruit production; 2. The fruit pattern code is taken from the fruit itself, and the function used in the invention has good anti-tampering characteristics, which greatly reduces the risk of fruit products being replaced during circulation; 3. Since the present invention uses a desensitization treatment, the method has good stability and ease of use; 4. Since most fruits will produce self-preserving wax and can sufficiently ensure the stability of their appearance during the circulation period, the present invention has good physical stability; 5. The present invention provides the possibility to subsequently attach more proprietary data and information of fruit objects based on the fruit pattern code. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1is a flowchart of the steps of a method for generating a fruit pattern code based on fruit spot texture recognition in an embodiment of the present invention; Figure 2 is an orthophoto of the top of an apple in an embodiment of the present invention; Figure 3 It is the outer rectangle of the fruit image segmented from the image; Figure 4 It is a schematic diagram of the outer rectangle of the fruit image spot; Figure 5 Schematic diagram of the sample spot coordinate origin, the first spot coordinate and the directrix in an embodiment of the present invention; Figure 6 is a schematic diagram of the coordinates, distance, and angle between any spot of the sample and the directrix in the embodiment of the present invention; Figure 7 is the sample feature array in the embodiment of the present invention Schematic diagram; Figure 8 is a system structure diagram in an embodiment of the present invention; Fig. 9 It is a structural diagram of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION
[0014] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.
[0015] See also Figure 1 This embodiment discloses a method for generating a fruit pattern code based on fruit spot texture recognition. The method can quickly extract all spots in the top image of the fruit, and convert them into an array of distances from the image origin and an array of angles with the directrix, and further use them as inputs of a hash function to obtain a fruit pattern code that can uniquely identify the fruit. The method specifically comprises the following steps: S101, obtain the image of the top of the fruit through the camera, such as Figure 2 As shown; In this embodiment, the basic parameters of the image of the top of the apple obtained by the mobile phone camera are: image width 3024 pixels, image height 4032 pixels, image resolution 72dpi; S102, segmenting the fruit image from the image using a deep separable convolutional neural network model; In this embodiment, a network that can apply deep learning on mobile and embedded terminals is constructed using the MobileNet architecture to segment fruit objects from images. Its structure includes 9 point-by-point convolutional layers, 8 depth-by-depth convolutional layers, 1 connection layer, 1 pooling layer, 1 fully connected layer, and a filter. The processing process includes the following steps: By padding the image width and height with 0, the input image is processed into a pixel matrix of size 227×227×3×18 (length×width×channel×number of blocks); Convolution processing, using matrices of several preset sizes as convolution kernels to convolve the pixel matrix or the input matrix from the previous layer to obtain a feature vector; The ReLU6 function is used to operate the feature vector obtained by convolution processing to obtain a nonlinear enhancement matrix; Among them, ReLU6=min(max(0,x),6); Pooling processing, using the preset pooling unit to perform overlapping pooling on the nonlinear enhancement matrix calculated by the ReLU6 function to obtain a pooling matrix; Normalization processing: using the local response normalization function to perform local response normalization on the pooling matrix obtained by the pooling processing, and output the image matrix; It should be noted that not all the above processing steps must be performed in each layer. Some convolutional layers only need to perform some of the above processing steps as required. The present invention provides a specific embodiment for illustration. For example, the convolutional neural network model of this embodiment has 5 convolutional layers, namely: Convolution layer C1, the processing flow of this layer is: convolution-->ReLU6-->pooling-->normalization; Convolution: Use 96 matrices of size 11×11×3 as convolution kernels to convolve M1 and obtain a feature vector M2 of size 55×55×96; ReLU6: Perform ReLU6 operation on the feature vector M2 to obtain the matrix M3; Pooling: Use 3×3 pooling units with a stride of 2 to perform overlapping pooling on matrix M3, and output matrix M4 with a size of 27×27×96; Normalization: Use the local response normalization function to perform local response normalization on M4, and output an image matrix M5 with a size of 27×27×96. M5 is divided into two matrices M5-1 and M5-2, each with a size of 27×27×48; Convolution layer C2, the processing flow of this layer is: convolution-->ReLU6-->pooling-->normalization; Convolution: Use 2 groups of 128 matrices of size 5×5×48 in each group as convolution kernels to convolve the two input matrices M5-1 and M5-2 from C1. The convolution step size is 1, and two groups of feature vectors M6-1 and M6-2 of size 27×27×128 are obtained. ReLU6: Perform ReLU6 operation on the eigenvectors M6-1 and M6-2 to obtain matrices M7-1 and M7-2; Pooling: Use 3×3 pooling units with a stride of 2 to perform overlapping pooling on matrix M3, and output matrices M8-1 and M8-2 with a size of 13×13×256; Normalization: Use the same local response normalization function as the C1 layer to perform local response normalization on M9-1 and M9-2, and output two sets of image matrices M10-1 and M10-2 with a size of 13×13×128; Convolution layer C3, the processing flow of this layer is: convolution-->ReLU6; Convolution: Use 2 groups of 192 matrices of size 3×3×128 in each group as convolution kernels to convolve the two input matrices M10-1 and M10-2 from C2. The convolution step size is 1, and two groups of feature vectors M11-1 and M11-2 of size 13×13×192 are obtained. ReLU6: Perform ReLU6 operation on the feature vectors M11-1 and M11-2 to obtain matrices M12-1 and M12-2; Convolution layer C4, the processing flow of this layer is: convolution-->ReLU6; Convolution: Use 2 groups of 192 matrices of size 3×3×192 in each group as convolution kernels to convolve the two input matrices M12-1 and M12-2 from C3. The convolution step size is 1, and two groups of feature vectors M13-1 and M13-2 of size 13×13×192 are obtained. ReLU6: Perform ReLU6 operation on the feature vectors M13-1 and M13-2 to obtain matrices M14-1 and M14-2; Convolution layer C5, the processing flow of this layer is: convolution-->ReLU6-->pooling; Convolution: Use 2 groups of 128 matrices of size 3×3×192 as convolution kernels to convolve the two input matrices M14-1 and M14-2 from C4. The convolution step size is 1, and two groups of feature vectors M15-1 and M15-2 of size 13×13×128 are obtained. ReLU6: Perform ReLU6 operation on the feature vectors M15-1 and M15-2 to obtain matrices M16-1 and M16-2; Pooling: Use 3×3 pooling units with a stride of 2 to overlap the matrices M16-1 and M16-2, and output the matrix M17 with a size of 6×6×256; Specifically, the processing steps performed by the fully connected layer include: The input matrix from the convolution layer is convolved to obtain a neuron matrix; in order to increase the function fitting ability of the neuron matrix, it is also necessary to perform ReLU6 function operation on it; Using the Dropout function to invalidate some neurons in the neuron matrix, the purpose is to use the Dropout function to randomly assign some neurons in the neuron matrix to zero values, so as to make some neurons invalid, in order to prevent overfitting; The present invention provides a specific embodiment for illustration. For example, the convolutional neural network model of this embodiment has three fully connected layers, one of which is the output layer of the final output: Fully connected layer FC6, the processing flow of this layer is: (convolution) fully connected --> ReLU6 --> Dropout; Convolution->Fully connected: Use 4096 matrices of size 6×6×256 as convolution kernels to convolve the input matrix M17 from C5, and obtain 4096 1×1 pixels, that is, 4096 neurons [M18-1, M18-2, M18-3, ..., M18-4096]; ReLU6: Perform ReLU6 operation on [M18-1, M18-2, M18-3, ..., M18-4096] to obtain neurons [M19-1, M19-2, M19-3, ..., M19-4096]; Dropout: To prevent overfitting, M19 is subjected to a Dropout operation, that is, the Dropout function is used to set P percent of the members of the matrix M19 to 0 (neuron failure), resulting in 4096 neurons M20. In this model, P is 50%; Fully connected layer FC7, the processing flow of this layer is: fully connected --> ReLU6 --> Dropout; Convolution->Fully connected: Use a matrix of size 1×1×4096 as the convolution kernel to convolve the input matrix M20 from FC6 to obtain a 1×1×4096 neuron matrix M21; ReLU6: Perform ReLU6 function operation on M21 to obtain matrix M22; Dropout: To prevent overfitting, perform a Dropout operation on M22, that is, use the Dropout function to set P percent of the members of the matrix M22 to 0 (neuron failure), and obtain the matrix M23. In this model, P is 50%; Connection layer (output layer) FC8, the processing flow of this layer is: use 1000 neurons to fully connect M23, filter M23 through Gaussian filter, and obtain 1000 float-type prediction possibilities; Preferably, the ReLU6 function is a piecewise linear function, and when the output result of the ReLU6 function is less than or equal to 0, the output is 0, and when it is greater than 0, the output is constant; Preferably, the local response normalization function expression is as follows: ; The local response normalization function parameters k, α, β, and n used are 2, 5, 10-4, and 0.75, respectively; Preferably, the Dropout function is a random function that randomly selects neurons that meet the specified ratio from the neuron matrix according to the ratio specified by the parameter and sets them to 0 (failure). In this model, the failure ratio is 50%; S103, using a deep separable convolutional neural network model to identify and extract all the spots from the segmented fruit image; S104, see Figure 3 , generate an outer rectangle for the fruit image, and use the center of the outer rectangle as the coordinate origin O ; S105, calculate the coordinates of the center point of the rectangle surrounding each spot pattern to form a coordinate array ; S106, calculate the distance between the center point of the outer rectangle of each spot and the origin to form a distance array , arrange the distance array and its corresponding coordinate array in ascending order from small to large, and get and ; S107, coordinate array The first coordinate point With origin The straight line between As the reference line, calculate the current coordinate points one by one With origin The angle between the line connecting the two and the directrix ,Right now , forming an angle array ; S108, yes and After desensitization treatment, we can obtain and ; In this embodiment, the following algorithm is used to implement the desensitization process: ; ; in is the desensitization function, is the rounding function, dpi=72 is the image resolution. Since the image identified is an apple, the scale parameter The value is 1. is the desensitization step length, which takes values of 1 and 2 respectively; S109, will and Synthesize a new array , use the Hash function SM3 to find The hash code, that is, the fruit code: .
[0016] In this embodiment, the computing device may be a terminal device such as a desktop computer, a laptop computer, a PDA handheld terminal, a tablet computer, etc.
[0017] The above is a preferred embodiment of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A fruit pattern code generation method based on fruit spot texture recognition, characterized in that: The steps include: S1, obtaining the image of the top of the fruit through a camera; S2, using the deep separable convolutional neural network model to segment the fruit image from the image; S3, using a deep separable convolutional neural network model to identify and extract all the spots from the segmented fruit images; S4. Generate an outer rectangle for the fruit image, and use the center of the outer rectangle as the coordinate origin. O ; S5. Calculate the coordinates of the center point of the rectangle surrounding each spot to form a coordinate array ; S6. Calculate the distance between the center point of the rectangle surrounding each spot and the origin to form a distance array , arrange the distance array and its corresponding coordinate array in ascending order from small to large, and get and ; S7, with coordinate array The first coordinate point With origin The straight line between As the reference line, calculate the current coordinate points one by one With origin The angle between the line connecting the two and the directrix ,Right now , forming an angle array ; S8, yes and After desensitization treatment, we can obtain and ; S9, will and Synthesize a new array , use the Hash function to find The hash code is the fruit pattern code.
2. The method for generating a fruit pattern code based on fruit spot texture recognition as claimed in claim 1, characterized in that: Step S2 uses a deep separable convolutional neural network model to segment the fruit object from the image, including the following processing steps: Process the input image into multiple pixel matrices; MobileNet is used to build a deep separable convolutional neural network model, which performs convolution processing on the pixel matrix to segment the fruit objects from the image.
3. The method for generating a fruit pattern code based on fruit spot texture recognition as claimed in claim 1, characterized in that: Step S3 uses a deep separable convolutional neural network model to identify and extract all the spots from the segmented fruit image, including the following processing steps: Process the fruit image into multiple pixel matrices; MobileNet is used to build a deep separable convolutional neural network model, which performs convolution processing on the pixel matrix to segment the spot objects from the image.
4. The method for generating a fruit pattern code based on fruit spot texture recognition as claimed in claim 1, characterized in that: Step S8 and Perform desensitization treatment, the preferred treatment method is as follows: ; ; in is the desensitization function, is the rounding function, dpi is the image resolution, is a scale parameter, and its value is determined by the recognized fruit category. is the desensitization step length. The larger the desensitization step length is, the lower the data resolution of the calculation result is.
5. The method for generating a fruit pattern code based on fruit spot texture recognition as claimed in claim 1, characterized in that: Step S9 and Synthesize a new array , the preferred processing method is as follows: The array and The array element type is converted into a string element; Each element in the array is assigned a value ,Right now .
6. The method for generating a fruit pattern code based on fruit spot texture recognition as claimed in claim 1, characterized in that: The Hash function in step S9 may preferably use the cryptographic hash algorithm SM3 promulgated by the State Cryptography Administration in December 2010.
7. A fruit pattern code generation system based on fruit spot texture recognition, characterized in that: The system comprises: An acquisition module, used for acquiring an image of the top of a fruit; A deep separable convolutional neural network module for segmenting fruit images from images and identifying and extracting all spots from the segmented fruit images; Calculation module, used to calculate and generate the grain code: Generate an outer rectangle for the fruit image and use the center of the outer rectangle as the coordinate origin O ; Calculate the coordinates of the center point of the rectangle surrounding each spot to form a coordinate array ; Calculate the distance between the center point of each spot's enclosing rectangle and the origin to form a distance array , arrange the distance array and its corresponding coordinate array in ascending order from small to large, and get and ; With coordinate array The first coordinate point With origin The straight line between As the reference line, calculate the current coordinate points one by one With origin The angle between the line connecting the two and the directrix ,Right now , forming an angle array ; right and After desensitization treatment, we can obtain and ; Will and Synthesize a new array , use the Hash function to find The hash code is the fruit pattern code.
8. A fruit pattern code generation device based on fruit spot texture recognition, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, the method for generating a fruit pattern code based on fruit spot texture recognition as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Coding and recognition method and device based on fruit streak map information
CN112488233A
METHOD FOR FORMING AND VERIFYING A BIOMETRIC FINGERPRINT CODE
RU2009111980A