A wheat quality inspection and evaluation method based on artificial intelligence

Through the wheat quality inspection and assessment method based on artificial intelligence, high-resolution cameras are used to collect wheat images and perform feature extraction to build a quality assessment model, which solves the problems of traditional wheat quality inspection taking a long time, high human error and high cost, and achieves rapid , accurate and economical quality assessment.

CN118865369BActive Publication Date: 2025-01-21LIAOCHENG GUOXINGXINGNONG AGRICULTURAL SERVICE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411093831.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2025-01-21
Estimated Expiration
2044-08-09

AI Technical Summary

Technical Problem

Traditional wheat quality testing methods are time-consuming, have high human error and high cost, making it difficult to meet the needs of fast, accurate and economical quality assessment.

Method used

An artificial intelligence-based wheat quality inspection and assessment method is adopted to collect wheat images through high-resolution cameras, perform denoising processing and target segmentation, extract wheat feature vectors, and build a quality assessment model to achieve rapid quality assessment.

Benefits of technology

It reduces manual operation time, improves detection accuracy and efficiency, reduces detection costs, and achieves fast and accurate wheat quality assessment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865369B_ABST
    Figure CN118865369B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of wheat quality inspection and evaluation, and discloses a wheat quality inspection and evaluation method based on artificial intelligence, the method comprising: collecting and denoising wheat images; performing target segmentation on the denoised wheat images; performing feature extraction on wheat sub-images to obtain wheat feature vectors; constructing a wheat quality evaluation model to evaluate the quality of wheat; and counting the quality evaluation results of all wheat to generate the overall quality of wheat. The present invention performs multi-scale segmentation on the denoised wheat images, combines the change information of pixels at different scales and the gradient information of neighborhood changes, performs target pixel identification on the pixels in the wheat images, realizes wheat target segmentation, extracts wheat feature vectors that characterize wheat texture changes, colors, and shape sizes, and uses a wheat quality evaluation model trained by equalization to perform quality evaluation, thereby realizing wheat quality inspection processing based on wheat images and artificial intelligence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of wheat quality inspection and evaluation, and in particular to a wheat quality inspection and evaluation method based on artificial intelligence. Background Art

[0002] With the continuous development of the wheat market and the improvement of consumers' requirements for food quality, wheat quality inspection is particularly important. Traditional wheat quality inspection methods mainly rely on manual experience and physical and chemical analysis, including indicators such as appearance, color, particle size, moisture content, and protein content. Although these methods can meet the needs of quality inspection to a certain extent, there are several problems: First, it is time-consuming. Traditional inspection methods usually take a long time to complete sample preparation and testing; second, the human error is high. Since the inspection process relies on manual operation, it may lead to inconsistent and inaccurate results; third, the cost is high. The need for professionals makes the cost of quality inspection relatively high. Summary of the invention

[0003] In view of this, the present invention proposes a wheat quality inspection and evaluation method based on artificial intelligence, which reduces the time of manual operation and realizes rapid quality evaluation through artificial intelligence technology.

[0004] To achieve the above object, the present invention provides a wheat quality inspection and evaluation method based on artificial intelligence, comprising the following steps:

[0005] S1: using a high-resolution camera to collect a wheat image of the wheat after tiling and dispersion, and performing denoising on the wheat image to obtain a denoised wheat image;

[0006] S2: performing target segmentation on the denoised wheat image to obtain a wheat sub-image of each grain of wheat, wherein micro-target recognition is an implementation method of the target segmentation;

[0007] S3: extracting features from the wheat sub-image to obtain a wheat feature vector;

[0008] S4: constructing a wheat quality assessment model to assess the quality of wheat and obtain the quality assessment result of each grain of wheat, wherein the wheat quality assessment model uses the extracted wheat feature vector as input and the wheat quality assessment result as output, wherein improved nearest neighbor analysis is an implementation method of the wheat quality assessment model;

[0009] S5: Count the quality assessment results of all wheat and generate the overall quality of wheat.

[0010] As a further improvement method of the present invention:

[0011] Optionally, in step S1, using a high-resolution camera to collect wheat images after tiling and dispersing the wheat includes:

[0012] Wheat is collected and processed by tiling and dispersion. A high-resolution camera is used to collect wheat images after tiling and dispersion. The collected wheat images are in the form of:

[0013] ;

[0014] ;

[0015] in:

[0016] represents the collected wheat image, which is in the form of a pixel matrix with X rows and Y columns, where X represents the number of pixel rows and Y represents the number of pixel columns of the wheat image;

[0017] Represents wheat image The pixel at row x and column y in , ;

[0018] Indicates that the pixels in the xth row and yth column of the wheat image are Color values ​​of color channels;

[0019] Image of wheat Perform denoising to obtain the denoised wheat image .

[0020] Optionally, the wheat image Perform denoising to obtain the denoised wheat image ,include:

[0021] The wheat image The denoising process is as follows:

[0022] S11: Get wheat image The neighborhood pixel area of ​​any pixel in , where the neighborhood pixel area of ​​the xth row and yth column is:

[0023] ;

[0024] in:

[0025] Represents wheat image The neighborhood pixel area of ​​the pixel in the xth row and yth column;

[0026] S12: Construct a noise reduction filter:

[0027] ;

[0028] ;

[0029] in:

[0030] represents a noise reduction filter;

