Method for identifying adulteration of moringa seed oil
Through Raman spectroscopy and image processing technology, the spectral and image characteristics of Moringa seed oil are extracted and machine learning models are constructed, which solves the accuracy and adaptability of Moringa seed oil adulteration identification in the existing technology, and achieves rapid Accurate adulteration detection.
Patent Information
- Application Number
- CN202411160391.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the identification of adulteration of Moringa seed oil, there are problems in the prior art that the appearance inspection is easily subjectively affected, the difference in physical parameters makes it difficult to uniform the identification threshold, the chemical method is cumbersome and expensive to operate, and the reproducibility of the spectral analysis results.
Combining Raman spectral analysis and image processing technology, sample images are taken through high-definition cameras, spectral features and image texture features are extracted, binary classification models are constructed, and machine learning algorithms are used to identify Moringa seed oil adulteration to achieve automated judgment.
It improves the accuracy and adaptability of adulteration identification of Moringa seed oil, reduces the difficulty of identifying Moringa seed oil from different sources, reduces the dependence on physical or chemical parameters, and achieves rapid and accurate adulteration detection.
Smart Images

Figure CN119131472A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of vegetable oil detection, and in particular to a method for identifying adulteration of moringa seed oil. Background Art
[0002] As a high-value vegetable oil, moringa seed oil has received extensive attention in the market in recent years due to its rich nutrients and multiple health benefits, such as lowering blood lipids, blood pressure, regulating gastrointestinal function, etc. However, with the increasing market demand for moringa seed oil, unscrupulous vendors have begun to use adulteration methods to make huge profits, mixing inferior oils or other non-moringa seed oil ingredients into moringa seed oil, which seriously damages the rights and health of consumers.
[0003] At present, the identification of adulteration of moringa seed oil in the market mainly relies on traditional physical and chemical methods, such as appearance inspection, specific gravity measurement, and refractive index measurement. Although these methods can identify obvious adulteration to a certain extent, they have many limitations. Appearance inspection is easily affected by subjective factors, and it is difficult to accurately judge fine adulteration; although physical parameters such as specific gravity and refractive index are objective, there may be natural differences in moringa seed oil from different sources, which makes it difficult to unify the identification threshold; chemical methods often require complex sample pretreatment processes and expensive detection equipment, which are cumbersome and costly to operate. In addition, existing spectral analysis techniques, such as infrared spectroscopy and ultraviolet spectroscopy, can provide molecular structure information of samples, but the spectral characteristics of different adulterants may be similar and difficult to accurately distinguish; and spectral data are easily affected by environmental factors, such as temperature and humidity, resulting in poor reproducibility of results. To this end, we propose a method for identifying adulteration of moringa seed oil. Summary of the invention
[0004] The object of the present invention is to provide a method for identifying adulteration of Moringa seed oil to solve the problems raised in the above-mentioned background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: a method for identifying adulteration of Moringa seed oil, the method comprising:
[0006] Collecting known authentic Moringa seed oil samples and known adulterated Moringa seed oil samples; using a Raman spectrometer to perform spectral scanning on each sample to obtain its spectral data; using a high-definition camera to take an appearance image of each sample to obtain its image data;
[0007] Performing baseline correction and normalization processing on the collected spectral data; and extracting spectral features from the processed spectral data, wherein the spectral features include key absorption peaks, absorption intensity, peak shape parameters and characteristic ratios;
[0008] The collected image data is grayed, denoised and enhanced; and the texture features of the processed image are extracted using the gray-level co-occurrence matrix algorithm;
[0009] A binary classification model is constructed, wherein the binary classification model is used to determine whether a Moringa seed oil sample is adulterated, the binary classification model is trained using the preprocessed spectral feature and image texture feature data sets, and the classification performance is optimized by adjusting the model parameters;
[0010] Use independent test set data to evaluate the trained model and calculate the accuracy, recall, and F1 score to verify the generalization ability and classification effect of the model;
[0011] The trained machine learning model is integrated into the online detection system, and real-time spectral scanning and image acquisition are performed on the newly collected moringa seed oil samples. The images are input into the machine learning model to automatically determine whether the samples are adulterated.
[0012] Preferably, the method for baseline correction of Moringa seed oil spectral data is: select a polynomial fitting algorithm baseline correction algorithm to perform baseline correction on the spectral data, first determine the order of the polynomial, then use the least squares method to fit the baseline part in the spectral data, obtain a baseline polynomial function, and subtract the baseline polynomial function from the original spectral data to complete the baseline correction; finally, output the spectral data after baseline correction.
[0013] Preferably, the spectral data is normalized using a Z-score algorithm, where each data value is subtracted from its mean and divided by its standard deviation so that the processed data conforms to a standard normal distribution. The Z-score algorithm formula is: Among them, X is the original data, μ is the mean of the original data, σ is the standard deviation of the original data, and Z is the normalized data value.
[0014] Preferably, the Moringa seed oil image data is subjected to Gaussian filtering to eliminate noise in the image, and the value of each pixel in the image is replaced by the weighted average of the pixel values in its neighborhood, and the calculation formula is:
[0015]
[0016] Among them, G(x,y) is the Gaussian function value at the two-dimensional coordinate (x,y) of the image, x and y are coordinates in the two-dimensional space, σ is the standard deviation of the Gaussian distribution, e is the base of the natural logarithm, and π is the pi. The denoised image is obtained by convolving the Gaussian kernel with the original image.
[0017] Preferably, the method for grayscale processing of Moringa seed oil image data is:
[0018] S1. Select the weighted method to convert the color image into a grayscale image, and use the formula GRAY = 0.3*R + 0.59*G + 0.11*B to calculate the grayscale value. R, G, and B in the formula represent the components of the pixel in the red, green, and blue color domains respectively.
[0019] S2, read the Moringa seed oil image data, traverse each pixel in the image, and obtain the RGB color value corresponding to each pixel;
[0020] S3, applying a color value conversion method, calling the formula in step S1 to convert the RGB color value of each pixel obtained in step S2, and obtaining a corresponding grayscale value;
[0021] S4. Apply the converted grayscale value to each pixel to generate a grayscale image of Moringa seed oil.
[0022] Preferably, a logistic regression algorithm is used to construct a binary classification model, the classification labels are abstracted into 0 and 1, and the logarithmic geometric function is used to realize the mapping relationship:
[0023]
[0024] Wherein, x represents the numerical vector transformed from the spectral features of Moringa seed oil and the texture features of the image, z represents an arbitrary real number, y represents the result of logistic regression, w represents the weight vector, b represents the offset, T is the transposition mark, which means that w is transposed from a column vector to a row vector, and the output range of logistic regression from negative infinity to positive infinity is compressed to (0,1) using the logarithmic probability function. The result of logistic regression y=0.5 is regarded as a dividing point; when y>=0.5, the result of logistic regression is judged as a positive example, the classification mark is 1, and the Moringa seed oil is regarded as not adulterated; when y<0.5, the result of logistic regression is judged as a negative example, the classification mark is 0, and the Moringa seed oil is regarded as adulterated.
[0025] Preferably, the image enhancement method is: the collected Moringa seed oil image data is adjusted by adjusting the brightness, contrast and sharpness of the image to highlight the texture characteristics of the image.
[0026] Preferably, the step of extracting texture features using a gray level co-occurrence matrix algorithm includes:
[0027] Step 1: Select appropriate distance and angle parameters to construct the gray level co-occurrence matrix;
[0028] Step 2: Calculate statistics reflecting image texture features from the gray-level co-occurrence matrix, including energy, contrast, entropy and correlation;
[0029] Step 3: Use the calculated statistics as the texture feature vector of the image.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] The present invention combines Raman spectroscopy analysis and image processing technology to extract features from two dimensions, spectrum and texture, providing more comprehensive information for the identification of adulteration of Moringa seed oil. By constructing a binary classification model and training it with pre-processed spectral features and image texture feature data sets, the model can learn more complex adulteration patterns, thereby improving the accuracy of identification.
[0032] The present invention does not rely on specific physical or chemical parameters, but is based on spectral and image features, so it has better adaptability to moringa seed oil from different sources. By training and optimizing the model, the identification threshold can be continuously adjusted to adapt to moringa seed oil samples from different batches and sources. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A diagram showing the processing steps of the method of the present invention;
[0034] Figure 2 Flowchart for binary classification model training. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] See also Figure 1-2 The present invention provides a technical solution: a method for identifying adulteration of Moringa seed oil, which combines Raman spectroscopy analysis and image processing technology to achieve automatic judgment of whether the Moringa seed oil sample is adulterated through a machine learning algorithm. The specific steps are as follows:
[0037] Step 1: Collect known authentic Moringa seed oil samples and known adulterated Moringa seed oil samples. Use a Raman spectrometer to perform spectral scanning on each sample to obtain its spectral data. At the same time, use a high-definition camera to capture the appearance of each sample to obtain its image data.
[0038] Step 2: Baseline correction and normalization are performed on the collected spectral data to eliminate the influence of background noise and instrument differences on the spectral data. Baseline correction can be performed using polynomial fitting or asymptotic non-negative least squares algorithm, and normalization can be performed using maximum-minimum normalization or Z-score normalization algorithm. The processed spectral data is more accurate and consistent, which is convenient for subsequent feature extraction.
[0039] Step 3, extracting spectral features from the processed spectral data, including key absorption peaks, absorption intensity, peak shape parameters and characteristic ratios, wherein the features can reflect the molecular structure and composition of the moringa seed oil sample, and are key information for distinguishing true and false moringa seed oil.
[0040] Step 4: Grayscale, denoise and enhance the collected image data to improve the clarity and contrast of the image. Grayscale processing converts color images into grayscale images for subsequent processing. Denoising processing can use filtering algorithms or image restoration techniques to reduce noise and interference in the image. Enhancement processing can highlight the texture features of the image by adjusting the brightness, contrast and sharpness of the image.
[0041] Step 5: Use the gray-level co-occurrence matrix algorithm to extract the texture features of the processed image. The gray-level co-occurrence matrix can reflect the spatial relationship between different gray levels in the image and is an effective tool for describing the texture features of the image. By calculating the statistics of the gray-level co-occurrence matrix, such as energy, contrast, entropy, and correlation, the texture feature vector of the image can be obtained.
[0042] Step 6: Build a binary classification model to determine whether the Moringa seed oil sample is adulterated. Select a machine learning algorithm such as logistic regression, support vector machine or neural network as the classifier, and use the preprocessed spectral feature and image texture feature data set to train the model. By adjusting the model parameters and optimizing the algorithm, the accuracy and generalization ability of the classifier can be improved.
[0043] Step 7: Use independent test set data to evaluate the trained model and calculate the accuracy, recall and F1 score indicators to verify the generalization ability and classification effect of the model. The accuracy reflects the model's ability to judge the overall sample, the recall reflects the model's ability to identify truly adulterated samples, and the F1 score is the harmonic mean of the accuracy and recall, which can more comprehensively evaluate the performance of the model.
[0044] Step 8: Integrate the trained machine learning model into the online detection system, perform real-time spectral scanning and image acquisition on the newly collected Moringa seed oil samples, and input them into the machine learning model to automatically determine whether the samples are adulterated. The online detection system can achieve fast and accurate identification of Moringa seed oil adulteration, providing technical support for food safety supervision.
[0045] The present invention will be further described below in conjunction with Examples 1 to 3:
[0046] Embodiment 1:
[0047] In the method for identifying adulteration of Moringa seed oil, the present invention adopts a polynomial fitting algorithm to perform baseline correction of spectral data. The specific implementation method is as follows:
[0048] Determine the order of the polynomial. The process of determining the order of the polynomial in the polynomial fitting algorithm includes preparing spectral data, selecting the order range, fitting the baseline, evaluating the fitting effect, selecting the best order, and performing baseline correction. The polynomial order that can best fit the baseline of the spectral data is found through trial and error and statistical indicators.
[0049] The baseline part in the spectral data is fitted using the least squares method. The least squares method is a mathematical optimization technique that finds the best function match for the data by minimizing the sum of squares of the errors. In the present invention, the baseline part in the spectral data is taken as the fitting object, and the least squares method is used to solve the polynomial coefficients to obtain the baseline polynomial function.
[0050] The baseline polynomial function is subtracted from the original spectral data to complete the baseline correction. The purpose of this step is to eliminate the background noise and instrument differences in the spectral data to make the spectral data more accurate and consistent. By subtracting the baseline polynomial function, the corrected spectral data can be obtained, which only contains the inherent spectral features of the Moringa seed oil sample.
[0051] Output the spectral data after baseline correction. Through baseline correction, the accuracy and reliability of identifying adulterated Moringa seed oil can be further improved.
[0052] The spectral data were normalized using the Z-score algorithm to ensure data consistency and comparability. The specific method is as follows:
[0053] Calculate the mean of the raw spectral data. The mean is the sum of all data values divided by the number of data points, reflecting the central location of the data.
[0054] Calculate the standard deviation of the raw spectral data. The standard deviation is the square root of the average of the squares of the differences between the data values and the mean, and is used to measure the dispersion of the data.
[0055] Apply the Z-score algorithm formula to normalize each data value. The formula is: Among them, X is the original data, μ is the mean of the original data, σ is the standard deviation of the original data, and Z is the normalized data value. Through this formula, each data value is subtracted from its mean and divided by its standard deviation to obtain the normalized data.
[0056] Output the normalized spectral data. The data processed by the Z-score algorithm will conform to the standard normal distribution, that is, the mean is 0 and the standard deviation is 1. This makes the data more consistent and comparable.
[0057] Gaussian filtering is used to reduce the noise of Moringa seed oil image data to eliminate the noise in the image and improve the image quality. The specific method is as follows:
[0058] Determine the core parameter of the Gaussian filter, that is, the standard deviation σ of the Gaussian distribution. This parameter controls the smoothness of the filter. The larger the σ value, the more obvious the smoothing effect of the filter on the image, but too large a σ value may lead to the loss of image details.
[0059] According to the definition of Gaussian function, calculate the Gaussian function value G(x,y) of each pixel position in the image. Gaussian function is a function with a bell-shaped distribution in two-dimensional space, and its calculation formula is:
[0060]
[0061] Where x and y represent the two-dimensional coordinates in the image, e is the base of the natural logarithm, and π is the circumference of a circle. The calculated Gaussian kernel is convolved with the original image. Convolution is an image processing method that multiplies each weight in the Gaussian kernel by the pixel value at the corresponding position in the original image and adds the results to obtain the value of each pixel in the denoised image. Specifically, the value of each pixel in the denoised image is the weighted average of the pixel values in its neighborhood, with the weights determined by the Gaussian kernel.
[0062] Finally, the moringa seed oil image data after noise reduction is output. After the image is processed by Gaussian filtering, the noise is effectively eliminated and the image quality is improved, providing a reliable data basis for subsequent image texture feature extraction.
[0063] The present invention uses a weighted method to perform grayscale processing on the Moringa seed oil image data to convert the color image into a grayscale image. The specific method is as follows:
[0064] S1. Select the weighted method as the method for converting color images to grayscale images. Specifically, the grayscale value is calculated using the formula GRAY=0.3R+0.59G+0.11*B, where R, G, and B represent the components of each pixel in the image in the red, green, and blue color domains, respectively. This formula takes into account the sensitivity of the human eye to different colors, where the green component has the highest weight.
[0065] S2, read the Moringa seed oil image data, and traverse each pixel in the image. For each pixel, obtain its corresponding RGB color value. This step is the basis of grayscale processing, ensuring that the color information of each pixel is accurately read.
[0066] S3, applying the color value conversion method, converting the RGB color value of each pixel obtained in step S2 into a grayscale value. Specifically, the formula GRAY=0.3R+0.59G+0.11*B in step S1 is called to calculate and obtain the grayscale value corresponding to each pixel. This step realizes the conversion of color image to grayscale image.
[0067] S4, applying the gray value obtained by conversion to each pixel to generate a gray image of Moringa seed oil. This step obtains a complete gray image by replacing the color information of each pixel with its corresponding gray value.
[0068] Embodiment 2:
[0069] The present invention uses a logistic regression algorithm to construct a binary classification model to determine whether Moringa seed oil is adulterated. The specific method includes:
[0070] S1. Convert the spectral features and image texture features of Moringa seed oil into a numerical vector x as the input of the logistic regression model. At the same time, define the classification labels as 0 and 1, where 0 indicates that Moringa seed oil is adulterated and 1 indicates that Moringa seed oil is not adulterated.
[0071] S2. Use the logarithmic probability function as the mapping relationship of the logistic regression model to map the input vector x to the output y between (0,1). The form of the logarithmic probability function is:
[0072]
[0073] Where w is the weight vector, b is the offset, T is the transposition marker, indicating that w is transposed from a column vector to a row vector. e is the base of the natural logarithm.
[0074] S3. Make a judgment based on the result y of the logistic regression. When y is greater than or equal to 0.5, the classification mark is set to 1, indicating that the Moringa seed oil is not adulterated; when y is less than 0.5, the classification mark is set to 0, indicating that the Moringa seed oil is adulterated. y = 0.5 is regarded as a cutoff point.
[0075] S4. Output the classification result, i.e., whether the Moringa seed oil is adulterated.
[0076] For the binary classification model constructed above, the specific implementation method of its training process is as follows:
[0077] The spectral characteristics and image texture characteristics of Moringa seed oil were collected and prepared as training data sets. At the same time, each sample was labeled, and the label 0 indicated that the Moringa seed oil was adulterated, and the label 1 indicated that the Moringa seed oil was not adulterated.
[0078] Initialize the weight vector w and offset b of the logistic regression model. The w and b parameters are updated during the training process through the optimization algorithm.
[0079] The cross entropy loss function is selected to evaluate the difference between the model's prediction results and the actual annotations, which is used to effectively measure the performance of the model on the binary classification task.
[0080] Use an optimization algorithm (such as gradient descent) to minimize the loss function and update the model's weight vector w and offset b. By iteratively updating the parameters, the model can gradually learn the mapping relationship from input features to output classifications.
[0081] During the training process, set appropriate stopping conditions to prevent overfitting or unnecessary computational overhead. Stopping conditions include reaching a preset number of iterations or the change in the loss function being less than a certain threshold.
[0082] When the training process meets the stopping condition, a trained logistic regression model is obtained.
[0083] Embodiment 3:
[0084] The present invention performs enhancement operation on the collected images as follows:
[0085] Adjust the brightness of the image. By increasing or decreasing the brightness value of the image, the texture features in the image are made more obvious. The brightness adjustment is based on the image's histogram to ensure that the adjusted image will not be overexposed or underexposed.
[0086] Adjust the contrast of the image. The purpose of contrast adjustment is to enhance the difference between different areas in the image, making the texture features more prominent. Contrast enhancement is achieved by adjusting the difference between the brightest and darkest pixels in the image.
[0087] Adjust the sharpness of the image. Sharpening can enhance the edges and details in the image, making the texture features clearer. The image is sharpened by applying a sharpening filter, such as a Laplacian filter or a high-pass filter.
[0088] The present invention adopts the gray level co-occurrence matrix (GLCM) algorithm to extract texture features, and the specific method is as follows:
[0089] Step 1: Select appropriate distance and angle parameters to construct the gray-level co-occurrence matrix.
[0090] Select a suitable distance parameter, which determines the spatial proximity between pixel pairs to be considered when constructing the gray-level co-occurrence matrix. In practical applications, the selection of this parameter is usually based on the resolution and texture characteristics of the image. This embodiment selects 1 pixel unit, which is suitable for analyzing the fine texture features of the image. The selection of the distance parameter can be adjusted according to the texture scale to be extracted. Larger distance values can capture texture changes in a larger range, but may ignore some detail information.
[0091] Select one or more angle parameters to determine the relationship of the pixel pairs analyzed in a specific direction. According to the selected distance and angle parameters, traverse each pixel in the image and calculate the co-occurrence frequency of the pixel pairs with the specified distance and angle relationship in grayscale, so as to construct the gray-level co-occurrence matrix.
[0092] Step 2: Calculate the statistics reflecting the texture characteristics of the image from the gray-level co-occurrence matrix.
[0093] Calculate the energy. Energy reflects the uniformity and coarseness of the image texture. It is the square root of the sum of the squares of the elements in the gray-level co-occurrence matrix. Calculate the contrast. Contrast reflects the clarity of the image and the depth of the texture grooves. It is the value of the element far from the diagonal in the gray-level co-occurrence matrix. Calculate the entropy. Entropy represents the complexity of the image texture and is a measure of the randomness of all elements in the gray-level co-occurrence matrix. Calculate the correlation. Correlation is used to measure the similarity of the elements in the gray-level co-occurrence matrix in the row or column direction, reflecting the consistency of the image texture.
[0094] Step 3: Use the calculated statistics as the texture feature vector of the image.
[0095] Combine the energy, contrast, entropy, and correlation statistics calculated in step 2 into a feature vector.
[0096] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device 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, method, article or device.
[0097] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for identifying adulteration of Moringa seed oil, It is characterized in that The method comprises: Collecting known authentic Moringa seed oil samples and known adulterated Moringa seed oil samples; using a Raman spectrometer to perform spectral scanning on each sample to obtain its spectral data; using a high-definition camera to take an appearance image of each sample to obtain its image data; Performing baseline correction and normalization processing on the collected spectral data; and extracting spectral features from the processed spectral data, wherein the spectral features include key absorption peaks, absorption intensities, peak shape parameters and characteristic ratios; The collected image data is grayed, denoised and enhanced; and the texture features of the processed image are extracted using the gray-level co-occurrence matrix algorithm; A binary classification model is constructed, wherein the binary classification model is used to determine whether a Moringa seed oil sample is adulterated, the binary classification model is trained using the preprocessed spectral feature and image texture feature data sets, and the classification performance is optimized by adjusting the model parameters; Use independent test set data to evaluate the trained model and calculate the accuracy, recall, and F1 score to verify the generalization ability and classification effect of the model; The trained machine learning model is integrated into the online detection system, and real-time spectral scanning and image acquisition are performed on the newly collected moringa seed oil samples. The images are input into the machine learning model to automatically determine whether the samples are adulterated.
2. A method for identifying adulteration of Moringa seed oil according to claim 1, It is characterized in that The method for baseline correction of Moringa seed oil spectral data is as follows: a polynomial fitting algorithm baseline correction algorithm is selected to perform baseline correction on the spectral data, firstly the order of the polynomial is determined, then the baseline part in the spectral data is fitted using the least squares method to obtain a baseline polynomial function, and the baseline polynomial function is subtracted from the original spectral data to complete the baseline correction; finally the spectral data after baseline correction is output.
3. A method for identifying adulteration of Moringa seed oil according to claim 2, Features: The Z-score algorithm is used to normalize the spectral data. Each data value is subtracted from its mean and divided by its standard deviation so that the processed data conforms to the standard normal distribution. The Z-score algorithm formula is: Among them, X is the original data, μ is the mean of the original data, σ is the standard deviation of the original data, and Z is the normalized data value.
4. A method for identifying adulteration of Moringa seed oil according to claim 3, Features: The Gaussian filtering method is used to eliminate the noise in the image data of Moringa seed oil, and the value of each pixel in the image is replaced by the weighted average of the pixel values in its neighborhood. The calculation formula is: Among them, G(x,y) is the Gaussian function value at the two-dimensional coordinate (x,y) of the image, x and y are coordinates in the two-dimensional space, σ is the standard deviation of the Gaussian distribution, e is the base of the natural logarithm, and π is the pi. The denoised image is obtained by convolving the Gaussian kernel with the original image.
5. A method for identifying adulteration of Moringa seed oil according to claim 4, It is characterized in that The method for grayscale processing of Moringa seed oil image data is: S1. Select the weighted method to convert the color image into a grayscale image, and use the formula GRAY = 0.3*R + 0.59*G + 0.11*B to calculate the grayscale value. R, G, and B in the formula represent the components of the pixel in the red, green, and blue color domains respectively. S2, read the Moringa seed oil image data, traverse each pixel in the image, and obtain the RGB color value corresponding to each pixel; S3, applying a color value conversion method, calling the formula in step S1 to convert the RGB color value of each pixel obtained in step S2, and obtaining a corresponding grayscale value; S4. Apply the converted grayscale value to each pixel to generate a grayscale image of Moringa seed oil.
6. A method for identifying adulteration of Moringa seed oil according to claim 5, It is characterized in that The logistic regression algorithm is used to build a binary classification model, the classification labels are abstracted into 0 and 1, and the logarithmic geometric function is used to realize the mapping relationship: Wherein, x represents the numerical vector transformed from the spectral features of Moringa seed oil and the texture features of the image, z represents an arbitrary real number, y represents the result of logistic regression, w represents the weight vector, b represents the offset, T is the transposition mark, which means that w is transposed from a column vector to a row vector, and the output range of logistic regression from negative infinity to positive infinity is compressed to (0,1) using the logarithmic probability function. The result of logistic regression y=0.5 is regarded as a dividing point; when y>=0.5, the result of logistic regression is judged as a positive example, the classification mark is 1, and the Moringa seed oil is regarded as not adulterated; when y<0.5, the result of logistic regression is judged as a negative example, the classification mark is 0, and the Moringa seed oil is regarded as adulterated.
7. A method for identifying adulteration of Moringa seed oil according to claim 1, It is characterized in that The image enhancement method is as follows: the collected Moringa seed oil image data is adjusted in terms of brightness, contrast and sharpness to highlight the texture features of the image.
8. A method for identifying adulteration of Moringa seed oil according to claim 1, Features: The steps of texture feature extraction using gray level co-occurrence matrix algorithm include: Step 1: Select appropriate distance and angle parameters to construct the gray level co-occurrence matrix; Step 2: Calculate statistics reflecting image texture features from the gray-level co-occurrence matrix, including energy, contrast, entropy and correlation; Step 3: Use the calculated statistics as the texture feature vector of the image.
Citation Information
Cited By
Camellia oil adulteration identification method and system
CN119846158A
Generation method, device and equipment of oil product detection model and medium
CN121808521A
A method, device, equipment and medium for generating an oil product detection model
CN121808521B
