A water quality category detection method, system and device based on hybrid neural network
Through a water quality category detection method based on a hybrid neural network, combined with a convolutional neural network and a self-attention module, real-time, automated detection of water quality monitoring is achieved, solving the problem of time and manpower waste in traditional methods, and improving monitoring efficiency and accuracy. sex.
Patent Information
- Application Number
- CN202410796507.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-20
AI Technical Summary
Traditional water quality monitoring methods waste time and manpower and are difficult to meet real-time monitoring needs, and the sample collection process may cause contamination or external interference, affecting the accuracy of monitoring results.
A water quality category detection method based on a hybrid neural network is used, combined with a convolutional neural network for feature extraction and image classification. Through parallel convolution blocks, residual connection blocks and self-attention modules, a water quality image detection network is constructed to achieve water quality category detection. Real-time, automatic detection.
It improves monitoring efficiency and accuracy, reduces human resource consumption, can obtain monitoring results more quickly, and has better feature extraction capabilities and stronger generalization capabilities to adapt to complex water quality category detection tasks.
Smart Images

Figure CN118365974B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of water environment monitoring and management, and in particular relates to a water quality category detection method, system and equipment based on a hybrid neural network. Background Art
[0002] Water resources are the basis of human survival and development, while water quality is directly related to human health and the sustainable development of the environment. Therefore, while actively managing the water environment, local governments pay more attention to the monitoring of water environment health indicators. Traditional water quality monitoring methods usually rely on collecting water samples for testing and analysis, which has some obvious disadvantages. This method wastes time and manpower and is difficult to meet the needs of real-time water quality monitoring. The sample collection process may cause sample contamination or interference from external factors, affecting the accuracy of the monitoring results. In contrast, the water quality category detection scheme based on deep learning technology has significant advantages. This study constructs a hybrid neural network model and combines convolutional neural networks for feature extraction and image classification. It can identify the type of water quality in real time and automatically without manual intervention, reducing the consumption of human resources and improving the degree of automation of monitoring. Compared with traditional methods, it can obtain monitoring results more quickly and improve monitoring efficiency. Summary of the invention
[0003] The present invention provides a water quality category detection method, system and device based on a hybrid neural network. The present invention has better feature extraction capability, higher accuracy and stronger generalization ability, so that it can cope with various complex water quality category detection tasks.
[0004] To achieve the above purpose, in view of the shortcomings of the existing technology, the technical solutions adopted are as follows:
[0005] In one aspect, the present invention provides a method for detecting water quality categories based on a hybrid neural network, comprising the following steps:
[0006] 1) Collect water quality image data sets and preprocess the collected water quality images;
[0007] 2) Establish a water quality image detection network, which consists of parallel convolution blocks I and II, parallel residual connection blocks I and II, parallel residual connections I and II, parallel self-attention modules I and II, and fully connected layers;
[0008] 3) The preprocessed water quality image samples are simultaneously input into the parallel convolution block I and convolution block II to obtain convolution features;
[0009] 4) The convolutional features obtained in 3) are input into the parallel residual connection blocks I and II to obtain the residual processing features;
[0010] 5) The residual processing features obtained in 4) are input into the parallel self-attention modules I and II through the parallel residual connection I and residual connection II to obtain the attention features and perform feature fusion to obtain the fusion features;
[0011] 6) Input the fused features in 5) into the Dropout layer and the fully connected layer of the water quality image detection network to obtain the probability of water quality image detection. According to the probability of water quality image detection, the water quality category is classified to realize the category detection of water quality.
[0012] 1) It includes the following steps:
[0013] Collect water quality image datasets and preprocess the collected water quality images. The preprocessing operations include image denoising, data enhancement, and size adjustment. The water quality images are preprocessed to obtain the preprocessed water quality image dataset. , ,in For the Preprocessed water quality image samples, ,The size of each water quality image sample is H×W×C, where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image.
[0014] 3) Includes the following steps:
[0015] 3-1) Convolutional block I and convolutional block II are composed of standard convolutional layer and maximum pooling layer, and dilated convolutional layer and maximum pooling layer respectively;
[0016] 3-2) Preprocessed water quality image samples The standard convolution layer of convolution block I and the hole convolution layer of convolution block II are input to obtain the features respectively. and , the calculation process of standard convolution is as follows:
[0017] ,
[0018] Among them, O is the output size, W is the input size, L is the product kernel size, P is the size of the padding value, and S is the size of the stride;
[0019] The calculation process of the dilated convolution is as follows:
[0020] ,
[0021] Where W' represents the input size, L is the convolution kernel size, P is the size of the padding value, S is the size of the stride, R represents the dilation rate, and O' represents the calculation result of the dilated convolution. For a standard convolution with a convolution kernel size of L, after the dilation rate R is expanded, the size of the convolution kernel becomes L+(L-1)(R-1).
[0022] 3-3) The characteristics and They are input into the maximum pooling layer of convolution block I and convolution block II respectively to obtain convolution features and convolutional features .
[0023] 4) Includes the following steps:
[0024] 4-1) Both residual connection block I and residual connection block II are composed of residual connection and maximum pooling layer; residual connection is composed of parallel first convolution layer, second convolution layer, parallel third convolution layer and fourth convolution layer;
[0025] 4-2) Convolution features They are respectively input into the first convolutional layer and the second convolutional layer of the residual connection of the residual connection block I to obtain the features and , the feature and Splice to get , the feature They are input into the third and fourth convolutional layers of the residual connection respectively to obtain the features and , the feature and Splicing to get features ;
[0026] 4-3) The characteristics Input to the maximum pooling layer of residual connection block I to obtain residual processing features ;
[0027] 4-4) Convolution features They are respectively input into the first convolutional layer and the second convolutional layer of the residual connection block II, and the features are obtained respectively. and , the feature and Splicing to get features , the feature They are input into the third and fourth convolutional layers of the residual connection respectively to obtain the features and , the feature and Splice to get ;
[0028] 4-5) The characteristics Input to the maximum pooling layer of residual connection block II to obtain residual processing features .
[0029] 5) Includes the following steps:
[0030] The obtained residual processing features and residual processing features The features are obtained by inputting them into the parallel self-attention modules I and II through the parallel residual connection I and residual connection II. and Features , then the feature and Features After fusion, input to the fully connected layer to obtain features ;
[0031] The calculation process of the self-attention module is as follows:
[0032] ,
[0033] Where Q represents the query vector, K represents the key vector, V represents the value vector, and X represents the features input to the self-attention module. represents the dimension of the key vector, T is the transposed value, represents the query vector weight, represents the key vector weight, represents the value vector weight, Represents the result calculated by the self-attention module, that is, the features obtained by the self-attention module. represents the activation function;
[0034] The calculation process of feature fusion is as follows:
[0035] ,
[0036] in, Indicates The i-th channel of the input feature map, Representative The i-th channel of the input feature map, K represents the weight, C represents the number of channels, represents the weight of the i-th channel, Represents the weight of the i+Cth channel.
[0037] 6) Includes the following steps:
[0038] 6-1) Features Input into the Dropout layer of the water quality image detection network D_Net, and output the feature ;
[0039] 6-2) Features Input into the fully connected layer of the water quality image detection network D_Net and mapped into a length of The eigenvector of , , For the vectors, , is transposed;
[0040] 6-3) The feature vector Input into the softmax activation function to get the detection probability , the calculation process is as follows:
[0041] ,
[0042] in, It is the predicted The probability that an object belongs to class u.
[0043] In a second aspect, a water quality category detection system based on a hybrid neural network is provided, which executes a water quality category detection method based on a hybrid neural network, and specifically includes the following units:
[0044] A data processing unit, used for collecting water quality image data sets and preprocessing the collected water quality images;
[0045] Water quality image detection network unit, composed of parallel convolutional blocks And convolutional block II, parallel residual connection block And residual connection block II, parallel residual connection and residual connection II, self-attention module It consists of a self-attention module II and a fully connected layer.
[0046] The preprocessed water quality image samples are simultaneously input into the parallel convolution blocks And convolution block II to obtain convolution features, and obtain the residual connection block parallel to the convolution feature input And residual connection block II to obtain residual processing features; the residual processing features are connected through parallel residual And residual connection II is input to the parallel self-attention module And the self-attention module II obtains the attention features and performs feature fusion;
[0047] The water quality image detection network also has a Dropout layer and a fully connected layer to obtain the probability of water quality image detection.
[0048] In a third aspect, the present invention provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a water quality category detection method based on a hybrid neural network.
[0049] The beneficial effects of the present invention are:
[0050] By constructing a hybrid neural network model, a variety of technical means such as standard convolution and dilated convolution, residual connection and self-attention mechanism are comprehensively used to achieve the identification and detection of water quality categories. The model can receive water quality images as input, and accurately judge the categories represented by the images, such as clear water, polluted water, etc. by learning and extracting features in the images. Through the dilated convolution technology, the model can effectively capture the long-distance dependencies in the image and improve the globality of feature extraction. At the same time, the standard convolution technology is used to capture the local features of the image, further enriching the expressiveness of the features. The residual connection technology helps to better transmit information and gradients, alleviate the gradient vanishing problem, and accelerate the training process, so that the model can learn the complex features of water quality images more deeply and effectively. The self-attention mechanism helps the model to focus more on the areas that are most helpful for classification and recognition tasks by automatically learning the correlation between various positions in the image. The comprehensive application of this technology enables the model to have better feature extraction capabilities, higher accuracy and stronger generalization capabilities, so that it can cope with various complex water quality category detection tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] By reading the detailed description of the preferred embodiment below, the scheme and advantages of the present application will become clear to those skilled in the art. The accompanying drawings are only for the purpose of illustrating the preferred embodiment and are not to be considered as limiting the present invention.
[0052] Figure 1 This is the confusion matrix diagram for the test in Example 1.
[0053] Figure 2 It is a schematic diagram of the structure of the water quality image detection network D_Net of the present invention.
[0054] Figure 3 Schematic diagram of residual connection of the present invention. DETAILED DESCRIPTION
[0055] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0056] Example 1
[0057] The existing methods have the following problems: time and manpower are wasted, and it is difficult to meet the demand for real-time monitoring of water quality; the sample collection process may cause sample contamination or interference from external factors, affecting the accuracy of the monitoring results. The present invention constructs a hybrid neural network model, inputs a large number of labeled water quality images containing different colors, trains and extracts features in the convolutional neural network, outputs the probability of each category in the last layer of the network, and determines the color parameters in the water quality image by selecting the category with the highest probability. After comparing the water quality color parameters with the preset standard water quality color parameters, the quality of the water and the degree of pollution can be accurately determined.
[0058] The working principle of the method of the present invention is as follows: first, high-resolution water quality images are collected, and image data is preprocessed such as image denoising and size standardization to ensure the quality and consistency of the input data; secondly, the image is input into a hybrid neural network model, which combines dilated convolution and standard convolution to better capture long-distance dependencies in the image and helps to extract more global features; a self-attention module is used to make the model focus on more critical information; at the same time, residual connections are used to help the network effectively transmit information and gradients, accelerating the training process; finally, the color features of the extracted water quality images are classified and used for real-time monitoring and automated analysis of water quality.
[0059] A water quality category detection method based on a hybrid neural network comprises the following steps:
[0060] 1) Collect water quality image data sets and preprocess the collected water quality images;
[0061] 2) Establish a water quality image detection network, which consists of parallel convolution blocks I and II, parallel residual connection blocks I and II, parallel residual connections I and II, parallel self-attention modules I and II, and fully connected layers;
[0062] 3) The preprocessed water quality image samples are simultaneously input into the parallel convolution block I and convolution block II to obtain convolution features;
[0063] 4) The convolutional features obtained in 3) are input into the parallel residual connection blocks I and II to obtain the residual processing features;
[0064] 5) The residual processing features obtained in 4) are input into the parallel self-attention modules I and II through the parallel residual connection I and residual connection II to obtain the attention features and perform feature fusion to obtain the fusion features;
[0065] 6) Input the fused features in 5) into the Dropout layer and the fully connected layer of the water quality image detection network to obtain the probability of water quality image detection. According to the probability of water quality image detection, the water quality category is classified to realize the category detection of water quality.
[0066] 1) It includes the following steps:
[0067] Collect water quality image datasets and preprocess the collected water quality images. The preprocessing operations include image denoising, data enhancement, and size adjustment. The water quality images are preprocessed to obtain the preprocessed water quality image dataset. , ,in For the Preprocessed water quality image samples, ,The size of each water quality image sample is H×W×C, where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image.
[0068] 3) Includes the following steps:
[0069] 3-1) Convolutional block I and convolutional block II are composed of standard convolutional layer and maximum pooling layer, and dilated convolutional layer and maximum pooling layer respectively;
[0070] 3-2) Preprocessed water quality image samples The standard convolution layer of convolution block I and the hole convolution layer of convolution block II are input to obtain the features respectively. and , the calculation process of standard convolution is as follows:
[0071] ,
[0072] Among them, O is the output size, W is the input size, L is the product kernel size, P is the size of the padding value, and S is the size of the stride;
[0073] The calculation process of the dilated convolution is as follows:
[0074] ,
[0075] Where W' represents the input size, L is the convolution kernel size, P is the size of the padding value, S is the size of the stride, R represents the dilation rate, and O' represents the calculation result of the dilated convolution. For a standard convolution with a convolution kernel size of L, after the dilation rate R is expanded, the size of the convolution kernel becomes L+(L-1)(R-1).
[0076] 3-3) The characteristics and They are input into the maximum pooling layer of convolution block I and convolution block II respectively to obtain convolution features and convolutional features .
[0077] 4) Includes the following steps:
[0078] 4-1) Both residual connection block I and residual connection block II are composed of residual connection and maximum pooling layer; residual connection is composed of parallel first convolution layer, second convolution layer, parallel third convolution layer and fourth convolution layer;
[0079] 4-2) Convolution features They are respectively input into the first convolutional layer and the second convolutional layer of the residual connection of the residual connection block I to obtain the features and , the feature and Splice to get , the feature They are input into the third and fourth convolutional layers of the residual connection respectively to obtain the features and , the feature and Splicing to get features ;
[0080] 4-3) The characteristics Input to the maximum pooling layer of residual connection block I to obtain residual processing features ;
[0081] 4-4) Convolution features They are respectively input into the first convolutional layer and the second convolutional layer of the residual connection block II, and the features are obtained respectively. and , the feature and Splicing to get features , the feature They are input into the third and fourth convolutional layers of the residual connection respectively to obtain the features and , the feature and Splice to get ;
[0082] 4-5) The characteristics Input to the maximum pooling layer of residual connection block II to obtain residual processing features .
[0083] 5) Includes the following steps:
[0084] The obtained residual processing features and residual processing features The features are obtained by inputting them into the parallel self-attention modules I and II through the parallel residual connection I and residual connection II. and Features , then the feature and Features After fusion, input to the fully connected layer to obtain features ;
[0085] The calculation process of the self-attention module is as follows:
[0086] ,
[0087] Where Q represents the query vector, K represents the key vector, V represents the value vector, and X represents the features input to the self-attention module. represents the dimension of the key vector, T is the transposed value, represents the query vector weight, represents the key vector weight, represents the value vector weight, Represents the result calculated by the self-attention module, that is, the features obtained by the self-attention module. represents the activation function;
[0088] The calculation process of feature fusion is as follows:
[0089] ,
[0090] in, Indicates The i-th channel of the input feature map, Representative The i-th channel of the input feature map, K represents the weight, C represents the number of channels, represents the weight of the i-th channel, Represents the weight of the i+Cth channel.
[0091] 6) Includes the following steps:
[0092] 6-1) Features Input into the Dropout layer of the water quality image detection network D_Net, and output the feature ;
[0093] 6-2) Features Input into the fully connected layer of the water quality image detection network D_Net and mapped into a length of The eigenvector of , , For the vectors, , is transposed;
[0094] 6-3) The feature vector Input into the softmax activation function to get the detection probability , the calculation process is as follows:
[0095] ,
[0096] in, It is the predicted The probability that an object belongs to class u.
[0097] In order to verify the reliability of the method of the present invention, the technology was verified on the Mandl's Water Quality Dataset water quality image dataset. Figure 1 is the confusion matrix of the test, where 0 represents the water color of light green, 1 represents the water color of gray-blue, 2 represents the water color of yellow-brown, and 3 represents the water color of tea-brown. The results show that for water quality category 0 light green, the model predicts that the probability of light green is 91.28%; for water quality category 1 gray-blue, the model predicts that the probability of gray-blue is 91.61%; for water quality category 2 yellow-brown, the model predicts that the probability of yellow-brown is 90.30%; for water quality category 3 tea-brown, the model predicts that the probability of tea-brown is 92.68%.
[0098] Table 1 Comparative experimental results of the method in the present invention and other methods
[0099]
[0100] As can be seen from Table 1, the method of the present invention is compared with a variety of water quality image detection methods, namely UV-visible spectroscopy, wavelet transform, and CNN. Each method was tested on the Mandl's Water Quality Dataset, and the common indicators of accuracy (Acc), sensitivity (Sen), and specificity (Spe) were used to evaluate the model's detection performance for water quality images. As can be seen from Table 1, this method has high accuracy, sensitivity, and specificity, reaching 98.88%, 94.15%, and 97.39% respectively, which are 5.12%, 3.36%, and 3.39% higher than the previous optimal method CNNs, respectively, and are better than the previous methods.
[0101] Example 2
[0102] A water quality category detection system based on a hybrid neural network implements a water quality category detection method based on a hybrid neural network, specifically comprising the following units:
[0103] A data processing unit, used for collecting water quality image data sets and preprocessing the collected water quality images;
[0104] Water quality image detection network unit, composed of parallel convolutional blocks And convolutional block II, parallel residual connection block And residual connection block II, parallel residual connection and residual connection II, self-attention module It consists of a self-attention module II and a fully connected layer.
[0105] The preprocessed water quality image samples are simultaneously input into the parallel convolution blocks And convolution block II to obtain convolution features, and obtain the residual connection block parallel to the convolution feature input And residual connection block II to obtain residual processing features; the residual processing features are connected through parallel residual And residual connection II is input to the parallel self-attention module And the self-attention module II obtains the attention features and performs feature fusion;
[0106] The water quality image detection network also has a Dropout layer and a fully connected layer to obtain the probability of water quality image detection.
[0107] Example 3
[0108] The present invention provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a water quality category detection method based on a hybrid neural network.
[0109] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A water quality category detection method based on a hybrid neural network, characterized in that: The steps include: 1) Collect water quality image data sets and preprocess the collected water quality images; 2) Establish a water quality image detection network, which consists of parallel convolution blocks I and II, parallel residual connection blocks I and II, parallel residual connections I and II, parallel self-attention modules I and II, and fully connected layers; 3) The preprocessed water quality image samples are simultaneously input into the parallel convolution block I and convolution block II to obtain convolution features; 3-1) Convolutional block I and convolutional block II are composed of standard convolutional layer and maximum pooling layer, and dilated convolutional layer and maximum pooling layer respectively; 3-2) Preprocessed water quality image samples The standard convolution layer of convolution block I and the hole convolution layer of convolution block II are input to obtain the features respectively. and , the calculation process of standard convolution is as follows: , Among them, O is the output size, W is the input size, L is the product kernel size, P is the size of the padding value, and S is the size of the stride; The calculation process of the dilated convolution is as follows: , Where W' represents the input size, L is the convolution kernel size, P is the size of the padding value, S is the size of the stride, R represents the dilation rate, and O' represents the calculation result of the dilated convolution. For a standard convolution with a convolution kernel size of L, after the dilation rate R is expanded, the size of the convolution kernel becomes L+(L-1)(R-1). 3-3) The characteristics and They are input into the maximum pooling layer of convolution block I and convolution block II respectively to obtain convolution features and convolutional features ; 4) The convolutional features obtained in 3) are input into the parallel residual connection blocks I and II to obtain the residual processing features; 5) The residual processing features obtained in 4) are input into the parallel self-attention modules I and II through the parallel residual connection I and residual connection II to obtain the attention features and perform feature fusion to obtain the fusion features; The obtained residual processing features and residual processing features The features are obtained by inputting them into the parallel self-attention modules I and II through the parallel residual connection I and residual connection II. and Features , then the feature and Features After fusion, input to the fully connected layer to obtain features ; The calculation process of the self-attention module is as follows: , Where Q represents the query vector, K represents the key vector, and V represents the value vector. represents the dimension of the key vector, T is the transposed value, represents the query vector weight, represents the key vector weight, represents the value vector weight, X represents the feature input to the self-attention module, Represents the result calculated by the self-attention module, that is, the features obtained by the self-attention module. represents the activation function; The calculation process of feature fusion is as follows: , in, Indicates The i-th channel of the input feature map, Representative The i-th channel of the input feature map, K represents the weight, C represents the number of channels, represents the weight of the i-th channel, represents the weight of the i+Cth channel; 6) Input the fused features in 5) into the Dropout layer and the fully connected layer of the water quality image detection network to obtain the probability of water quality image detection. According to the probability of water quality image detection, the water quality category is classified to realize the category detection of water quality.
2. According to claim 1, a water quality category detection method based on hybrid neural network is characterized in that: 1) It includes the following steps: Collect water quality image datasets and preprocess the collected water quality images. The preprocessing operations include image denoising, data enhancement, and size adjustment. The water quality images are preprocessed to obtain the preprocessed water quality image dataset. , ,in For the Preprocessed water quality image samples, ,The size of each water quality image sample is H×W×C, where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image.
3. According to claim 1, a water quality category detection method based on hybrid neural network is characterized in that: 4) Includes the following steps: 4-1) Both residual connection block I and residual connection block II are composed of residual connection and maximum pooling layer; residual connection is composed of parallel first convolution layer, second convolution layer, parallel third convolution layer and fourth convolution layer; 4-2) Convolution features They are respectively input into the first convolutional layer and the second convolutional layer of the residual connection of the residual connection block I to obtain the features and , the feature and Splice to get , the feature They are input into the third and fourth convolutional layers of the residual connection respectively to obtain the features and , the feature and Splicing to get features ; 4-3) The characteristics Input to the maximum pooling layer of residual connection block I to obtain residual processing features ; 4-4) Convolution features They are respectively input into the first convolutional layer and the second convolutional layer of the residual connection block II, and the features are obtained respectively. and , the feature and Splicing to get features , the feature They are input into the third and fourth convolutional layers of the residual connection respectively to obtain the features and , the feature and Splice to get ; 4-5) The characteristics Input to the maximum pooling layer of residual connection block II to obtain residual processing features .
4. According to claim 1, a water quality category detection method based on hybrid neural network is characterized in that: 6) Includes the following steps: 6-1) Features Input into the Dropout layer of the water quality image detection network D_Net, and output the feature ; 6-2) Features Input into the fully connected layer of the water quality image detection network D_Net and mapped into a length of The eigenvector of , , For the vectors, , is transposed; 6-3) The feature vector Input into the softmax activation function to get the detection probability , the calculation process is as follows: , in, It is the predicted The probability that an object belongs to class u.
5. A water quality category detection system based on hybrid neural network, characterized in that: The method for detecting water quality based on a hybrid neural network according to any one of claims 1 to 4 specifically comprises the following units: A data processing unit, used for collecting water quality image data sets and preprocessing the collected water quality images; Water quality image detection network unit, composed of parallel convolutional blocks And convolutional block II, parallel residual connection block And residual connection block II, parallel residual connection and residual connection II, self-attention module It consists of a self-attention module II and a fully connected layer. The preprocessed water quality image samples are simultaneously input into the parallel convolution blocks And convolution block II to obtain convolution features, and obtain the residual connection block parallel to the convolution feature input And residual connection block II to obtain residual processing features; The residual processing features are connected through parallel residual And residual connection II is input to the parallel self-attention module And the self-attention module II obtains the attention features and performs feature fusion; The water quality image detection network also has a Dropout layer and a fully connected layer to obtain the probability of water quality image detection.
6. An electronic device, characterized in that: It comprises: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the water quality category detection method based on a hybrid neural network as described in any one of claims 1 to 4.
