A method and system for detecting the state of a sample tube for biological sample detection
By building MAML metamodel and Siamese Networks, SNNs, and CapsNets-based models, the rapid adaptability and automation of test tube detection technology are achieved, the problems of discontinuity of detection processes and insufficient data processing in the existing technology are solved, and the detection efficiency is improved and accuracy.
Patent Information
- Application Number
- CN202411356872.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-09-27
AI Technical Summary
Existing test tube detection technology has shortcomings in rapid adaptability, data processing capabilities, real-time monitoring and automation, making it difficult to meet the needs of fast and accurate detection, especially when faced with new testing tasks or unknown samples, which require time-consuming and potentially impactfulness. The accuracy of the detection results and the lack of effective data fusion strategies and intelligent decision-making support.
Using the sample test tube state detection method for biological sample detection, the test tube state data, spectral data and information data were collected, and feature extraction and fusion were carried out to construct the MAML meta model and the Siamese Networks, SNNs and CapsNets-based models, respectively, and the features were predicted and Consolidate and output prediction results to determine sample qualifications, achieving rapid adaptation and comprehensive characteristic analysis.
It realizes an automated inspection process, reduces manual intervention, improves the continuity and response speed of the inspection process, can quickly adapt to new inspection tasks and provide accurate evaluation results.
Smart Images