[0031] Denotes a noise reduction filter The filter coefficients in , ;

[0032] represents the low-frequency filter coefficient in the noise reduction filter, Represents the high-frequency filter coefficient in the noise reduction filter;

[0033] represents an exponential function with a natural constant as base;

[0034] e represents the cutoff frequency;

[0035] S13: Using denoising filter to denoise wheat images Filter any pixel in the filter, where the filtering result of the pixel in the xth row and yth column is:

[0036] ;

[0037] ;

[0038] ;

[0039] in:

[0040] Represents wheat image The filtering result of the pixel at the xth row and the yth column in ;

[0041] Represents wheat image Middle Line Gray value of column pixels;

[0042] Represents the wheat image after filtering;

[0043] S14: Filtered wheat image The structural feature information is extracted and processed, wherein the extracted structural feature information is:

[0044] ;

[0045] in:

[0046] Represents wheat image Structural feature information;

[0047] represents the dilated convolution process with a dilation rate of 2, and the dilated convolution kernel is Pixel size, Represents the dilated convolution matrix corresponding to the dilated convolution kernel;

[0048] Represents convolution processing, and the convolution kernel is Pixel size, for The convolution matrix corresponding to the convolution kernel;

[0049] S15: Constructing a denoised wheat image :

[0050] ;

[0051] in:

[0052] For wheat images The corresponding denoised wheat image, , For wheat images The denoised pixel value of the pixel at row x and column y in .

[0053] Optionally, performing target segmentation on the denoised wheat image in step S2 includes:

[0054] The denoised wheat image is segmented. The target segmentation process is:

[0055] S21: Wheat image Divide into multiple target scales to obtain wheat images of multiple target scales:

[0056] ;

[0057] ;

[0058] in:

[0059] represents the wheat image at the target scale u, where U represents the maximum target scale;

[0060] S22: Construct U-1 wheat differential images, where the cth wheat differential image is:

[0061] ;

[0062] ;

[0063] in:

[0064] represents the cth wheat difference image, Represents wheat difference image The pixel value of the pixel at the xth row and yth column in;

[0065] S23: Calculate and obtain the gradient image corresponding to each wheat differential image, where the wheat differential image The corresponding gradient image is:

[0066] ;

[0067] :

[0068] in:

[0069] Represents wheat difference image The corresponding gradient image;

[0070] Represents wheat difference image The gradient value of the pixel at the xth row and yth column in;

[0071] S24: Generate spatial weights of different wheat difference images, where wheat difference images The spatial weight is:

[0072] ;

[0073] ;

[0074] in:

[0075] Represents wheat difference image The spatial weight of

[0076] Represents wheat difference image The neighborhood gradient of the pixel in the xth row and yth column;

[0077] S25: Based on the spatial weight and the pixel values ​​in the wheat difference image, the wheat image is The pixels in the wheat image are used for target pixel recognition. The target pixel recognition result of the pixel in the xth row and yth column is:

[0078] ;

[0079] in:

[0080] Represents wheat image The target pixel recognition result of the pixel in the xth row and yth column, If it is 1, it means that the pixel is the target pixel. If it is 0, it means that the pixel is not the target pixel;

[0081] Represents wheat image The standard deviation of the pixel value of the x-th row and y-th column in the U-1 wheat difference images;

[0082] Represents wheat image The mean pixel value of the pixel in the xth row and yth column in U-1 wheat difference images;

[0083] represents the pixel scale change threshold, For wheat images The change information of the pixel in the xth row and yth column at different target scales;

[0084] S26: Wheat image The pixel area formed by the continuous target pixels in the wheat image is taken as the wheat area, wherein the number of pixels in the pixel area is lower than the preset maximum pixel number threshold and higher than the preset minimum pixel number threshold; and Extract the image with wheat The image area with the same position of the wheat area in the middle is taken as the wheat sub-image, and the set of wheat sub-images is:

[0085] ;

[0086] in:

[0087] represents the kth wheat image;

[0088] K represents the total number of wheat sub-images, i.e., wheat images The total number of grains in wheat.

[0089] Optionally, the step S3 of extracting features from the wheat sub-image includes:

[0090] Feature extraction is performed on the wheat sub-image to obtain the wheat feature vector of each grain of wheat. The feature extraction process is:

[0091] S31: Extract wheat image Color features in:

[0092] ;

[0093] ;

[0094] ;

[0095] ;

[0096] ;

[0097] ;

[0098] ;

[0099] in:

[0100] Represents wheat image Color features in

[0101] represents wheat images in sequence Characteristic components in the R, G, B color channels;

[0102] Represents wheat image exist The characteristic component of the color channel, ;

[0103] Represents wheat image The bth pixel in The color value of the color channel, Represents wheat image The total number of pixels;

[0104] S32: Extract wheat image The texture information of the pixels marked as target pixels in constitutes the wheat sub-image Texture features:

[0105] ;

[0106] ;

[0107] ;

[0108] in:

[0109] Represents wheat image The texture features of Represents wheat image The texture information of the pth target pixel in, Represents wheat image The gray value of the pth target pixel in , Represents wheat image The pth target pixel in the wheat sub-image Pixel coordinates in ;

[0110] Represents wheat image middle The texture change value of the neighborhood pixel at position for the pth target pixel;

