Multi-task learning prediction method and quality detection method based on network architecture search
Through the network architecture search method optimized by genetic algorithm, combined with the Res-SE module and multiple feature interaction modules, the problems of low efficiency of network architecture design and insufficient feature interaction in multi-task learning are solved, and high-precision spectral data analysis is achieved.
Patent Information
- Application Number
- CN202510736064.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-09-19
AI Technical Summary
Existing multi-task learning methods have inefficient network architecture design in spectral data processing, which easily leads to overfitting or underfitting, and ignores the interaction of private features between tasks, affecting the independence and accuracy of the model.
A network architecture search method based on genetic algorithm is adopted to dynamically optimize the network structure through shared feature extraction layers, specific task prediction branches and feature interaction modules. It combines Res-SE modules, gating mechanism interaction, feature fusion interaction and feature conversion interaction modules to improve feature extraction efficiency and feature sharing independence between tasks.
It improves the prediction accuracy and adaptability of the model in multi-task scenarios, realizes efficient feature extraction and feature interaction between tasks, and enhances the stability and generalization ability of the model.
Smart Images

Figure CN120673400A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of spectral analysis technology based on big data, specifically a multi-task learning prediction method and quality detection method based on network architecture search Background Art
[0002] With the rapid development of big data technologies, deep learning has become increasingly widely used in analytical tasks, particularly in near-infrared (NIR) spectroscopy, where it has become a crucial tool for food and agricultural product quality analysis. NIR spectroscopy captures high-dimensional features of samples, reflecting their chemical composition and physical properties. Through its hierarchical structure, deep learning can automatically extract features from raw spectral data. For example, one-dimensional convolutional neural networks (1D-CNNs) can efficiently mine the relationship between spectra and target variables without relying on prior knowledge. To improve model performance in complex tasks, multi-task learning (MTL) has been increasingly applied to NIR spectroscopy. By sharing feature representations, it not only improves training efficiency but also enhances model generalization. However, most MTL methods rely on manually designed backbone networks and ignore the interaction of private features between tasks. This can lead to over-reliance on shared features, compromising task independence and accuracy. As task complexity and data size increase, manually designed network architectures become inefficient and prone to overfitting and underfitting. To address these issues, automated neural network architecture search (NAS) has emerged as an effective approach. By automatically searching and optimizing network architectures, it significantly reduces reliance on manual design and can generate high-performance models. Among them, the NAS method based on genetic algorithm (GA) simulates the biological evolution mechanism and uses selection, crossover and mutation operations to optimize the network architecture, showing significant optimization capabilities in practice.
[0003] Although NAS technology has achieved remarkable results in fields such as image classification, there is still little research on spectral data processing. The high-dimensional characteristics of spectral data place higher demands on the network architecture. Summary of the Invention
[0004] The purpose of the present invention is to provide a multi-task learning prediction method and a quality detection method based on network architecture search to solve the problems existing in the above-mentioned background technology.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A multi-task learning prediction method based on network architecture search, including:
[0007] The shared feature extraction layer consists of multiple Res-SE modules to mine global shared feature information applicable to multiple tasks;
[0008] The task-specific prediction branch divides the global shared feature information into two task-specific prediction branches;
[0009] Feature interaction module, which interacts the input features of two specific task prediction branches to fuse specific task features;
[0010] Dynamically select and configure multiple Res-SE modules and feature interaction modules to achieve dynamic module optimization.
[0011] As an improvement to the above technical solution, there are three Res-SE modules, each of which contains a convolutional layer (Conv), batch normalization (BN), a residual block (ResBlock) and a Squeeze-and-Excitation (SE) module; the residual block (Resblock) first processes the original input feature data x through convolution and activation function to generate a residual map:
[0012] F(x) = ReLU(Comv(x));
[0013] The residual map F(x) is then added to the original input feature data x, and the final output is obtained through the activation function:
[0014] Output = ReLU(F(x)+x).
[0015] As an improvement to the above technical solution, the Squeeze-and-Excitation (SE) module first performs global average pooling on the original input feature data x to generate channel information:
[0016] s = AvgPool1d(x);
[0017] After two layers of fully connected networks and activation functions, the channel weight z is generated:
[0018] z=Sigmoid(W2·ReLU(W1·s));
[0019] Adjust the input feature channel weights and output weighted features:
[0020] Output = x·z;
[0021] Among them, W1 and W2 are the weight matrices of the fully connected layer.
[0022] As an improvement to the above technical solution, the specific task prediction branch includes:
[0023] The first branch, consisting of a convolutional layer, a batch normalization layer, and a residual block, processes global shared feature information and generates input features x1;
[0024] The second branch, consisting of a fully connected layer, transforms the globally shared feature information to generate the input feature x2.
[0025] As an improvement to the above technical solution, the feature interaction module includes a gating mechanism interaction (GI) module, a feature fusion interaction (FFI) module, and a feature transformation interaction (FTI) module; the gating mechanism interaction (GI) module first concatenates the input features x1 and x2 to generate a combined feature vector:
[0026] combined_values=[x1;x2];
[0027] Calculate the gate value through the fully connected layer and activation function:
[0028] gate_values = Sigmoid(W gate x2+b gate );
[0029] Among them, W gate and b gate are the weights and biases of the fully connected layer, which are used to generate the gating values for dynamically adjusting the weights.
[0030] Use the gating value to weight the combined features and output the interactive features:
[0031] Interaction1=(W·combined values +b)☉gate values ;
[0032] Where W and b are the weights and biases of the fully connected layer, and ⊙ represents the element-wise weighted operation.
[0033] As an improvement to the above technical solution, the Feature Fusion Interaction (FFI) module first concatenates the input features x1 and x2 to generate a combined feature vector:
[0034] combined_values=[x1;x2];
[0035] Use the fully connected layer and activation function to transform the combined features and output the interactive features:
[0036] Interaction2=ReLU(W·combined_values+b);
[0037] Where W and b are the weights and biases of the fully connected layer.
[0038] As an improvement to the above technical solution, the Feature Transformation Interaction (FTI) module first transforms the input features x1 and x2 independently to generate the transformed features:
[0039] tramsformed_x1=W1·x1+b1;
[0040] transformed_x2=W2·x2+b2;
[0041] Perform weighted summation on the transformed features and output the interactive features:
[0042] Intereaction3=transformed_x1+transformed_x2;
[0043] According to the selection of the genetic algorithm, the outputs of multiple interaction modules are averaged, and finally the task prediction results are output through two prediction heads. To balance the training of multiple tasks, the final loss function is the weighted sum of the losses of the two regression tasks:
[0044] Loss total =α×Loss regression1 +β×Loss regresstion2 ;
[0045] α and β are the loss weights of the two regression tasks, α is 0.6 and β is 0.4, to achieve better model performance in multi-task learning.
[0046] As an improvement to the above technical solution, the dynamic selection and configuration includes the following steps:
[0047] S1. The activation state of each module is represented by binary encoding, X1, X2, X3, X4, X5, X6, X7, X8, X9 ∈ {0, 1} represents the activation state of the batch normalization (BN), residual block (ResBlock) and Squeeze-and-Excitation (SE) modules in the three Res-SE modules; X 10 ,X 11 ,X 12 ∈{0, 1} represents the gating mechanism interaction (GI) module, feature fusion interaction (FFI) module, and feature transformation interaction (FTI) module in the feature interaction module; 1 means enabled and 0 means disabled;
[0048] S2. Calculate the average root mean square error (RMSE) of the two regression tasks and evaluate the fitness. The fitness formula is:
[0049] S3,selection, prioritizes individuals with lower fitness values to enter the next generation, thereby retaining the network configuration with better performance;
[0050] S4, crossover, generating new offspring by recombining the codes of two parent individuals;
[0051]
[0052] C new represents the newly generated individual, p1 and p2 are the encoding vectors of the parents respectively;
[0053] S5, mutation, randomly changes the state of a module, i.e., changes it from “enabled” (1) to “disabled” (0) or vice versa, to prevent the genetic algorithm (GA) from falling into a local optimum.
[0054] As an improvement to the above technical solution, the present invention also provides an application of the above multi-task learning prediction method, which is applied to the quality detection of American ginseng and flour.
[0055] As an improvement to the above technical solution, the quality detection method of American ginseng and flour includes the following steps:
[0056] S1. Prepare American ginseng and wheat flour samples;
[0057] S2. Near-infrared spectral (NIR) data collection and preprocessing: The collected raw NIR spectral data undergoes standard normal transformation (SNV) and Z-score normalization (Z_score) to correct for slope differences in the spectral data, improve spectral discrimination, and improve the quality of model input data.
[0058] S3. Chemical composition analysis of samples;
[0059] S4. The preprocessed spectral data were divided into training set, validation set and test set. American ginseng was divided in a ratio of 5:1:4, and wheat flour was divided in a ratio of 5:2:3. Then, a multi-task learning prediction method based on network architecture search was used to train the training set and validation set, and the results were evaluated on the test set. Finally, the experiment was randomly repeated 10 times and the average results were taken.
[0060] Compared with the prior art, the present invention has the following beneficial effects:
[0061] 1. The Res-SE module combines residual and channel attention mechanisms to improve feature extraction efficiency and model stability. 2. A genetic algorithm is used to dynamically optimize module selection, enhancing model adaptability and prediction performance. 3. Multiple feature interaction modules (GI, FFI, and FTI) are introduced to enhance feature sharing and independence across multiple tasks. 4. The model achieves high-precision predictions in multi-task scenarios and has broad applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 This is a flow chart of the experimental process of using the algorithm of the present invention for product quality testing;
[0063] Figure 2 Schematic diagram of the overall composition structure of GA-OMTL;
[0064] Figure 3 Schematic diagram of the composition structure and optimization of the three Res-SE modules and feature interaction module;
[0065] Figure 4 Schematic diagram of the composition structure of the residual module and SE module in the Res-SE module;
[0066] Figure 5 The schematic diagram of the composition structure of the GI module, FFI module, and FTI module in the feature interaction module;
[0067] Figure 6 Color images of American ginseng and wheat flour; (a) is the color image of American ginseng, and (b) is the color image of wheat flour;
[0068] Figure 7 are the average spectral images of American ginseng and wheat flour; (a) is the average spectral image of American ginseng, and (b) is the average spectral image of wheat flour;
[0069] Figure 8 Schematic diagram of the prediction results of American ginseng and wheat flour; (a) and (b) are the prediction results of ginsenotriol saponins and ginsenodiol saponins of American ginseng samples, respectively; (c) and (d) are the prediction results of protein and moisture of wheat flour samples;
[0070] Figure 9 Schematic diagram of the search results for the model;
[0071] Figure 10 Schematic diagram of the change of fitness value during model training. DETAILED DESCRIPTION
[0072] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 making creative efforts are within the scope of protection of the present invention.
[0073] The multi-task learning prediction method based on network architecture search of the present invention aims to combine the optimization capabilities of automated neural network architecture search (NAS) and genetic algorithm (GA) to dynamically select and optimize the network structure in the multi-task learning framework, and apply it to the quality detection of American ginseng and flour. By improving the feature extraction and feature interaction capabilities between tasks, it solves the problems of low efficiency and insufficient generalization ability of existing methods in spectral data analysis.
[0074] The multi-task learning prediction method of the present invention is applied to the process of American ginseng and flour quality detection as follows: Figure 1 The specific steps are:
[0075] Step 1: Preparation of American ginseng and wheat flour samples
[0076] Figure 6 Color images of American ginseng and wheat flour samples selected during the quality testing of American ginseng and flour in the present invention. Two samples were selected in the present invention: American ginseng and wheat flour. American ginseng came from four regions, including Weihai, Shandong, Baishan, Jilin, Montreal, Canada, and Wisconsin, USA. The whole American ginseng samples were cut into slices about 1 mm thick, with diameters ranging from 8.2 mm to 15.6 mm. 35 to 40 samples were prepared from each region, for a total of 150 samples, which were sealed and stored in a refrigerator at 2°C. Wheat flour samples came from nine varieties in China (Wudili Flour Group Co., Ltd., Jinshahe Group, and Yihai Kerry Golden Dragon Fish Holdings Co., Ltd.), the United States (Bob's Red Mill), and Russia (Topqiha Flour Processing Co., Ltd.), covering high, medium, and low gluten content. Each variety was divided into 46-77 parallel samples, each weighing 150 grams, and placed in a clean Petri dish.
[0077] Step 2: Near-Infrared Spectroscopy (NIR) Data Collection
[0078] Figure 7 This is the average spectral image of American ginseng and wheat flour obtained during the quality testing of American ginseng and wheat flour in the present invention. The American ginseng samples were analyzed using a DA7250 diode array near-infrared analyzer from Perten, Sweden, with a wavelength range of 950–1650 nm. After a 30-minute instrument warm-up, the samples were equilibrated at 22°C for 10 minutes. The samples were randomly placed on a sampling tray and scanned twice using a halogen lamp. The spectral resolution was 0.5 nm, and the 1401 spectral points collected were reduced to 280 data points using sliding window processing.
[0079] Wheat flour was measured using an OTOPhotonics Inc. SW2860 spectrometer with a wavelength range of 900–1700 nm and a Y-type optical fiber (from Shanghai Isuzu Optics). The fiber was positioned 25 cm from the sample surface, creating a 2.6 cm spot size with an exposure time of 300 ms. The sample was placed on a conveyor belt, which was paused to ensure measurement accuracy. Light was projected through one arm of the fiber, while the other arm captured the reflected light and transmitted it to the spectrometer, generating 248 spectral points with a resolution of approximately 3.2 nm.
[0080] Step 3: Chemical composition analysis of samples
[0081] The main components of American ginseng samples are saponins, which were analyzed by high-performance liquid chromatography (HPLC) for panaxadiol saponins (Rb1, Rc, Rb2, and Rd) and panaxatriol saponins (Rg1 and Re). After preliminary near-infrared spectra were collected, the samples were crushed and passed through an 80-mesh sieve. Each 100 mg sample was ultrasonically extracted with 3 mL of 20% anhydrous ethanol at 50°C for 60 minutes. After centrifugation and filtration, the samples were analyzed by HPLC (Shimadzu LC-2030C3DPlus), using a gradient elution method to measure saponin content at 203 nm.
[0082] Wheat flour samples were tested for protein and moisture content. Protein content was estimated using the Kjeldahl method according to AOAC standard 960.52, multiplying total nitrogen by a factor of 5.7. Moisture content was determined using the oven-dried method according to AOAC standard 930.15. All analyses were conducted in strict accordance with standard chemical methods to ensure accurate and reliable results.
[0083] Step 4: Near-infrared spectrum preprocessing
[0084] The raw NIR spectral data were preprocessed using standard normal transformation (SNV) and Z-score normalization (Z_score). SNV corrected for slope differences in the spectral data, while Z-score normalization further improved spectral discrimination and the quality of the model input data.
[0085] Step 5: Construction of multi-task detection model optimized by genetic algorithm
[0086] Figure 2 Figure 1 is a schematic diagram of the overall composition structure of GA-OMTL. Figure 2 As shown, the genetic algorithm optimized multi-task deep learning network (GA-OMTL) of the present invention aims to construct a multi-module deep learning architecture to improve quality detection performance by introducing a genetic algorithm (GA) to dynamically optimize module selection. The model takes near-infrared (NIR) spectral data as input, and first passes it into a shared feature extraction layer composed of multiple residual-Squeeze-and-Excitation (Res-SE) modules to fully mine the global shared feature information suitable for multiple tasks. The extracted shared features are passed to task-specific branches respectively, and each branch further processes and learns the features according to task requirements. The optimal combination of modules is achieved by dynamically selecting and configuring the shared layer and task-specific modules through the genetic algorithm.
[0087] 1. Backbone network
[0088] Figure 3 Schematic diagram of the composition structure and optimization of the three Res-SE modules and feature interaction module; Figure 4Schematic diagram of the composition structure of the residual module and SE module in the Res-SE module; Figure 5 Schematic diagram of the composition structure of the GI module, FFI module, and FTI module in the feature interaction module;
[0089] like Figure 3 、 4 As shown in Figure 5, the backbone network extracts common features of samples through multiple Res-SE modules. Each module contains a convolutional layer (Conv), batch normalization (BN), a residual block (ResBlock), and a Squeeze-and-Excitation (SE) module to enhance the stability of feature extraction and alleviate the vanishing gradient problem. The extracted shared features are then passed to the subsequent task-specific branch network for task prediction.
[0090] 1.1 Residual Block (Resblock)
[0091] The residual block directly transfers information between input and output by introducing skip connections, thereby alleviating the gradient vanishing problem and combining shallow and deep features to enhance feature expression capabilities.
[0092] First, the input feature x is processed by convolution and activation function to generate a residual map:
[0093] F(x) = ReLU(Comv(x));
[0094] After adding the residual map F(x) to the original data x, the final output is obtained through the activation function:
[0095] Output = ReLU(F(x)+x);
[0096] 1.2 Squeeze-and-Excitation (SE) Module
[0097] The SE module performs weighted summarization of the global features of each channel through a “squeeze” operation, and then dynamically adjusts the channel weights through an “excitation” operation, so that the model focuses on feature channels with higher information density.
[0098] First, perform global average pooling on the input x to generate channel information:
[0099] s = AvgPool1d(x);
[0100] After two layers of fully connected networks and activation functions, the channel weight z is generated:
[0101] z=Sigmoid(W2·ReLU(W1·s));
[0102] Adjust the input feature channel weights and output weighted features:
[0103] Output = x·z;
[0104] Among them, W1 and W2 are the weight matrices of the fully connected layer
[0105] 2. Task-Specific Prediction Branch
[0106] The GA-OMTL model consists of two prediction branches, each dedicated to handling different tasks. Common features extracted by the shared layer are passed through these two branches to ensure task independence. The first branch, consisting of convolutional layers, batch normalization layers, and residual blocks, further processes the shared features; the second branch uses fully connected layers for feature transformation. After the task output, three feature interaction modules are designed to fuse task features and enhance representation.
[0107] 2.1 Gating Mechanism Interaction (GI) Module
[0108] The GI module achieves selective interaction between features through dynamic adjustment of features between tasks, so that the importance of one feature can be "adjusted" according to the content of another feature.
[0109] First, concatenate the input features x1 and x2 to generate a combined feature vector:
[0110] combined_values=[x1;x2];
[0111] Calculate the gate value through the fully connected layer and activation function:
[0112] gate_values = Sigmoid(W gate x2+b gate );
[0113] Among them, W gate and b gate are the weights and biases of the fully connected layer, which are used to generate the gating values for dynamically adjusting the weights.
[0114] Use the gating value to weight the combined features and output the interactive features:
[0115] Interaction1=(W·combined values +b)☉gate values ;
[0116] Where W and b are the weights and biases of the fully connected layer, and ⊙ represents the element-wise weighted operation.
[0117] 2.2 Feature Fusion Interaction (FFI) Module
[0118] The FFI module concatenates features from different tasks and further transforms them through the fully connected layer to improve feature expression capabilities.
[0119] First, concatenate the input features x1 and x2 to generate a combined feature vector:
[0120] combined_values=[x1;x2];
[0121] Use the fully connected layer and activation function to transform the combined features and output the interactive features:
[0122] Interaction2=ReLU(W·combined_values+b);
[0123] Where W and b are the weights and biases of the fully connected layer
[0124] 2.3 Feature Transformation Interaction (FTI) Module
[0125] The FTI module independently transforms two task features and then performs a weighted addition to construct an expression that takes into account both shared and task-specific features.
[0126] First, the input features x1 and x2 are transformed independently to generate the transformed features:
[0127] transformed_x1=W1·x1+b1;
[0128] transformed_x2=W2·x2+b2;
[0129] Perform weighted summation on the transformed features and output the interactive features:
[0130] Intereaction3=transformed_x1+transformed_x2;
[0131] According to the selection of the genetic algorithm, the outputs of multiple interaction modules are averaged, and finally the task prediction results are output through two prediction heads. To balance the training of multiple tasks, the final loss function is the weighted sum of the losses of the two regression tasks:
[0132] Loss totat =α×Loss regression1 +β×Loss regression2 ;
[0133] α and β are the loss weights of the two regression tasks, α is 0.6 and β is 0.4, to achieve better model performance in multi-task learning.
[0134] 3. Genetic algorithm optimization process
[0135] The GA-OMTL model of the present invention uses a genetic algorithm (GA) to dynamically optimize the enabled states of multiple modules, including the BN, Resblock and SE modules in the Res-SE module (Block1, Block2, Block3), and the feature interaction modules (GI, FFI, FTI).
[0136] 3.1 Encoding
[0137] The enabled state of each module is represented by binary code, where 1 indicates the module is enabled and 0 indicates the module is disabled. The specific encoding is as follows:
[0138] X1, X2, X3, X4, X5, X6, X7, X8, X9∈{0, 1} represents the activation status of BN, Resblock and SE modules in Block1, Block2 and Block3. 10 ,X 11 ,X 12 ∈{0, 1} represents the activation status of the GI, FFI, and FTI modules in the feature interaction module.
[0139] 3.2 Fitness Evaluation
[0140] The performance of each individual (i.e., a candidate configuration) is evaluated by the fitness function. The fitness function calculates the average root mean square error (RMSE) of the two regression tasks:
[0141]
[0142] The lower the fitness value, the better the performance of the configuration and the higher the probability that the individual will be selected into the next generation.
[0143] 3.3 Genetic Operations
[0144] 3.3.1 Selection
[0145] In the selection phase, individuals with lower fitness values are preferentially selected to enter the next generation, thereby retaining the network configuration with better performance.
[0146] 3.3.2 Crossover
[0147] The crossover operation generates new offspring by recombining the codes of two parent individuals.
[0148]
[0149] C new Denotes the newly generated individual, p1 and p2 are the encoding vectors of the parents respectively. This genetic recombination can effectively integrate the advantages of different module combinations.
[0150] 3.3.3 Variation
[0151] The mutation operation introduces randomness with a certain probability to prevent the GA from falling into a local optimum. Specifically, mutation randomly changes the state of a module, that is, changing it from "enabled" (1) to "disabled" (0) or vice versa.
[0152] Step 6: Experimental Setup
[0153] This study used the Kennard-Stone method to partition samples into training, validation, and test sets. American ginseng was partitioned in a 5:1:4 ratio, while wheat flour was partitioned in a 5:2:3 ratio. The training set was expanded 10-fold through unsupervised spectral data augmentation. To compare the performance of the GA-OMMN model, three multi-task learning methods (Multi-taskCNN, Multi-CNN, and MTCNN) were selected, and their model architectures were designed based on relevant literature. Each method was trained on the training and validation sets and then evaluated on the test set. The experiment was randomly repeated 10 times and the results averaged.
[0154] Step 7: Model Evaluation
[0155] To evaluate the performance of the model in multi-task prediction tasks, the coefficient of determination (R 2 ), root mean square error (RMSE) and residual prediction deviation (RPD) are used to evaluate the prediction accuracy and reliability of the model to quantify its performance.
[0156] 1. Coefficient of determination (R2): measures the fit between the predicted value and the true value:
[0157]
[0158] 2. Root Mean Square Error (RMSE): Measures the error between the predicted value and the true value:
[0159]
[0160] 3. Residual Prediction Deviation (RPD): Indicates the stability of the model prediction:
[0161]
[0162] In the above formula, N is the total number of test samples, y i and are the true value and predicted value of the i-th sample, y m and is the mean of the true value and predicted value of the test sample.
[0163] In order to verify the scientific nature of the multi-task learning prediction method based on network architecture search of the present invention, the present invention selected two samples: American ginseng and wheat flour. Figure 8 As shown in the figure, (a) and (b) are the prediction results of ginsenotriol saponins and ginsenodiol saponins of American ginseng samples, respectively; (c) and (d) are the prediction results of protein and moisture of wheat flour samples. The scatter plot shows the distribution of actual values and predicted values. The fitting line is highly close to the 1:1 line, indicating that the model prediction results have good accuracy and stability. From the perspective of quantitative evaluation indicators, the prediction R of American ginseng and wheat flour samples under different tasks is 2 Both exceeded 0.93, and the RPD values were greater than 3.8, indicating that the model had high prediction accuracy and robustness in these two different types of samples.
[0164] Attachment Figure 9 、 10 The results of the model search and the evolution of the fitness values during model training are presented. The search time for American ginseng was 9.19 minutes, the model had 608,258 parameters, and a weighted test set loss of 0.97. The search time for wheat flour was 16.88 minutes, the model had 575,490 parameters, and a weighted test set loss of 0.055. These results demonstrate that GA can flexibly find the optimal model configuration based on different data and task requirements. During training, American ginseng reached a fitness value of 2.05 in the 544th round, and wheat flour reached a fitness value of 0.83 in the 540th round. The fitness curves fluctuated significantly early on, but stabilized after 200 rounds, ultimately approaching the optimal solution.
[0165] The above verification results demonstrate that, compared to existing technologies, the present invention has at least the following advantages: 1. The Res-SE module combines the residual and channel attention mechanisms to improve feature extraction efficiency and model stability. 2. A genetic algorithm is used to dynamically optimize module selection, enhancing model adaptability and prediction performance. 3. Multiple feature interaction modules (GI, FFI, and FTI) are introduced to enhance feature sharing and independence across multiple tasks. 4. The model achieves high-precision predictions in multi-task scenarios and has broad applicability.
[0166] 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 invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.
Claims
1. A multi-task learning prediction method based on network architecture search, characterized in that: include: The shared feature extraction layer consists of multiple Res-SE modules to mine global shared feature information applicable to multiple tasks; The task-specific prediction branch divides the global shared feature information into two task-specific prediction branches; Feature interaction module, which interacts the input features of two specific task prediction branches to fuse specific task features; Dynamically select and configure multiple Res-SE modules and feature interaction modules to achieve dynamic optimization of multiple Res-SE modules and feature interaction modules.
2. The multi-task learning prediction method according to claim 1, wherein: There are three Res-SE modules, each of which contains a convolutional layer, batch normalization, a residual block, and a SE module; The residual block first processes the original input feature data x through convolution and activation function to generate a residual map: F(x) = ReLU(Conv(x)); The residual map F(x) is then added to the original input feature data x, and the final output is obtained through the activation function: Output = ReLU(F(x)+x); The SE module first performs global average pooling on the original input feature data x to generate channel information: s = AvgPool1d(x); After two layers of fully connected networks and activation functions, the channel weight z is generated: z=Sigmoid(W2·ReLU(W1·s)); Adjust the input feature channel weights and output weighted features: Output = x·z; Among them, W1 and W2 are the weight matrices of the fully connected layer.
3. The multi-task learning prediction method according to claim 2, wherein: The specific task prediction branch includes: The first branch, consisting of a convolutional layer, a batch normalization layer, and a residual block, processes global shared feature information and generates input features x1; The second branch, consisting of a fully connected layer, transforms the globally shared feature information to generate the input feature x2.
4. The multi-task learning prediction method according to claim 3, wherein: The feature interaction module includes a gating mechanism interaction module, a feature fusion interaction module, and a feature conversion interaction module; The gating mechanism interaction module first concatenates the input features x1 and x2 to generate a combined feature vector: combined_values=[x1;x2]; Calculate the gate value through the fully connected layer and activation function: gate_values=Sigmoid(W gate ·x2+b gate ); Among them, W gate and b gate are the weights and biases of the fully connected layer, used to generate the gating values for dynamically adjusting the weights; Use the gating value to weight the combined features and output the interactive features: Interaction1=(W·combined values +b)⊙gate values ; Where W and b are the weights and biases of the fully connected layer, and ⊙ represents the element-wise weighted operation. The feature fusion interaction module first concatenates the input features x1 and x2 to generate a combined feature vector: combined_values=[x1;x2]; Use the fully connected layer and activation function to transform the combined features and output the interactive features: Interaction2=ReLU(W·combined_values+b); Where W and b are the weights and biases of the fully connected layer; The feature conversion interaction module first transforms the input features x1 and x2 independently to generate the transformed features: transformed_x1=W1·x1+b1; transformed_x2=W2·x2+b2; Perform weighted summation on the transformed features and output the interactive features: Intereaction3=transformed_x1+transformed_x2.
5. The multi-task learning prediction method according to claim 4, wherein: The interaction module finally outputs the task prediction results through two prediction heads. To balance the training of multiple tasks, the final loss function is the weighted sum of the losses of the two regression tasks: Loss total =α×Loss regression1 +β×Loss regression2 ; α and β are the loss weights of the two regression tasks, α is 0.6 and β is 0.
4.
6. The multi-task learning prediction method according to claim 5, wherein: The dynamic selection and configuration includes the following steps: S1. The activation state of each module is represented by binary encoding, X1, X2, X3, X4, X5, X6, X7, X8, X9∈{0, 1} represents the activation state of the batch normalization, residual block and SE module modules in the three Res-SE modules; X 10 ,X 11 ,X 12 ∈{0, 1} represents the gating mechanism interaction module, feature fusion interaction module and feature conversion interaction module in the feature interaction module; 1 means enabled and 0 means disabled; S2. Calculate the average root mean square error (RMSE) of the two regression tasks and evaluate the fitness. The fitness formula is: Among them, RMSE1 is the root mean square error of regression task 1, and RMSE2 is the root mean square error of regression task 2; S3,selection, prioritizes individuals with lower fitness values to enter the next generation, thereby retaining the network configuration with better performance; S4, crossover, generating new offspring by recombining the codes of two parent individuals; C new represents the newly generated individual, p1 and p2 are the encoding vectors of the parents respectively; S5, mutation, randomly changes the state of a module, i.e., changes it from "enabled" (1) to "disabled" (0) or vice versa, to prevent the genetic algorithm (GA) from falling into a local optimum.
7. A quality detection method based on any one of the multi-task learning prediction methods of claims 1-6, wherein the multi-task learning prediction method is applied to the quality detection of American ginseng and flour.
8. The quality inspection method according to claim 7, wherein: The quality detection method comprises the following steps: S1. Prepare American ginseng and wheat flour samples; S2. Near-infrared spectral (NIR) data were collected and preprocessed. The collected raw NIR spectral data were processed by standard normal transformation (SNV) and Z-score normalization (Z_score) to correct the slope difference of the spectral data and improve the spectral discrimination and the quality of the model input data. S3. Chemical composition analysis of samples; S4. The preprocessed spectral data were divided into training set, validation set and test set. American ginseng was divided in a ratio of 5:1:4, and wheat flour was divided in a ratio of 5:2:
3. Then, a multi-task learning prediction method based on network architecture search was used to train the training set and validation set, and evaluated on the test set. Finally, the experiment was randomly repeated 10 times and the average results were taken.
Citation Information
Cited By
Modeling method suitable for traceability and quality parameter collaborative detection of mineral products
CN121073511A