River bank abnormal behavior identification method based on video understanding
By combining DeepLabV3+ and SlowFast network, efficient identification and early warning of abnormal river bank behaviors are achieved, which solves the problems of low efficiency and poor recognition rate in the existing technology. It is suitable for multiple river scenarios, reduces labor and hardware costs, and improves recognition efficiency. accuracy and stability.
Patent Information
- Application Number
- CN202411165528.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-09-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing abnormal behavior identification technology on riverbanks has low efficiency and poor recognition rate. It relies on human supervision or target detection algorithms, is easily missed and is affected by the background, making it difficult to effectively identify abnormal behaviors in videos.
Using a method based on video understanding, DeepLabV3+ and SlowFast network are combined to perform semantic segmentation and behavior recognition of people, generate early warning logs, reduce labor costs and hardware costs, and adapt to the identification of abnormal river bank behaviors in different scenarios.
It achieves efficient identification and early warning of uncivilized or unsafe behaviors on the river bank, improves identification accuracy and stability, is suitable for multiple river scenarios, does not require retraining, and reduces operational complexity.
Smart Images

Figure CN118675093A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video analysis and urban river environment management, and in particular to a method for identifying abnormal river bank behavior based on video understanding. Background Art
[0002] Throwing garbage into the river, washing toilets with river water, and other uncivilized behaviors, as well as dangerous behaviors such as fishing and swimming. If these uncivilized or unsafe abnormal behaviors can be identified in real time based on the monitoring installed in the river in advance, and early warning logs can be generated in time, it will provide a basis for managers to carry out subsequent education, and it will also be of great significance to protect the river environment.
[0003] Thanks to the vigorous development of my country's monitoring industry, it is no longer difficult to install monitoring in rivers that need to be monitored. In order to improve the civilized quality of residents and establish their civilized awareness of urban rivers, relevant technologies have emerged to monitor possible uncivilized and abnormal behaviors of residents.
[0004] In the existing monitoring technology, there are already several methods for identifying abnormal behavior. The first is to let the management personnel identify and judge in front of the monitoring screen. However, this method relies on manpower and is prone to missed detection. If the monitoring volume is large, more manpower is required. Therefore, the ability to supervise multiple videos at the same time by manpower is limited. Compared with intelligent monitoring, the work efficiency is low. The second is to apply the image processing algorithm of target detection. Target detection can quickly classify and locate the detection target, but when target detection is used to identify abnormal behavior, because it only has strong perception ability for static images, for videos containing time information, a large amount of training data sets are required to make the recognition rate of abnormal behavior of people reach an available level. In addition, the target detection algorithm is easily affected by the background, which will cause the recognition rate to fluctuate and may lead to false detection.
[0005] In summary, the existing riverbank abnormal behavior recognition technology has technical problems such as low efficiency and poor recognition rate. Summary of the invention
[0006] In order to overcome the above-mentioned shortcomings, the present invention aims to provide a method for identifying abnormal riverbank behavior based on video understanding, which can adapt to different scenarios, identify uncivilized or unsafe abnormal behaviors and generate early warning logs in time for administrators to view and process.
[0007] The present invention achieves the above-mentioned object through the following scheme: A method for identifying abnormal riverbank behavior based on video understanding, comprising the following steps: S1: Dataset preparation stage: Use the HTTPS protocol to send a POST request to the API to connect to the data platform. After passing the security authentication, the monitored RTSP stream address can be obtained, and the stream can be decoded through the OpenCV module; S2: Image data set acquisition stage: Analyze the acquired video stream, capture images with people, and obtain a number of color images of a set image size; S3: Video sample collection stage: Analyze the acquired video stream, edit the video of people’s abnormal behavior on the river bank, and obtain video samples with abnormal behavior; S4: Image dataset processing stage: the outlines of the people contained in the collected image dataset are annotated, and the images are divided into training set and test set according to 7:3; S5: DeepLabV3+ network training stage: Use the training set to train the DeepLabV3+ network, use the trained DeepLabV3+ network to perform semantic segmentation of the collected video samples, extract the foreground image of the person, and thus complete the data preprocessing of the video samples; S6: Training SlowFast network stage: Use the pre-processed video samples to train the SlowFast network, detect the foreground image of people, and identify abnormal behaviors; S7: Identification stage: Identify abnormal behaviors of people in the test set and generate warning logs based on the identification results for administrators to review and process.
[0008] Preferably, in step S3, the abnormal human behaviors include throwing garbage, fishing, cleaning mops and other uncivilized behaviors.
[0009] Preferably, in step S5, the DeepLabV3+ network includes an Encoder module and a Decoder module; the Encoder module is used to extract semantic information of high-level features, and its main body is a DCNN with a dilated convolution. The classification network ResNet is used and changed to a dilated convolution as BackBone, and a spatial pyramid pooling module ASPP with a dilated convolution is also used. This is a basic network. In order to accurately realize the semantic segmentation of characters in different scenes, the low-dimensional feature information extracted by the basic network is directly calculated using 1×1 convolution in the Encoder module, and ASPP extracts and uses it to compare dense features; the Decoder module is used to extract the boundary information of low-level features, and further integrates it with high-level features to improve the accuracy of segmentation boundaries, and superimposes the four upsampled images containing the detail feature image and the output of the Encoder module with the same size. After 1×1 convolution and upsampling, a semantic segmentation image of the character is output.
[0010] Preferably, the loss function of the DeepLabV3+ network consists of cross entropy loss and Dice loss; cross entropy loss is used to evaluate the prediction accuracy of the model at the pixel level, and is the scalarized result of the difference between the model's output and the actual label; Dice loss is used to evaluate the prediction accuracy of the model at the image level, and the similarity between the model's predicted output and the true value label: , where X represents the sample set of prediction results of the DeeplabV3+ network, and Y represents the sample set of true values.
[0011] Preferably, in step S5, the trained DeepLabV3+ network performs semantic segmentation of characters on the collected video samples, extracts the foreground image of the characters, and separates the characters in the video from the background.
[0012] Preferably, the video dataset processed by the DeepLabV3+ network is cut in two ways: (1) Crop the collected video data set to 1 frame per second, mark the coordinates of the characters and label the behaviors. Fast R-CNN can be used directly to assist in labeling. (2) The collected video dataset is cropped to 30 frames per second for training the SlowFast network.
[0013] Preferably, in step S6, the SlowFast network is divided into a Slow Pathway and a Fast Pathway; in the Slow Pathway, every The frame is sampled once, and a total of The video is taken as input, aiming to capture the semantic information provided by the image. It runs at a low frame rate and has a slow refresh rate. In Fast Pathway, the video is refreshed every The frame is sampled once, so the total number of samples is Frame is used to capture rapidly changing actions. It has a fast refresh rate and high temporal resolution. The features output by Fast Pathway use 3D convolution with a convolution kernel size of (5,1,1) and a convolution step size of (α,1,1). This makes the number of output channels twice the number of input channels, thereby performing feature fusion with the output results of Slow Pathway.
[0014] As a preferred method, the accuracy of the evaluation index of the SlowFast network training result refers to the proportion of the number of correct classifications in all classifications. The evaluation standard formula is: , where TP represents the number of samples classified correctly and Total represents the overall number used for classification.
[0015] Preferably, the final outputs of Slow Pathway and Fast Pathway are fused into an average softmax score of a predicted value to obtain the final confidence of each predicted category.
[0016] Preferably, in step S7, the test set is input into the DeepLabV3+ network to segment the riverbank characters to obtain the foreground image of the characters; the foreground image is sent to the SlowFast network for behavior recognition, and the confidence of the abnormal behavior of each character exceeds the threshold of 60%. The final recognition result and the original video frame are saved, and an early warning log is generated according to the recognition result for the administrator to review and process.
[0017] The beneficial effects of the present invention are as follows: the present invention obtains streaming data from the data platform, combines image segmentation and behavior recognition technology, and determines whether riverside residents have uncivilized or unsafe abnormal behaviors towards the river. When abnormal behaviors are identified, video frames containing recognition results are intercepted and saved together with the recognition results. Unlike other abnormal behavior recognition scenarios, the present invention recognizes abnormal behaviors in river scenarios and can be directly deployed in other river scenarios without retraining. It has good versatility and robustness, reduces labor costs and hardware costs, and is simple and convenient to operate. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic flow diagram of the method of the present invention;
[0019] Figure 2 It is a schematic diagram of the network structure of the present invention. DETAILED DESCRIPTION
[0020] The present invention is further described below in conjunction with specific implementation examples, but the protection scope of the present invention is not limited thereto:
[0021] Example: Figure 1 , Figure 2 As shown, a method for identifying abnormal behavior of throwing garbage on a river bank based on video understanding includes the following steps:
[0022] S1: Dataset preparation phase: Use the requests module of the Python script to implement a POST request based on the HTTPS protocol to connect to the data platform, obtain the RTSP protocol stream address of the monitoring video stream, and decode the stream through OpenCV.
[0023] S2: Image dataset collection stage: Analyze the acquired video stream, capture images with people, and obtain RGB color images with an image size of 2560*1440, with a total of 1000 images.
[0024] S3: Video sample collection stage: Analyze the acquired video stream, edit the videos of people’s abnormal behaviors such as throwing garbage on the river bank, and obtain 32 video samples with abnormal behaviors.
[0025] S4: Image dataset processing stage: The characters contained in the collected image dataset are annotated with outlines using Labelme software, and the images are divided into training set and test set according to a 7:3 ratio, that is, 700 images are used for training and 300 images are used for testing.
[0026] S5: DeepLabV3+ network training stage: Use the training set to train the DeepLabV3+ network, use the trained DeepLabV3+ network to perform semantic segmentation of the collected video samples, extract the foreground image of the person, and thus complete the data preprocessing of the video samples.
[0027] The DeepLabV3+ network includes Encoder and Decoder modules; the Encoder module is used to extract semantic information of high-level features. Its main body is DCNN with dilated convolution. The classification network ResNet is used and changed to dilated convolution as BackBone. The spatial pyramid pooling module ASPP with dilated convolution is also used. This is the basic network. In order to accurately achieve the semantic segmentation of people in different scenes, the Encoder module directly uses 1×1 convolution to calculate the low-dimensional feature information extracted by the basic network. ASPP extracts and compares dense features. The Decoder module is used to extract the boundary information of low-level features, and further integrates with high-level features to improve the accuracy of segmentation boundaries. The image containing detailed features and the four upsampled images output by the Encoder module are superimposed with the same size. After 1×1 convolution and upsampling, the semantic segmentation image of the person is output.
[0028] The loss function of the DeeplabV3+ segmentation structure during training consists of cross entropy loss and Dice loss; cross entropy loss is used to evaluate the prediction accuracy of the model at the pixel level, and is the scalar result of the difference between the model's output and the actual label; Dice loss is used to evaluate the prediction accuracy of the model at the image level, and the degree of similarity between the model's predicted output and the true value label. The difference between the label image and the predicted output image is calculated using the loss function, and then the network parameters are updated using back propagation. When the loss function reaches the minimum, it will be saved as the optimal parameter model.
[0029] The calculation formula of the loss function is: , where X represents the prediction result sample set of DeeplabV3+ network, and Y represents the sample set of true value. The final result of training in this embodiment is Dice=97.74%, that is, Dice Loss=0.0226.
[0030] The DeepLabV3+ network is trained using a labeled image dataset, performs semantic segmentation of characters on the collected video dataset, and extracts the foreground image of the characters, thereby completing data preprocessing of the video dataset.
[0031] S6: SlowFast network training stage: Use the preprocessed video samples to train the SlowFast network, detect the foreground image of the person, and identify abnormal behavior.
[0032] The data preprocessing uses the trained DeepLabV3+ network to predict the obtained video data set and separate the characters in the video from the background. The video data set processed by the DeepLabV3+ network is cut in two ways: (1) Crop the video according to 1 frame per second, mark the coordinates of the characters and label their behaviors. Fast R-CNN can be used directly to assist in labeling.
[0033] (2) The collected video dataset is cropped to 30 frames per second for training the SlowFast network.
[0034] The Fast R-CNN assisted labeling, Fast R-CNN is a fast target detection method, which uses the trained Fast R-CNN network to input 1 second 1 frame cropped image, and outputs a labeled image that only retains the person detection frame result.
[0035] The SlowFast network is divided into Slow Pathway and Fast Pathway. First, 64 frames of images are read continuously. In the Slow Pathway, the video is sampled every 8 frames, and a total of 8 frames are sampled as input, aiming to capture the semantic information provided by the image. It runs at a low frame rate and has a slow refresh rate. In the Fast Pathway, the video is sampled every 2 frames, and a total of 32 frames are sampled to capture rapidly changing actions. It has a fast refresh rate and high temporal resolution. The features output by the Fast Pathway use 3D convolution, with a convolution kernel size of (5,1,1) and a convolution step size of (4,1,1), so that the number of output channels is twice the number of input channels, so as to perform feature fusion with the output results of the Slow Pathway.
[0036] The evaluation index accuracy of the SlowFast network training result refers to the proportion of the number of correct classifications in all classifications. The evaluation standard formula is: , where TP represents the number of samples classified correctly, and Total represents the overall number used for classification. Finally, the accuracy of the training result of this embodiment reaches 90.3%.
[0037] The final outputs of the Slow Pathway and Fast Pathway are fused into a predicted value average softmax score to obtain the final confidence of each predicted category.
[0038] S7: Identification stage: Identify the abnormal behavior of the person in the test set, and generate an early warning log based on the identification results for the administrator to review and process. The test image is first input into the DeepLabV3+ network. The Encoder module gradually reduces the feature map resolution to capture the high-level semantic information of the image, such as the characteristic information of the person, and then gradually restores the spatial information through the Encoder module to obtain the spatial position information of the person in the image, and finally obtain the foreground image of the person; the foreground image is sent to the SlowFast network for behavior recognition, and multiple frames of images are input into the SlowFast network. The SlowPathway obtains the spatial position information of the person. The frame rate is low, and the Fast Pathway has a high frame rate. The behavior information of the person can be obtained, so as to determine whether the person's behavior is abnormal. For each person's abnormal behavior, the confidence level exceeds the threshold of 60%. The final recognition result and the original video frame are saved, and an early warning log is generated based on the recognition result for the administrator to review and process.
[0039] When the real-time monitoring equipment equipped with the method of the present invention is deployed around the river, there is no need for retraining. The action video of the people on the opposite side of the river bank is obtained through the real-time monitoring camera. The people on the river bank are first segmented through the DeepLabV3+ network to obtain the foreground image of the people; the foreground image is sent to the SlowFast network for behavior recognition. For the abnormal behavior of each person whose confidence exceeds the threshold of 60%, the final recognition result and the original video frame are saved.
[0040] Abnormal behaviors include not only throwing garbage in this embodiment, but also uncivilized behaviors such as fishing and washing mops, and the method of the present invention is also applicable to identifying the above abnormal behaviors.
[0041] On the other hand, an embodiment of the present invention provides an early warning platform, which includes: real-time abnormal behavior recognition result video, surveillance camera switching, and recognition log; the administrator can use the recognition result of the early warning platform as a basis for further processing.
[0042] The above description is a specific embodiment of the present invention and the technical principles used. If the changes made according to the concept of the present invention do not exceed the spirit covered by the description and drawings, they should still fall within the scope of protection of the present invention.
Claims
1. A method for identifying abnormal riverbank behavior based on video understanding, characterized in that The following steps are involved: S1: Dataset preparation stage: Use the HTTPS protocol to send a POST request to the API to connect to the data platform. After passing the security authentication, the monitored RTSP stream address can be obtained, and the stream can be decoded through the OpenCV module; S2: Image data set acquisition stage: Analyze the acquired video stream, capture images with people, and obtain a number of color images of a set image size; S3: Video sample collection stage: Analyze the acquired video stream, edit the video of people’s abnormal behavior on the river bank, and obtain video samples with abnormal behavior; S4: Image dataset processing stage: the outlines of the people contained in the collected image dataset are annotated, and the images are divided into training set and test set according to 7:3; S5: DeepLabV3+ network training stage: Use the training set to train the DeepLabV3+ network, use the trained DeepLabV3+ network to perform semantic segmentation of the collected video samples, extract the foreground image of the person, and thus complete the data preprocessing of the video samples; S6: Training SlowFast network stage: Use the pre-processed video samples to train the SlowFast network, detect the foreground image of people, and identify abnormal behaviors; S7: Identification stage: Identify abnormal behaviors of people in the test set and generate warning logs based on the identification results for administrators to review and process.
2. The method for identifying abnormal riverbank behavior based on video understanding according to claim 1 is characterized in that In step S5, the DeepLabV3+ network includes an Encoder module and a Decoder module; the Encoder module is used to extract semantic information of high-level features, and its main body is a DCNN with dilated convolution. The classification network ResNet is used and changed to dilated convolution as BackBone, and the spatial pyramid pooling module ASPP with dilated convolution is also used. In the Encoder module, 1×1 convolution is directly used to calculate the low-dimensional feature information extracted by the basic network, and ASPP extracts and uses it to compare dense features; the Decoder module is used to extract the boundary information of low-level features, and further integrates it with high-level features to improve the accuracy of segmentation boundaries, and superimposes the four upsampled images containing the detail feature image and the output of the Encoder module with the same size. After 1×1 convolution and upsampling, the semantic segmentation image of the person is output.
3. The method for identifying abnormal riverbank behavior based on video understanding according to claim 2 is characterized in that The loss function of the DeepLabV3+ network is composed of cross entropy loss and Dice loss; cross entropy loss is used to evaluate the prediction accuracy of the model at the pixel level, which is the scalar result of the difference between the model's output and the actual label; Dice loss is used to evaluate the prediction accuracy of the model at the image level, and the similarity between the model's predicted output and the true value label: , where X represents the sample set of prediction results of the DeeplabV3+ network, and Y represents the sample set of true values.
4. The method for identifying abnormal riverbank behavior based on video understanding according to claim 1 is characterized in that In step S5, the trained DeepLabV3+ network performs semantic segmentation of the characters on the collected video samples, extracts the foreground image of the characters, and separates the characters in the video from the background.
5. The method for identifying abnormal riverbank behavior based on video understanding according to claim 4 is characterized in that The video dataset processed by the DeepLabV3+ network is cut in two ways: (1) Crop the collected video data set to 1 frame per second, mark the coordinates of the characters and label the behaviors. Fast R-CNN can be used directly to assist in labeling. (2) The collected video dataset is cropped to 30 frames per second for training the SlowFast network.
6. The method for identifying abnormal riverbank behavior based on video understanding according to claim 1 is characterized in that In step S6, the SlowFast network is divided into a Slow Pathway and a Fast Pathway; in the Slow Pathway, every The frame is sampled once, and a total of Frames are taken as input, aiming to capture the semantic information provided by the image; in FastPathway, the video is The frame is sampled once, so the total number of samples is Frames are used to capture rapidly changing actions. The features output by Fast Pathway use 3D convolution with a convolution kernel size of (5, 1, 1) and a convolution step size of (α, 1, 1), so that the number of output channels is twice the number of input channels, thereby performing feature fusion with the output results of Slow Pathway.
7. The method for identifying abnormal riverbank behavior based on video understanding according to claim 6 is characterized in that The accuracy of the evaluation index of the SlowFast network training result refers to the proportion of the number of correct classifications in all classifications. The evaluation standard formula is: , where TP represents the number of samples classified correctly and Total represents the overall number used for classification.
8. The method for identifying abnormal riverbank behavior based on video understanding according to claim 6 is characterized in that The final outputs of Slow Pathway and Fast Pathway are fused into an average softmax score of a predicted value to obtain the final confidence of each predicted category.
9. The method for identifying abnormal riverbank behavior based on video understanding according to claim 1 is characterized in that In step S7, the test set is input into the DeepLabV3+ network to segment the riverbank characters and obtain the foreground image of the characters; the foreground image is sent to the SlowFast network for behavior recognition, and the confidence of abnormal behavior of each character exceeds the threshold of 60%. The final recognition result and the original video frame are saved, and an early warning log is generated based on the recognition result for the administrator to review and process.
Citation Information
Patent Citations
Vehicle behavior recognition method and device, equipment and storage medium
CN112668391A
Underground mine abnormal action recognition method based on video understanding
CN116798117A
Identification method for small-difference classroom behaviors
CN117373058A
Human body uncivilized behavior detection method fusing non-uniform sampling and feature enhancement
CN117392753A
Improved DeepLabV3 + large model method for riverway water bank segmentation
CN117437544A
Cited By
Intelligent monitoring method for wading shoreside fishing behavior based on unmanned ship
CN119559581A