[0111] S33: Extract wheat image The outermost target pixel is taken as the wheat outline, and the geometric center of the inner area formed by the wheat outline is calculated. ,focal length and eccentricity , as the wheat sub-image Shape characteristics .

[0112] Optionally, constructing a wheat quality assessment model in step S4 includes:

[0113] Constructing a wheat quality assessment model, wherein the wheat quality assessment model takes the extracted wheat feature vector as input and takes the wheat quality assessment result as output, wherein the improved nearest neighbor analysis is the implementation method of the wheat quality assessment model, wherein the wheat quality assessment model includes an input layer, a feature mapping layer and a quality assessment layer;

[0114] The input layer is used to receive the wheat feature vector, the feature mapping layer is used to map the wheat feature vector to a high-dimensional space as the high-dimensional feature of the wheat, and the quality assessment layer is used to convert the high-dimensional feature of the wheat into a wheat quality assessment result; wherein the mapping parameters in the feature mapping layer and the assessment conversion parameters in the quality assessment layer are the parameters to be trained in the wheat quality assessment model;

[0115] The training process of the wheat quality assessment model is as follows:

[0116] S41: Obtain wheat feature vectors of D wheat and wheat quality assessment results to form a training data set data:

[0117] ;

[0118] in:

[0119] represents the wheat feature vector of the dth wheat, represents the wheat quality assessment result of the dth wheat; the wheat quality assessment results are divided into 1 to 7, corresponding to insect-damaged kernels, diseased kernels, fusarium-damaged kernels, damaged kernels, sprouted kernels, moldy kernels and normal wheat;

[0120] S42: calculating the Euclidean distance between the wheat feature vectors, and obtaining H nearest neighbor wheat feature vectors of each wheat feature vector;

[0121] S43: Select wheat feature vectors whose wheat quality assessment results are insect-damaged grains, diseased grains, fusarium-damaged grains, broken grains, sprouted grains and moldy grains, and generate feature vectors by performing nearest neighbor analysis on the selected wheat feature vectors until the proportion of wheat feature vectors of all wheat quality assessment results is higher than a preset threshold, and the generated feature vector is consistent with the wheat quality assessment result of the selected wheat feature vector; the wheat feature vector The formula for generating the eigenvector of is:

[0122] ;

[0123] in:

[0124] Represents a random number between 0 and 1;

[0125] Represents wheat feature vector The hth nearest neighbor wheat feature vector, Represents wheat feature vector The number of eigenvectors generated;

[0126] S44: Construct the model training objective function, use the gradient descent method to solve the parameters of the training objective function, and obtain the mapping parameters in the wheat quality assessment model And evaluate the transformation parameters, where the constructed training objective function is:

[0127] ;

[0128] in:

[0129] represents the training objective function, represents the parameters to be solved, Indicates that based on parameters The wheat quality assessment model constructed represents the total number of wheat feature vectors after feature vector generation, Represents the wheat feature vector As a model for wheat quality assessment The input of the model is the quality assessment result output by the model;

[0130] The wheat quality assessment model is used to receive the wheat feature vectors of all wheat, conduct quality assessment on the wheat, and obtain the quality assessment result of each grain of wheat.

[0131] Optionally, the wheat quality assessment model is used to assess the quality of wheat to obtain the quality assessment result of each grain of wheat, including:

[0132] The wheat quality assessment model is used to assess the quality of wheat and obtain the quality assessment results of each grain of wheat, where the wheat feature vector The quality assessment process is:

[0133] The input layer receives the wheat feature vector ;

[0134] The feature mapping layer transforms the wheat feature vector Mapped to high-dimensional space as high-dimensional features of wheat:

[0135] ;

[0136] in:

[0137] Represents wheat feature vector Corresponding high-dimensional features;

[0138] Represents the mapping parameters in the feature mapping layer;

[0139] represents the convolution operator;

[0140] The quality assessment layer transforms the high-dimensional features of wheat into Converted to wheat quality assessment results:

[0141] ;

[0142] in:

[0143] Represents wheat feature vector The wheat quality assessment results of the corresponding wheat, , which correspond to insect-damaged kernels, diseased kernels, fusarium-infected kernels, damaged kernels, sprouted kernels, moldy kernels and normal wheat in turn;

[0144] Indicates the evaluation conversion parameter corresponding to the wheat quality evaluation result v;

[0145] In an embodiment of the present invention, Indicates that the selection makes The maximum wheat quality evaluation result v is obtained as the output result.

[0146] Optionally, the quality assessment results of all wheat are counted in step S5, including:

[0147] The quality assessment results of all wheat are counted, and the proportion of wheat with different wheat quality assessment results is counted. Wheat assessed as insect-damaged grains, diseased grains, ergot-affected grains, broken grains, sprouted grains, and moldy grains are regarded as imperfect grains. The proportion of wheat with imperfect grains is regarded as the overall quality of wheat. If the overall quality of wheat is higher than the preset threshold, the wheat quality inspection assessment is unqualified.

[0148] In order to solve the above problem, the present invention provides an electronic device, the electronic device comprising:

[0149] A memory storing at least one instruction;

[0150] Communication interface, enabling electronic equipment to communicate; and

[0151] A processor executes the instructions stored in the memory to implement the above-mentioned artificial intelligence-based wheat quality inspection and evaluation method.

[0152] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one instruction is stored. The at least one instruction is executed by a processor in an electronic device to implement the above-mentioned artificial intelligence-based wheat quality inspection and evaluation method.