Figure CN118885976B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of test tube fusion model detection, and in particular to a sample test tube state detection method and system for biological sample detection. Background Art
[0002] In modern scientific research and industrial production, test tube testing is a basic and critical technology. Existing technologies usually rely on a series of standardized laboratory testing processes, including but not limited to chemical composition analysis, spectral analysis, microbial culture and other methods. These methods can provide accurate measurement results, but often require a long time and professional operators. For example, spectral analysis technology determines the chemical composition of a sample by measuring the sample's absorption or scattering of light of a specific wavelength. This method is very effective in both qualitative and quantitative analysis, but its application in rapid detection scenarios may be limited by high equipment costs and complex operations. Microbial culture evaluates the microbial content of a sample by observing the growth of the sample on a specific culture medium. This process usually takes hours to days, which is not conducive to immediate detection needs.
[0003] In addition, traditional test tube testing methods also have limitations in data processing. A large amount of experimental data needs to be manually recorded and analyzed, which not only increases the workload but also increases the error rate. Although some automated equipment can provide partial solutions, they often focus on a single testing task, lack flexibility and adaptability, and are difficult to cope with changing testing needs.
[0004] The limitations of existing test tube detection technology, especially in terms of rapid adaptability and multimodal data processing, are particularly prominent. On the one hand, traditional methods often require recalibration of equipment or adjustment of experimental parameters when faced with new detection tasks or unknown samples. This process is time-consuming and may affect the accuracy of the test results. On the other hand, existing technologies often lack effective data fusion strategies when processing multimodal data, resulting in the inability to fully utilize information from different data sources. For example, chemical composition analysis and spectral data are usually completed independently by different devices, and the correlation analysis between them is insufficient, which limits the ability to fully understand the characteristics of the samples.
[0005] In addition, the shortcomings of existing technologies in real-time monitoring and automation also restrict the improvement of detection efficiency. Although some automated equipment can automatically sample and analyze samples, they usually lack intelligent decision support and cannot adjust the detection process based on real-time data. This is particularly problematic when dealing with complex or variable sample characteristics, and more advanced algorithms are needed to achieve fast and accurate evaluation.
[0006] In summary, existing test tube detection technology has obvious defects in adaptability, data processing capabilities, real-time monitoring and automation, which limits its development and application in the field of rapid and accurate detection. In view of these defects, new detection schemes need to provide more flexible, efficient and intelligent solutions to meet the growing detection needs. Summary of the invention
[0007] The present invention proposes a sample tube status detection method and system for biological sample detection to solve the above problems.
[0008] Among them, a method for detecting the state of a sample tube for biological sample detection includes the following steps:
[0009] S1. Collecting test tube status data, sample spectrum data and sample information data of the sample test tube respectively, and collecting test tube capacity data and test tube liquid level data by edge detection according to the test tube status data;
[0010] S2. performing feature extraction and feature fusion based on the collected test tube capacity data, test tube liquid level data, sample spectrum data and sample information data;
[0011] S3. Construct the MAML meta-model and the base models including Siamese Networks, SNNs and CapsNets respectively;
[0012] S4. Predict the fused features separately through the base model, and integrate the predictions of the base model through the meta-model and predict them as new features;
[0013] S5. Qualify the sample test tubes according to the prediction results, and screen out qualified and unqualified sample test tubes;
[0014] Wherein, the step S4 specifically includes the following sub-steps:
[0015] S401. Compare the capacity characteristics and liquid level characteristics of the sample test tubes through the Siamese Networks based model to identify the similarities and differences of the samples;
[0016] S402. Predicting biochemical reaction rates by using SNNs to respond to time series changes in spectral features;
[0017] S403. Analyze the distribution and morphology of the sample in the test tube through the CapsNets-based model, and identify the filling state and sediment of the sample;
[0018] S404. Fuse the output features of the base model, perform comprehensive prediction on the features through the meta-model, and output the prediction results.
[0019] Furthermore, in step S401, the similarities and differences of the samples are identified, specifically by a defined loss function, wherein the loss function is defined as:
[0020] ;
[0021] Among them, the Represents the loss value of Siamese Networks, which is used to measure the difference between the sample image to be detected and the reference sample image. Indicates i feature vectors of sample images to be detected, Representation and The corresponding feature vector of the reference sample image.
[0022] Furthermore, in step S402, the biochemical reaction rate is predicted, specifically by simulating the spike activity of biological neurons, and the process is as follows:
[0023] ;
[0024] Among them, the Indicates at time t +1 moment, i The membrane potential of a neuron, represents the wavelength, Indicates i Neurons and The synaptic weights between the band spectral data, Indicates at time t time, the wavelength is The spectral data of Indicates at time t -1 moment, i The membrane potential of a neuron, The time constant of the membrane potential affects the time scale of neuronal response. Indicates i The external input current of a neuron.
[0025] Furthermore, in step S403, the filling state and sediment of the sample are identified, and the characteristic information is integrated through a dynamic routing algorithm, and the process is as follows:
[0026] ;
[0027] Among them, the Indicates j The capsule in k+1 iteration output vector, the Indicated in k In the iteration, from i Layer capsule to j The routing weight of the layer capsule, Indicates i The output vector of the layer capsule represents the features of the lower-level capsules.
[0028] Furthermore, in step S404, the fusion of the base model output features is specifically expressed as:
[0029] ;
[0030] Among them, the Represents the integrated feature vector after fusion, which is used to represent the comprehensive characteristics of the sample. Represents the time series features from Spiking Neural Networks. Represents the morphological and structural features from Capsule Networks. Represents image similarity features from Siamese Networks.
[0031] Furthermore, in step S404, the features are comprehensively predicted by the meta-model, and outputting the prediction results specifically includes the following sub-steps:
[0032] S4041. The sample test tube qualified prediction task is adapted by the MAML model, and the MAML algorithm is expressed as:
[0033] ;
[0034] Among them, the represents the model parameters after adaptation on the new task, represents the original model parameters, Represents the learning rate, which controls the step size of parameter update. Adaptation loss function at The gradient of Represents the integrated feature vector after fusion;
[0035] S4042. Update the model parameters through the AdamW optimizer, and the update process is expressed as follows:
[0036] ;
[0037] Among them, the represents the updated model parameters, represents the estimated value of the first-order moment, represents the estimated value of the second-order moment, represents the exponential decay rate of the second-order moment, represents a constant for numerical stability. Represents the weight decay term, which is used to regularize and control the complexity of the model;
[0038] S4043. According to the test tube diversity, the sample test tube status is predicted by the constructed MAML model, wherein the test tube diversity is obtained according to the output features of the fused base model, and the prediction process is expressed as follows:
[0039] ;
[0040] Among them, the Represents the final prediction result of the meta-model. Represents the integration function of the meta-model, which is used to integrate the predictions of the base model. Represents the base model for fusion features prediction.
[0041] Furthermore, a sample tube status detection system for biological sample detection is proposed. The system is implemented based on any one of the sample tube status detection methods for biological sample detection described above, and comprises:
[0042] A data sampling module is used to collect test tube status data, sample spectrum data and sample information data of the sample test tube, and collect test tube capacity data and test tube liquid level data through Canny edge detection according to the test tube status data;
[0043] A feature extraction module is used to extract and fuse features based on the collected test tube capacity data, test tube liquid level data, sample spectrum data and sample information data;
[0044] Model building module, used to build MAML meta-model and base models including Siamese Networks, SNNs and CapsNets;
[0045] The model prediction module is used to predict the fused features separately through the base model, and integrate the predictions of the base model through the meta-model and predict them as new features;
[0046] The state detection module is used to determine the quality of the sample test tubes according to the prediction results, and to select qualified and unqualified sample test tubes;
[0047] Furthermore, the model prediction module specifically includes:
[0048] A Siamese Networks base model unit is used to compare the capacity characteristics and liquid level characteristics of the sample test tubes through the Siamese Networks base model to identify the similarities and differences of the samples;
[0049] The SNNs-based model unit is used to predict the biochemical reaction rate through the time series changes of the SNNs response spectral features;
[0050] CapsNets-based model unit, used to analyze the distribution and morphology of samples in the test tube through the CapsNets-based model, and identify the filling state and sediment of the samples;
[0051] The MAML metamodel unit is used to fuse the output features of the base model, and comprehensively predict the features through the metamodel to output the prediction results.
[0052] Furthermore, in the MAML metamodel unit, the fusion of the base model output features is specifically expressed as:
[0053] ;
[0054] Among them, the Represents the integrated feature vector after fusion, which is used to represent the comprehensive characteristics of the sample. Represents the time series features from Spiking Neural Networks. Represents the morphological and structural features from Capsule Networks. Represents similarity features from Siamese Networks.
[0055] Furthermore, the MAML metamodel unit specifically includes:
[0056] The adaptive optimization subunit is used to adapt the sample test tube qualified prediction task through the MAML model. The MAML algorithm is expressed as:
[0057] ;
[0058] Among them, the represents the model parameters after adaptation on the new task, represents the original model parameters, Represents the learning rate, which controls the step size of parameter update. Indicated in Adaptation loss function at The gradient of Represents the integrated feature vector after fusion;
[0059] The model update subunit is used to update the model parameters through the AdamW optimizer. Its update process is expressed as follows:
[0060] ;
[0061] Among them, the represents the updated model parameters, represents the estimated value of the first-order moment, represents the estimated value of the second-order moment, represents the exponential decay rate of the second-order moment, represents a constant for numerical stability. Represents the weight decay term, which is used to regularize and control the complexity of the model;
[0062] The model prediction subunit is used to predict the sample test tube status through the constructed MAML model according to the test tube diversity. The test tube diversity is obtained according to the output features of the fused base model. The prediction process is expressed as follows:
[0063] ;
[0064] Among them, the Represents the final prediction result of the meta-model. Represents the integration function of the meta-model, which is used to integrate the predictions of the base model. Represents the base model for fusion features prediction.
[0065] The beneficial effects of the present invention are:
[0066] The present invention realizes an automated sample detection process by integrating the model into the real-time monitoring system, reduces manual intervention, and improves the continuity and response speed of the detection process. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 A flow chart of a method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings, but the protection scope of the present invention is not limited to the following.
[0069] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.
[0070] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative work are within the scope of protection of the present invention. It should be noted that relational terms such as the terms "first" and "second" 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.
[0071] Moreover, the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus that includes a list of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or apparatus. In the absence of more restrictions, an element defined by the phrase "comprises a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0072] The features and performance of the present invention are further described in detail below in conjunction with the embodiments.
[0073] Among them, Figure 1 A method for detecting the state of a sample tube for biological sample detection comprises the following steps:
[0074] S1. respectively collecting a test tube state image, sample spectrum data and sample information data of the sample test tube, and collecting test tube capacity data and test tube liquid level data by edge detection according to the test tube state image;
[0075] S2. performing feature extraction and feature fusion based on the collected test tube capacity data, test tube liquid level data, sample spectrum data and sample information data;
[0076] S3. Construct the MAML meta-model and the base models including Siamese Networks, SNNs and CapsNets respectively;
[0077] S4. Predict the fused features separately through the base model, and integrate the predictions of the base model through the meta-model and predict them as new features;
[0078] S5. Qualify the sample test tubes according to the prediction results, and screen out qualified and unqualified sample test tubes;
[0079] Wherein, the step S4 specifically includes the following sub-steps:
[0080] S401. Compare the capacity characteristics and liquid level characteristics of the sample test tubes through the Siamese Networks based model to identify the similarities and differences of the samples;
[0081] S402. Predicting biochemical reaction rates by using SNNs to respond to time series changes in spectral features;
[0082] S403. Analyze the distribution and morphology of the sample in the test tube through the CapsNets-based model, and identify the filling state and sediment of the sample;
[0083] S404. Fuse the output features of the base model, perform comprehensive prediction on the features through the meta-model, and output the prediction results.
[0084] Specifically, the above embodiment adopts the MAML (Model-Agnostic Meta-Learning) algorithm, and the model can quickly adapt to new detection tasks, and only a very small number of samples are needed to complete the learning of new sample characteristics, reducing the dependence on a large number of standard samples in traditional detection methods. In addition, through the fusion application of Siamese Networks, Spiking Neural Networks (SNNs), and Capsule Networks (CapsNets) base models, the above solution can comprehensively analyze the spectral characteristics, time series changes, and morphological structures of samples, overcoming the limitations of a single detection method.
[0085] Furthermore, in step S401, the similarities and differences of the samples are identified, specifically by a defined loss function, wherein the loss function is defined as:
[0086] ;
[0087] Among them, the Represents the loss value of Siamese Networks, which is used to measure the difference between the sample image to be detected and the reference sample image. Indicates i feature vectors of sample images to be detected, Representation and The corresponding feature vector of the reference sample image.
[0088] Specifically, the specific implementation principle flow of step S401 is as follows: first, collect pairs of sample test tube images, each pair includes a sample to be detected and a reference sample, initialize the parameters of Siamese Networks, including shared convolutional layers, activation functions, and use randomly initialized or pre-trained weights to set network parameters. Further, extract the feature representation of each image through forward propagation of the network, input each image into the network, and obtain a feature map through convolutional layers and pooling layers; further, calculate the difference between paired image features, and use a loss function to measure the difference between positive sample pairs and negative sample pairs.
[0089] Further, for the calculation of the difference between the paired image features described in the above embodiment, this step is used to compare the features. For example, the Euclidean distance comparison is used. , represents the distance metric. Secondly, according to the feature difference, the loss is calculated by contrasting the loss function, which is further transformed based on the above-disclosed loss function, namely: , wherein the Represents the boundary distance, Represents the similarity label, such as 0 for dissimilar and 1 for similar.
[0090] Furthermore, in step S402, the biochemical reaction rate is predicted, specifically by simulating the spike activity of biological neurons, and the process is as follows:
[0091] ;
[0092] Among them, the Indicates at time t +1 moment, i The membrane potential of a neuron, represents the wavelength, Indicates i Neurons and The synaptic weights between the band spectral data, Indicates at time t time, the wavelength is The spectral data of Indicates at time t -1 moment, i The membrane potential of a neuron, The time constant of the membrane potential affects the time scale of neuronal response. Indicates iThe external input current of a neuron.
[0093] Specifically, the specific implementation principle flow of step S402 is as follows: select a biological neuron model. Exemplarily, the biological neuron model selected in this embodiment is the Hodgkin-Huxley model or the Leaky Integrate-and-Fire model. Further, design the network architecture of SNNs, including an input layer, a hidden layer, and an output layer, as well as a connection mode between the layers, determine the number of neurons and connection weights in each layer, define the topological structure of the network, and set the time step of the simulation, and determine the time step according to the time resolution of the spectral data; further, update the membrane potential state of each neuron according to the neuron model, and for each time step, update the membrane potential according to the input signal and the membrane potential state of the previous time step. ,Furthermore, SNNs are trained to identify the response rate changes of ,spectral data in test tube samples, and the trained SNNs are applied to new spectral data for ,dynamic characteristic analysis.
[0094] As a preferred implementation of the above embodiment, when the membrane potential of a neuron exceeds the threshold, a spike is triggered and the membrane potential is reset, and the membrane potential of each neuron is checked to see whether it reaches the threshold, a spike is triggered and the membrane potential is reset to a resting state. That is:
[0095] ;
[0096] ;
[0097] Among them, the represents the threshold value, A signal indicating a resting state, That is, the membrane potential reaches the threshold.
[0098] Further, for the synaptic weights described in the above embodiment, specifically, the synaptic weights are adjusted by the learning rule STDP - Spike-Timing-Dependent Plasticity, and the weights are adjusted according to the time difference between the pre-synaptic and post-synaptic spikes to strengthen or weaken the connection, that is:
[0099] ;
[0100] Among them, the and represent the proportionality constants of synaptic enhancement and weakening, respectively. and denote the timing of postsynaptic and presynaptic spikes, respectively.
[0101] Furthermore, in step S403, the filling state and sediment of the sample are identified, and the characteristic information is integrated through a dynamic routing algorithm, and the process is as follows:
[0102] ;
[0103] Among them, the Indicates j The capsule in k +1 iteration output vector, the Indicated in k In the iteration, from i Layer capsule to j The routing weight of the layer capsule, Indicates i The output vector of the layer capsule represents the features of the lower-level capsules.
[0104] Specifically, the specific implementation principle flow of step S403 is as follows: in CapsNets, each capsule is responsible for encoding a specific type of feature, including one or more of the shape, direction and position of the sample, using a dynamic routing algorithm to transfer information between capsules at different levels, calculating routing weights through an iterative process, and transferring the output of the low-level capsule to the high-level capsule; further, through the activation of the capsule, the morphological and structural features of the sample in the image are extracted, and the composition information of the sample is combined with the output of the capsule network to enhance the model's understanding of the sample characteristics. Furthermore, CapsNets are trained to recognize and classify the morphological features of different samples, and the trained CapsNets are applied to the analysis of real-time sample test tubes.
[0105] Furthermore, in step S404, the fusion of the base model output features is specifically expressed as:
[0106] ;
[0107] Among them, the Represents the integrated feature vector after fusion, which is used to represent the comprehensive characteristics of the sample. Represents the time series features from Spiking Neural Networks. Represents the morphological and structural features from Capsule Networks. Represents image similarity features from Siamese Networks.
[0108] Specifically, the specific process principle of step S404 is: fusing Siamese Networks, Spiking NeuralNetworks (SNNs), and Capsule Networks (CapsNets) to form a comprehensive feature representation, aligning features from different sources, assigning weights to different features, and aggregating the weighted features to form a fused feature vector.
[0109] Furthermore, in step S404, the features are comprehensively predicted by the meta-model, and outputting the prediction results specifically includes the following sub-steps:
[0110] S4041. The sample test tube qualified prediction task is adapted by the MAML model, and the MAML algorithm is expressed as:
[0111] ;
[0112] Among them, the represents the model parameters after adaptation on the new task, represents the original model parameters, Represents the learning rate, which controls the step size of parameter update. Indicated in Adaptation loss function at The gradient of Represents the integrated feature vector after fusion;
[0113] S4042. Update the model parameters through the AdamW optimizer, and the update process is expressed as follows:
[0114] ;
[0115] Among them, the represents the updated model parameters, represents the estimated value of the first-order moment, represents the estimated value of the second-order moment, represents the exponential decay rate of the second-order moment, represents a constant for numerical stability. Represents the weight decay term, which is used to regularize and control the complexity of the model;
[0116] S4043. According to the test tube diversity, the sample test tube status is predicted by the constructed MAML model, wherein the test tube diversity is obtained according to the output features of the fused base model, and the prediction process is expressed as follows:
[0117] ;
[0118] Among them, the Represents the final prediction result of the meta-model. Represents the integration function of the meta-model, which is used to integrate the predictions of the base model. Represents the base model for fusion features prediction.
[0119] Specifically, the specific process principle of step S404 is: based on the obtained fusion features as input, perform inner loop update, calculate the outer loop gradient, and update the initial parameters of the model, combine the model output after rapid adaptation and the prediction of other base models, and adjust the model parameters or data acquisition strategy according to the difference between the model prediction and the actual detection results.
[0120] Furthermore, a sample tube status detection system for biological sample detection is proposed. The system is implemented based on any one of the sample tube status detection methods for biological sample detection described above, and comprises:
[0121] A data sampling module is used to collect a test tube state image, sample spectrum data and sample information data of the sample test tube, and collect test tube capacity data and test tube liquid level data according to the test tube state image through Canny edge detection;
[0122] A feature extraction module is used to extract and fuse features based on the collected test tube capacity data, test tube liquid level data, sample spectrum data and sample information data;
[0123] Model building module, used to build MAML meta-model and base models including Siamese Networks, SNNs and CapsNets;
[0124] The model prediction module is used to predict the fused features separately through the base model, and integrate the predictions of the base model through the meta-model and predict them as new features;
[0125] The state detection module is used to determine the quality of the sample test tubes according to the prediction results, and to select qualified and unqualified sample test tubes;
[0126] Furthermore, the model prediction module specifically includes:
[0127] A Siamese Networks base model unit is used to compare the capacity characteristics and liquid level characteristics of the sample test tubes through the Siamese Networks base model to identify the similarities and differences of the samples;
[0128] The SNNs-based model unit is used to predict the biochemical reaction rate through the time series changes of the SNNs response spectral features;
[0129] CapsNets-based model unit, used to analyze the distribution and morphology of samples in the test tube through the CapsNets-based model, and identify the filling state and sediment of the samples;
[0130] The MAML metamodel unit is used to fuse the output features of the base model, and comprehensively predict the features through the metamodel to output the prediction results.
[0131] Furthermore, in the MAML metamodel unit, the fusion of the base model output features is specifically expressed as:
[0132] ;
[0133] Among them, the Represents the integrated feature vector after fusion, which is used to represent the comprehensive characteristics of the sample. Represents the time series features from Spiking Neural Networks. Represents the morphological and structural features from Capsule Networks. Represents image similarity features from Siamese Networks.
[0134] Furthermore, the MAML metamodel unit specifically includes:
[0135] The adaptive optimization subunit is used to adapt the sample test tube qualified prediction task through the MAML model. The MAML algorithm is expressed as:
[0136] ;
[0137] Among them, the represents the model parameters after adaptation on the new task, represents the original model parameters, Represents the learning rate, which controls the step size of parameter update. Indicated in Adaptation loss function at The gradient of Represents the integrated feature vector after fusion;
[0138] The model update subunit is used to update the model parameters through the AdamW optimizer. Its update process is expressed as follows:
[0139] ;
[0140] Among them, the represents the updated model parameters, represents the estimated value of the first-order moment, represents the estimated value of the second-order moment, represents the exponential decay rate of the second-order moment, represents a constant for numerical stability. Represents the weight decay term, which is used to regularize and control the complexity of the model;
[0141] The model prediction subunit is used to predict the sample test tube status through the constructed MAML model according to the test tube diversity. The test tube diversity is obtained according to the output features of the fused base model. The prediction process is expressed as follows:
[0142] ;
[0143] Among them, the Represents the final prediction result of the meta-model. Represents the integration function of the meta-model, which is used to integrate the predictions of the base model. Represents the base model for fusion features prediction.
[0144] Furthermore, the above embodiment proposes a fast adaptive model based on the meta-learning algorithm MAML, which is specifically used to optimize the detection process of sample test tubes. The following are the detailed parameter settings and implementation steps for model construction, including specific data and implementation details:
[0145] Among them, the designed MAML model consists of the following layers:
[0146] Input layer: Receives image data of dimension (C,H,W), where C is the number of channels, H and W are the height and width of the image respectively.
[0147] Four convolutional layers (Conv2d), conv1 to conv4, are configured as follows:
[0148] conv1: 32 filters, 3x3 kernel, stride 1, padding 1, ReLU activation.
[0149] conv2: 64 filters, 3x3 kernel, stride 1, padding 1, ReLU activation.
[0150] conv3: 128 filters, 3x3 kernel, stride 2 (for downsampling), padding 1, ReLU activation.
[0151] conv4: 256 filters, 3x3 kernel, stride 1, padding 1, ReLU activation.
[0152] Three fully connected layers (Linear), fc1 to fc3, are configured as follows:
[0153] fc1: 512 nodes.
[0154] fc2: 256 nodes.
[0155] fc3: The number of output nodes is set according to the task requirements. The binary classification task has 1 node and uses Sigmoid activation.
[0156] In addition, in the inner loop, the model is trained using the support set, which contains images and spectral data of N sample tubes, where N=20; the outer loop is performed on a larger dataset, which contains M samples, where M=600, to optimize the initial parameters of the model; the inner loop uses a learning rate of 0.01, and the outer loop uses a learning rate of 0.001; the dataset for the new task contains K new sample tubes, where K=5.
[0157] Specifically, the experiment was conducted on a server equipped with an NVIDIA RTX 3080 GPU, the operating system was Ubuntu20.04 LTS, and the PyTorch1.8 framework was used. A self-made sample tube detection dataset was used, containing images and spectral data of a total of 1,000 sample tubes, each with 224×224 pixels. The model was trained on the training set for 300 iterations, using the cross entropy loss function and Adam optimizer, with the learning rate set to 0.001. After each iteration, the model was evaluated on an independent validation set. The output of the MAML model was fused with the output of the SiameseNetworks, SNNs, and CapsNets base models through ensemble learning technology to improve detection accuracy. In addition, during use, 8*12 sample tubes were detected simultaneously at a time.
[0158] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not deviate from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.
Claims
1. A method for detecting the state of a sample tube for biological sample detection, characterized in that: The following steps are involved: S1. Collecting test tube status data, sample spectrum data and sample information data of the sample test tube respectively, and collecting test tube capacity data and test tube liquid level data by edge detection according to the test tube status data; S2. performing feature extraction and feature fusion based on the collected test tube capacity data, test tube liquid level data, sample spectrum data and sample information data; S3. Construct the MAML meta-model and the base models including Siamese Networks, SNNs and CapsNets respectively; S4. Predict the fused features separately through the base model, and integrate the predictions of the base model through the meta-model and predict them as new features; S5. Qualify the sample test tubes according to the prediction results, and screen out qualified and unqualified sample test tubes; Wherein, the step S4 specifically includes the following sub-steps: S401. Compare the capacity characteristics and liquid level characteristics of the sample test tubes through the Siamese Networks based model to identify the similarities and differences of the samples; S402. Predicting biochemical reaction rates by using SNNs to respond to time series changes in spectral features; S403. Analyze the distribution and morphology of the sample in the test tube through the CapsNets-based model, and identify the filling state and sediment of the sample; S404. Fuse the output features of the base model, perform comprehensive prediction on the features through the meta-model, and output the prediction results.
2. A method for detecting a sample tube state for biological sample detection as claimed in claim 1, characterized in that: In step S401, the similarities and differences of the samples are identified, specifically by a defined loss function, which is defined as: ; Among them, the Represents the loss value of Siamese Networks, which is used to measure the difference between the sample data to be detected and the reference sample data. Indicates i feature vectors of sample data to be detected, Representation and The corresponding feature vector of the reference sample data, where i represents the index.
3. A method for detecting a sample tube state for biological sample detection as claimed in claim 1, characterized in that: In step S402, the biochemical reaction rate is predicted, specifically by simulating the spike activity of biological neurons, and the process is as follows: ; Among them, the Indicates at time t +1 moment, i The membrane potential of a neuron, represents the wavelength, Indicates i Neurons and The synaptic weights between the band spectral data, Indicates at time t time, the wavelength is The spectral data of Indicates at time t -1 moment, i The membrane potential of a neuron, The time constant of the membrane potential affects the time scale of neuronal response. Indicates i The external input current of a neuron.
4. A method for detecting a sample tube state for biological sample detection as claimed in claim 1, characterized in that: In step S403, the filling state and sediment of the sample are identified, and the characteristic information is integrated through a dynamic routing algorithm, and the process is as follows: ; Among them, the Indicates j The capsule in k +1 iteration output vector, the Indicated in k In the iteration, from i Capsule layer to j The routing weight of the layer capsule, Indicates i The output vector of the layer capsule represents the features of the lower-level capsules.
5. The method for detecting the state of a sample tube for biological sample detection according to claim 1, characterized in that: In step S404, the fusion of the base model output features is specifically expressed as: ; Among them, the Represents the integrated feature vector after fusion, which is used to represent the comprehensive characteristics of the sample. Represents the time series features from Spiking Neural Networks. Represents the morphological and structural features from CapsuleNetworks. Represents similarity features from Siamese Networks.
6. A method for detecting a sample tube state for biological sample detection as claimed in claim 1, characterized in that: In step S404, the features are comprehensively predicted by the meta-model, and outputting the prediction results specifically includes the following sub-steps: S4041. Adapting the sample test tube qualified prediction task through the MAML model, the MAML model is represented as: ; Among them, the represents the model parameters after adaptation on the new task, represents the original model parameters, Represents the learning rate, which controls the step size of parameter update. Indicated in Adaptation loss function at The gradient of Represents the integrated feature vector after fusion; S4042. Update the model parameters through the AdamW optimizer, and the update process is expressed as follows: ; Among them, the represents the updated model parameters, represents the estimated value of the first-order moment, represents the estimated value of the second-order moment, represents the exponential decay rate of the second-order moment, represents a constant for numerical stability. Represents the weight decay term, which is used to regularize and control the complexity of the model; S4043. According to the test tube diversity, the sample test tube status is predicted by the constructed MAML model, wherein the test tube diversity is obtained according to the output features of the fused base model, and the prediction process is expressed as follows: ; Among them, the Represents the final prediction result of the meta-model. Represents the integration function of the meta-model, which is used to integrate the predictions of the base model. Represents the base model for fusion features prediction.
7. A sample tube status detection system for biological sample detection, the system being implemented based on a sample tube status detection method for biological sample detection according to any one of claims 1 to 6, characterized in that: include: A data sampling module is used to collect test tube status data, sample spectrum data and sample information data of the sample test tube, and collect test tube capacity data and test tube liquid level data through edge detection according to the test tube status data; A feature extraction module is used to extract and fuse features based on the collected test tube capacity data, test tube liquid level data, sample spectrum data and sample information data; Model building module, used to build MAML meta-model and base models including Siamese Networks, SNNs and CapsNets; The model prediction module is used to predict the fused features separately through the base model, and integrate the predictions of the base model through the meta-model and predict them as new features; The state detection module is used to determine the quality of the sample test tubes according to the prediction results, and to screen out qualified and unqualified sample test tubes.
8. A sample tube status detection system for biological sample detection as claimed in claim 7, characterized in that: The model prediction module specifically includes: A Siamese Networks base model unit is used to compare the capacity characteristics and liquid level characteristics of the sample test tubes through the Siamese Networks base model to identify the similarities and differences of the samples; The SNNs-based model unit is used to predict the biochemical reaction rate through the time series changes of the SNNs response spectral features; CapsNets-based model unit, used to analyze the distribution and morphology of samples in the test tube through the CapsNets-based model, and identify the filling state and sediment of the samples; The MAML metamodel unit is used to fuse the output features of the base model, and comprehensively predict the features through the metamodel to output the prediction results.
9. A sample tube status detection system for biological sample detection as claimed in claim 8, characterized in that: In the MAML metamodel unit, the fusion of the base model output features is specifically expressed as: ; Among them, the Represents the integrated feature vector after fusion, which is used to represent the comprehensive characteristics of the sample. Represents the time series features from Spiking Neural Networks. Represents the morphological and structural features from Capsule Networks. Represents data similarity features from Siamese Networks.
10. A sample tube status detection system for biological sample detection as claimed in claim 8, characterized in that: The MAML metamodel unit specifically includes: The adaptive optimization subunit is used to adapt the sample test tube qualification prediction task through the MAML model, and the MAML model is expressed as: ; Among them, the represents the model parameters after adaptation on the new task, represents the original model parameters, Represents the learning rate, which controls the step size of parameter update. Indicated in Adaptation loss function at The gradient of Represents the integrated feature vector after fusion; The model update subunit is used to update the model parameters through the AdamW optimizer. Its update process is expressed as follows: ; Among them, the represents the updated model parameters, represents the estimated value of the first-order moment, represents the estimated value of the second-order moment, represents the exponential decay rate of the second-order moment, represents a constant for numerical stability. Represents the weight decay term, which is used to regularize and control the complexity of the model; The model prediction subunit is used to predict the sample test tube status through the constructed MAML model according to the test tube diversity. The test tube diversity is obtained according to the output features of the fused base model. The prediction process is expressed as follows: ; Among them, the Represents the final prediction result of the meta-model. Represents the integration function of the meta-model, which is used to integrate the predictions of the base model. Represents the base model for fusion features prediction.
Citation Information
Patent Citations
Method for rapidly detecting growth process of cassava solid-state fermentation on line
CN110987895A
Method and system for classifying blood samples in blood coagulation index detection based on MAML and spatial transformation
CN117036823A
Disconnecting link opening and closing state abnormity detection method and system
CN117372925A
Hardware-oriented deep spiking neural network speech recognition method and system
WO2024152583A1
