CN-121980539-A - Tea water content detection method combining temperature sensing attention and multi-mode fusion
Abstract
The invention discloses a tea water content detection method combining temperature sensing attention and multi-mode fusion, which comprises a first step of constructing input sample data, a second step of processing the temperature data and spectrum data to obtain spectrum temperature sensing attention data, a third step of processing the spectrum temperature sensing attention data to obtain spectrum characteristics, a fourth step of extracting multi-scale characteristics from image data to obtain multi-scale image characteristics, a fifth step of fusing the spectrum characteristics and the multi-scale image characteristics, and a sixth step of constructing a total loss function based on a prediction result and real labels to train a target detection network to obtain a trained target detection model to realize target detection. The invention can combine the temperature data with the spectrum image fusion data, thereby improving the water content detection of the tea after fixation.
Inventors
- SONG YAN
- WAN XIAOCHUN
- CHEN HUI
- ZENG XUEHONG
- SHANG LIXIN
- YI WENQING
- XIA XIANJUN
- NING JINGMING
- DAI QIANYING
- LI LUQING
- SHAO CHENYANG
- LI TIEHAN
Assignees
- 安徽农业大学
Dates
- Publication Date
- 20260505
- Application Date
- 20260124
Claims (7)
- 1. The tea water content detection method combining temperature sensing attention and multi-mode fusion is characterized by comprising the following steps of: step 1, acquiring a tea image set after fixation , wherein, Represent the first The image of each tea is displayed on the display screen, Representing the total number of tea images; Acquiring a preprocessed spectrum set , wherein, Representation of Corresponding spectral data; Acquiring temperature data , Representation of Corresponding temperature data; From the following components , , Composition No. 1 Individual samples ; Will be The true water content label of (2) is recorded as And (2) and ; Is a water content label set; Step 2, constructing a multi-mode feature detection network, wherein the multi-mode feature detection network comprises a temperature sensing attention module TA, a spectrum feature extraction module SFM, an image feature extraction module IFM, a feature fusion module FFM and a regression prediction module, and the multi-mode feature detection network is used for the first time Individual samples Processing to obtain the first Spectral temperature fusion features for individual samples ; Step 2.1, the temperature sensing attention module TA pairs And Processing to obtain the first Individual spectral temperature aware attention features ; Step 2.2, the spectral feature extraction module SFM is composed of a plurality of spectral shallow units SSU and Are composed of parallel dense blocks DB and are matched with Spectral feature extraction is carried out to obtain Is a multi-scale spectral feature set of (1) , wherein, Representation of In the first place Spectral features at the individual scale; Step 2.3, the image feature extraction module IFM is composed of a plurality of image shallow units ISU and Multiple multi-scale feature extraction blocks MFB, and pair Processing to obtain Is a multi-scale image feature set of (1) , wherein, Representation of Is the first of (2) Image features at individual scales; step 2.4, the feature fusion module FFM pair And Processing to obtain Spectral image fusion features of (a) ; Step 2.5, the regression prediction module RPM pairs Processing to obtain the first Individual samples Is predicted water content of (2) ; And 3, constructing an RMSE loss function based on the predicted water content and the actual water content, and performing iterative training on the multi-mode feature detection network to obtain a trained tea water content detection model, and performing water content detection on the tea subjected to the de-enzyming treatment.
- 2. The method for detecting the water content of tea leaves by combining temperature sensing attention with multiple modes according to claim 1, wherein the step 2.1 comprises the following steps: Step 2.1.1, the temperature sensing attention module TA consists of two one-dimensional convolution layers and a cross attention layer; the first one-dimensional convolution layer is processed to obtain Is a first layer spectral feature map of (2) ; Cross attention layer As a query vector, it is embedded into the same feature space as the spectral features by linear mapping to As a key vector and a value vector, pair And Performing a scaled dot product attention process to obtain the first Individual spectrum temperature aware attention context vector And is connected with Residual connection and normalization are carried out to obtain Is a spectrum temperature aware attention context vector ; Processing the second one-dimensional convolution layer to obtain Is of (a) spectral temperature-aware concentration profile 。
- 3. The method for detecting the moisture content of tea leaves by fusing temperature sensing attention and multiple modes according to claim 1, wherein any one of the spectrum shallow units SSU in the spectrum characteristic extraction module SFM in the step 2.2 sequentially comprises a batch normalization layer, a ReLU activation function, a one-dimensional convolution layer and any first one of the spectrum shallow units SSU The dense block DB sequentially comprises a one-dimensional convolution layer FirstConv D and E dense units DU, wherein the convolution kernel size of the one-dimensional convolution layer in each dense block is different; Step 2.2.1, will Is input into an SFM, and is obtained after preliminary feature extraction of a plurality of shallow unit SSUs in sequence Spectral shallow features of (2) ; Step 2.2.2, will Respectively input to In parallel dense blocks and passing Processing one-dimensional convolution layers with different convolution kernel sizes to obtain Individual preliminary spectral features , wherein, Represent the first Preliminary spectral features of the individual dense block outputs; When e=1, it will Processing the output of the second dense unit in the second dense unit of the k dense block to obtain the second spectrum characteristic of the output of the second dense unit And with the e-1 st spectral feature The e-th splicing result is obtained after the jump connection And as input to the (e+1) th dense cell; when e=2, 3, E, will Processing the output of the second dense unit in the second dense unit of the k dense block to obtain the second spectrum characteristic of the output of the second dense unit And with the e-1 th splice result After the jump connection, the e-th splicing result is obtained And as input to the (e+1) th dense unit, thereby outputting the (e+1) th spectral feature of the (e+1) th dense unit And (3) with The (e+1) th splicing result obtained after the jump connection Inputting the next dense unit until the E-th spliced result is output by the E-th dense unit And as an output of the kth dense block; Is of the dimension of ; Expressed at the kth scale Is a length of (c).
- 4. The method for detecting the moisture content of tea leaves by combining temperature sensing attention with multiple modes according to claim 1, wherein an image shallow unit ISU in an image feature extraction module IFM of the step 2.3 consists of a normalization layer, relu activation functions and two-dimensional convolution layers, each multi-scale feature extraction block MFB consists of two deep units and a pooling layer, a first deep unit consists of a BN layer, an activation function layer ReLU and a two-dimensional convolution layer, a second deep unit consists of a BN layer, an activation function layer ReLU and a convolution kernel with the size of Wherein the convolution kernel sizes of the two-dimensional convolution layers in the first deep unit of each multi-scale feature extraction block MFB are different; step 2.3.1, will Inputting the extracted features into an IFM, and obtaining the final product after preliminary feature extraction of a plurality of image shallow units ISU Image shallow features of (a) ; Step 2.3.2, Sequentially pass through Processing of a plurality of multi-scale feature extraction blocks MFB, correspondingly obtaining Image features at individual scales And is composed of Is a multi-scale image feature set of (1) , Is of the dimension of , wherein, Representing at the kth scale Is provided for the length of (a), Representing at the kth scale Is a width of (c).
- 5. The method for detecting the water content of tea leaves by fusing temperature sensing attention and multiple modes according to claim 4, wherein the feature fusion module FFM in the step 2.4 is composed of a Linear mapping layer Linear, a downsampling layer DS, an upsampling layer US, a flattening layer flat and a channel merging layer; Step 2.4.1 output of SFM Inputting into the Linear mapping layer for processing, and transforming the dimensions of all elements into , wherein, Is the largest length value within the multi-scale spectral feature set, , To take maximum value operation, obtain Spectral scaling feature set of (a) Wherein, the method comprises the steps of, Is shown in the first Spectral features scaled down in individual dimensions; step 2.4.2, calculating Feature scaling factor of (a) Thereby obtaining Scaled height And width of , wherein, Representing a rounding operation; If it is Then Inputting into the up-sampling layer US to perform up-sampling operation to obtain In the first place Sampling features at individual scales , Is of the dimension of Wherein, the method comprises the steps of, And Respectively represent Length and width obtained by up-sampling layer treatment; If it is Then keep Dimension of (2) Unchanged and will Is recorded as ; If it is Will then Inputting the DS of the downsampling layer to perform downsampling operation to obtain In the first place Sampling features at individual scales , Is of the dimension of Wherein, the method comprises the steps of, And Respectively represent The length and width obtained by the down sampling layer treatment; Step 2.4.3, calculating In the first place Actual dimension at individual dimensions ; If it is Will then Flattening the input flattening layer in the flattening layer to obtain In the first place Image features at individual scales , Is of the dimension of ; If it is Then calculate Left difference of (2) Sum-to-right difference , wherein, In order to perform the rounding-down operation, In order to perform the rounding-up operation, To take absolute value operation; When (when) When it will After flattening treatment in the flattening layer flat, the obtained product is obtained In the first place Image features at individual scales Its dimension is According to And For a pair of Is of the first dimension of (1) Cutting to obtain In the first place Image features at individual scales Its dimension is ; When (when) When it will After flattening treatment in the input flattening layer Flatte, the obtained In the first place Image features at individual scales Its dimension is According to And For a pair of First dimension Supplementing and aligning to obtain In the first place Image features at individual scales Its dimension is ; Step 2.4.4, will And image feature sequence Channel merging operation is carried out to obtain Final spectral image fusion feature , Is of the dimension of 。
- 6. An electronic device comprising a memory and a processor, wherein the memory is for storing a program supporting the processor to perform the tea leaf moisture content detection method of any one of claims 1 to 5, the processor being configured to execute the program stored in the memory.
- 7. A computer-readable storage medium having a computer program stored thereon, wherein the computer program when executed by a processor performs the steps of the tea leaf moisture content detection method of any one of claims 1 to 5.
Description
Tea water content detection method combining temperature sensing attention and multi-mode fusion Technical Field The invention belongs to the technical field of artificial intelligence, and particularly relates to a tea water content detection method combining temperature sensing attention and multi-mode fusion. Background In the processing process of green tea, the water content of the green tea can directly influence the quality of tea, so that the accurate detection of the water content is of great significance. In the prior art, the tea water content detection method is mostly dependent on single image information or single spectrum information, the method has the advantages of convenient data acquisition, relatively simple processing flow, and capability of realizing basic detection function under a scene with relatively stable conditions. However, the single sensor based detection approach has certain limitations in complex processing environments. For example, a detection method based on single image information is easily affected by factors such as illumination conditions, shooting angles, environmental changes and the like, so that the stability of image features is insufficient, and the problem of false detection or omission occurs. The detection method based on single spectrum information can reflect the internal characteristics of the tea, but the spectral response of the tea is obviously affected by temperature change in the processing process. The temperature directly influences the moisture absorption balance moisture content of the tea, so that the spectrum data collected under different temperature conditions have distribution differences, and accurate prediction of the moisture content is difficult to realize by independently relying on spectrum information. Therefore, it is difficult to realize stable and accurate detection of the water content of green tea under the condition of temperature change by only relying on single visible light image information or single spectrum information. Disclosure of Invention The invention aims to solve the defects of the prior art, and provides the tea water content detection method combining temperature sensing attention and multi-mode fusion, so that the limitation that target feature extraction is incomplete and easy to be interfered when the tea water content is extracted can be broken through, multi-mode image information and spectrum information are fused and combined with temperature information, so that the features of a target in different states and different scenes can be comprehensively and accurately captured, the accuracy and the robustness of target detection can be obviously improved in complex and changeable application scenes, the false detection rate is reduced, more reliable and more efficient technical support is provided for intelligent application based on target detection in various industries, and the technical development and the application upgrading of the related fields are promoted. In order to achieve the aim of the invention, the invention adopts the following technical scheme: the invention relates to a tea water content detection method combining temperature sensing attention and multi-mode fusion, which is characterized by comprising the following steps: step 1, acquiring a tea image set after fixation , wherein,Represent the firstThe image of each tea is displayed on the display screen,Representing the total number of tea images; Acquiring a preprocessed spectrum set , wherein,Representation ofCorresponding spectral data; Acquiring temperature data ,Representation ofCorresponding temperature data; From the following components ,,Composition No. 1Individual samples; Will beThe true water content label of (2) is recorded asAnd (2) and;Is a water content label set; Step 2, constructing a multi-mode feature detection network, wherein the multi-mode feature detection network comprises a temperature sensing attention module TA, a spectrum feature extraction module SFM, an image feature extraction module IFM, a feature fusion module FFM and a regression prediction module, and the multi-mode feature detection network is used for the first time Individual samplesProcessing to obtain the firstSpectral temperature fusion features for individual samples; Step 2.1, the temperature sensing attention module TA pairsAndProcessing to obtain the firstIndividual spectral temperature aware attention features; Step 2.2, the spectral feature extraction module SFM is composed of a plurality of spectral shallow units SSU andAre composed of parallel dense blocks DB and are matched withSpectral feature extraction is carried out to obtainIs a multi-scale spectral feature set of (1), wherein,Representation ofIn the first placeSpectral features at the individual scale; Step 2.3, the image feature extraction module IFM is composed of a plurality of image shallow units ISU and Multiple multi-scale feature extraction blocks MFB, and pairProcessing t