[0153] Compared with the prior art, the present invention proposes a wheat quality inspection and evaluation method based on artificial intelligence, which has the following advantages:

[0154] First of all, this scheme proposes a wheat image target segmentation method. A denoising filter is constructed by combining low-frequency filter coefficients and high-frequency filter coefficients, the wheat image is filtered, and the structural feature information of the wheat image is extracted by the hole convolution method. The filtered wheat image is enhanced to enhance the important structure, and the noise information of the wheat images collected in different environments is filtered. The denoised wheat image is segmented at multiple scales, and the multi-scale images are differentially calculated to obtain a differential image representing the pixel change information at different scales. The gradient value of the pixel is calculated to obtain the gradient information representing the pixel change in the neighborhood, and then the pixels in the wheat image are identified as target pixels, where the target pixel is the foreground pixel representing the inside of the wheat, to achieve wheat sub-image segmentation.

[0155] At the same time, this scheme extracts color features, texture features and structural features of wheat sub-images to obtain wheat feature vectors that characterize wheat texture changes, color, and shape and size, thereby improving the accuracy of wheat quality assessment. Training data is collected, and feature vectors of a few samples are generated in combination with nearest neighbor analysis to achieve few-sample equalization processing. A wheat quality assessment model that can evaluate multiple types of wheat is trained to achieve quality inspection of each grain of wheat based on wheat images and artificial intelligence. According to the proportion of different types of wheat, the proportion of imperfect grains is used as the overall quality of wheat to achieve overall quality assessment. BRIEF DESCRIPTION OF THE DRAWINGS

[0156] Figure 1 A schematic diagram of a flow chart of a wheat quality inspection and evaluation method based on artificial intelligence provided by an embodiment of the present invention;

[0157] Figure 2 A schematic diagram of the structure of an electronic device for implementing an artificial intelligence-based wheat quality inspection and evaluation method provided by an embodiment of the present invention.

[0158] In the figure: 1 electronic device, 10 processor, 11 memory, 12 program, 13 communication interface.

[0159] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0160] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0161] The embodiment of the present application provides a wheat quality inspection and evaluation method based on artificial intelligence. The execution subject of the wheat quality inspection and evaluation method based on artificial intelligence includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided in the embodiment of the present application. In other words, the wheat quality inspection and evaluation method based on artificial intelligence can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.

[0162] Embodiment 1:

[0163] S1: using a high-resolution camera to collect a wheat image of the wheat after tiling and dispersion, and performing denoising on the wheat image to obtain a denoised wheat image.

[0164] In the step S1, a high-resolution camera is used to collect wheat images after tiling and dispersing the wheat, including:

[0165] Wheat is collected and processed by tiling and dispersion. A high-resolution camera is used to collect wheat images after tiling and dispersion. The collected wheat images are in the form of:

[0166] ;

[0167] ;

[0168] in:

[0169] represents the collected wheat image, which is in the form of a pixel matrix with X rows and Y columns, where X represents the number of pixel rows and Y represents the number of pixel columns of the wheat image;

[0170] Represents wheat image The pixel at row x and column y in , ;

[0171] Indicates that the pixels in the xth row and yth column of the wheat image are Color values ​​of color channels;

[0172] Image of wheat Perform denoising to obtain the denoised wheat image .

[0173] The wheat image The denoising process is as follows:

[0174] S11: Get wheat image The neighborhood pixel area of ​​any pixel in , where the neighborhood pixel area of ​​the xth row and yth column is:

[0175] ;

[0176] in:

[0177] Represents wheat image The neighborhood pixel area of ​​the pixel in the xth row and yth column;

[0178] S12: Construct a noise reduction filter:

[0179] ;

[0180] ;

[0181] in:

[0182] represents a noise reduction filter;

[0183] Denotes a noise reduction filter The filter coefficients in ;

[0184] represents the low-frequency filter coefficient in the noise reduction filter, Represents the high-frequency filter coefficient in the noise reduction filter;

[0185] represents an exponential function with a natural constant as base;

[0186] e represents the cutoff frequency;

[0187] S13: Using denoising filter to denoise wheat images Filter any pixel in the filter, where the filtering result of the pixel in the xth row and yth column is:

[0188] ;

[0189] ;

[0190] ;

[0191] in:

[0192] Represents wheat image The filtering result of the pixel at the xth row and the yth column in ;

[0193] Represents wheat image Middle Line Gray value of column pixels;

[0194] Represents the wheat image after filtering;

[0195] S14: Filtered wheat image The structural feature information is extracted and processed, wherein the extracted structural feature information is:

[0196] ;

[0197] in:

[0198] Represents wheat image Structural feature information;

[0199] represents the dilated convolution process with a dilation rate of 2, and the dilated convolution kernel is Pixel size, Represents the dilated convolution matrix corresponding to the dilated convolution kernel;

[0200] Represents convolution processing, and the convolution kernel is Pixel size, for The convolution matrix corresponding to the convolution kernel;

[0201] S15: Constructing a denoised wheat image :

[0202] ;

[0203] in:

[0204] For wheat images The corresponding denoised wheat image, , For wheat images The denoised pixel value of the pixel at row x and column y in .

[0205] S2: Perform target segmentation on the denoised wheat image to obtain a wheat sub-image of each grain of wheat.

[0206] In the step S2, target segmentation is performed on the denoised wheat image, including:

[0207] The denoised wheat image is segmented. The target segmentation process is:

[0208] S21: Wheat image Divide into multiple target scales to obtain wheat images of multiple target scales:

[0209] ;

[0210] ;

[0211] in:

[0212] represents the wheat image at the target scale u, where U represents the maximum target scale;

[0213] S22: Construct U-1 wheat differential images, where the cth wheat differential image is:

[0214] ;

[0215] ;

[0216] in:

[0217] represents the cth wheat difference image, Represents wheat difference image The pixel value of the pixel at the xth row and yth column in;

[0218] S23: Calculate and obtain the gradient image corresponding to each wheat differential image, where the wheat differential image The corresponding gradient image is:

[0219] ;

[0220] ;

[0221] in:

[0222] Represents wheat difference image The corresponding gradient image;

[0223] Represents wheat difference image The gradient value of the pixel at the xth row and yth column in;

[0224] S24: Generate spatial weights of different wheat difference images, where wheat difference images The spatial weight is:

[0225] ;

[0226] ;

[0227] in:

[0228] Represents wheat difference image The spatial weight of

[0229] Represents wheat difference image The neighborhood gradient of the pixel in the xth row and yth column;

[0230] S25: Based on the spatial weight and the pixel values ​​in the wheat difference image, the wheat image is The pixels in the wheat image are used for target pixel recognition. The target pixel recognition result of the pixel in the xth row and yth column is:

[0231] ;

[0232] in:

[0233] Represents wheat image The target pixel recognition result of the pixel in the xth row and yth column, If it is 1, it means that the pixel is the target pixel. If it is 0, it means that the pixel is not the target pixel;

[0234] Represents wheat image The standard deviation of the pixel value of the x-th row and y-th column in the U-1 wheat difference images;

[0235] Represents wheat image The mean pixel value of the pixel in the xth row and yth column in U-1 wheat difference images;

[0236] represents the pixel scale change threshold, For wheat images The change information of the pixel in the xth row and yth column at different target scales;

[0237] S26: Wheat image The pixel area formed by the continuous target pixels in the wheat image is taken as the wheat area, wherein the number of pixels in the pixel area is lower than the preset maximum pixel number threshold and higher than the preset minimum pixel number threshold; and Extract the image with wheat The image area with the same position of the wheat area in the middle is taken as the wheat sub-image, and the set of wheat sub-images is:

[0238] ;

[0239] in:

[0240] represents the kth wheat image;

[0241] K represents the total number of wheat sub-images, i.e., wheat images The total number of grains in wheat.

[0242] S3: Extract features from the wheat sub-image to obtain a wheat feature vector.

[0243] The step S3 extracts features from the wheat image, including:

[0244] Feature extraction is performed on the wheat sub-image to obtain the wheat feature vector of each grain of wheat. The feature extraction process is:

[0245] S31: Extract wheat image Color features in:

[0246] ;

[0247] ;

[0248] ;

[0249] ;

[0250] ;

[0251] ;

[0252] ;

[0253] in:

[0254] Represents wheat image Color features in

[0255] represents wheat images in sequence Characteristic components in the R, G, B color channels;

[0256] Represents wheat image exist The characteristic component of the color channel, ;

[0257] Represents wheat image The bth pixel in The color value of the color channel, Represents wheat image The total number of pixels;

[0258] S32: Extract wheat image The texture information of the pixels marked as target pixels in constitutes the wheat sub-image Texture features:

[0259] ;

[0260] ;

[0261] ;

[0262] in:

[0263] Represents wheat image The texture features of Represents wheat image The texture information of the pth target pixel in, Represents wheat image The gray value of the pth target pixel in , Represents wheat image The pth target pixel in the wheat sub-image Pixel coordinates in ;

[0264] Represents wheat image middle The texture change value of the neighborhood pixel at position for the pth target pixel;

[0265] S33: Extract wheat image The outermost target pixel is taken as the wheat outline, and the geometric center of the inner area formed by the wheat outline is calculated. ,focal length and eccentricity , as the wheat sub-image Shape characteristics .

[0266] S4: constructing a wheat quality assessment model to assess the quality of wheat and obtain the quality assessment result of each grain of wheat. The wheat quality assessment model takes the extracted wheat feature vector as input and takes the wheat quality assessment result as output.

[0267] The wheat quality assessment model is constructed in step S4, including:

[0268] Constructing a wheat quality assessment model, wherein the wheat quality assessment model takes the extracted wheat feature vector as input and takes the wheat quality assessment result as output, wherein the wheat quality assessment model comprises an input layer, a feature mapping layer and a quality assessment layer;

[0269] The input layer is used to receive the wheat feature vector, the feature mapping layer is used to map the wheat feature vector to a high-dimensional space as the high-dimensional feature of the wheat, and the quality assessment layer is used to convert the high-dimensional feature of the wheat into a wheat quality assessment result; wherein the mapping parameters in the feature mapping layer and the assessment conversion parameters in the quality assessment layer are the parameters to be trained in the wheat quality assessment model;

[0270] The training process of the wheat quality assessment model is as follows:

[0271] S41: Obtain wheat feature vectors of D wheat and wheat quality assessment results to form a training data set data:

[0272] ;

[0273] in:

[0274] represents the wheat feature vector of the dth wheat, represents the wheat quality assessment result of the dth wheat; the wheat quality assessment results are divided into 1 to 7, corresponding to insect-damaged kernels, diseased kernels, fusarium-damaged kernels, damaged kernels, sprouted kernels, moldy kernels and normal wheat;

[0275] S42: calculating the Euclidean distance between the wheat feature vectors, and obtaining H nearest neighbor wheat feature vectors of each wheat feature vector;

[0276] S43: Select wheat feature vectors whose wheat quality assessment results are insect-damaged grains, diseased grains, fusarium-damaged grains, broken grains, sprouted grains and moldy grains, and generate feature vectors by performing nearest neighbor analysis on the selected wheat feature vectors until the proportion of wheat feature vectors of all wheat quality assessment results is higher than a preset threshold, and the generated feature vector is consistent with the wheat quality assessment result of the selected wheat feature vector; the wheat feature vector The formula for generating the eigenvector of is:

[0277] ;

[0278] in:

[0279] Represents a random number between 0 and 1;

[0280] Represents wheat feature vector The hth nearest neighbor wheat feature vector, Represents wheat feature vector The number of eigenvectors generated;

[0281] S44: Construct the model training objective function, use the gradient descent method to solve the parameters of the training objective function, and obtain the mapping parameters in the wheat quality assessment model And evaluate the transformation parameters, where the constructed training objective function is:

[0282] ;

[0283] in:

[0284] represents the training objective function, represents the parameters to be solved, Indicates that based on parameters The wheat quality assessment model constructed represents the total number of wheat feature vectors after feature vector generation, Represents the wheat feature vector As a model for wheat quality assessment The input of the model is the quality assessment result output by the model;

[0285] The wheat quality assessment model is used to receive the wheat feature vectors of all wheat, conduct quality assessment on the wheat, and obtain the quality assessment result of each grain of wheat.

[0286] The wheat quality assessment model is used to assess the quality of wheat, and the quality assessment result of each grain of wheat is obtained, including:

[0287] The wheat quality assessment model is used to assess the quality of wheat and obtain the quality assessment results of each grain of wheat, where the wheat feature vector The quality assessment process is:

[0288] The input layer receives the wheat feature vector ;

[0289] The feature mapping layer transforms the wheat feature vector Mapped to high-dimensional space as high-dimensional features of wheat:

[0290] ;

[0291] in:

[0292] Represents wheat feature vector Corresponding high-dimensional features;

[0293] Represents the mapping parameters in the feature mapping layer;

[0294] represents the convolution operator;

[0295] The quality assessment layer transforms the high-dimensional features of wheat into Converted to wheat quality assessment results:

[0296] ;

[0297] in:

[0298] Represents wheat feature vector The wheat quality assessment results of the corresponding wheat, , which correspond to insect-damaged kernels, diseased kernels, fusarium-infected kernels, damaged kernels, sprouted kernels, moldy kernels and normal wheat in turn;

[0299] Represents the evaluation conversion parameter corresponding to the wheat quality evaluation result v.

[0300] S5: Count the quality assessment results of all wheat and generate the overall quality of wheat.

[0301] The quality assessment results of all wheat are counted in step S5, including:

[0302] The quality assessment results of all wheat are counted, and the proportion of wheat with different wheat quality assessment results is counted. Wheat assessed as insect-damaged grains, diseased grains, ergot-affected grains, broken grains, sprouted grains, and moldy grains are regarded as imperfect grains. The proportion of wheat with imperfect grains is regarded as the overall quality of wheat. If the overall quality of wheat is higher than the preset threshold, the wheat quality inspection assessment is unqualified.

[0303] Embodiment 2:

[0304] like Figure 2 , is a schematic diagram of the structure of an electronic device for implementing an artificial intelligence-based wheat quality inspection and evaluation method provided by an embodiment of the present invention.

[0305] The electronic device 1 may include a processor 10 , a memory 11 , a communication interface 13 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as a program 12 .

[0306] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device 1, such as the code of the program 12, etc., but also be used to temporarily store data that has been output or is to be output.

[0307] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, and executes or executes the programs or modules stored in the memory 11 (such as the program 12 for implementing wheat quality inspection and evaluation based on artificial intelligence), and calls the data stored in the memory 11 to execute various functions of the electronic device 1 and process data.

[0308] The communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices, and to achieve connection and communication between internal components of the electronic device.

[0309] The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.

[0310] Figure 2 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 2 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0311] For example, although not shown, the electronic device 1 may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0312] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.

[0313] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0314] The program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:

[0315] A high-resolution camera is used to collect wheat images after tiling and dispersion of wheat, and the wheat images are denoised to obtain denoised wheat images;

[0316] Perform target segmentation on the denoised wheat image to obtain the wheat sub-image of each grain of wheat;

[0317] Extract features from the wheat sub-image to obtain a wheat feature vector;

[0318] Construct a wheat quality assessment model to assess the quality of wheat and obtain the quality assessment results of each grain of wheat;

[0319] The quality assessment results of all wheat are counted to generate the overall quality of wheat.

[0320] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to Figure 1 to Figure 2 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0321] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.

