A variable selection method for marine dinoflagellate cell concentration detection based on spectral imaging
Partial least squares regression and adaptive weighted sampling algorithm are used to select the optimal wavelength subset and establish a marine dinoflagellate cell concentration detection model, which solves the time-consuming and high-cost problems of traditional red tide detection technology and achieves fast and accurate spectral imaging. Detection reduces the difficulty and cost of detection.
Patent Information
- Application Number
- CN202210940736.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-06
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2042-08-06
AI Technical Summary
Traditional red tide detection technology is time-consuming, costly and requires high professionalism. It is difficult to achieve rapid and non-destructive detection of marine dinoflagellate cell concentrations. Existing spectral imaging technology is difficult to obtain effective information from large amounts of data.
Partial least squares regression method and adaptive weighted sampling algorithm are used for variable selection. The variable space is repeatedly shrunk through descending sorting and iteration to determine the optimal wavelength subset. A marine dinoflagellate cell concentration detection model is established, and spectral non-destructive detection technology is used to achieve rapid detection. , accurate detection.
It reduces the difficulty and cost of detection, improves the detection accuracy and stability of the model, and achieves rapid and non-destructive detection of marine dinoflagellate cell concentration.
Smart Images

Figure CN115308135B
Abstract
Description
Technical Field
[0001] This invention relates to the field of environmental monitoring technology, and in particular to a method for selecting variables for detecting the concentration of marine dinoflagellates based on spectral imaging. Background Technology
[0002] Red tides, also known as harmful algal blooms, are caused by the explosive proliferation of red tide algae under specific environmental conditions. Dinoflagellates are a general term for single-celled aggregates of plants with two flagella, and constitute a large category of red tides. In recent years, due to factors such as the global spread of harmful red tide algae, eutrophication of coastal waters caused by human activities, the rapid development of aquaculture, and long-term climate change, the frequency, scale, and harm of harmful red tides have been gradually increasing globally. Large-scale toxic dinoflagellate red tides, including *Alexandrium*, *Karenella mikimotoi*, and *Gymnodinium*, have occurred several times in the coastal waters of China.
[0003] Harmful red tides can significantly impact human health, marine life, marine ecosystems, and marine tourism and cultural functions. Long-term preventative measures are needed to reduce the frequency and scale of red tides, and emergency management mechanisms are required to mitigate their harmful effects. However, traditional red tide detection technologies, such as microscopic observation, are time-consuming, costly, and require a high level of expertise, making them difficult to implement and promote in practice. Spectral imaging-based red tide detection technology represents the latest research direction. How to extract effective information from large amounts of spectral data and achieve rapid, non-destructive detection of algal cell concentration is a pressing issue that needs to be addressed. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method for selecting variables for detecting marine dinoflagellates cell concentration based on spectral imaging, which uses spectral technology to reduce the difficulty and cost of detection, and obtains effective information from a large amount of spectral data, thereby achieving rapid and non-destructive detection of marine dinoflagellates cell concentration.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a method for selecting variables for detecting marine dinoflagellate cell concentration based on spectral imaging, comprising the following steps:
[0006] Step S1: Obtain hyperspectral data and true values of algal cell concentration from dinoflagellates;
[0007] Step S2: Using the regression coefficients b of each wavelength obtained by the partial least squares regression method as weights, perform n samplings using the adaptive weighted sampling (ARS) algorithm;
[0008] Step S3: Sort the sampling frequency of each wavelength in descending order and gradually eliminate low-frequency variables, calculate the root mean square error (RMSECV) of the cross-validation, and determine the subset of variables with the smallest RMSECV as the optimal subset.
[0009] Step S4: Iterate k times to repeatedly shrink the variable space, and determine the number of iterations to terminate based on the root mean square error, goodness of fit, and number of wavelengths;
[0010] Step S5: Perform cluster analysis on the remaining wavelengths, select the optimal wavelength based on practical indicators, and establish a dinoflagellate cell concentration detection model.
[0011] In a preferred embodiment, obtaining the hyperspectral data of dinoflagellates and the true values of algal cell concentration includes the following steps:
[0012] Step S11: Laboratory culture of dinoflagellates;
[0013] Step S12: Construct a rapid detection system for marine dinoflagellates based on spectral imaging, including a dark box, stage, background plate, culture dish, fan, light homogenizer, halogen light source, halogen light source DC voltage regulator, camera bracket, hyperspectral camera, and main controller.
[0014] Step S13: Observe the algal species using a microscope and obtain the true value of algal cell concentration;
[0015] Step S14: Preheat the spectral detection system for 30 minutes and acquire hyperspectral images of dinoflagellates, including dark current images, 99% reflectance calibration plate images, and images of different species and concentrations of dinoflagellates.
[0016] Step S15: Perform spectral reflectance correction, and use MATLAB software to select the region of interest in the image and calculate the average spectral reflectance. The formula for reflectance correction is as follows:
[0017]
[0018] In the formula, R0 is the spectral reflectance value of the dinoflagellate image to be measured, R d R is the spectral reflectance value of a dark current image with 0% reflectance. w R is the spectral reflectance value of a standard whiteboard image with a reflectance of 99%, and R is the spectral reflectance value of the dinoflagellate image to be tested after correction.
[0019] In a preferred embodiment, using the regression coefficients b of each wavelength obtained by the partial least squares regression method as weights, the adaptive weighted sampling (ARS) algorithm is used to perform n samplings, including the following steps:
[0020] Step S21: Establish a leave-one-out cross-validation partial least squares regression (PLSR) model based on spectral data X and concentration data Y; the optimal number of principal factors (LVs) is determined according to the explained variance curves of all samples and variables.
[0021] Step S22: Use the absolute value of the regression coefficient b obtained from PLSR as the input of the non-negative weight w for each wavelength, where w is the probability that wavelength i is selected as a variable input item, and the length of the w matrix is equal to the number of wavelengths Nx.
[0022] Step S23: Set the number of samples n, the default is 100;
[0023] Step S24: The loop begins, and random sampling with replacement is performed in the variable pool composed of all wavelengths according to the weight w, and duplicate values are removed; the total number of samples in the random sampling with replacement is equal to the number of wavelengths Nx;
[0024] Step S25: Record the number of sampling wavelengths and their sequence numbers;
[0025] Step S26: Repeat steps S3 and S4 n times until the loop ends.
[0026] In a preferred embodiment, the sampling frequency of each wavelength is sorted in descending order and low-frequency variables are gradually eliminated. For each wavelength eliminated, a 10-fold cross-validation PLSR model needs to be established. The optimal number of principal factors (LVs) is determined based on the explained variance curves of all samples and the remaining variables. The RMSECV of the model after gradual elimination is calculated, and the wavelength combination with the smallest RMSECV is found as the optimal subset to avoid eliminating effective variables. The formula for calculating the root mean square error (RMSECV) of the cross-validation is as follows:
[0027]
[0028] In the formula, y′1 is the true value of the first dinoflagellate cell concentration to be tested, y′2 is the true value of the second dinoflagellate cell concentration to be tested, and y′ m Let y1 be the true value of the m-th dinoflagellate cell concentration, y2 be the predicted value of the 1st dinoflagellate cell concentration, and y3 be the predicted value of the 2nd dinoflagellate cell concentration. m Let m be the predicted concentration of the m-th dinoflagellate cell to be tested, where m is the number of samples. RMSECV is the root mean square error between the predicted and true values of the dinoflagellate cell concentration, reflecting the deviation between the predicted and true values.
[0029] In a preferred embodiment, the clustering analysis of the remaining wavelengths, which selects wavelengths based on practical indicators, includes clustering based on wavelength differences and selecting wavelengths in each cluster according to the control variable method and practical indicators.
[0030] Compared with existing technologies, the present invention has the following advantages: The present invention proposes a new variable selection algorithm that can repeatedly shrink the variable space while ensuring modeling accuracy, and can be further developed for application in multiple fields of research; the present invention utilizes spectral non-destructive testing technology to realize the detection of marine dinoflagellates cell concentration, which improves the detection accuracy and stability of the model and reduces the detection difficulty and cost. Attached Figure Description
[0031] Figure 1 This is a flowchart of the variable selection algorithm in a preferred embodiment of the present invention;
[0032] Figure 2 This is a schematic diagram of the structure of a marine dinoflagellate rapid detection system based on spectral imaging in a preferred embodiment of the present invention;
[0033] Figure 3 This is a schematic diagram of the visualization results of the first ARS operation based on the frequency reduction of band number - optimal band combination when the sample in the preferred embodiment of the present invention is a robust Prosogynum.
[0034] Figure 4 This is a schematic diagram of the result of the first ARS selection of the optimal band combination based on the sampling frequency when the sample is a robust *Prosogynum* in a preferred embodiment of the present invention.
[0035] Figure 5 This is a schematic diagram of the clustering and selection results of the remaining bands when the sample is a robust Prosogynum in a preferred embodiment of the present invention.
[0036] Figure 6 This is a schematic diagram of the final variable modeling results when the sample is a robust Prosogynum in a preferred embodiment of the present invention;
[0037] Figure labels: 1-Dark box; 2-Fan; 3-Halogen light source DC regulated controller; 4-Uniform light plate; 5-Petroleum dish; 6-Stage; 7-Camera bracket; 8-Hyperspectral camera; 9-Halogen light source; 10-Background plate; 11-Main controller. Detailed Implementation
[0038] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0039] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0040] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations according to this application; as used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise; furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.
[0041] like Figure 1As shown, a method for selecting variables for detecting the concentration of marine dinoflagellates based on spectral imaging includes the following steps:
[0042] Step S1: Input the hyperspectral data of dinoflagellates as X, and input the true value of algal cell concentration as Y;
[0043] Step S2: Establish a partial least squares regression (PLSR) model based on X and Y;
[0044] Step S3: Determine the optimal number of principal factors (LVs) based on the explained variance curve;
[0045] Step S4: Based on the X and Y data, the optimal LVs are used to establish a leave-one-out cross-validation PLSR model;
[0046] Step S5: Obtain the regression coefficient matrix b corresponding to each wavelength;
[0047] Step S6: Use the absolute value of b as the non-negative weight w of each wavelength in the adaptive weighted sampling ARS algorithm, where w is the probability that wavelength i is selected as a variable input item;
[0048] Step S7: Set the number of samples n, the default is 100;
[0049] Step S8: Use the ARS algorithm to sample, perform random sampling with replacement on all wavelengths according to the non-negative weight w, the total number of samples is equal to the total number of wavelengths, and remove duplicate values.
[0050] Step S9: Determine whether the n sampling count is met; otherwise, continue sampling using the ARS algorithm until the condition is met.
[0051] Step S10: Count the frequency of sampling for each wavelength;
[0052] Step S11: Arrange the wavelengths in descending order of their sampling frequency, and remove the lowest frequency wavelength one at a time until only one wavelength remains;
[0053] Step S12: For each wavelength removed, a 10-fold cross-validation PLSR model is established, and the root mean square error (RMSECV) of the cross-validation is calculated. The wavelength corresponding to the minimum RMSECV matrix is the optimal subset of variables. The frequency of each wavelength is sorted in descending order, and low-frequency variables are gradually removed. A 10-fold cross-validation PLSR model needs to be established for each wavelength removed. The optimal number of principal factors (LVs) is determined based on the explained variance curves of all samples and the remaining variables. The RMSECV of the model after gradual removal is calculated, and the wavelength combination with the minimum RMSECV is found as the optimal subset to avoid removing effective variables. The formula for calculating the root mean square error (RMSECV) of the cross-validation is: y′1
[0054]
[0055] In the formula, y′1 is the true value of the first dinoflagellate cell concentration to be tested, y′2 is the true value of the second dinoflagellate cell concentration to be tested, and y′ m Let y1 be the true value of the m-th dinoflagellate cell concentration, y2 be the predicted value of the 1st dinoflagellate cell concentration, and y3 be the predicted value of the 2nd dinoflagellate cell concentration. m Let m be the predicted concentration of the m-th dinoflagellate cell to be tested, where m is the number of samples. RMSECV is the root mean square error between the predicted and true values of the dinoflagellate cell concentration, reflecting the deviation between the predicted and true values.
[0056] Step S13: Repeatedly shrink the variable space using an iterative method, determine the number of iterations based on the root mean square error, goodness of fit, and number of wavelengths, and determine whether the number of iterations is satisfied; otherwise, return to S2 to continue iterating.
[0057] Step S14: Perform cluster analysis on the remaining wavelengths and determine that the adjacent differences are no greater than 10 nm based on the resolution of the hyperspectral camera;
[0058] Step S15: Strictly follow the principle of controlling variables to replace each variable in each cluster and model with PLSR. Based on the modeling results and practical indicators, select the optimal wavelength in each cluster to form the final variable selection result. Establish a dinoflagellate cell concentration detection model based on the spectral data X1 corresponding to the selected wavelength of all samples and the true value Y of algal cell concentration.
[0059] like Figure 2As shown, the rapid detection system for marine dinoflagellates, used to acquire spectral data, includes a dark box 1, a fan 2, a halogen light source 9, a halogen light source DC voltage regulator 3, a light diffuser 4, a camera bracket 7, a hyperspectral camera 8, a culture dish 5, a background plate 10, a stage 6, and a main controller 11. The dark box 1 uses a frame structure made of alloy material and is designed as a complete system for easy portability. The halogen light source 9, the halogen light source DC voltage regulator 3, and the light diffuser 4 form the illumination module. The halogen light source 9 consists of two 25W halogen lamps. The light diffuser is 10mm × 15mm in size and 3mm thick, transforming the point light source of the halogen lamps into a parallel light source. The halogen light source DC voltage regulator 3 converts the 220V AC power to DC power and maintains voltage stability to prevent flickering of the halogen light source 9. The camera bracket 7 and the hyperspectral camera 8 form the imaging unit. The camera 7 is fixed on the dark box 1. The hyperspectral camera 8 is mounted on the camera bracket 7 and can be height adjusted. The hyperspectral camera 8 is a Sichuan Shuangli Hepu GaiaField portable hyperspectral camera with a spectral range of 400-1000nm and a spectral resolution of 2.8nm. It can achieve automatic focusing, automatic exposure, and automatic scanning speed matching. The background plate can be replaced according to the algae species requirements, such as a beige light-absorbing velvet background plate. The stage 6 is an alumina lifting platform with manual height adjustment. The platform size is 15cm×15cm, the lifting range is 6.5cm~25cm, and the load-bearing standard is 10kg. The main controller 11 is designed based on MATLAB, Python, and C++ programming. It is used for instruction transmission and data acquisition, and controls the halogen light source DC voltage regulator 3, the hyperspectral camera 8, and the fan 2.
[0060] The specific implementation method of this embodiment is as follows:
[0061] The true concentration Y of robust *Protosporum* cells was observed and obtained using a microscope. The rapid detection system for marine dinoflagellates was activated, including the illumination module, imaging unit, fan 2, and main controller 11. Initial parameters were set, and the halogen light source 9 was preheated for 30 minutes. A culture dish 5 containing a homogeneous algal solution was placed on a cream-colored velvet background plate and fixed in place. The door of the dark chamber 1 was closed, and hyperspectral images of robust *Protosporum* were acquired, including dark current images, images from a 99% reflectance calibration plate, and images of algal solutions at different concentrations. The reflectance was corrected using the reflectance correction formula:
[0062]
[0063] In the formula, R0 is the spectral reflectance value of the image of the robust prosogalactia to be tested, R d R is the spectral reflectance value of a dark current image with 0% reflectance. wR represents the spectral reflectance value of a standard whiteboard image with a reflectance of 99%, and R represents the corrected spectral reflectance value of the *Prosteona vegetans* image to be tested. A circular region of interest with a radius of 60 mm was selected at a fixed location using MATLAB software, and the average spectral reflectance was calculated. All sample data were then aggregated to obtain the spectral data X of *Prosteona vegetans*.
[0064] Input X and Y data, and use the variable selection algorithm proposed in this invention to perform wavelength selection. The specific steps are as follows: Figure 1 As shown. Figure 3 and Figure 4 A schematic diagram illustrating the results of the first run of the variable selection algorithm, including... Figure 3 "ARS Frequency-Based Band Number Reduction - RMSECVmin Visualization of Optimal Band Combinations" and Figure 4 The image shows a visualization of the optimal band combination selected by ARS based on sampling frequency. After three iterations, cluster analysis was performed on the remaining 16 wavelengths. Following the principle of controlling variables, variables within each cluster were replaced one by one, and PLSR modeling was conducted. Based on the modeling results and practical indicators, wavelengths were optimally selected from each cluster. Figure 5 The diagram illustrates the clustering and selection results for the remaining bands. The final selected wavelengths were 455nm, 675nm, 706nm, and 726nm. Based on the spectral data X1 of all samples at the selected wavelengths and the true algal cell concentration Y, a PLSR model was established to detect the concentration of robust *Proximacentorium roxburghii* cells. The model results are shown below. Figure 6 As shown, the root mean square error and goodness of fit of the calibration set (cal) and validation set (val) are respectively RMSE cal =1.7991×10 5 RMSE val =1.8716×10 5 ,
[0065] The main technical features, basic principles, and related advantages of the present invention have been described above. It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the concept or basic characteristics of the invention. Therefore, the above-described embodiments should be considered exemplary and non-limiting in all respects. The scope of the present invention is defined by the appended claims rather than the foregoing description, and thus all variations falling within the meaning and scope of the equivalents of the claims are intended to be included within the present invention.
[0066] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in the embodiments can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A method for selecting variables for detecting marine dinoflagellate cell concentration based on spectral imaging, characterized in that: The steps include: Step S1: Obtaining the hyperspectral data of dinoflagellates and the true value of algal cell concentration; Step S2: using the regression coefficient b of each wavelength obtained by the partial least squares regression method as a weight, and performing n samplings using the adaptive weighted sampling ARS algorithm; Step S3: sort the sampling frequencies of each wavelength in descending order and gradually eliminate low-frequency variables, calculate the root mean square error of the interactive test RMSECV, and determine the variable subset with the smallest root mean square error as the best subset; Step S4: iteratively run k times to repeatedly shrink the variable space, and determine the number of iteration terminations based on the root mean square error, goodness of fit, and number of wavelengths; Step S5: cluster analysis is performed on the remaining wavelengths, wavelengths are optimized according to practical indicators, and a dinoflagellate cell concentration detection model is established; The method of obtaining the hyperspectral data of dinoflagellates and the true value of algal cell concentration comprises the following steps: Step S11: laboratory dinoflagellates cultivation; Step S12: constructing a marine dinoflagellate rapid detection system based on spectral imaging, including a dark box, a stage, a background plate, a culture dish, a fan, a homogenizer, a halogen light source, a halogen light source DC voltage regulator controller, a camera bracket, a hyperspectral camera, and a main controller; Step S13: observing the algae species using a microscope and obtaining the true value of the algae cell concentration; Step S14: The spectrum detection system is preheated for 30 minutes to collect high-spectral images of dinoflagellates, including dark current images, 99% reflectance calibration plate images, and images of dinoflagellates of different types and concentrations; Step S15: Perform spectral reflectance correction, and use Matlab software to select the area of interest in the image and calculate the average spectral reflectance. The reflectance correction calculation formula is: In the formula, is the spectral reflectance value of the dinoflagellate image to be tested, is the spectral reflectance value of the dark current image with a reflectance of 0%, is the spectral reflectance value of the standard whiteboard image with a reflectance of 99%, is the spectral reflectance value after correction of the dinoflagellate image to be tested; The regression coefficient b of each wavelength obtained by the partial least squares regression method is used as the weight, and the adaptive weighted sampling ARS algorithm is used to perform n samplings, including the following steps: Step S21: establishing a leave-one-out cross-validation partial least squares regression PLSR model under the optimal number of principal factors LVs based on the spectral data X and the concentration data Y; the optimal number of principal factors LVs is determined according to the explained variance curves of all samples and variables; Step S22: the absolute value of the regression coefficient b obtained by PLSR is input as the non-negative weight w of each wavelength, where w is the probability that wavelength i is selected as a variable input item, and the length of the w matrix is equal to the number of wavelengths Nx; Step S23: Set the sampling times n, the default value is 100; Step S24: the loop starts, random sampling with replacement is performed in the variable pool composed of all wavelengths according to the weight w, and duplicate values are removed; the total number of samples in the random sampling with replacement is equal to the number of wavelengths Nx; Step S25: Record the number of sampled wavelengths and the wavelength serial numbers; Step S26: Repeat steps S3 and S4 n times, and the cycle ends; The sampling frequencies of each wavelength are sorted in descending order and low-frequency variables are gradually eliminated. A 10-fold cross-validation PLSR model is established for each wavelength eliminated. The optimal number of principal factors LVs is determined based on the explained variance curves of all samples and remaining variables. The RMSECV of the model established after stepwise elimination is statistically analyzed to find the wavelength combination with the smallest RMSECV as the best subset to avoid eliminating effective variables. The root mean square error RMSECV of the interactive test is calculated as follows: In the formula, is the true value of the first dinoflagellate cell concentration to be tested, is the true value of the second dinoflagellate cell concentration to be tested, is the true value of the mth dinoflagellate cell concentration to be tested, is the predicted value of the first dinoflagellate cell concentration to be tested, is the predicted value of the second dinoflagellate cell concentration to be tested, is the predicted value of the mth dinoflagellate cell concentration to be tested, m is the number of samples, RMSECV is the root mean square error between the predicted value and the true value of dinoflagellate cell concentration, reflecting the deviation between the predicted value and the true value; The cluster analysis of the remaining wavelengths and the optimization of wavelengths according to practical indicators include clustering according to wavelength differences and optimizing wavelengths in each category according to the control variable method and practical indicators.
Citation Information
Patent Citations
Method and device for detecting fruit hardness based on hyperspectral analysis
CN108596123A
Distinguishing and content measuring method for methanol gasoline and ethanol gasoline
CN109374565A
