A method for monitoring illegal entry into water by personnel based on semantic segmentation and target detection
Through the monitoring method of illegal entry of people into the water based on semantic segmentation and target detection, the problems of low monitoring efficiency, high cost and difficulty in accurate identification in the existing technology have been solved, and the accurate identification of water areas and personnel locations in complex environments has been achieved, and false alarms have been reduced. rate and false negative rate, improving monitoring efficiency and response speed.
Patent Information
- Application Number
- CN202411002460.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-10-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies have low efficiency and high cost when monitoring illegal activities of people entering the water, and it is difficult to achieve accurate identification in complex environments. In particular, equipment deployment and maintenance costs are high in large-scale water monitoring, and a large number of high-cost scene images are required. data set.
Adopt a monitoring method for illegal entry into the water based on semantic segmentation and target detection. The semantic segmentation model and target detection model are trained by obtaining the water mark data set. Combined with the water semantic segmentation and personnel target detection algorithms, the position and posture of the person can be identified in real time to determine whether the person has entered the water illegally. , and output the security alarm index through the early warning model, and take corresponding measures.
It achieves accurate identification of water areas and personnel locations in complex environments, reduces false alarm and omission rates, improves monitoring efficiency, reduces equipment costs, can complete surveillance video analysis and processing in a short time, and quickly responds to illegal water entry behaviors. , reduce the risk of accidents.
Smart Images