[0322] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0323] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A wheat quality inspection and evaluation method based on artificial intelligence, characterized in that: The method comprises: S1: using a high-resolution camera to collect a wheat image of the wheat after tiling and dispersion, and performing denoising on the wheat image to obtain a denoised wheat image; S2: Perform target segmentation on the denoised wheat image to obtain a wheat sub-image of each grain of wheat; S3: extracting features from the wheat sub-image to obtain a wheat feature vector; S4: constructing a wheat quality assessment model to assess the quality of wheat and obtain a quality assessment result of each grain of wheat, wherein the wheat quality assessment model takes the extracted wheat feature vector as input and takes the wheat quality assessment result as output; Constructing a wheat quality assessment model, wherein the wheat quality assessment model takes the extracted wheat feature vector as input and takes the wheat quality assessment result as output, wherein the wheat quality assessment model comprises an input layer, a feature mapping layer and a quality assessment layer; The input layer is used to receive the wheat feature vector, the feature mapping layer is used to map the wheat feature vector to a high-dimensional space as the high-dimensional feature of the wheat, and the quality assessment layer is used to convert the high-dimensional feature of the wheat into a wheat quality assessment result; wherein the mapping parameters in the feature mapping layer and the assessment conversion parameters in the quality assessment layer are the parameters to be trained in the wheat quality assessment model; The training process of the wheat quality assessment model is as follows: S41: Obtain wheat feature vectors of D wheat and wheat quality assessment results to form a training data set data: data={(F(d),V(d))|d∈[1,D]} in: F(d) represents the wheat feature vector of the d-th wheat, V(d) represents the wheat quality assessment result of the d-th wheat, and D represents the total number of wheat feature vectors after the feature vectors are generated; the wheat quality assessment results are divided into 1 to 7, corresponding to insect-damaged kernels, diseased kernels, fusarium-damaged kernels, damaged kernels, sprouted kernels, moldy kernels, and normal wheat; S42: calculating the Euclidean distance between the wheat feature vectors, and obtaining H nearest neighbor wheat feature vectors of each wheat feature vector; S43: Select wheat feature vectors whose wheat quality assessment results are insect-damaged grains, diseased grains, fusarium-damaged grains, broken grains, sprouted grains and moldy grains, and generate feature vectors by performing nearest neighbor analysis on the selected wheat feature vectors until the proportion of wheat feature vectors of all wheat quality assessment results is higher than a preset threshold, wherein the generated feature vector is consistent with the wheat quality assessment result of the selected wheat feature vector; the feature vector generation formula of the wheat feature vector F(d) is: in: rand(0,1) represents a random number between 0 and 1; F h (d) represents the hth nearest neighbor wheat feature vector of the wheat feature vector F(d), count(F h (d)) represents the number of feature vectors generated based on the wheat feature vector F(d), and F′(d) represents the wheat feature vector calculated by performing nearest neighbor analysis on the wheat feature vector F(d); S44: constructing a model training objective function, using a gradient descent method to solve the parameters of the training objective function, and obtaining mapping parameters and evaluation conversion parameters in the wheat quality evaluation model, wherein the constructed training objective function is: in: Loss(θ) represents the training objective function, θ represents the parameter to be solved, G θ (·) represents the wheat quality assessment model constructed based on parameter θ, G θ (F′(d)) shows that the wheat feature vector F′(d) calculated by nearest neighbor analysis is used as the wheat quality evaluation model G θ (·) input, the quality assessment result output by the model; The wheat quality assessment model is used to receive the wheat feature vectors of all wheat, and the quality of the wheat is assessed to obtain the quality assessment result of each grain of wheat; S5: Count the quality assessment results of all wheat to generate the overall quality of wheat; In the step S1, a high-resolution camera is used to collect wheat images after tiling and dispersing the wheat, including: Wheat is collected and processed by tiling and dispersion. A high-resolution camera is used to collect wheat images after tiling and dispersion. The collected wheat images are in the form of: I=(I(x,y)) X×Y I(x,y)=(I R (x,y),I G (x,y),I B (x,y)) in: I represents the collected wheat image, which is in the form of a pixel matrix of X rows and Y columns, where X represents the number of pixel rows of the wheat image, and Y represents the number of pixel columns of the wheat image; I(x,y) represents the pixel in the xth row and yth column of the wheat image I, x∈[1,X],y∈[1,Y]; I R (x,y),I G (x,y),I B (x,y) represents the color value of the pixel in the xth row and yth column of the wheat image in the R, G, and B color channels respectively; De-noising the wheat image I to obtain the denoised wheat image I * ; The wheat image I is subjected to denoising processing to obtain the denoised wheat image I * ,include: The denoising process of the wheat image I is as follows: S11: Obtain the neighborhood pixel area of ​​any pixel in the wheat image I, where the neighborhood pixel area of ​​the pixel in the xth row and the yth column is: in: Ω(x,y) represents the neighborhood pixel area of ​​the pixel in the xth row and yth column in the wheat image I; S12: Construct the noise reduction filter: in: H * represents a noise reduction filter; H i,j Denotes the noise reduction filter H * The filter coefficients in , i∈{-1,0,1},j∈{-1,0,1}; S0 represents the low-frequency filter coefficient in the noise reduction filter, and S1 represents the high-frequency filter coefficient in the noise reduction filter; exp(·) represents an exponential function with a natural constant as the base; e represents the cutoff frequency; S13: Use a noise reduction filter to filter any pixel in the wheat image I, where the filtering result of the pixel in the xth row and yth column is: I′=(I′(x,y)) X×Y g(x+i,y+j)=0.3I R (x+i,y+j)+0.58I G (x+i,y+j)+0.12I G (x+i,y+j) in: I′(x,y) represents the filtering result of the pixel in the xth row and yth column in the wheat image I; g(x+i,y+j) represents the gray value of the pixel in the x+ith row and y+jth column in the wheat image I; I′ represents the wheat image after filtering; S14: extracting structural feature information from the filtered wheat image I′, wherein the extracted structural feature information is: in: F1 represents the structural feature information of the wheat image I′; represents the dilated convolution process with a dilation rate of 2, the dilated convolution kernel is 3×3 pixels in size, and W1 represents the dilated convolution matrix corresponding to the dilated convolution kernel; Conv 1×1 (·) represents convolution processing, the convolution kernel is 1×1 pixel size, and W2 is the convolution matrix corresponding to the 1×1 convolution kernel; S15: Constructing the denoised wheat image I * : I * =I′+F1 in: I * is the denoised wheat image corresponding to wheat image I, I * =(I * (x,y) X×Y , I * (x,y) is the denoised pixel value of the pixel in the xth row and yth column in the wheat image I; In the step S2, target segmentation is performed on the denoised wheat image, including: The denoised wheat image is segmented, where the wheat image I * The target segmentation process is: S21: Wheat image I * Divide into multiple target scales to obtain wheat images of multiple target scales: in: represents the wheat image at the target scale u, where U represents the maximum target scale; S22: Construct U-1 wheat differential images, where the cth wheat differential image is: L c =(L c (x,y)) X×Y ,c∈[1,U-1] in: L c represents the cth wheat differential image, L c (x,y) represents the wheat difference image L c The pixel value of the pixel at the xth row and yth column in ; S23: Calculate and obtain the gradient image corresponding to each wheat differential image, where the wheat differential image L c The corresponding gradient image is: grad c =(grad c (x,y)) X×Y in: grad c Represents the wheat difference image L c The corresponding gradient image; grad c (x,y) represents the wheat difference image L c The gradient value of the pixel at the xth row and yth column in; S24: Generate spatial weights of different wheat difference images, where the wheat difference image L c The spatial weight is weight c ; S25: Based on the spatial weight and the pixel values ​​in the wheat difference image, the wheat image I * Target pixel recognition is performed on the pixels in the image; S26: Wheat image I * The pixel area formed by the continuous target pixels in the wheat image I is taken as the wheat area, wherein the number of pixels in the pixel area is lower than the preset maximum pixel number threshold and higher than the preset minimum pixel number threshold; and the wheat image I is extracted from the wheat image I * The image area with the same position of the wheat area in the middle is taken as the wheat sub-image, and the set of wheat sub-images is: {I k |k∈[1,K]} in: I k represents the kth wheat image; K represents the total number of wheat sub-images, that is, the total number of wheat grains in the wheat image I; The step S3 extracts features from the wheat image, including: Feature extraction is performed on the wheat sub-image to obtain the wheat feature vector of each grain of wheat, where the wheat sub-image I k The feature extraction process is: S31: Extract wheat image I k Color features in S32: Extract wheat image I k The texture information of the pixels marked as target pixels in constitutes the wheat sub-image I k Texture features S33: Extract wheat image I k The outermost target pixel is taken as the wheat outline, and the geometric center of the inner area formed by the wheat outline is calculated. focal length and eccentricity As wheat image I k Shape characteristics 2. The wheat quality inspection and evaluation method based on artificial intelligence as claimed in claim 1, characterized in that: The wheat quality assessment model is used to assess the quality of wheat, and the quality assessment result of each grain of wheat is obtained, including: The wheat quality assessment model is used to assess the quality of wheat and obtain the quality assessment result of each grain of wheat, where the wheat feature vector f k The quality assessment process is: The input layer receives the wheat feature vector f k ; The feature mapping layer transforms the wheat feature vector f k Mapped to high-dimensional space as high-dimensional features of wheat: in: E k represents the wheat feature vector f k Corresponding high-dimensional features; W1′ represents the mapping parameters in the feature mapping layer; * indicates the convolution operator; The quality assessment layer transforms the high-dimensional features E of wheat into k Converted to wheat quality assessment results: in: V k represents the wheat feature vector f k The wheat quality assessment result of the corresponding wheat, V k ∈[1,7], corresponding to insect-damaged kernels, diseased kernels, fusarium-damaged kernels, damaged kernels, sprouted kernels, moldy kernels, and normal wheat; w v Represents the evaluation conversion parameter corresponding to the wheat quality evaluation result v.

3. A wheat quality inspection and evaluation method based on artificial intelligence as claimed in claim 2, characterized in that: The quality assessment results of all wheat are counted in step S5, including: The quality assessment results of all wheat are counted, and the proportion of wheat with different wheat quality assessment results is counted. Wheat assessed as insect-damaged grains, diseased grains, ergot-affected grains, broken grains, sprouted grains, and moldy grains are regarded as imperfect grains. The proportion of wheat with imperfect grains is regarded as the overall quality of wheat. If the overall quality of wheat is higher than the preset threshold, the wheat quality inspection assessment is unqualified.

Citation Information

Patent Citations

  • Quality detection method and device, equipment and storage medium

    CN115273074A

  • Grain quality index intelligent detection method based on machine vision

    CN116912244A

  • Fresh food sorting method with multi-stage filtration

    CN118155203A