Zanthoxylum schinifolium quality evaluation system and method based on image recognition
Through the blue and white pepper quality evaluation system based on image recognition, using multimodal image data and advanced image processing algorithms, combined with hyperspectral imaging technology and texture feature analysis, the accuracy and efficiency of traditional blue and white pepper quality evaluation methods are solved, and a comprehensive, accurate and efficient evaluation of blue and white pepper quality is achieved.
Patent Information
- Application Number
- CN202510522973.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-05-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The traditional green pepper quality evaluation method has poor accuracy, single evaluation indicators and cannot meet the needs of large-scale rapid evaluation, resulting in inefficient and inefficient evaluation results.
The blue and white pepper quality evaluation system based on image recognition is adopted, and the feature map of blue and white pepper is constructed through multimodal image data, advanced image processing algorithms and machine learning technology, and combined with hyperspectral imaging technology and texture feature analysis, a comprehensive, accurate and efficient evaluation of blue and white pepper quality is achieved.
The accuracy and efficiency of the quality evaluation of green and white peppers has been improved, and the quality of green and white peppers can be measured more accurately, and the subjectivity and error of manual evaluation are reduced. It is suitable for large-scale and real-time quality evaluation needs.
Smart Images

Figure CN120047694A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of recognition and processing of image data, and relates to a quality evaluation system and method for green prickly ash based on image recognition. Background Art
[0002] As an important agricultural product, green prickly ash is widely used in multiple fields such as food, medicine, and daily chemicals. The quality of green prickly ash directly affects the taste, quality, and market value of products. In the current era of rapid digital and intelligent development, image recognition technology has been increasingly widely used in the field of agricultural product quality evaluation due to its advantages of high efficiency, accuracy, and non-contact. Using image recognition technology to evaluate the quality of green prickly ash can quickly obtain various information about the appearance, color, and texture of green prickly ash, providing the possibility for accurate and efficient quality grading.
[0003] Currently, in the production and actual use process of green prickly ash, there are many problems in the quality evaluation of green prickly ash. On the one hand, the traditional quality evaluation of green prickly ash mainly relies on manual sensory judgment, which is greatly affected by the experience, subjective factors, and environmental factors of the evaluators, resulting in poor accuracy and consistency of the evaluation results. For example, different evaluators have different perceptions of the color and numbness characteristics of green prickly ash, making it difficult to ensure the reliability of the evaluation results. On the other hand, the quality of green prickly ash is comprehensively affected by multiple factors, including the growth environment, picking time, and storage conditions. Existing evaluation methods are difficult to comprehensively and quantitatively consider these factors and cannot accurately reflect the internal quality and quality differences of green prickly ash. In addition, in the process of large-scale production and trading of green prickly ash, manual evaluation is inefficient and difficult to meet the needs of rapid and batch evaluation, seriously restricting the development of the green prickly ash industry.
[0004] Currently, the following are the main solutions. Some studies have tried to use chemical analysis methods to detect the components of green prickly ash to evaluate its quality. By using high-performance liquid chromatography to determine the content of the main active components in green prickly ash, it provides a certain quantitative basis for quality evaluation. However, chemical analysis methods are complex to operate, costly, and destructive, and are not suitable for large-scale and real-time quality evaluation. There are also some studies that use simple image analysis techniques, such as color analysis based on the RGB color model and basic shape measurement, to evaluate the appearance of green prickly ash. For example, a method for evaluating the quality of agricultural products based on image color features grades the quality by extracting color features. But this method only considers some appearance features and ignores important factors such as the spectral information, texture features, and growth stage of green prickly ash, and the evaluation results are not comprehensive and accurate enough.
[0005] At present, there are mainly the following solutions. Some studies have tried to use chemical analysis methods to detect the components of green pepper to evaluate its quality. The content of the main active ingredients in green pepper was determined by high-performance liquid chromatography, which provided a certain quantitative basis for quality assessment. However, the chemical analysis method is complex, costly, and destructive, and is not suitable for large-scale, real-time quality assessment. Some other studies use simple image analysis techniques, such as color analysis based on the RGB color model and basic shape measurement, to evaluate the appearance of green pepper. For example, the authorization announcement number is CN118379727B, and the patent name is a system and method for evaluating the quality grade of polygonatum agricultural products based on image recognition. This technology extracts color features for quality grading, recognizes the shape of polygonatum agricultural products in the image, constructs a feature map, and evaluates the color based on this. In terms of image optimization, it only uses the plane layout method to construct the feature map, preliminarily evaluates the shape based on the area duty cycle, and evaluates the color grade through simple color difference comparison. The method is relatively simple and it is difficult to perform deep optimization processing on the green pepper image. It is unable to fully mine the complex information of the texture and growth stage in the green pepper image, and ignores the important factors of the spectral information, texture characteristics and growth stage of the green pepper. The evaluation results are not comprehensive and accurate enough.
[0006] In addition, the patent with publication number CN115953627A is called an image recognition system for classifying peppers by grade. The light source module provides parallel shadowless light irradiation, the image acquisition module collects images, and the image processing module performs a series of processing such as filtering and sharpening to optimize the image. A model is built for grade classification, and the equipment is evaluated based on the collection deviation coefficient. However, this technology is designed for peppers. When applied to the quality assessment of green peppercorns, its image optimization process may not be able to adapt to the unique morphology and characteristics of green peppercorns. For example, the texture of green peppercorns is more complex and there may be more subtle features on the surface. During the image filtering and sharpening process, this technology may not be able to accurately highlight these features of green peppercorns, resulting in the subsequent recognition and evaluation accuracy being affected.
[0007] The existing solutions have their own advantages and disadvantages in the production process. Although simple image analysis technology has certain rapidity and non-destructiveness, it cannot fully reflect the quality characteristics of green pepper due to its single evaluation index. Therefore, in order to solve the problems in actual production, the present invention proposes a green pepper quality evaluation system and method based on image recognition, which comprehensively uses multimodal image data, advanced image processing algorithms and machine learning technology to comprehensively, accurately and efficiently evaluate the quality of green pepper to meet the needs of the development of the green pepper industry. Summary of the invention
[0008] The present invention provides a quality evaluation system and method for green prickly ash based on image recognition, so as to solve the problems of poor accuracy, single evaluation index, and inability to meet the needs of large-scale rapid evaluation in the traditional quality evaluation method of green prickly ash.
[0009] To solve the above problems, the technical solution adopted by the invention is as follows: A quality evaluation method for green prickly ash based on image recognition includes the following steps: S01 Collect green prickly ash images, use image preprocessing technology to remove image noise, adjust image brightness and contrast, then use an edge detection algorithm to identify the shape contour of green prickly ash, compare the extracted shape contour data with the pre-stored standard green prickly ash shape contour data, calculate the similarity between the two, set a similarity threshold, if the calculated similarity is greater than or equal to the threshold, it is determined that there is green prickly ash in the image, and record the number of green prickly ash. For the shape contour of each identified green prickly ash, use a curvature-based segmentation method for segmentation, divide the shape contour of green prickly ash into multiple small polygon regions, use the shoelace formula to calculate the area of each small polygon respectively and accumulate them to obtain the area of each green prickly ash, calculate the average value A of the areas of all green prickly ash as the average size of green prickly ash, and divide the green prickly ash into several grades according to the set proportional coefficient k The shoelace formula is:
[0010] n is the number of polygon vertices, is i the vertex coordinates of the green prickly ash area, the n abscissa of the th vertex of the small polygon, n the ordinate of the Calculate the variance of the areas of all green prickly ash, and define the uniformity index where the closer U is to 1, the higher the uniformity. Among them, is the variance of the areas of all green prickly ash, is the uniformity index; S02 Based on the shape of the green prickly ash identified in S01, construct a characteristic spectrum of the green prickly ash; use hyperspectral imaging technology to obtain the spectral characteristics of the green prickly ash, and expand the hyperspectral data into a matrix by pixels, calculate the covariance matrix where, represents the hyperspectral data, , where m and n are the number of pixels of the hyperspectral image in the spatial dimension, p represents the number of spectral dimensions, C is the covariance matrix, and X is the matrix obtained by unfolding the hyperspectral data pixel by pixel, is the transpose matrix of matrix X. The projection matrix V is obtained by performing eigen decomposition on C, and the hyperspectral features after dimensionality reduction , and is concatenated with the shape and size features of the visible light image to obtain . The contrast is extracted from the co-occurrence matrix, and after dimensionality reduction, it is fused with the shape and size features of the visible light image. At the same time, the gray-level co-occurrence matrix, local binary pattern, and fractal dimension are used to extract texture features to form , is fused with to obtain which is the comprehensive feature vector obtained after being processed by the feature map construction module; By collecting samples during the young fruit stage and mature stage of green prickly ash, the spectral features are obtained using hyperspectral imaging technology for each sample, and the shape and size features are obtained using visible light images. Hyperspectral clustering analysis, dimensionality reduction, feature concatenation and fusion, and texture feature extraction are combined to obtain the feature vectors of each growth stage, which are stored in the database together with the corresponding growth stage labels to construct the growth stage database , where represents the set of feature vectors of different growth stages, q represents the number of growth stages, and the comprehensive feature vector is calculated with each standard feature vector for similarity , where is the i th standard feature vector of the j th growth stage in the growth stage database D, and the growth stage with the largest associated similarity is determined; for the same batch of green prickly ash, images are collected multiple times to obtain the feature sequence , Among them , represents the feature vector obtained after the L th image collection, L represents the number of collections, and the dynamic time warping algorithm is used to construct the time series feature map ; S03 performs quality assessment based on the time series feature map obtained from S02, assigns weights to each feature in the time series feature map . The analytic hierarchy process is used to determine the weight size. It is defined that the feature image has n features, which are respectively , and the corresponding weights are , and Through the formula
[0011] Calculate the comprehensive quality score of green prickly ash, and evaluate the quality of green prickly ash according to the score threshold, where is the weight corresponding to the feature and is the comprehensive quality score of green prickly ash.
[0012] A quality evaluation system for green prickly ash based on image recognition, characterized by comprising: Image acquisition and preprocessing module: used to acquire green prickly ash images, apply image preprocessing techniques to remove image noise, adjust image brightness and contrast, use edge detection algorithms to identify the shape contours of green prickly ash, compare the extracted shape contour data with the pre-stored standard green prickly ash shape contour data, calculate the similarity between the two, set a similarity threshold, if the calculated similarity is greater than or equal to the threshold, it is determined that there is green prickly ash in the image, and the quantity of green prickly ash is recorded; meanwhile, for the shape contour of each identified green prickly ash, use a curvature-based segmentation method for segmentation, divide the shape contour of green prickly ash into multiple small polygon regions, use the shoelace formula to calculate the area of each small polygon respectively and accumulate them to obtain the area of each green prickly ash, calculate the average value A of the areas of all green prickly ash as the average size of green prickly ash, calculate the variance of the areas of all green prickly ash, and define the uniformity index Perform eigen decomposition on C to obtain the projection matrix V and the hyperspectral features after dimensionality reduction; Feature map construction module: construct the feature map of green prickly ash based on the shape of green prickly ash identified by the image acquisition and preprocessing module; use hyperspectral imaging technology to obtain the spectral features of green prickly ash, and perform hyperspectral clustering analysis on the hyperspectral data Unfold it into a matrix according to pixels Calculate the covariance matrix, , Perform eigen decomposition on C to obtain the projection matrix V and the hyperspectral features after dimensionality reduction , and is stitched with the shape and size features of the visible light image to obtain , extract the contrast from the co-occurrence matrix, fuse it with the shape and size features of the visible light image after dimensionality reduction, and at the same time use the gray-level co-occurrence matrix, local binary pattern and fractal dimension to extract texture features to form , and are fused to obtain the comprehensive feature vector , by collecting samples during the young fruit stage and mature stage of Zanthoxylum schinifolium, obtaining spectral features using hyperspectral imaging technology and shape and size features using visible light images for each sample simultaneously, through hyperspectral clustering analysis, dimensionality reduction, feature stitching and fusion, and texture feature extraction and combination, obtaining feature vectors for each growth stage, and storing them together with the corresponding growth stage labels in the database , calculate the similarity with the standard feature vector of each growth stage , and associate the growth stage with the largest similarity; time series feature map ; Quality assessment module: Conduct quality assessment based on the feature map obtained by the feature map construction module, assign weights to each feature in the feature map, determine the weight size using the analytic hierarchy process, define that the feature image has n features, which are respectively , and the corresponding weights are , and Through the formula
[0013] calculate the comprehensive quality score of Zanthoxylum schinifolium, and evaluate the quality of Zanthoxylum schinifolium according to the score threshold, where is the weight corresponding to the feature , is the comprehensive quality score of Zanthoxylum schinifolium.
[0014] The principle of this solution is as follows: In the image acquisition and preprocessing module, by collecting Zanthoxylum schinifolium images and performing preprocessing, removing noise and adjusting image parameters, then using the edge detection algorithm in the shape analysis module to identify the shape contour of Zanthoxylum schinifolium, comparing it with the standard contour data to determine whether it is Zanthoxylum schinifolium, and recording the quantity, calculating the exact area of Zanthoxylum schinifolium through the curvature-based segmentation method, and then obtaining the average size and uniformity.
[0015] In the feature map construction module, use hyperspectral imaging technology to obtain the spectral features of Zanthoxylum schinifolium, after dimensionality reduction processing by principal component analysis, fuse them with the shape and size features of visible light images, extract and fuse texture features at the same time, establish a growth stage database to associate the growth stage of Zanthoxylum schinifolium, for the same batch of Zanthoxylum schinifolium collected multiple times, use the dynamic time warping algorithm to construct a time series feature map to reflect the feature changes of Zanthoxylum schinifolium.
[0016] The quality assessment module assigns weights to each feature according to the results obtained by the feature map construction module, determines the weight size through the analytic hierarchy process and then calculates the comprehensive quality score, and evaluates the quality of Zanthoxylum schinifolium according to the set score threshold, so as to achieve an accurate and comprehensive assessment of the quality of Zanthoxylum schinifolium.
[0017] The beneficial effects produced by this solution: This solution lays a foundation for subsequent quality assessment through precise image acquisition and preprocessing techniques. Removing image noise, adjusting brightness and contrast ensures the accuracy and clarity of the obtained images of green prickly ash, thereby reducing the possibility of misjudgment caused by poor image quality.
[0018] The edge detection algorithm is used to identify the shape contour of green prickly ash and compare it with standard data, which can accurately judge the presence of green prickly ash and record the quantity at the same time, providing a preliminary quantitative basis for quality assessment. The segmentation method based on curvature calculates the precise area, and then obtains the average size and uniformity. These detailed shape and size analysis indicators make the quality assessment more comprehensive and in-depth.
[0019] Hyperspectral imaging technology is used to obtain spectral features, which are fused with the shape and size features of visible light images. At the same time, rich texture features are extracted, greatly enriching the information dimension for evaluation. Establishing a growth stage database and using the dynamic time warping algorithm to construct a time series feature map can dynamically and comprehensively reflect the characteristic changes of green prickly ash during the growth process.
[0020] In the quality assessment stage, the analytic hierarchy process is used to assign reasonable weights to each feature in the feature map, and the comprehensive quality score is obtained through scientific calculation. The evaluation is carried out based on the score threshold, ensuring the objectivity of the evaluation results. Avoiding the interference of subjective factors makes the evaluation results more credible and persuasive.
[0021] Through image recognition technology and multi-dimensional feature analysis, the subjectivity and errors of manual evaluation are avoided, and the quality of green prickly ash can be measured more accurately. In the image acquisition and preprocessing link, noise is removed and image parameters are optimized, providing a clear and accurate basis for subsequent analysis and reducing misjudgment caused by image quality problems. The shape analysis module can not only accurately identify green prickly ash, but also calculate its size and uniformity. These indicators provide key quantitative data for quality assessment, making the evaluation results more persuasive.
[0022] The feature map construction module integrates various features of hyperspectral imaging and texture, and establishes an association with the growth stage, comprehensively and deeply depicting the characteristics of green prickly ash, providing rich information support for accurate evaluation.
[0023] The quality assessment module uses the analytic hierarchy process to determine the feature weights and calculate the comprehensive score, making the evaluation results more scientific and reasonable, and being able to accurately reflect the true quality level of green prickly ash. In addition, this solution realizes the automation and high efficiency of green prickly ash quality assessment. Compared with traditional manual assessment methods, it greatly saves time and labor costs and improves the assessment efficiency.
[0024] Furthermore, the image preprocessing technology includes, but is not limited to, Gaussian filtering to remove noise, histogram equalization to adjust brightness and contrast. Gaussian filtering to remove noise can effectively smooth the image and reduce the interference of noise on subsequent edge detection and shape recognition operations, making the shape contour of green prickly ash clearer and more accurate, improving the reliability and accuracy of subsequent analysis. Histogram equalization to adjust brightness and contrast can enhance the visual effect of the image, making the distinction between green prickly ash and the background more obvious, which helps to more accurately extract the features of green prickly ash and reduce the omission or mis-extraction of features caused by inappropriate brightness and contrast.
[0025] Furthermore, in S01, an adaptive median filtering algorithm is used to remove image noise. The adaptive median filtering algorithm can better retain the edge and detail information of the image while removing noise. The adaptive median filtering has a good inhibitory effect on the sudden and high-intensity impulse noise, and can effectively remove the noise type that seriously affects the quality of the green prickly ash image, providing a clearer and more accurate image basis for quality assessment.
[0026] Furthermore, in S02, when using the gray-level co-occurrence matrix to extract texture features, it also includes calculating the features of correlation, energy, and entropy from the co-occurrence matrix. Calculating the features of correlation, energy, and entropy from the co-occurrence matrix can describe the texture characteristics of green prickly ash from different angles and provide information for evaluating the quality of green prickly ash.
[0027] Furthermore, when using the analytic hierarchy process to determine the weights in S03, the weights of each feature are determined by constructing a judgment matrix, calculating the eigenvector, and performing a consistency test. When the consistency ratio is less than 0.1, the judgment matrix passes the test and the weights are reasonably determined; otherwise, the judgment matrix is readjusted. In the quality assessment of green prickly ash, the influence degrees of each feature on the quality are different. When determining the weights by constructing a judgment matrix, readjusting the judgment matrix can make the weights more in line with the actual situation. For example, if there is a deviation in the initial judgment of the relative importance of spectral features and shape features, resulting in a consistency ratio greater than 0.1, readjusting can correct this deviation, enabling the weights to accurately reflect the true roles of each feature in evaluating the numbing taste, aroma, and appearance quality of green prickly ash, thus ensuring the reliability of the assessment results; when the consistency ratio of the judgment matrix does not meet the requirements, it means that the weight distribution is unreasonable, which will affect the accuracy of the comprehensive quality score. Readjusting the judgment matrix to make the weights of each feature reasonable can make the quality assessment results more accurately reflect the true quality level of green prickly ash and avoid misjudging high-quality green prickly ash as medium or low-quality due to unreasonable weights.
[0028] When using the analytic hierarchy process to determine the weights in S03, the weights of each feature are determined by constructing a judgment matrix, calculating the eigenvector, and performing a consistency test. The eigenvector can be used to obtain the quantitative values of the relative weights of each feature from the judgment matrix, avoiding subjective randomness and making the determination of weights have certain mathematical basis and scientific nature.
[0029] Furthermore, when using the curvature-based segmentation method in S01, a machine learning algorithm is introduced to analyze the contour curvature data. By training the model, the curvature key points on the contour that are most suitable for segmentation can be automatically identified. The machine learning algorithm can process a large amount of data and learn complex patterns and rules from it. For the contour curvature data, it can automatically discover those features that are difficult for humans to directly observe but are crucial for segmentation, thereby improving the accuracy and rationality of segmentation. And with the continuous accumulation of data and the continuous optimization of the model, the performance of segmentation will continue to improve, and it can adapt to different types, shapes, and qualities of green prickly ash images, with stronger generalization ability and adaptability.
[0030] Furthermore, in S02, when using the local binary pattern to extract texture features, the rotation-invariant local binary pattern algorithm is adopted and combined with multi-scale analysis. By calculating the rotation-invariant local binary pattern features at different scales, the texture information of green prickly ash at different details can be obtained. The rotation-invariant local binary pattern algorithm ensures the invariance of texture features when the image rotates, so that no matter how the direction of the green prickly ash image changes, stable and consistent texture features can be extracted, improving the reliability and robustness of the features. Brief Description of the Drawings
[0031] Figure 1 It is a flowchart of the system structure of the present invention. Detailed Embodiments
[0032] Embodiment 1, as Figure 1 shown, the green prickly ash quality evaluation system based on image recognition includes: Image Acquisition and Preprocessing Module: It is used to collect images of green prickly ash, remove image noise, adjust image brightness and contrast by using image preprocessing techniques, identify the shape contour of green prickly ash by using edge detection algorithms, compare the extracted shape contour data with the pre-stored standard shape contour data of green prickly ash, calculate the similarity between the two, set a similarity threshold. If the calculated similarity is greater than or equal to the threshold, it is determined that there is green prickly ash in the image and the number of green prickly ash is recorded. At the same time, for the shape contour of each identified green prickly ash, a segmentation method based on curvature is used for segmentation, the shape contour of green prickly ash is divided into multiple small polygon regions, the area of each small polygon is calculated respectively by using the shoelace formula and accumulated to obtain the area of each green prickly ash, the average value A of the areas of all green prickly ash is calculated as the average size of green prickly ash, the variance of the areas of all green prickly ash is calculated, and the uniformity index is defined Perform eigen-decomposition on C to obtain the projection matrix V and the hyperspectral features after dimensionality reduction; Feature Map Construction Module: Based on the shape of green prickly ash identified by the Image Acquisition and Preprocessing Module, construct the feature map of green prickly ash; Use hyperspectral imaging technology to obtain the spectral features of green prickly ash, and perform hyperspectral clustering analysis on the hyperspectral data Unfold it into a matrix according to pixels Calculate the covariance matrix, , Perform eigen-decomposition on C to obtain the projection matrix V and the hyperspectral features after dimensionality reduction , and combine with the shape and size features of the visible light image to obtain Extract the contrast from the co-occurrence matrix, fuse it with the shape and size features of the visible light image after dimensionality reduction. At the same time, use the gray-level co-occurrence matrix, local binary pattern and fractal dimension to extract texture features to form ; Combine with to obtain By collecting samples during the young fruit stage and mature stage of green prickly ash, simultaneously obtain spectral features by using hyperspectral imaging technology and shape and size features by using visible light images for each sample. Through hyperspectral clustering analysis, dimensionality reduction, feature stitching and fusion, and texture feature extraction and combination, obtain the feature vectors of each growth stage, and store them together with the corresponding growth stage labels in the database Calculate the comprehensive feature vector and the similarity with the standard feature vector of each growth stage ; Associate the growth stage with the maximum similarity; Obtain the feature sequence by collecting images of the same batch of green prickly ash multiple times ; Among them ; denote the LThe feature vector obtained after the secondary image acquisition L represents the number of acquisitions, and uses the dynamic time warping algorithm to construct a time series feature map ; Quality assessment module: performs quality assessment based on the feature map obtained by the feature map construction module, assigns weights to each feature in the feature map, determines the weight size using the analytic hierarchy process, and defines that the feature image has n features, which are respectively , and the corresponding weights are , and Through the formula
[0033] Calculate the comprehensive quality score of the green prickly ash, and evaluate the quality of the green prickly ash according to the score threshold, where is the weight corresponding to the feature , is the comprehensive quality score of the green prickly ash.
[0034] The green prickly ash quality assessment method based on image recognition includes the following steps: S01 Collect green prickly ash images, use image preprocessing technology to remove image noise, adjust image brightness and contrast, then use an edge detection algorithm to identify the shape contour of the green prickly ash, compare the extracted shape contour data with the pre-stored standard green prickly ash shape contour data, calculate the similarity between the two, set a similarity threshold, if the calculated similarity is greater than or equal to the threshold, it is determined that there is green prickly ash in the image, and record the number of green prickly ash; For the shape contour of each identified green prickly ash, use a curvature-based segmentation method for segmentation, divide the shape contour of the green prickly ash into multiple small polygon regions, use the shoelace formula to calculate the area of each small polygon respectively and accumulate them to obtain the area of each green prickly ash, calculate the average value A of the areas of all green prickly ash as the average size of the green prickly ash, and according to the set proportionality coefficient k Divide the green prickly ash into several grades; where the shoelace formula is:
[0035] n is the number of polygon vertices, is i the vertex coordinates of the -vertex polygon, is the area of the green prickly ash, n is the abscissa of the th vertex of the small polygon, n is the ordinate of the th vertex of the small polygon; Calculate the variance of the areas of all green prickly ash Among them U The closer it is to 1, the higher the uniformity. Among them is the variance of the area of all green prickly ash, is the uniformity index; S02 constructs a characteristic spectrum of green prickly ash based on the shape of green prickly ash identified in S01; uses hyperspectral imaging technology to obtain the spectral characteristics of green prickly ash, and performs hyperspectral clustering analysis on the hyperspectral data unfolds it into a matrix according to pixels and calculates the covariance matrix Among them represents the hyperspectral data, , m, n are the number of pixels in the spatial dimension of the hyperspectral image respectively, p represents the number of spectral dimensions, C is the covariance matrix, X is to unfold the hyperspectral data into a matrix according to pixels, is the matrix X transpose matrix of, and perform eigen-decomposition on C to obtain the projection matrix V , the hyperspectral features after dimensionality reduction , and is spliced with the shape and size features of the visible light image to obtain , extract the contrast from the co-occurrence matrix, fuse it with the shape and size features of the visible light image after dimensionality reduction, and at the same time use the gray-level co-occurrence matrix, local binary pattern and fractal dimension to extract texture features to form and are fused to obtain is the comprehensive feature vector obtained after being processed by the feature spectrum construction module; By collecting samples during the young fruit stage and mature stage of green prickly ash, simultaneously obtaining spectral features using hyperspectral imaging technology and shape and size features using visible light images for each sample, through hyperspectral clustering analysis, dimensionality reduction, feature splicing and fusion, and texture feature extraction combination, the feature vectors of each growth stage are obtained, and they are stored in the database together with the corresponding growth stage labels to construct a growth stage database , among them represents the set of feature vectors of different growth stages, q represents the number of growth stages, and calculate the comprehensive feature vector and the similarity with the standard feature vector of each growth stage , among them is the growth stage database D in the i th j Standard eigenvectors, the growth stage with the largest associated similarity; for the same batch of green prickly ash, images are collected multiple times to obtain a feature sequence , where represents the eigenvector obtained after the L -th image collection, L represents the number of collections, and the dynamic time warping algorithm is used to construct a time series feature map ; S03 performs quality assessment based on the feature map obtained from S02, assigns weights to each feature in the feature map, determines the weight size using the analytic hierarchy process, and defines that the feature image has n features, which are respectively , and the corresponding weights are , and Through the formula
[0036] Calculate the comprehensive quality score of green prickly ash, and evaluate the quality of green prickly ash according to the score threshold, where is the weight corresponding to the feature , is the comprehensive quality score of green prickly ash.
[0037] This solution lays a foundation for subsequent quality assessment through precise image acquisition and preprocessing techniques. Removing image noise, adjusting brightness and contrast ensures the accuracy and clarity of the acquired green prickly ash image information, thereby reducing the possibility of misjudgment caused by poor image quality.
[0038] Using an edge detection algorithm to identify the shape contour of green prickly ash and comparing it with standard data can accurately judge the presence of green prickly ash and record the quantity at the same time, providing a preliminary quantitative basis for quality assessment. The curvature-based segmentation method calculates the exact area, and then obtains the average size and uniformity. These detailed shape and size analysis indicators make the quality assessment more comprehensive and in-depth.
[0039] Using hyperspectral imaging technology to obtain spectral features, fusing them with the shape and size features of visible light images, and simultaneously extracting rich texture features greatly enriches the information dimension on which the assessment is based. Establishing a growth stage database and using the dynamic time warping algorithm to construct a time series feature map can dynamically and comprehensively reflect the characteristic changes of green prickly ash during the growth process.
[0040] In the quality assessment stage, the analytic hierarchy process is used to assign reasonable weights to each feature in the feature map, and the comprehensive quality score is obtained through scientific calculation. The assessment is carried out based on the score threshold, ensuring the objectivity of the assessment results. Avoiding the interference of subjective factors makes the assessment results more credible and persuasive.
[0041] Through image recognition technology and multi-dimensional feature analysis, the subjectivity and errors of manual evaluation are avoided, and the quality of green prickly ash can be measured more accurately. In the image acquisition and preprocessing link, noise is removed and image parameters are optimized, providing a clear and accurate basis for subsequent analysis, reducing misjudgment caused by image quality problems. The shape analysis module can not only accurately identify green prickly ash, but also calculate its size and uniformity. These indicators provide key quantitative data for quality evaluation, making the evaluation results more persuasive.
[0042] The feature map construction module integrates various features such as hyperspectral imaging and texture, and establishes an association with the growth stage, comprehensively and deeply depicting the characteristics of green prickly ash, providing rich information support for accurate evaluation.
[0043] The quality evaluation module uses the analytic hierarchy process to determine the feature weights and calculate the comprehensive score, making the evaluation results more scientific and reasonable, and being able to accurately reflect the true quality level of green prickly ash. In addition, this solution realizes the automation and high efficiency of green prickly ash quality evaluation. Compared with traditional manual evaluation methods, it greatly saves time and labor costs and improves the evaluation efficiency.
[0044] The image preprocessing technology includes but is not limited to Gaussian filtering to remove noise, histogram equalization to adjust brightness and contrast. Gaussian filtering to remove noise can effectively smooth the image, reducing the interference of noise on subsequent edge detection and shape recognition operations, making the shape contour of green prickly ash clearer and more accurate, improving the reliability and accuracy of subsequent analysis. Histogram equalization to adjust brightness and contrast can enhance the visual effect of the image, making the distinction between green prickly ash and the background more obvious, which helps to more accurately extract the features of green prickly ash and reduce feature omission or mis-extraction caused by inappropriate brightness and contrast.
[0045] In S01, an adaptive median filtering algorithm is used to remove image noise. The adaptive median filtering algorithm can better retain the edge and detail information of the image while removing noise. The adaptive median filtering has a good inhibitory effect on sudden and high-intensity impulse noise, and can effectively remove the noise type that seriously affects the quality of green prickly ash images, providing a clearer and more accurate image basis for quality evaluation.
[0046] In S02, when using the gray-level co-occurrence matrix to extract texture features, it also includes calculating features such as correlation, energy, and entropy from the co-occurrence matrix. Calculating features such as correlation, energy, and entropy from the co-occurrence matrix can describe the texture characteristics of green prickly ash from different angles and provide information for evaluating the quality of green prickly ash.
[0047] When the weight of S03 is determined by the analytic hierarchy process, the weight of each feature is determined by constructing a judgment matrix, calculating the eigenvector and performing a consistency test. When the consistency ratio is less than 0.1, the judgment matrix passes the test and the weight is reasonably determined; otherwise, the judgment matrix is adjusted again. In the quality evaluation of green prickly ash, the influence degree of each feature on the quality is different. When determining the weight by constructing a judgment matrix, adjusting the judgment matrix again can make the weight more in line with the actual situation. For example, if there is a deviation in the initial judgment of the relative importance of spectral features and shape features, resulting in a consistency ratio greater than 0.1, this deviation can be corrected after readjustment, so that the weight can accurately reflect the true role of each feature in evaluating the numbness, aroma, and appearance quality of green prickly ash, thus ensuring the reliability of the evaluation results; when the consistency ratio of the judgment matrix does not meet the requirements, it means that the weight distribution is unreasonable, which will affect the accuracy of the comprehensive quality score. Readjusting the judgment matrix to make the weights of each feature reasonable can make the quality evaluation results more accurately reflect the true quality level of green prickly ash, and avoid misjudging high-quality green prickly ash as medium or low-quality due to unreasonable weights.
[0048] In S01, when using the curvature-based segmentation method, a machine learning algorithm is introduced to analyze the contour curvature data. By training the model, the curvature key points on the contour that are most suitable for segmentation can be automatically identified. The machine learning algorithm can process a large amount of data and learn complex patterns and rules from it. For the contour curvature data, it can automatically discover those features that are difficult for humans to directly observe but are crucial for segmentation, thereby improving the accuracy and rationality of segmentation. And with the continuous accumulation of data and the continuous optimization of the model, the performance of segmentation will continue to improve, and it can adapt to green prickly ash images of different types, shapes, and qualities, with stronger generalization ability and adaptability.
[0049] In S02, when using the local binary pattern to extract texture features, the rotation-invariant local binary pattern algorithm is adopted and combined with multi-scale analysis. By calculating the rotation-invariant local binary pattern features at different scales, the texture information of green prickly ash at different details can be obtained. The rotation-invariant local binary pattern algorithm ensures the invariance of texture features during image rotation, so that no matter how the direction of the green prickly ash image changes, stable and consistent texture features can be extracted, improving the reliability and robustness of the features.
[0050] The specific method for the value of the above proportional coefficient k: Select 10 different pepper plantations from at least 5 different main producing areas of green prickly ash. During the mature period of green prickly ash, randomly pick 200 green prickly ash fruits from each plantation. Ensure that the collected green prickly ash covers different growth environments and variety types to obtain a widely representative sample; Use a high-precision image acquisition device to obtain images of green prickly ash. Through the image analysis software ImageJ, combined with the curvature-based segmentation method and the shoelace formula, accurately measure the area of each green prickly ash. Record the area data of each green prickly ash to form a dataset containing a large amount of sample area information; Clean the collected area data to remove outliers. Outliers may be values of area data that deviate significantly from the normal range due to measurement errors, lesions of green prickly ash fruits, or other special circumstances. By calculating the interquartile range of the data, IQR = Q3 - Q1 , where Q1 is the lower quartile, Q3 is the upper quartile, and values less than Q1 - 1.5IQR or greater than Q3+ 1.5IQR are regarded as outliers and removed; Perform standardization processing on the cleaned data to make the data from different origins and batches comparable. Use the Z-score standardization method to convert the area data of each sample to , where x is the mean of the sample data, s is the standard deviation of the sample data, is the new data value obtained after conversion by the Z - score standardization method, represents the area data of each original sample; Considering the size differences of green prickly ash, initially set the value range of the proportionality coefficient K to be 0.6 - 1.0, with a step of 0.05, that is, calculate the partitioning effects when K takes 0.6, 0.65, 0.7,..., 1.0 respectively.
[0051] Set evaluation indicators: Use the quality attributes, market price, and consumer preferences of green prickly ash fruits as evaluation indicators. Determine the content of numbing substances by high-performance liquid chromatography, and analyze the content of aroma components by gas chromatography-mass spectrometry to measure the quality attributes of green prickly ash; collect price data of green prickly ash of different sizes on the market; obtain consumer preference data for green prickly ash of different sizes through questionnaire surveys or consumer tastings, etc. For each set K value, divide the green prickly ash samples into small-sized ones with an area less than KA , medium-sized ones with an area between KA - (2 - K)A and large-sized ones with an area greater than ( (2 - K)A into three grades. Calculate the average value of quality attributes, the average market price, and the consumer preference score of green prickly ash for each grade respectively; Invite agricultural experts, food experts and market analysts to form an evaluation team. Construct a judgment matrix based on the importance of each indicator for the quality evaluation of green prickly ash, calculate the eigenvector and conduct a consistency test to determine that the weights of quality attributes, market price and consumer preference are respectively , ([[]]END]] + + = 1). For each K value, calculate the comprehensive evaluation score
[0052] , where is the number of green prickly ash samples at the i th grade, including small, medium and large ones, is the average value of the quality attributes of green prickly ash at the i th grade, is the average market price of green prickly ash at the i th grade, is the consumer preference score of green prickly ash at the i th grade; Compare the comprehensive evaluation scores under different K values, and select the K value with the highest comprehensive evaluation score as the finally determined proportional coefficient.
[0053] In actual use, I. System construction Image Acquisition and Preprocessing Module: A high-resolution imaging device, such as an industrial camera, is selected to ensure that the collected images of green prickly ash are clear and can accurately reflect their morphological characteristics. It is installed at a suitable shooting position to ensure the stability and consistency of image acquisition. For the collected images, the adaptive median filtering algorithm is first used to remove noise. This algorithm can adaptively adjust the filtering window size and filtering method according to the local characteristics of the image, effectively suppressing various noises such as impulse noise, while retaining the edge and detail information of the green prickly ash image to the greatest extent. The histogram equalization method is used to adjust the image brightness and contrast, enhancing the distinction between the green prickly ash and the background, making the shape contour of the green prickly ash more obvious for subsequent extraction. The Canny edge detection algorithm is used to accurately identify the shape contour of the green prickly ash. The extracted shape contour data is compared with the standard green prickly ash shape contour data pre-stored in the database, and the similarity between the two is calculated. A reasonable similarity threshold is set, such as 0.8. If the calculated similarity is greater than or equal to this threshold, it is determined that there is green prickly ash in the image, and the number of green prickly ash is recorded through a counting program. For the shape contour of each identified green prickly ash, an algorithm such as the support vector machine is introduced to analyze the contour curvature data. The model is trained with a large amount of labeled green prickly ash contour curvature data, enabling the model to automatically learn and identify the curvature key points on the contour that are most suitable for segmentation. Then, a curvature-based segmentation method is used to divide the shape contour of the green prickly ash into multiple small polygon regions. The area of each small polygon is calculated using the shoelace formula and accumulated to obtain the area of each green prickly ash. The average value of the areas of all green prickly ash is calculated as the average size of the green prickly ash, and according to the set proportionality coefficient k, such as k = 0.2, the green prickly ash is divided into three grades: large, medium, and small according to the area size, and the green prickly ash is graded. At the same time, the variance of the areas of all green prickly ash is calculated, and according to the formula Calculate the uniformity index, which is used to measure the uniformity of the size of green prickly ash.
[0054] Feature Map Construction Module: A hyperspectral imager is used to obtain the spectral characteristics of green prickly ash. This imager can obtain the spectral information of green prickly ash in multiple narrow wavelength ranges, providing rich data support for subsequent analysis. The hyperspectral data is expanded into a matrix , where m and n are the number of pixels of the hyperspectral image in the spatial dimension respectively, and p represents the number of spectral dimensions. Calculate the covariance matrix , perform eigen-decomposition on the covariance matrix C to obtain the projection matrix V, and thus obtain the dimension-reduced hyperspectral features , reducing the data dimension, reducing the amount of calculation while retaining key information. The dimension-reduced hyperspectral features are spliced with the shape and size features of the visible light image to obtain Extract the features of contrast, correlation, energy, and entropy from the co-occurrence matrix, reduce the dimensions of these features, and fuse them with the shape and size features of the visible light image. At the same time, use the gray-level co-occurrence matrix and rotation-invariant local binary pattern, combined with multi-scale analysis, to calculate the rotation-invariant local binary pattern features at different scales, obtain the texture information of green prickly ash at different details, and extract the texture features composed of the fractal dimension , and fuse to obtain , which is the comprehensive feature vector obtained after being processed by the feature map construction module. Collect a large number of samples at different growth stages of green prickly ash, such as the young fruit stage and the mature stage. For each sample, obtain the spectral features using hyperspectral imaging technology and the shape and size features using visible light images at the same time. After operations such as hyperspectral clustering analysis, dimensionality reduction, feature stitching and fusion, and texture feature extraction and combination, obtain the feature vectors of each growth stage, and store them in the database together with the corresponding growth stage labels , and construct a growth stage database. Calculate the comprehensive feature vector and the cosine similarity with each standard feature vector of each growth stage , and associate the growth stage with the largest similarity. Obtain the feature sequences , Among them , by collecting images of the same batch of green prickly ash multiple times. L represents the feature vector obtained after the L th image collection, where
[0055] denotes the number of collections. Use the dynamic time warping algorithm to construct a time series feature map n to dynamically reflect the feature changes of green prickly ash during the growth process. , and the corresponding weights are , and through the formula. Through the formula
[0056] Calculate the comprehensive quality score of green prickly ash. Evaluate the quality of green prickly ash according to the preset score threshold. For example, if the score is greater than 80, it is of high quality; if it is between 60 and 80, it is of medium quality; if it is less than 60, it is of low quality, so as to achieve an objective and accurate evaluation of the quality of green prickly ash.
[0057] II. Method implementation steps Image acquisition and preliminary processing: Use the above-built image acquisition device to acquire images of green prickly ash. After the acquisition is completed, according to the processing method of the image acquisition and preprocessing module, first use the adaptive median filtering algorithm to remove image noise, and then adjust the image brightness and contrast through histogram equalization. Then use the Canny edge detection algorithm to identify the shape contour of green prickly ash, compare the extracted shape contour data with the standard data, calculate the similarity and determine whether there is green prickly ash in the image, and record the number of green prickly ash. Then introduce a machine learning algorithm to assist the curvature-based segmentation method to segment the shape contour of green prickly ash, and calculate the area, average size, grade and uniformity index of each green prickly ash.
[0058] Characteristic spectrum construction: Based on the shape of green prickly ash identified in S01, use a hyperspectral imager to obtain the spectral characteristics of green prickly ash. According to the operation process of the characteristic spectrum construction module, perform operations such as unfolding, covariance matrix calculation, and eigen-decomposition on the hyperspectral data to obtain the reduced-dimensional hyperspectral characteristics. Stitch and fuse it with the shape and size characteristics of the visible light image, and combine various characteristics extracted from the co-occurrence matrix and texture characteristics extracted from the gray-level co-occurrence matrix, rotation-invariant local binary pattern and fractal dimension to obtain a comprehensive feature vector . By collecting samples at different growth stages to construct a growth stage database, calculate the similarity with the standard feature vectors of each growth stage, and associate the growth stage. If there are multiple groups of collected data, use the dynamic time warping algorithm to construct a time series characteristic spectrum .
[0059] Quality evaluation: According to the characteristic spectrum obtained above, use the analytic hierarchy process to determine the weights of each feature. Ensure the rationality of the weights by constructing a judgment matrix, calculating the eigenvector and consistency test. Use the formula to calculate the comprehensive quality score of green prickly ash, evaluate the quality of green prickly ash according to the preset score threshold, obtain the quality grade of green prickly ash, and complete a comprehensive and accurate evaluation of the quality of green prickly ash.
[0060] represents various features extracted from the green prickly ash image, such as shape features, spectral features, texture features, etc. These features are obtained through steps such as image acquisition and preprocessing, and characteristic spectrum construction. It is determined by the analytic hierarchy process. The specific process is as follows: First, a judgment matrix is constructed according to the relative importance of each feature's influence on the quality of green prickly ash. The matrix elements are assigned based on expert experience or actual experimental data. Then, the eigenvector of the judgment matrix is calculated to obtain the relative weights of each feature. Finally, a consistency test is carried out. When the consistency ratio is less than 0.1, the judgment matrix passes the test, and the weights obtained at this time are reasonable and can be used to calculate the comprehensive quality score Q. Specific Example 2 Image acquisition: Select three representative green prickly ash production areas. Randomly select 5 different planting parks in each production area, and select 10 well-growing and representative green prickly ash plants in each park. Using an image acquisition device equipped with a fish-eye lens and a telephoto lens, around 10 am during the mature period of green prickly ash, when the light is uniform to avoid the influence of shadows on the image, image acquisition is carried out. The fish-eye lens takes images centered on the plant, covering the whole plant and its surrounding growth environment to obtain the growth environment information of green prickly ash, such as light conditions, plant spacing, and soil conditions; the telephoto lens focuses on the green prickly ash fruits at different positions on the plant to take clear close-up images of the fruits for subsequent fruit detail analysis. 3 groups of images are collected from different angles for each plant, and both the fish-eye lens and the telephoto lens are used simultaneously each time to ensure comprehensive image information is obtained. A total of 450 groups of images are collected (3 production areas × 5 parks × 10 plants × 3 groups).
[0062] Image preprocessing: Transmit the collected images to the computer. The adaptive median filtering algorithm is used to remove image noise. The filtering window size is dynamically adjusted according to the pixel value distribution in the local area of the image to retain the edge and detail information of the image to the greatest extent while removing noise. Then, the histogram equalization technique is used to adjust the image brightness and contrast to enhance the difference between the green prickly ash fruits and the background, making the features of green prickly ash more obvious. After that, Gaussian filtering is used to further smooth the image to remove possible remaining fine noise and ensure that the image quality meets the requirements of subsequent analysis.
[0063] Shape analysis: Use the Canny edge detection algorithm to process the preprocessed images to extract the shape contours of green prickly ash. Compare the extracted shape contour data with the standard green prickly ash shape contour data pre-stored in the database, and use the shape context algorithm to calculate the similarity between the two. If the shape contour in the image is the same as or similar to the actual product shape contour, it is determined that there is green prickly ash in the image, and the number of green prickly ash is recorded through the counting function of the image analysis software.
[0064] For each identified shape contour of the green prickly ash, a curvature-based segmentation method is combined with a convolutional neural network model to analyze the contour curvature data. Use PyTorch to build and train the CNN model, allowing the model to automatically learn the feature patterns in the contour curvature data, so as to automatically identify the curvature key points on the contour that are most suitable for segmentation. Divide the green prickly ash shape contour into multiple small polygon regions, and use the shoelace formula
[0065] , where are the polygon vertex coordinates, n is the number of polygon vertices, calculate the area of each small polygon and accumulate it to obtain the exact area of each green prickly ash. Calculate the average value A of the areas of all green prickly ashes, set the proportionality coefficient K = 0.8, and divide the green prickly ashes into small ones with an area less than 0.8A), medium ones with an area between 0.8A - 1.2A, and large ones with an area greater than 1.2A grades. At the same time, calculate the variance of the areas of all green prickly ashes, and define the uniformity index U to represent the degree of uniformity of the size of the green prickly ash. The closer U is to 1, the higher the uniformity.
[0066] Feature map construction: Use a hyperspectral imager to collect spectral data of the green prickly ash. The spectral range is set to 400 - 1000 nm, and the spectral resolution is 10 nm. Unfold the collected hyperspectral data into a matrix according to pixels, and calculate the covariance matrix C. Perform eigen-decomposition on the covariance matrix to obtain the projection matrix V, and perform dimensionality reduction processing on the hyperspectral data through the projection matrix V, retaining more than 90% of the feature information to reduce data redundancy and improve the efficiency of subsequent processing. Concatenate the dimensionality-reduced hyperspectral features with the shape and size features of the visible light image to obtain the preliminary fusion features.
[0067] Extract the contrast from the co-occurrence matrix, and at the same time calculate the texture features of correlation, energy, and entropy. Use the gray-level co-occurrence matrix to calculate these texture features in four directions of 0°, 45°, 90°, 135° and three distances of 1, 2, 3 pixels. Use the rotation-invariant local binary pattern algorithm to calculate the features at scales 1, 2, and 3 respectively, and then extract the texture features at different levels of detail. Combine the texture features extracted by the fractal dimension to construct a comprehensive feature map.
[0068] Establish a growth stage database, collect sample images of green prickly ash at different growth stages, such as the flowering stage, young fruit stage, swelling stage, and maturity stage, extract their feature vectors and store them. Calculate the similarity between the features of the current green prickly ash and the standard feature vectors of each growth stage in the database, use the cosine similarity as the measurement method, and associate the growth stage with the largest similarity.
[0069] Quality assessment: Invite agricultural experts, food quality inspection experts and image processing experts to form an assessment team to construct a judgment matrix based on the degree of influence of each feature on the quality of green pepper. For example, when judging the relative importance of spectral features and shape features, experts give judgment values based on their influence on the numbing taste, aroma, and appearance quality of green pepper. Calculate the eigenvectors of the judgment matrix, obtain the relative weights of each feature, and perform a consistency test. If the consistency ratio is less than 0.1, the judgment matrix passes the test and the weight determination is reasonable; otherwise, readjust the judgment matrix until the consistency requirements are met.
[0070] Assume there are n features in the feature map. , the corresponding weight is ,and By formula Calculate the comprehensive quality score of green pepper Q , based on a large amount of experimental data and market feedback, set the score threshold: Q For high quality, For the middle, The quality of green pepper was evaluated according to the scores.
[0071] Example 3 Quality evaluation of green pepper at different growth stages from the same origin Image acquisition: In a certain green pepper plantation, we selected the same batch of green pepper and collected images at four growth stages: flowering, young fruit, swelling, and maturity. We collected images every 7 days for each growth stage, and collected 10 sets of images each time.
[0072] Image preprocessing: Preprocess the collected images at different growth stages to ensure that the image quality meets the requirements of subsequent analysis.
[0073] Shape analysis: As the green peppercorns grow, their shape gradually becomes larger and fuller. The average size and uniformity index calculated by the shape analysis module also change. During the flowering period, the average area of the green peppercorns is small and the uniformity is low; at maturity, the average area increases and the uniformity gradually improves.
[0074] Feature map construction: The spectral characteristics and texture characteristics of green pepper at different growth stages are obtained, and feature maps are constructed and associated with the growth stages. The dynamic time warping algorithm is used to construct a time series feature map, which clearly shows the characteristic change trend of green pepper during its growth process. For example, the reflectivity of certain bands in the spectral characteristics changes significantly during the maturity period, and the texture characteristics are also clearer and more regular.
[0075] Quality evaluation: According to the characteristic spectra at different growth stages, the analytic hierarchy process is used to determine the characteristic weights, and the comprehensive quality score is calculated. The results show that the comprehensive quality score of green prickly ash is the highest at the mature stage, indicating that the green prickly ash has the best quality at this time, providing a scientific basis for determining the optimal harvesting time.
[0076] The above are only embodiments of the present invention. Common knowledge of specific structures and characteristics in the solution is not described in detail here. Those of ordinary skill in the art know all the common general technical knowledge in the technical field to which the invention belongs before the application date or the priority date, can learn all the existing technologies in this field, and have the ability to apply the conventional experimental means before this date. Those of ordinary skill in the art can, under the inspiration given in this application, combine their own abilities to improve and implement this solution. Some typical well-known structures or well-known methods should not become an obstacle for those of ordinary skill in the art to implement this application. It should be noted that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can still be made, and these should also be regarded as the protection scope of the present invention, and these will not affect the implementation effect of the present invention and the practicality of the patent. The protection scope required by this application should be based on the content of its claims, and the description of the specific implementation manners in the specification can be used to interpret the content of the claims.
Claims
1. A green pepper quality assessment method based on image recognition, characterized in that: The steps include: S01 collects the image of the green peppercorns, uses image preprocessing technology to remove image noise, adjust image brightness and contrast, then uses an edge detection algorithm to identify the shape contour of the green peppercorns, compares the extracted shape contour data with pre-stored standard shape contour data of the green peppercorns, calculates the similarity between the two, sets a similarity threshold, and if the calculated similarity is greater than or equal to the threshold, it is determined that the image contains green peppercorns, and the number of green peppercorns is recorded; For each identified green peppercorn shape contour, a curvature-based segmentation method is used to segment the shape contour of the green peppercorn into multiple small polygonal areas. The shoelace formula is used to calculate the area of each small polygon and accumulate them to obtain the area of each green peppercorn. The average value A of the area of all green peppercorns is calculated as the average size of the green peppercorns, and the average value A is calculated according to the set proportional coefficient. k Green peppercorns are divided into several grades; the shoelace formula is: n is the number of polygon vertices, for i Vertex coordinates of the polygon, is the area of green pepper, The horizontal coordinate of the nth vertex of the small polygon, The ordinate of the nth vertex of the small polygon; Calculate the variance of the area of all green peppercorns , and define the uniformity index The closer U is to 1, the higher the uniformity. is the variance of the area of all green peppercorns, is the uniformity index; S02 constructs a characteristic map of green peppercorns based on the shape of the green peppercorns identified in S01; uses hyperspectral imaging technology to obtain the spectral characteristics of green peppercorns, and uses hyperspectral clustering analysis to analyze the hyperspectral data. Expand into a matrix according to pixels , calculate the covariance matrix ,in, represents hyperspectral data, , m and n are the number of pixels of the hyperspectral image in the spatial dimension, p represents the number of spectral dimensions, C is the covariance matrix, and X is the hyperspectral data According to the matrix expanded by pixels, is the transposed matrix of matrix X. The projection matrix V is obtained by eigendecomposing C. The hyperspectral features after dimensionality reduction are ,Will Shape and size characteristics of visible light images Splice to get , extract contrast from the co-occurrence matrix, and fuse it with the shape and size features of the visible light image after dimensionality reduction. At the same time, the gray-level co-occurrence matrix, local binary pattern and fractal dimension are used to extract texture feature components. and with Fusion It is the comprehensive feature vector obtained after being processed by the feature map construction module; By collecting samples at the young fruit stage and mature stage of green pepper, the spectral characteristics of each sample are obtained by hyperspectral imaging technology and the shape and size characteristics are obtained by visible light images. Hyperspectral clustering analysis, dimensionality reduction, feature splicing and fusion, and texture feature extraction are combined to obtain the feature vectors of each growth stage, which are stored in the database with the corresponding growth stage labels to build a growth stage database ,in Represents a set of eigenvectors at different growth stages, q represents the number of growth stages, and the comprehensive eigenvector is calculated Growth stage database Each standard eigenvector in Cosine similarity of ,in is the first i The first growth stage j standard feature vectors, associated with the growth stage with the greatest similarity; collect images of the same batch of green pepper multiple times to obtain feature sequences , in , Indicates L The feature vector obtained after collecting images is L Indicates the number of acquisitions, and uses the dynamic time warping algorithm to construct a time series feature map ; S03 Sequence feature map obtained based on S02 Perform quality assessment, assign weights to each feature in the feature map, use hierarchical analysis to determine the weights, and define the feature image as having n features, which are , the corresponding weight is ,and By formula Calculate the comprehensive quality score of green pepper and evaluate the quality of green pepper according to the score threshold. Is with characteristics The corresponding weight, It is the comprehensive quality score of green peppercorns.
2. The green prickly ash quality assessment method based on image recognition according to claim 1, characterized in that: In S01, the image preprocessing technology includes but is not limited to Gaussian filtering to remove noise and histogram equalization to adjust brightness and contrast.
3. The green prickly ash quality assessment method based on image recognition according to claim 1, characterized in that, In S01, an adaptive median filtering algorithm is used to remove image noise.
4. The green prickly ash quality assessment method based on image recognition according to claim 1, characterized in that: In the S02, when the gray-level co-occurrence matrix is used to extract texture features, the process also includes calculating correlation, energy and entropy from the co-occurrence matrix.
5. The green prickly ash quality assessment method based on image recognition according to claim 1, characterized in that: When the S03 adopts the hierarchical analysis method to determine the weight, the weight of each feature is determined by constructing a judgment matrix, calculating the eigenvector and performing a consistency test. When the consistency ratio is less than 0.1, the judgment matrix passes the test and the weight determination is reasonable; otherwise, the judgment matrix is readjusted.
6. The green prickly ash quality assessment method based on image recognition according to claim 1, characterized in that: In the S01, when using the curvature-based segmentation method, a machine learning algorithm is introduced to analyze the contour curvature data, and the curvature key points on the contour that are most suitable for segmentation are automatically identified by training the model.
7. The green prickly ash quality assessment method based on image recognition according to claim 1, characterized in that: In S02, when using local binary patterns to extract texture features, a rotation-invariant local binary pattern algorithm is adopted, and combined with multi-scale analysis, the rotation-invariant local binary pattern features are calculated at different scales to obtain the texture information of the green pepper in different details.
8. A green pepper quality assessment system based on image recognition, using the green pepper quality assessment method based on image recognition according to any one of claims 1 to 7, characterized in that: include: Image acquisition and preprocessing module: used to collect green pepper images, use image preprocessing technology to remove image noise, adjust image brightness and contrast, use edge detection algorithm to identify the shape contour of green pepper, compare the extracted shape contour data with the pre-stored standard green pepper shape contour data, calculate the similarity between the two, set the similarity threshold, if the calculated similarity is greater than or equal to the threshold, it is determined that there are green peppers in the image, and the number of green peppers is recorded; at the same time, for each identified shape contour of green pepper, a curvature-based segmentation method is used for segmentation, the shape contour of the green pepper is divided into multiple small polygonal areas, the shoelace formula is used to calculate the area of each small polygon and accumulate them to obtain the area of each green pepper, the average value A of the area of all green peppers is calculated as the average size of the green pepper, the variance of the area of all green peppers is calculated, and the uniformity index is defined , perform eigendecomposition on C to obtain the projection matrix V, the hyperspectral features after dimensionality reduction; Feature map construction module: Based on the shape of green peppercorns identified by the image acquisition and preprocessing module, the feature map of green peppercorns is constructed; the spectral characteristics of green peppercorns are obtained using hyperspectral imaging technology, and the hyperspectral data are clustered by hyperspectral analysis. Expand into a matrix according to pixels , calculate the covariance matrix, , Perform eigendecomposition on C to obtain the projection matrix V, and the hyperspectral features after dimensionality reduction ,Will Shape and size characteristics of visible light images Splice to get , extract contrast from the co-occurrence matrix, and fuse it with the shape and size features of the visible light image after dimensionality reduction. At the same time, the gray-level co-occurrence matrix, local binary pattern and fractal dimension are used to extract texture feature components. , and Fusion to obtain comprehensive feature vector By collecting samples at the young fruit stage and mature stage of green pepper, the spectral features of each sample are obtained by hyperspectral imaging technology and the shape and size features are obtained by visible light images. The feature vectors of each growth stage are obtained through hyperspectral clustering analysis, dimensionality reduction, feature splicing and fusion, and texture feature extraction, and are stored in the database with the corresponding growth stage labels. , calculate the comprehensive feature vector With the standard eigenvector Similarity , the growth stage with the greatest correlation similarity; collect images of the same batch of green pepper multiple times to obtain feature sequences , in , Indicates L The feature vector obtained after collecting images is L Indicates the number of acquisitions, and uses the dynamic time warping algorithm to construct a time series feature map ; Quality assessment module: time series feature maps obtained by building modules based on feature maps Perform quality assessment to create a time series feature map Each feature in is given a weight, and the weight is determined by using the hierarchical analysis method. The feature image is defined to have n features, which are , the corresponding weight is ,and By formula Calculate the comprehensive quality score of green pepper and evaluate the quality of green pepper according to the score threshold. Is with characteristics The corresponding weight, It is the comprehensive quality score of green peppercorns.
Citation Information
Patent Citations
Image recognition system capable of performing grade classification on peppers
CN115953627A
A system and method for evaluating the quality grade of polygonatum sibiricum agricultural products based on image recognition
CN118379727B
Cited By
Method and system for detecting maturity of waxberries
CN120655651A
Steel plate code spraying intelligent identification method and device based on multi-camera cooperation
CN121354124A