Figure CN118552906B_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the technical fields of computer vision and image processing, and in particular to a method for monitoring illegal entry of personnel into water based on semantic segmentation and target detection. Background Art
[0002] With the development of society and the diversification of people's lifestyles, water activities are becoming more frequent. In certain waters, in order to ensure the safety of personnel and the stability of the environment, people are prohibited from entering the water without permission. However, due to the difficulty of supervision, people often enter the water illegally. The traditional manual inspection method is inefficient and difficult to achieve real-time monitoring.
[0003] The existing technology monitors underwater sound signals through underwater sound sensors, uses sound features to identify whether there are people who illegally enter the water and promptly alarms, uses underwater drones equipped with corresponding sensors for monitoring, or combines geographic information systems and intelligent sensing technologies to pre-demarcate illegal water entry areas and set up electronic fences around the areas. However, these methods have many shortcomings in practical application. First, changes and fluctuations in the water environment will affect the monitoring effect. For example, factors such as bad weather and turbid waters will interfere with the normal operation of monitoring equipment; secondly, equipment such as underwater drones and cameras are expensive, and the cost of deploying and maintaining monitoring equipment is high, especially for monitoring of large areas of water, which requires a large amount of capital investment; thirdly, some technologies require a large number of relevant scene images as training and verification data sets to achieve a high monitoring accuracy, but the collection of image data sets for these specific scenes is difficult and the cost is very high. Summary of the invention
[0004] To solve the above problems, the present invention provides a method for monitoring illegal water entry by personnel based on semantic segmentation and target detection. The method can accurately segment image areas in surveillance videos under complex scenes, accurately identify the positions and postures of personnel, and realize real-time monitoring of illegal water entry by personnel in the surveillance area.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] The method for monitoring illegal entry of people into water based on semantic segmentation and target detection includes the following steps:
[0007] S1. Obtain and filter a water area annotation dataset, and train a water area semantic segmentation model based on the filtered water area annotation dataset;
[0008] S2, identifying the location of the water area in the image based on a preset water area semantic segmentation model;
[0009] S3. Detecting the position of the person based on a preset person target detection model;
[0010] S4, combining the pixels of the water area and the location information of the personnel in the image obtained by the water area semantic segmentation model and the personnel target detection model, and detecting whether the personnel are illegally entering the water based on the personnel illegal entering the water monitoring algorithm;
[0011] S5. Draw a relevant line graph according to the proportion of the water area in the personnel target detection frame, output the corresponding safety warning index through the preset water area early warning model, and execute the corresponding warning measures.
[0012] Furthermore, in step S1, the water area annotation dataset includes an ADE20K dataset, water area image data and annotation data.
[0013] Furthermore, in step S2, the water semantic segmentation model adopts a neural network model with a variety of network architectures, including using a ResNet pre-trained network to extract image features and using a U-Net to segment water pixels in the image.
[0014] Furthermore, the construction of the water area semantic segmentation model includes the following steps:
[0015] S21, using ResNet50 network as the basic model and pre-training with the imagenet dataset;
[0016] S22, remove the last fully connected layer of the ResNet50 model, input the preprocessed image data into the model, and extract the feature representation of the image through the convolution layer;
[0017] S23, extract the first layer input_layer, conv1_relu, conv2_block3_out and conv3_block4_out of ResNet50 as the encoder of the U-Net network;
[0018] S24, define a decoder, which is composed of a two-dimensional transposed convolution block, a connection layer concatenate and a custom convolution block;
[0019] S25. Extract conv4_block6_out of the ResNet50 network as the skip connection layer, which is located between the encoder and the decoder.
[0020] S26, using a 1x1 two-dimensional convolutional layer to obtain a semantic segmentation result image with the same size as the original input;
[0021] S27. Use Adam optimizer and cross entropy loss function for training to optimize and adjust model parameters.
[0022] Furthermore, in step S3, the preset human target detection model adopts the YOLOv8 algorithm as the human target detection algorithm, and the human target detection model is trained on the open source COCO dataset. The workflow of the human target detection model includes the following steps:
[0023] S31, preprocessing the image data, including adjusting the image size and normalizing the image to meet the model input requirements;
[0024] S32, reasoning the preprocessed image through the model, that is, performing forward propagation calculation to obtain the detection result of the target in the image;
[0025] S33, post-processing the output of the model to remove redundant detection results, wherein the post-processing includes non-maximum suppression, drawing a person target detection frame and a category label;
[0026] S34. Evaluate the model performance, including accuracy, recall, and mAP, and adjust and modify relevant parameters based on the evaluation results.
[0027] Further, in step S4, the personnel illegal entry into water monitoring algorithm detects whether the personnel illegally enter the water, including the following steps:
[0028] S41, calculating the ratio of the lower edge of the human target detection frame in the water area according to the positions of the human target detection frame and the water area pixels, and comparing the obtained ratio with a preset lower edge threshold;
[0029] S42. When the proportion of the lower edge of the human target detection frame in the water area exceeds a preset lower edge threshold, the proportion of the water area in the human target detection frame is calculated, and the obtained proportion of the water area in the human target detection frame is compared with a preset global threshold.
[0030] Furthermore, in step S41, the ratio p1 of the lower edge of the human target detection frame in the water area is calculated as follows:
[0031] ;
[0032] Among them, the positions of the four vertices of the person target detection frame from left to right and from top to bottom are (x 1 ,y 1 )、(x m ,y 1 )、(x 1 ,y n ) and (x m ,y n ), x represents the horizontal coordinate position, y represents the vertical coordinate position, then the pixels at the bottom edge of the person target detection frame are (x 1 ,y n )、(x1 +1,y n )、(x 1 +2,y n )...(x m ,y n ) has a total of M pixels, M is the number of pixels in the horizontal direction of the human target detection frame, m is the coordinate on the x-axis, n is the coordinate on the y-axis, S represents the water pixel set in the image, Represents the number of lower edge pixels of the person target detection box in S.
[0033] Further, in step S42, the calculation formula of the water area ratio p2 in the human target detection frame is:
[0034] ;
[0035] Where N is the number of pixels in the vertical direction of the person target detection frame, M*N represents the number of pixels traversed in sequence in the person target detection frame, Indicates the number of water pixels in the human target detection frame.
[0036] Furthermore, in step S5, the outputting of the corresponding safety warning index by the preset water area warning model includes the following steps:
[0037] S51, obtaining water area ratio data in the personnel target detection frame in real time and preprocessing the data;
[0038] S52, using time as the horizontal coordinate and the water area ratio as the vertical coordinate, converting the acquired data points into a broken line in real time according to the time sequence;
[0039] S53, inputting the generated line graph into the water area early warning model;
[0040] S54, extracting feature information in the line graph through the convolution layer and pooling layer of the model, including the change range of the line graph and the global change trend;
[0041] S55, input the extracted feature information into the fully connected layer, and output the predicted safety warning index;
[0042] S56. Take corresponding safety measures according to the output safety alarm index.
[0043] The beneficial effects of the present invention are:
[0044] The present invention uses the ADE20K dataset and other water semantic data as the final fine-tuning training set. The dataset contains rich scene images, which improves the performance and generalization ability of the water semantic model. The water semantic segmentation algorithm and the personnel target detection algorithm are used to segment the water direction and detect the target position of the personnel respectively, which solves the problem of high cost and difficulty in acquiring specific scene data for building large-scale high-quality datasets at a low cost. At the same time, it realizes the precise identification of water areas and personnel positions in complex environments, reducing false alarm rates and missed alarm rates.
[0045] The present invention uses a personnel illegal entry into the water monitoring algorithm to intelligently judge whether a person has illegally entered the water according to a preset threshold value. It has efficient real-time processing capabilities and can complete the analysis and processing of monitoring videos in a short time. Through a preset water area early warning model, corresponding safety measures can be taken according to relevant safety alarm indexes to achieve a rapid response to personnel illegal entry into the water and reduce the risk of accidents. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a flow chart of a method for monitoring illegal entry of personnel into water based on semantic segmentation and target detection of the present invention;
[0047] Figure 2 It is a flowchart diagram of step S4 provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] See also Figure 1-2 As shown, the present invention provides a method for monitoring illegal water entry by personnel based on semantic segmentation and target detection. The method can accurately segment image areas in surveillance videos under complex scenarios, accurately identify the positions and postures of personnel, and realize real-time monitoring of illegal water entry by personnel in the surveillance area.
[0049] The method for monitoring illegal entry of people into water based on semantic segmentation and target detection comprises the following steps:
[0050] S1. Obtain and filter a water area annotation dataset, and train a water area semantic segmentation model based on the filtered water area annotation dataset;
[0051] Furthermore, in step S1, the water area annotation dataset includes an ADE20K dataset, water area image data and annotation data.
[0052] It should be noted that ADE20K is a large-scale dataset for scene parsing, which contains scene images from all over the world. The dataset contains more than 20,000 annotated images, and each annotated image is annotated with dense semantic segmentation information, that is, each pixel in the image is annotated to indicate its semantic category, such as "sky", "person", "road" and "water", etc. In this embodiment, the screened dataset has a total of 2137 original images and their corresponding annotated images.
[0053] By introducing the ADE20K dataset and related water semantic segmentation data, the diversity of scene and object features learned by the water semantic segmentation model is improved, enabling the model to better understand the particularity of the water environment and accurately segment water-related areas under different environmental conditions.
[0054] S2, identifying the location of the water area in the image based on a preset water area semantic segmentation model;
[0055] Furthermore, in step S2, the water semantic segmentation model adopts a neural network model with a variety of network architectures, including using a ResNet pre-trained network to extract image features and using a U-Net to segment water pixels in the image.
[0056] Furthermore, the construction of the water area semantic segmentation model includes the following steps:
[0057] S21, using ResNet50 network as the basic model and pre-training with the imagenet dataset;
[0058] Specifically, we obtain the imagenet dataset, which contains more than 14 million images and thousands of categories, and preprocess the data, including image enhancement, normalization, and other steps. By training ResNet50 with the imagenet dataset, the model can learn rich image feature representations. ResNet50 is a deep incomplete network that solves the gradient vanishing problem in the deep network training process by introducing residual connections. The pre-trained model provides good initialization weights to speed up the training process of new tasks.
[0059] S22, remove the last fully connected layer of the ResNet50 model, input the preprocessed image data into the model, and extract the feature representation of the image through the convolution layer;
[0060] S23, extract the first layer input_layer, conv1_relu, conv2_block3_out and conv3_block4_out of ResNet50 as the encoder of the U-Net network;
[0061] It should be noted that in this embodiment, the ResNet50 model is used as a feature extractor, so the last fully connected layer is removed. Specified layers are extracted from the ResNet50 model as different levels of the U-Net encoder. These layers represent image features of different scales. The feature extraction capability of ResNet50 provides a powerful feature representation for the U-Net encoder. Multi-scale features help capture details and contextual information in the image.
[0062] S24, define a decoder, which is composed of a two-dimensional transposed convolution block, a connection layer concatenate and a custom convolution block;
[0063] Among them, the two-dimensional transposed convolution layer is used to upsample the feature map, and the output feature map of different size from the input feature map is generated through padding, flipping and convolution operations, thereby achieving upsampling. The transposed convolution performs upsampling through learnable parameters rather than fixed interpolation methods, so that the optimal upsampling method can be learned.
[0064] The specific steps of transposed convolution include:
[0065] Calculate the padding size and step size: For a given input feature map size (i), convolution kernel size (k), padding size (p), and step size (s), the padding size of the transposed convolution is p'=kp-1, and the step size is s'=s;
[0066] Insert zeros between rows and columns of the input feature map, and insert s'-1 zeros between rows and columns of the input feature values according to the calculated step size s', thereby increasing the size of the feature map.
[0067] Fill the enlarged eigenvalues and use the calculated filling size p' to fill the feature map, further increasing the spatial dimension of the feature map;
[0068] Perform a convolution operation and use the defined convolution kernel to convolve the padded feature map to obtain the output feature map.
[0069] It should be noted that the encoder feature map is fused with the decoder feature map of the corresponding scale through the concatenate operation, and the custom convolution block is used to further process the fused feature map. The decoder can gradually restore the resolution of the image and perform fine semantic segmentation in combination with the encoder features.
[0070] S25. Extract conv4_block6_out of the ResNet50 network as the skip connection layer, which is located between the encoder and the decoder.
[0071] Among them, the skip connection layer connects the feature map of the encoder with the feature map of the decoder to supplement the detail information. The skip connection helps to restore the detail information in the image, improve the accuracy of the semantic style, and combine the features of the encoder and decoder to achieve multi-scale feature fusion.
[0072] S26, using a 1x1 two-dimensional convolutional layer to obtain a semantic segmentation result image with the same size as the original input;
[0073] Specifically, a 1x1 two-dimensional convolutional layer is used to perform convolution operations on the feature map. The number of output channels of this convolutional layer is equal to the number of categories of semantic segmentation. Each channel corresponds to the prediction result of one category. The size of the feature map is restored to the same as the original input image through upsampling. The 1x1 two-dimensional convolutional layer can realize cross-channel information interaction and help integrate the prediction results of different categories.
[0074] S27. Use Adam optimizer and cross entropy loss function for training to optimize and adjust model parameters.
[0075] Specifically, the Adam optimizer is selected for model training, and relevant hyperparameters such as learning rate and weight decay are set. The Adam optimizer can adaptively adjust the learning rate to accelerate the model training process. The cross entropy function is used to calculate the difference between the predicted result and the actual label, and used as the optimization target. The weight parameters of the model are updated through the back propagation algorithm to minimize the loss function.
[0076] S3. Detecting the position of the person based on a preset person target detection model;
[0077] Furthermore, in step S3, the preset human target detection model adopts the YOLOv8 algorithm as the human target detection algorithm, and the human target detection model is trained on the open source COCO dataset. The workflow of the human target detection model includes the following steps:
[0078] S31, preprocessing the image data, including adjusting the image size and normalizing the image to meet the model input requirements;
[0079] S32, reasoning the preprocessed image through the model, that is, performing forward propagation calculation to obtain the detection result of the target in the image;
[0080] S33, post-processing the output of the model to remove redundant detection results, wherein the post-processing includes non-maximum suppression, drawing a person target detection frame and a category label;
[0081] S34. Evaluate the model performance, including accuracy, recall, and mAP, and adjust and modify relevant parameters based on the evaluation results.
[0082] Specifically, since the human target detection model expects the input image to have a fixed size, it is necessary to adjust the size of the original image to match the input requirements of the model by image scaling or cropping. The image data is normalized, including scaling the pixel values from the range of 0-255 to the range of 0-1 or -1 to 1, to speed up the training process and improve the generalization ability of the model.
[0083] The COCO dataset is a large-scale object detection, segmentation and captioning dataset. The dataset aims at scene understanding and contains rich scene and annotation information, which helps the model learn more effective feature representations and improve detection accuracy. Load the person target detection model built with the YOLOv8 algorithm trained on the open source COCO dataset, input the preprocessed image data into the model, and obtain the detection results of the target in the image through the forward propagation calculation of the model, including the target category, bounding box location and confidence information. Since the model may generate multiple overlapping bounding boxes to detect the same target, it is necessary to use non-maximum suppression (NMS) to remove redundant detection results. NMS eliminates redundant bounding boxes by comparing the confidence and overlap of the bounding boxes. Draw the remaining bounding boxes on the original image and add the corresponding category label next to each bounding box.
[0084] The evaluation criteria of the COCO dataset are used to calculate the model's accuracy, recall, and mAP (mean average precision) and other indicators. The performance of the model in different situations is understood based on the indicators. The model parameters are adjusted and modified based on the evaluation results to improve the model's performance.
[0085] It should be noted that in the human target detection model, the minimum confidence is a key parameter that determines the threshold of the model when outputting the detection result. In the scenario of video surveillance that needs to process a large number of dynamic images, setting the minimum confidence is crucial to reduce the false alarm rate and missed alarm rate. The steps to set the minimum confidence include:
[0086] Set initial value: Set an initial value for the minimum confidence. The initial value can be set to 0.5, which means that the model will output the test result only when the confidence level of the model in the test result reaches 50% or more;
[0087] Collect test data and run the model to observe the results: prepare a set of test images or video clips containing different scenes, lighting conditions, and personnel densities. The data should simulate the actual video surveillance scene as much as possible. Run the model with the set initial minimum confidence, infer the test data and observe the output results, paying attention to the false detections and missed detections, as well as the distribution of these errors at different confidence thresholds.
[0088] Adjust the minimum confidence level: Based on the observed results, gradually adjust the minimum confidence level. If there are too many false positives, try increasing the confidence level; if there are too many missed positives, lower the confidence level. After each adjustment, rerun the model and observe the results until you find a relatively balanced point, where the number of false positives and missed positives are within an acceptable range.
[0089] Reasonable setting of the minimum confidence can find a balance between false detection and missed detection, thereby improving the overall performance of the system. In one embodiment, after verification testing of relevant scenarios, the minimum confidence of human target detection is set to 0.4, and the model has a good effect in human target detection under this minimum confidence.
[0090] S4, combining the pixels of the water area and the location information of the personnel in the image obtained by the water area semantic segmentation model and the personnel target detection model, and detecting whether the personnel are illegally entering the water based on the personnel illegal entering the water monitoring algorithm;
[0091] Further, in step S4, the personnel illegal entry into water monitoring algorithm detects whether the personnel illegally enter the water, including the following steps:
[0092] S41, calculating the ratio of the lower edge of the human target detection frame in the water area according to the positions of the human target detection frame and the water area pixels, and comparing the obtained ratio with a preset lower edge threshold;
[0093] S42. When the proportion of the lower edge of the human target detection frame in the water area exceeds a preset lower edge threshold, the proportion of the water area in the human target detection frame is calculated, and the obtained proportion of the water area in the human target detection frame is compared with a preset global threshold.
[0094] Furthermore, in step S41, the ratio p1 of the lower edge of the human target detection frame in the water area is calculated as follows:
[0095] ;
[0096] Among them, the positions of the four vertices of the person target detection frame from left to right and from top to bottom are (x 1 ,y 1 )、(x m ,y 1 )、(x 1 ,y n ) and (x m ,y n ), x represents the horizontal coordinate position, y represents the vertical coordinate position, then the pixels at the bottom edge of the person target detection frame are (x 1 ,y n )、(x 1 +1,y n )、(x 1 +2,yn )...(x m ,y n ) has a total of M pixels, M is the number of pixels in the horizontal direction of the human target detection frame, m is the coordinate on the x-axis, n is the coordinate on the y-axis, S represents the water pixel set in the image, Represents the number of lower edge pixels of the person target detection box in S.
[0097] Further, in step S42, the calculation formula of the water area ratio p2 in the human target detection frame is:
[0098] ;
[0099] Where N is the number of pixels in the vertical direction of the person target detection frame, M*N represents the number of pixels traversed in sequence in the person target detection frame, Indicates the number of water pixels in the human target detection frame.
[0100] It should be noted that the personnel illegal entry into the water monitoring algorithm obtains the pixels of the water area and the personnel position information in the image obtained by the water area semantic segmentation model and the personnel target detection model, and can detect the relative position of the personnel and the water area in real time. When the personnel is close to the water area, the ratio P1 of the lower edge of the personnel target detection frame in the water area is calculated according to the personnel target monitoring frame and the water area pixel position. When P1 is greater than the preset lower edge threshold, it can be judged that the personnel may be preparing to or have entered the water, and then step S42 is executed. Otherwise, it is judged that the personnel has not entered the water, and tracking detection continues. When the conditions of step S41 are met, the proportion of the water area in the personnel target detection frame continues to be calculated. When the proportion of water area pixels P2 in the personnel target detection frame is greater than the global threshold, it is judged that the personnel has illegally entered the water. The lower edge threshold and the global threshold are set in combination with the application scenario and the false alarm rate and the missed alarm rate.
[0101] S5. Draw a relevant line graph according to the proportion of the water area in the personnel target detection frame, output the corresponding safety warning index through the preset water area early warning model, and execute the corresponding warning measures.
[0102] Further, in step S5, the outputting of the corresponding safety warning index by the preset water area warning model includes the following steps:
[0103] S51, obtaining water area ratio data in the personnel target detection frame in real time and preprocessing the data;
[0104] S52, using time as the horizontal axis and the water area ratio as the vertical axis, converting the acquired data points into a line graph in real time according to the time sequence;
[0105] S53, inputting the generated line graph into the water area early warning model;
[0106] S54, extracting feature information in the line graph through the convolution layer and pooling layer of the model, including the change range of the line graph and the global change trend;
[0107] S55, input the extracted feature information into the fully connected layer, and output the predicted safety warning index;
[0108] S56. Take corresponding safety measures according to the output safety alarm index.
[0109] In one embodiment, first, the acquired water area ratio data in the personnel target detection frame is preprocessed to eliminate outliers and improve data quality. Next, the preprocessed data is arranged in chronological order, and the acquired data points are converted into a line graph in real time in chronological order. The line graph intuitively shows the changing trend of the water area ratio data in the personnel target detection frame over time. The line graph is encoded into a format recognizable by the model, such as a pixel matrix, and input into the water area warning model. The convolution layer in the model extracts the local features of the line graph through convolution operations, such as the amplitude of change, and the pooling layer aggregates the local features to obtain the global change trend. The combination of the convolution layer and the pooling layer can extract features of different scales in the line graph, thereby improving the representation ability of the model. The extracted feature information is flattened and input into the fully connected layer, which performs weighted summation on the features and obtains the final safety warning index through the activation function.
[0110] Among them, the safety warning index is set to three levels: "low", "medium" and "high". In this embodiment, the safety measures taken for low warning index (0-3) are: keep monitoring and do not take emergency actions; the safety measures taken for medium warning index (4-6) are: remind relevant personnel to leave the water through broadcasting or warning lights; the safety measures taken for high warning index (7-9) are: remind through broadcasting or warning lights and immediately dispatch personnel to dissuade, and start the emergency plan to prepare for rescue.
[0111] For example, the water area proportion data P2 in the personnel target detection frame is obtained every 5 seconds, and the global threshold set is 15%. At 0-1 minute, the proportion is in the range of 3%-12%, and the drawn broken line shows a fluctuating trend. This broken line graph is input into the model, and the model determines that the safety alarm index is 1, and the safety measures taken are: keep monitoring and do not take emergency actions; at 2-4 minutes, the proportion is in the range of 10%-40%, the drawn broken line rises faster and exceeds the global threshold, the model determines that the alarm index is 6, and the safety measures taken are: remind relevant personnel to leave the water through broadcasting or warning lights; at 4-5 minutes, the proportion is in the range of 30%-85%, the drawn broken line fluctuates violently, the module determines that the alarm index is 9, and the safety measures taken are: broadcasting or warning lights to remind and immediately dispatch personnel to dissuade, and activate the emergency plan to prepare for rescue.
[0112] To summarize, the present invention detects the location of water areas according to the water area segmentation model through real-time acquired video surveillance images, detects the location of personnel using a personnel detection target model, calculates the ratio of the lower edge of the personnel target detection frame and the water area pixels in the frame, and determines whether the personnel have illegally entered the water according to whether the ratio is greater than a preset global threshold. For incidents of personnel entering the water illegally, corresponding safety measures are taken through the output results of a preset safety alarm model, thereby achieving a rapid response to illegal entry into the water and reducing the risk of accidents.
[0113] The method of the present invention can replace traditional manual inspections, realize real-time monitoring, promptly detect illegal water discharge behaviors and take corresponding measures, effectively reduce the workload of personnel inspections, and improve monitoring efficiency. On the other hand, the method of the present invention uses the ResNet pre-trained network to extract image features and uses U-Net to segment image pixels, and uses the ADE20K data set and other water semantic data as the final fine-tuning training set, so that the model can accurately identify water boundaries in complex natural environment images. The personnel target detection model built using the YOLOv8 algorithm is trained on the open source COCO data set to detect personnel targets under interference from multiple factors such as light and partial occlusion. Compared with other methods, the model is trained in an open source data set, which has low implementation cost and can be deployed on a large scale, solving the problems of high hardware cost, difficulty in obtaining image data sets, weak anti-environmental interference ability, and inability to achieve accurate water and personnel identification in the prior art.
[0114] The above implementation modes are merely descriptions of the preferred implementation modes of the present invention, and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary engineering and technical personnel in the field shall fall within the protection scope determined by the claims of the present invention.
Claims
1. A method for monitoring illegal entry into water by personnel based on semantic segmentation and target detection, characterized in that: The following steps are involved: S1. Obtain and filter a water area annotation dataset, and train a water area semantic segmentation model based on the filtered water area annotation dataset; S2, identifying the location of the water area in the image based on a preset water area semantic segmentation model; S3. Detecting the position of the person based on a preset person target detection model; S4, combining the pixels of the water area and the location information of the personnel in the image obtained by the water area semantic segmentation model and the personnel target detection model, and detecting whether the personnel are illegally entering the water based on the personnel illegal entering the water monitoring algorithm; S5. Draw a relevant line graph according to the proportion of the water area in the personnel target detection frame, output the corresponding safety warning index through the preset water area warning model, and execute the corresponding warning measures; Wherein, in step S2, the water semantic segmentation model adopts a neural network model with a variety of network architectures, including using a ResNet pre-trained network to extract image features and using a U-Net to segment water pixels in the image; The construction of the water semantic segmentation model includes the following steps: S21, using ResNet50 network as the basic model and pre-training with the imagenet dataset; S22, remove the last fully connected layer of the ResNet50 model, input the preprocessed image data into the model, and extract the feature representation of the image through the convolution layer; S23, extract the first layer input_layer, conv1_relu, conv2_block3_out and conv3_block4_out of ResNet50 as the encoder of the U-Net network; S24, define a decoder, which is composed of a two-dimensional transposed convolution block, a connection layer concatenate and a custom convolution block; S25. Extract conv4_block6_out of the ResNet50 network as the skip connection layer, which is located between the encoder and the decoder. S26, using a 1x1 two-dimensional convolutional layer to obtain a semantic segmentation result image with the same size as the original input; S27, use Adam optimizer and cross entropy loss function for training and optimize and adjust model parameters; In step S24, the custom convolution block is composed of a plurality of two-dimensional convolution layers, a normalization layer, and an activation function connection; In step S4, the personnel illegal entry into water monitoring algorithm detects whether the personnel illegally enter the water, including the following steps: S41, calculating the ratio of the lower edge of the human target detection frame in the water area according to the positions of the human target detection frame and the water area pixels, and comparing the obtained ratio with a preset lower edge threshold; S42, when the proportion of the lower edge of the human target detection frame in the water area exceeds a preset lower edge threshold, calculating the proportion of the water area in the human target detection frame, and comparing the obtained proportion of the water area in the human target detection frame with a preset global threshold; In step S41, the ratio p1 of the lower edge of the human target detection frame in the water area is calculated as follows: ; Among them, the four vertex positions of the person target detection frame are (x1, y1), (x m ,y1)、(x1,y n ) and (x m ,y n ), x represents the horizontal coordinate position, y represents the vertical coordinate position, then the pixels at the bottom edge of the person target detection frame are (x1, y n )、(x1+1,y n )、(x1+2,y n )...(x m ,y n ) has a total of M pixels, M is the number of pixels in the horizontal direction of the human target detection frame, m is the coordinate on the x-axis, n is the coordinate on the y-axis, S represents the water pixel set in the image, Represents the number of lower edge pixels of the person target detection box in S; In step S42, the calculation formula of the water area ratio p2 in the human target detection frame is: ; Where N is the number of pixels in the vertical direction of the person target detection frame, M*N represents the number of pixels traversed in sequence in the person target detection frame, Indicates the number of water pixels in the human target detection frame.
2. The method for monitoring illegal entry into water by personnel based on semantic segmentation and target detection according to claim 1 is characterized in that: In step S1, the water area annotation dataset includes an ADE20K dataset, water area image data and annotation data.
3. The method for monitoring illegal entry into water by personnel based on semantic segmentation and target detection according to claim 1, characterized in that: In step S3, the preset human target detection model adopts the YOLOv8 algorithm as the human target detection algorithm, and trains the human target detection model on the open source COCO dataset. The workflow of the human target detection model includes the following steps: S31, preprocessing the image data, including adjusting the image size and normalizing the image to meet the model input requirements; S32, reasoning the preprocessed image through the model, that is, performing forward propagation calculation to obtain the detection result of the target in the image; S33, post-processing the output of the model to remove redundant detection results, wherein the post-processing includes non-maximum suppression, drawing a person target detection frame and a category label; S34. Evaluate the model performance, including accuracy, recall, and mAP, and adjust and modify relevant parameters based on the evaluation results.
4. The method for monitoring illegal entry into water by personnel based on semantic segmentation and target detection according to claim 1 is characterized in that: In step S5, the output of the corresponding safety warning index by the preset water area warning model includes the following steps: S51, obtaining water area ratio data in the personnel target detection frame in real time and preprocessing the data; S52, using time as the horizontal coordinate and the water area ratio as the vertical coordinate, converting the acquired data points into a broken line in real time according to the time sequence; S53, inputting the generated line graph into the water area early warning model; S54, extracting feature information in the line graph through the convolution layer and pooling layer of the model, including the change range of the line graph and the global change trend; S55, input the extracted feature information into the fully connected layer, and output the predicted safety warning index; S56. Take corresponding safety measures according to the output safety alarm index.
Citation Information
Patent Citations
Small object semantic segmentation method combined with object detection
CN109145713A
Road fallen leaf detection method and device based on deep learning and related components
CN116030400A
Anti-drowning alarm method, device and equipment and storage medium
CN116246417A
Deep learning-based method for detecting that berthing raft does not wear life jacket
CN118172719A
End-to-end recognition method for scene text in any shape
WO2019192397A1
