A biological water pollution early warning method and device based on machine vision technology
The machine vision-based water pollution monitoring system effectively identifies pollution sources by analyzing fish death and stress states, enhancing image clarity and using advanced models for rapid and accurate water pollution detection.
Patent Information
- Application Number
- CN202111281723.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-01
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-11-01
AI Technical Summary
The prior art is difficult to efficiently and accurately classify fish stress images, and cannot quickly identify water pollution sources.
The biological water pollution warning method based on machine vision technology is adopted, and the real-time acquisition of fish school image data is analyzed, and the identification of dead fish and the fish school stress status model is used to determine the degree and source of pollution in combination with the image texture feature curve chart to achieve efficient and intelligent water pollution warning.
It realizes efficient and accurate warning of water pollution, saves manpower and material resources, has a simple structure, and can be used for field water pollution monitoring.
Smart Images

Figure CN114005064B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of environmental protection, and particularly relates to a biological water pollution early warning method and device based on machine vision technology. Background Art
[0002] At present, the industrialization process in China is accelerating continuously, and the water pollution problem is becoming increasingly serious. The water bodies of water sources such as rivers and lakes are directly related to the life, health and safety of the people. Therefore, it is particularly important to strengthen the monitoring of water pollution. Most traditional methods adopt manual measurement methods to collect water samples regularly, and use laboratory equipment or portable instruments for detection, with poor timeliness and high detection costs.
[0003] In order to better monitor water bodies, many methods have been provided in the prior art, such as monitoring water bodies through fish behavior. In the Chinese patent with the patent number 201110141187.3, a biological water quality monitoring system and its monitoring method for fish behavior are disclosed. In this patent, a monitoring system is designed to identify the average swimming speed, density, etc. of the experimental fish group.
[0004] For another example, in the Chinese patent with the patent number 201010530149.2, a biological water quality monitoring system based on visual perception of fish behavior is disclosed. In this patent, the behavior of fish is analyzed through visual perception to determine whether the water body is polluted.
[0005] However, most of the existing methods in the prior art adopt traditional image processing methods, which are difficult to accurately and efficiently classify the stress images of fish schools and cannot quickly identify the pollution sources. Summary of the Invention
[0006] Technical Problem: Aiming at the deficiencies in the prior art, the present invention provides a biological water pollution early warning method and device based on machine vision technology. By analyzing the real-time acquired fish school image data, detecting the water pollution degree by identifying the dead fish discrimination model and the stress state of the fish school, and at the same time comparing the characteristic curve graph to identify the possible pollution sources, high-efficiency and intelligent water pollution early warning is realized, effectively saving manpower and material resources.
[0007] Technical Solution: In the first aspect of the present invention, a biological water pollution early warning method based on machine vision technology is provided, including:
[0008] Cultivate fish in the water body to be monitored, and obtain the video images of the fish school in the water body;
[0009] Enhance the clarity of the video images;
[0010] Based on the enhanced video image, use the first discriminant model to identify the first state of the fish school, obtain the first recognition result, and determine whether the first alarm is needed according to the first recognition result. The first state includes: fish death state and other states;
[0011] When the first alarm is not given, based on the enhanced video image, use the second discriminant model to judge the second state of the fish school, obtain the second recognition result, and determine whether it is necessary to identify the pollutant type and give the second alarm according to the second recognition result. The second state includes: mild stress state, severe stress state and normal state;
[0012] When it is necessary to identify the pollutant type, obtain the image texture feature curve graph of the second state of the fish school, input the image texture feature curve graph into the pollutant recognition model library, and use the pollutant recognition model in the library to identify the type of pollutants in the water body.
[0013] Further, the method further includes: obtaining the first discriminant model. The obtaining of the first recognition model includes:
[0014] Perform video frame splitting on the video image, and the splitting interval is 1 second;
[0015] Select 1000 pictures, including 500 pictures of dead fish and 500 pictures of other states. Perform clarity enhancement on the selected pictures, and use labellmg to label the dead fish;
[0016] Expand the labeled data set, including mirroring, rotation, random cropping and local deformation. Finally, obtain a dead fish detection data set containing 5000 images. Input the dead fish detection data set into the yolo model for training to obtain the first discriminant model.
[0017] Further, the method further includes: obtaining the second discriminant model. The obtaining of the second discriminant model includes:
[0018] Perform video frame splitting on the video image, and the splitting interval is 1 second;
[0019] Select 1500 pictures, including 500 pictures of normal state, 500 pictures of mild stress state and 500 pictures of severe stress state;
[0020] After performing clarity enhancement on the selected pictures, expand the data set, including mirroring, rotation, random cropping and local deformation. Finally, obtain a fish school stress state detection data set containing 7500 images. Input the images including normal state, mild stress state and severe stress state into the CNN classification network for training to obtain the second discriminant model.
[0021] Further, the image texture feature curve graph for obtaining the second state of the fish school includes:
[0022] Perform frame splitting processing on the video image with a splitting interval of 1 second, and select 600 consecutive frames of pictures;
[0023] Use mean background modeling to generate a background picture without a fish school, then extract the foreground target fish school through background subtraction, and then grayscale the picture to generate a gray-level co-occurrence matrix, and calculate the 4 texture feature values of the inverse matrix, correlation, energy, and contrast in the 0° direction of the picture to obtain the inverse matrix, correlation, energy, and contrast feature curve graphs of the fish school in the stress state caused by different pollutants.
[0024] Further, the enhancement of the clarity of the image includes:
[0025] Construct an image enhancement model, input the image into the trained image enhancement model, and learn the color difference map between the input image and the output image for image enhancement to obtain the image with enhanced clarity;
[0026] The image enhancement model includes 5 encoders and corresponding 5 decoders. The output of each encoder will be skip-connected to its corresponding decoder, and each encoder and decoder includes a 3×3 2D convolution.
[0027] Further, the pollutant recognition model library includes several pollutant recognition models, and each pollutant recognition model corresponds to a kind of pollutant;
[0028] The pollutant recognition model is a trained DHHM model.
[0029] Further, the method further includes: constructing a pollutant recognition model library; constructing the recognition model library includes:
[0030] For K kinds of pollutants, train K different DHHM models;
[0031] During training, select 50×K groups of samples, calculate the feature vectors respectively, where 30×K groups of samples are used for training and 20×K groups of samples are used for testing;
[0032] Use the Lloyds algorithm to perform scalar quantization processing on the feature vectors, and use the feature vectors of different pollution states after scalar quantization to train the DHMM respectively, and the training algorithm uses the Baum-Welch algorithm.
[0033] The logarithmic likelihood estimation of the DHMM for K kinds of pollution states reaches the convergence error range after iteration, and different pollutants have different convergence values.
[0034] Further, the pollutant recognition model of the image texture feature curve graph for recognizing the types of pollutants in water bodies includes:
[0035] Feeding the scalar - quantized image texture feature curve graph into the DHMM models in each pollution state for recognition, outputting the logarithmic likelihood probability estimation value, comparing and obtaining the maximum logarithmic likelihood probability, and the state corresponding to the maximum logarithmic likelihood probability is the current pollution state.
[0036] On the other hand, the present invention provides a biological water pollution early - warning device based on machine vision technology, which can monitor water bodies based on the biological water pollution early - warning method based on machine vision technology, including: a fish tank, a water pump, a wireless communication module, a computer, and an alarm; an inlet pipe and an outlet pipe are arranged on the fish tank, and both the inlet pipe and the outlet pipe are connected to the water pump;
[0037] A grid is arranged at the lower part of the fish tank, and a timing feeder is arranged at the upper part; a cover plate is arranged above the fish tank; at least one camera is arranged on the fish tank;
[0038] The wireless communication module is connected to the camera and the computer;
[0039] The computer is connected to the alarm;
[0040] The camera is used to obtain video images of the fish group in the water body;
[0041] The wireless communication module is used to transmit the video images of the fish group in the water body to the computer, and the following method is executed in the computer:
[0042] Enhance the clarity of the video images;
[0043] According to the enhanced video images, use the first discriminant model to identify the first state of the fish, obtain the first recognition result, and determine whether a first alarm is needed according to the first recognition result;
[0044] When the first alarm is not given, according to the enhanced images, use the second discriminant model to judge the second state of the fish group, obtain the second recognition result, and determine whether it is necessary to identify the pollutant type and give a second alarm according to the second recognition result;
[0045] When it is necessary to identify the types of pollutants, obtain the image texture feature curve graph of the second state of the fish group, input the image texture feature curve graph into the pollutant recognition model library, and use the pollutant recognition models in the library to identify the types of pollutants in the water body.
[0046] Further, two cameras are arranged on the fish tank, namely a first camera and a second camera. The first camera is arranged under the cover plate, and the second camera is arranged on the side of the fish tank;
[0047] The video image obtained by the first camera is used to identify the second state of the fish school.
[0048] The video image obtained by the second camera is used to identify the first state of the fish school.
[0049] Compared with the prior art, the present invention has the following advantages: The proposed biological water pollution early warning method based on machine vision technology identifies the body posture information and behavior information of fish schools based on machine vision technology and image processing technology, deeply analyzes the stress state law of fish schools, and monitors the water situation quickly by analyzing fish death and stress state, so as to realize efficient and accurate early warning of water pollution.
[0050] The proposed biological water pollution early warning device based on machine vision technology has a simple structure, can be used for field water pollution monitoring, and can perform efficient and accurate early warning on water bodies based on the proposed method. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 is a flowchart of the biological water pollution early warning method based on machine vision technology in an embodiment of the present invention;
[0052] Figure 2 is a logical flowchart of the biological water pollution early warning method based on machine vision technology in an embodiment of the present invention;
[0053] Figure 3 is a schematic structural diagram of an image enhancement model;
[0054] Figure 4 is a schematic diagram of the detection process of the first state of the fish school;
[0055] Figure 5 is a schematic diagram of the classification of the second state of the fish school;
[0056] Figure 6 (a) to (d) are texture feature curve diagrams of the fish school in a stress state;
[0057] Figure 7 is a training iteration curve diagram of the DHHM model;
[0058] Figure 8 is a schematic structural diagram of the biological water pollution early warning device based on machine vision technology.
[0059] Figure 8 In the figure: 1 - fish tank, 2 - water inlet pipe, 3 - water pump, 4 - water outlet pipe, 5 - grid, 6 - cover plate, 7 - LED supplementary light, 8 - first camera, 9 - timing feeder, 10 - second camera, 11 - wireless communication module, 12 - computer, 13 - alarm. Detailed implementation mode
[0060] The present invention will be further described below in conjunction with embodiments and the accompanying drawings of the specification.
[0061] In the first aspect of the present invention, a biological water pollution early warning method based on machine vision technology is provided. As Figure 1 and Figure 2 shown, this example includes:
[0062] Step S110: Cultivate fish in the water body to be monitored, and obtain video images of the fish population in the water body.
[0063] Step S120: Enhance the clarity of the video image. In the embodiment of the present invention, an image enhancement model is constructed, the image is input into the trained image enhancement model, and the color difference map between the input image and the output image is learned to perform image enhancement, and an image with enhanced clarity is obtained. Specifically, a more accurate and concise image enhancement model is proposed based on U-Net. As Figure 3 shown, this network is composed of 5 encoders corresponding to 5 decoders. The output of each encoder will be skip-connected to its corresponding decoder, and each convolutional layer contains a 3×3 2D convolution.
[0064] When the network executes, it first inputs an image of 3 channels, 256 pixels × 256 pixels, performs the first convolution to obtain a convolutional image of 128 pixels × 128 pixels, and then performs the second convolution to obtain a convolutional image of 64 pixels × 64 pixels. At the same time, the obtained convolutional image of 128 pixels × 128 pixels is skip-connected to the corresponding convolution in the network. According to the same method, after 4 times of convolution, max-pooling and upsampling operations are performed to obtain a convolutional image of 16 pixels × 16 pixels, and then after 4 times of upsampling, a convolution of 256 pixels × 256 pixels is obtained. The obtained image is learned again with the input underwater image, and finally an optimized image is obtained. This network does not use a fully connected layer and does not directly learn the mapping from the input image I(x) to the output image Y, but enhances the image by learning the ability of the residual color cast map between I(x) and Y, that is, d = Y - I(x), where d represents the residual color cast image, Y represents the output image, and I(x) represents the input underwater image. At the same time, the Leak-ReLU activation function and the BN layer are also used in the network, and transposed convolution is used instead of the traditional upsampling method to realize the restoration of color information while restoring the image size.
[0065] Step S130: According to the enhanced video image, use the first discriminant model to identify the first state of the fish population, obtain the first recognition result, and determine whether a first alarm is needed according to the first recognition result.
[0066] In an embodiment of the present invention, the first state of the fish school refers to whether the fish is in a dead state or other states. Therefore, there are two types of first recognition results. One is that the fish is recognized as dead, and the other is that the fish is recognized as being in other states. When it is recognized that the fish school is dead, an alarm needs to be issued. At this time, it indicates that the water body is in a serious pollution state. In an emergency, it may be necessary for the monitoring personnel to go to the water source site in time for sampling, etc., to sample the polluted water body in time. For example, Figure 4 in which it is recognized that the fish school is in other states, and at this time, no alarm needs to be issued.
[0067] In order to obtain the first recognition model, in an embodiment of the present invention, the video image is subjected to video frame splitting processing, and the splitting interval is 1 second. 1000 pictures are selected, including 500 pictures of dead fish and 500 pictures of other states respectively. The selected pictures are subjected to clarity enhancement operations, and labellmg is used to label the dead fish; the labeled data set is expanded, including mirroring, rotation, random cropping and local deformation. Finally, a dead fish detection data set containing 5000 images is obtained. The dead fish detection data set is input into the yolo model for training to obtain the first discrimination model.
[0068] During training, the batch random gradient descent method is used to optimize the loss function. A total of 30,000 iterations are performed, the learning rate = 0.01, the weight decay value = 0.0005, the batch size batch = 64, and a strategy of reducing the learning rate as the number of iterations deepens is adopted. The learning rate is adjusted when the network iterates to 10,000 times and 20,000 times, and is adjusted to 0.001 and 0.0001 respectively. In order to reduce the overfitting phenomenon, the momentum factor is set to 0.99. Through this discrimination model, the dead fish in the fish tank can be detected.
[0069] Step S140: When the first alarm is not issued, according to the enhanced image, use the second discrimination model to judge the second state of the fish school to obtain the second recognition result. According to the second recognition result, determine whether it is necessary to identify the type of pollutant and issue the second alarm.
[0070] In an embodiment of the present invention, the second state of the fish school is the stress state of the fish, including: mild stress state, severe stress state and normal state, such as Figure 5 . When the recognition result is a mild stress state or a severe stress state, it indicates that the water body has been polluted. At this time, an alarm is issued to remind the monitoring personnel that the water body is polluted and the type of pollutant is identified.
[0071] In order to obtain the second recognition model, in the embodiments of the present invention, the video image is subjected to video frame splitting processing with a splitting interval of 1 second; 1500 pictures are selected, including 500 pictures in the normal state, 500 pictures in the mild stress state, and 500 pictures in the severe stress state; after performing clarity enhancement operations on the selected pictures, the data set is expanded, including mirroring, rotation, random cropping, and local deformation, and finally a fish group stress state detection data set containing 7500 images is obtained. The images including the normal state, mild stress state, and severe stress state are input into the CNN classification network for training to obtain the second discriminant model.
[0072] During training, 70% of the images are randomly extracted from the fish group stress state detection data set as the stress state recognition training set, and the other 30% are used as the test set. The improved model is trained from scratch to obtain the parameters of the fully connected layer, the multi-classification vector values of the Softmax layer, and the values of the loss function. The initial learning rate is set to 0.01, the learning rate adjustment factor is set to 0.96, the momentum parameter is set to a fixed value of 0.9, the parameters of the fully connected layer and the Softmax classification layer are initialized by a random method, and the output of the last fully connected layer of the network is set to the number of categories of the classification data set of this method, that is, the number of categories is set to 3. The Adam adaptive moment estimation optimization method is used to train the model, and the stress response of the fish group in the fish tank can be discriminated by this model.
[0073] Step S150: When it is necessary to identify the types of pollutants, obtain the image texture feature curve graph of the second state of the fish group, input the image texture feature curve graph into the pollutant recognition model library, and use the pollutant recognition models in the library to identify the types of pollutants in the water body.
[0074] In the embodiments of the present invention, videos of the stress response of the fish group under different pollution conditions are obtained, the videos are subjected to frame splitting processing with a splitting interval of 1 second, 600 consecutive frames of pictures are selected. First, the mean background modeling is used to generate a background picture without the fish group, then the foreground target fish group is extracted by background subtraction, and then the picture is grayscale to generate a gray-level co-occurrence matrix. The four texture feature values of the inverse matrix, correlation, energy, and contrast in the 0° direction of the picture are calculated to obtain the inverse matrix, correlation, energy, and contrast feature curve graphs of the stress state of the fish group caused by different pollutants, as shown in Figure 6 (a) - (d).
[0075] In the embodiments of the present invention, when obtaining the feature curve graph, the mean background modeling is represented by the mathematical formula: In the formula is the pixel value at the (x, y) position of the m-th frame of the video, N represents the number of frames, B(x, y) is the average value of the background image at (x, y), and by continuously changing the values of (x, y), the entire background picture can be obtained.
[0076] Let \(f(x,y)\) be a two - dimensional digital image with a size of \(M\times N\) pixels and a gray - level of \(N\). g , then the gray - level co - occurrence matrix satisfying certain spatial relationships is: \(P(i,j)=\#\{(x 1, y1),(x 2, y2)\in M\times N|f(x 1, y1)=i,f(x 2, y2)=j\}\), where \(\#(x)\) represents the number of elements in set \(x\), and \(P\) is an \(N g \times N g matrix. If the distance between \((x 1, y1)\) and \(( 2, y2)\) is \(d\) and the angles between them and the horizontal axis of the coordinate are \(\theta\), then the gray - level co - occurrence matrix \(P(i,j,d,\theta)\) with various spacings and angles can be obtained.
[0077] The calculation formulas for the characteristic quantities of texture analysis are as follows:
[0078] Inverse difference:
[0079] Correlation:
[0080] Among them
[0081] Energy:
[0082] Contrast:
[0083] In order to identify pollutants, in the embodiments of the present invention, the DHMM model is used for analysis. The DHMM model is a classic type in the hidden Markov model, and its structure can be divided into two parts: one is the hidden Markov chain, described by \(\pi\), \(A\), which generates the state sequence; the other is the directly observable random process, described by \(B\), which generates the observation value sequence. A DHMM model can be defined as \(\pi=(N,M,\pi,A,B)\), where the definitions of each parameter are:
[0084] (1) \(N\) is the number of states of the Markov chain, \(S = \{S1,S2,\cdots,SN\}\) represents \(N\) hidden states, and let the state of the Markov chain at time \(t\) be \(q t \), where \(q t \in S\).
[0085] (2) \(M\) is the number of possible observation values corresponding to each state, \(V = \{V1,V2,\cdots,VM\}\) represents \(M\) observation values, and let the observation value at time \(t\) be \(O t \), where \(O t \in V\).
[0086] (3) π = (π i ) is the initial probability distribution vector, and the probability of randomly selecting a state S from N states is π i . π i = P(q1 = S i ). i )
[0087] (4) A = (a i,j ) N×N is the state transition probability matrix, where the transition probability from state S i to state S j is a i,j , a i,j = P(q t+1 = S i | q t = S i ).
[0088] (5) B = (b j,k ) N×M is the observation value probability matrix, and the probability of selecting the kth observation value under state S j is b j,k , b j,k = P(o t | q t = S j ).
[0089] The pollutant identification model library contains several pollutant identification models, and each pollutant identification model corresponds to a pollutant. To construct the pollutant identification model library, it can be carried out as follows:
[0090] For K kinds of pollutants, train K different DHMM models;
[0091] During training, select 50 × K groups of samples, calculate the feature vectors respectively, where 30 × K groups of samples are used for training and 20 × K groups of samples are used for testing;
[0092] Use the Lloyds algorithm to perform scalar quantization processing on the feature vectors, and use the different pollution state feature vectors after scalar quantization to train DHMM respectively. The training algorithm uses the Baum - Welch algorithm.
[0093] The logarithmic likelihood estimation of DHMM for K pollution states reaches the convergence error range after iteration. Different pollutants have different convergence values, Figure 7 and give the DHMM training iteration curve graph.
[0094] In the embodiment of the present invention, for the pollutant identification model of the image texture feature curve graph, the types of pollutants identified in the water body include:
[0095] The curve graph of the image texture features after scalar quantization is sent into the DHMM models of each pollution state for recognition, and the logarithmic likelihood probability estimation value is output. By comparing and obtaining the maximum logarithmic likelihood probability, the state corresponding to the maximum logarithmic likelihood probability is the current pollution state.
[0096] The scalar quantized test samples are sent into the DHMM models of each pollution state for recognition, and the logarithmic likelihood probability estimation value is output. By comparing and obtaining the maximum logarithmic likelihood probability, the state corresponding to the maximum logarithmic likelihood probability is the current pollution state.
[0097] In the second aspect of the present invention, a biological water pollution warning device based on machine vision technology is provided. This device can monitor the water body based on any one of the above biological water pollution warning methods based on machine vision technology. As shown in combination Figure 8 In this example, the device includes: a fish tank 1, a water pump 3, a wireless communication module 11, a computer 12, and an alarm 13; among them, a water inlet pipe 2 and a water outlet pipe 4 are arranged on the fish tank 1, and both the water inlet pipe 2 and the water outlet pipe 4 are connected to the water pump 3. Specifically, the water inlet pipe 2 is arranged in the upper middle part of the fish tank 1, and the water outlet pipe 4 is arranged at the bottom of the fish tank 1. A grid 5 is provided in the lower part of the fish tank 1, and a timed feeder 9 is provided in the upper part; a cover plate 6 is arranged above the fish tank 1, and at least one camera is arranged on the fish tank 1.
[0098] The wireless communication module 11 is connected to the camera and the computer 12; the computer 12 is connected to the alarm (13).
[0099] In this system, a video image of the fish school in the water body is obtained by using the camera; the wireless communication module is used to transmit the obtained video image of the fish school in the water body to the computer, and the following method is executed in the computer: enhancing the clarity of the video image;
[0100] According to the enhanced video image, the first discriminant model is used to identify the first state of the fish, and a first recognition result is obtained. Whether a first alarm is required is determined according to the first recognition result;
[0101] When the first alarm is not given, according to the enhanced image, the second discriminant model is used to judge the second state of the fish school, and a second recognition result is obtained. Whether it is necessary to identify the type of pollutant and give a second alarm is determined according to the second recognition result;
[0102] When it is necessary to identify the type of pollutant, an image texture feature curve graph of the second state of the fish school is obtained, and the pollutant recognition model of the image texture feature curve graph is used to identify the type of pollutant in the water body.
[0103] The specific implementation method is the same as the provided biological water pollution early warning method based on machine vision technology, and will not be elaborated here.
[0104] In an embodiment of the present invention, two cameras are provided, namely the first camera 8 and the second camera 10. The first camera 8 is arranged below the cover plate 6, and the video image obtained by the first camera 8 is used to identify the second state of the fish school; the second camera 10 is arranged on the side of the fish tank 1, and the obtained video image is used to identify the first state of the fish school.
[0105] When using the system in this embodiment to give an early warning of water pollution, the fish school is raised in the fish tank. The water inlet pipe and the water outlet pipe are connected to the fish tank and the water pump. The water pump inputs the water in the detected water source area into the fish tank. The timing feeder feeds the fish school regularly and quantitatively. The excrement produced by the fish school is discharged through the grid by the water outlet pipe. The cover plate prevents the influence of extreme weather and external organisms on the fish school, and an LED supplementary light is arranged below the cover plate. The LED supplementary light supplements light to the fish school. The first camera and the second camera take pictures of the fish school, and transmit the captured image information to the computer through the wireless communication module. The computer preprocesses the image information, including enhancing the image clarity and generating a dead fish discrimination model and a fish school stress state discrimination model. The computer processes the image information to detect dead fish. If dead fish are detected, a warning instruction is sent to the alarm, and the alarm emits a warning signal. The computer processes the image information to detect the stress of the fish school. If a stress response of the fish school is detected, an image texture feature curve graph is made for comparative analysis to identify the type of pollutant, and then a warning instruction is sent to the alarm, and the alarm emits a warning signal.
[0106] The above embodiments are only the preferred implementation manners of the present invention. It should be noted that: for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and equivalent replacements can be made. These technical solutions obtained by improving and equivalently replacing the claims of the present invention all fall within the protection scope of the present invention.
Claims
1. A biological water pollution early warning method based on machine vision technology, characterized in that, Including: Culturing fish in the water body to be monitored and obtaining video images of the fish population in the water body; Enhancing the clarity of the video images; Based on the enhanced video images, using the first discrimination model to identify the first state of the fish population and obtaining the first recognition result, and determining whether a first alarm is needed according to the first recognition result. The first state includes: fish death state and other states; When no first alarm is given, based on the enhanced video images, using the second discrimination model to judge the second state of the fish population and obtaining the second recognition result, and determining whether it is necessary to identify the pollutant type and give a second alarm according to the second recognition result. The second state includes: mild stress state, severe stress state and normal state; When it is necessary to identify the pollutant type, obtaining the image texture feature curve graph of the second state of the fish population, inputting the image texture feature curve graph into the pollutant recognition model library, and using the pollutant recognition models in the library to identify the types of pollutants in the water body, including: sending the scalar-quantized image texture feature curve graph into the DHMM models of each pollution state for recognition, outputting the logarithmic likelihood probability estimation value, comparing and obtaining the maximum logarithmic likelihood probability, and the state corresponding to the maximum logarithmic likelihood probability is the current pollution state; Constructing a pollutant recognition model library, including: training K different DHMM models for K kinds of pollutants; during training, selecting 50×K groups of samples, calculating the feature vectors respectively, where 30×K groups of samples are used for training and 20×K groups of samples are used for testing; using the Lloyds algorithm to perform scalar quantization processing on the feature vectors, and using the scalar-quantized feature vectors of different pollution states to train the DHMM respectively, and the training algorithm uses the Baum-Welch algorithm; the logarithmic likelihood estimation of the DHMM of K kinds of pollution states reaches the convergence error range after iteration, and different pollutants have different convergence values; Among them, the obtaining of the image texture feature curve graph of the second state of the fish population includes: performing frame splitting processing on the video images, with a splitting interval of 1 second, and selecting 600 consecutive frames of pictures; using mean background modeling to generate a background picture without fish population, then extracting the foreground target fish population through background subtraction, and then graying the picture to generate a gray-level co-occurrence matrix, calculating the 4 texture feature values of the inverse matrix, correlation, energy, and contrast in the 0° direction of the picture, and obtaining the inverse matrix, correlation, energy, and contrast feature curve graphs of the fish population; Among them, the pollutant recognition model library includes several pollutant recognition models, and each pollutant recognition model corresponds to a kind of pollutant; the pollutant recognition model is a trained DHMM model.
2. The method according to claim 1, wherein The method further includes: obtaining the first discrimination model, and the obtaining of the first recognition model includes: Performing video frame splitting processing on the video images, with a splitting interval of 1 second; Selecting 1000 pictures, including 500 pictures of dead fish and 500 pictures of other states respectively, performing clarity enhancement operations on the selected pictures, and using labellmg to label the dead fish; Augment the labeled dataset, including mirroring, rotation, random cropping, and local deformation. Finally, obtain a dead fish detection dataset containing 5000 images. Input the dead fish detection dataset into the YOLO model for training to obtain the first discrimination model.
3. The method according to claim 1, wherein The method further includes: obtaining a second discrimination model; the obtaining of the second discrimination model includes: Perform video frame splitting on the video images, with a splitting interval of 1 second; Select 1500 pictures, including 500 pictures in normal state, 500 pictures in mild stress state, and 500 pictures in severe stress state; After performing clarity enhancement operations on the selected pictures, augment the dataset, including mirroring, rotation, random cropping, and local deformation. Finally, obtain a fish school stress state detection dataset containing 7500 images. Input the images including normal state, mild stress state, and severe stress state into the CNN classification network for training to obtain the second discrimination model.
4. The method according to any one of claims 1 to 3, characterized in that, The clarity enhancement of the image includes: Construct an image enhancement model, input the image into the trained image enhancement model, and learn the chromatic aberration map between the input image and the output image for image enhancement to obtain the image with enhanced clarity; The image enhancement model includes 5 encoders and corresponding 5 decoders. The output of each encoder is skip-connected to its corresponding decoder. Each encoder and decoder includes a 3×3 2D convolution.
5. A biological water pollution early warning device based on machine vision technology, which can monitor water bodies based on the biological water pollution early warning method based on machine vision technology described in any one of claims 1-4, characterized in that, Including: An aquarium (1), a water pump (3), a wireless communication module (11), a computer (12), an alarm (13); an inlet pipe (2) and an outlet pipe (4) are provided on the aquarium (1), and both the inlet pipe (2) and the outlet pipe (4) are connected to the water pump (3); A grid (5) is provided at the lower part of the aquarium (1), and a timed feeder (9) is provided at the upper part; a cover plate (6) is provided above the aquarium (1); at least one camera is provided on the aquarium (1); The wireless communication module (11) is connected to the camera and the computer (12); The computer (12) is connected to the alarm (13); The camera is used to obtain video images of the fish school in the water body; The wireless communication module is used to transmit the video images of the fish school in the water body to the computer, and the following method is executed in the computer: Perform clarity enhancement on the video images; According to the enhanced video images, use the first discrimination model to identify the first state of the fish to obtain the first recognition result, and determine whether the first alarm is needed according to the first recognition result; When the first alarm is not issued, according to the enhanced images, use the second discrimination model to judge the second state of the fish school to obtain the second recognition result, and determine whether it is necessary to identify the type of pollutant and issue the second alarm according to the second recognition result; When it is necessary to identify the type of pollutant, obtain the image texture feature curve graph of the second state of the fish school, input the image texture feature curve graph into the pollutant recognition model library, and use the pollutant recognition models in the library to identify the type of pollutant in the water body.
6. The device according to claim 5, characterized in that Two cameras are provided on the fish tank (1), namely a first camera (8) and a second camera (10). The first camera (8) is arranged below the cover plate (6), and the second camera (10) is arranged on the side of the fish tank (1). The video image obtained by the first camera (8) is used to identify the second state of the fish school. The video image obtained by the second camera (10) is used to identify the first state of the fish school.
Citation Information
Patent Citations
Biologic water quality monitoring system for perceiving fish behaviors based on vision
CN102012419A
A biological water quality monitoring system for fish behavior and its monitoring method
CN102297865A
Fish activity method based on neural network
CN107423745A
Water quality early warning analysis method and system based on biological behaviors
CN111522860A