Water-related early warning method and system based on video monitoring
Through the water-to-water warning method based on video streams, the video stream data is used to identify pedestrians and detect fallen into the water behavior, which solves the cost increase and time gap caused by manual monitoring, and realizes automatic water-to-water warning and monitoring, ensuring safety and cost-effective.
Patent Information
- Application Number
- CN202210336402.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2042-03-31
AI Technical Summary
Manual monitoring video surveillance leads to the problem of increased labor costs and gaps in monitoring time, especially in water-facing operating environments, which increases the probability of accidents.
Using the video stream-based early warning method, by obtaining video stream data, identifying pedestrians, real-time tracking and identification of water-falling behavior, and issuing an alarm when identifying water-falling behavior, use the re-identification neural network and Kalman filter to track targets. and behavior recognition, combined with RGB and skeleton recognition algorithms, realize automatic early warning.
It realizes automatic tracking and identification of pedestrians in waterside in low-computing hardware scenarios, reduces monitoring costs, ensures all-weather monitoring, and solves the problems of increased costs and time gaps caused by manual monitoring.
Smart Images

Figure CN114648721B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of video image recognition and relates to a water-impending early warning method and system based on video monitoring. Background Art
[0002] When working near water, workers often walk near water sources, and often cross on both sides of water sources. These behaviors are dangerous. For example, due to bad weather (such as icy roads) or work fatigue, the probability of accidentally falling into the water increases. Based on this, it is essential to install video surveillance for real-time monitoring, but it also brings new problems: manual monitoring will increase labor costs and there will be gaps in monitoring time. Therefore, configuring a security system with real-time warning function for video surveillance to replace manual work can better ensure the safety of workers and save costs, which has important research significance and commercial value. Summary of the invention
[0003] In order to solve the above problems, the present invention provides a water impending early warning method and system based on video stream to solve the problems of increased labor costs and gaps in monitoring time caused by manual monitoring.
[0004] The technical solution adopted by the present invention is a water-impending early warning method based on video monitoring, which is carried out according to the following steps:
[0005] Step S1, obtaining video stream data;
[0006] Step S2, performing personnel recognition on the current frame in the video stream;
[0007] Step S3: real-time tracking of pedestrians identified in the current frame;
[0008] Step S4: Identify the falling-into-water behavior of the tracked pedestrian, and issue an alarm for early warning after the falling-into-water behavior is identified.
[0009] Further, step S3 includes:
[0010] Set the confidence threshold to filter the detection frames of the current frame that are lower than the confidence threshold. At the same time, perform non-maximum suppression on the detection frames of the current frame.
[0011] The positions of the remaining detection frames after non-maximum suppression of the current frame are read, and the re-identification neural network is used to extract the apparent features of the image blocks within these detection frames.
[0012] Furthermore, step S3 also includes:
[0013] Use the Kalman filter to predict the motion state of the tracker in the current frame, that is, the position and size of the prediction box;
[0014] Based on the apparent features of the image block within the detection frame, the detection frame is used to match the tracker to obtain a matching pair of the tracker and the detection frame;
[0015] Update the Kalman filter parameters and saved feature vector set of each matched tracker, and use the unmatched tracker to judge the disappearance of the target and the appearance of the new target;
[0016] Use the unmatched detection box to initialize a new tracker. Each time a new tracker is initialized, the tracker number increases by 1.
[0017] Furthermore, the specific implementation process of using the Kalman filter to predict the motion state of the tracker in the current frame, that is, the position and size of the prediction box, is as follows:
[0018] According to the motion state of all trackers in the previous frame, that is, the position and size of the detection frame in the previous frame, the Kalman filter is used to predict the motion state of all trackers in the current frame. The motion state of each tracker in the current frame is:
[0019] S(k)=AS(k-1)
[0020] Among them, S(k) is the motion state of the tracker in the kth frame predicted by the Kalman filter. The motion state contains 8 parameters [x, y, r, h, v x , v y , v r , v h ], where x, y are the center coordinates of the prediction box, r represents the aspect ratio of the prediction box, h represents the length of the prediction box, and v x , v y , v r , v h Represent the speeds of x, y, r, and h respectively; S(k-1) is the motion state of the tracker in the k-1th frame;
[0021] After the prediction, the updated number of unmatched values for each tracker is increased by 1.
[0022] Furthermore, based on the apparent features of the image block within the detection frame, the detection frame is used to match the tracker to obtain a matching pair of the tracker and the detection frame. The specific implementation process is as follows:
[0023] Determine whether the hit count of each tracker in the hypothetical state reaches 3. If so, change the state of the tracker to the confirmed state. Otherwise, keep the state of the tracker in the hypothetical state. The initial state of each tracker is the hypothetical state. The hit count of the tracker is initially 0. Each time the tracker matches, its hit count increases by 1.
[0024] Determine whether there is a tracker in the confirmed state. If so, perform cascade matching on the trackers in the confirmed state according to the values of the updated unmatched times of each tracker from small to large. If not, continue to determine whether there is an initialized tracker. If there is an initialized tracker, perform intersection-over-union matching on the tracker in the hypothetical state. If there is no initialized tracker, initialize a new tracker using the unmatched detection box.
[0025] For the trackers in the confirmation state, the specific implementation process of cascade matching is as follows:
[0026] Step S3421, calculate the loss matrix C between the feature vector of each detection frame, that is, the apparent features of the detection frame image block extracted by the re-identification neural network and the feature vector set saved by each tracker, the size of the loss matrix C is A×B, A is the number of trackers in the confirmation state of the current frame, B is the number of detection frames in the current frame, and each element of the loss matrix C is the minimum cosine distance between a single tracker and a single detection frame;
[0027] Step S3422, calculate the Mahalanobis distance between each row of the loss matrix C, i.e., the predicted box position corresponding to each tracker, and the detection box position corresponding to each column of the loss matrix C:
[0028] First, convert the x, y, w, h of the detection box to x, y, r, h, where w refers to the width of the detection box; then for each tracker, that is, each row in the loss matrix C, calculate the Mahalanobis distance between the position of the corresponding prediction box (the motion state of the tracker predicted by the Kalman filter) and the position of each detection box according to the following formula:
[0029]
[0030] Among them, d(i, j) is the Mahalanobis distance between the j-th detection box position and the i-th prediction box position, l j is the position of the jth detection box, p i is the position of the i-th prediction box, which is obtained from the motion state output by the Kalman filter of the tracker; represents the inverse of the covariance matrix between the jth detection box position and the i-th prediction box position. The covariance matrix between the jth detection box position and the i-th prediction box position uses the variance P(k) of the motion state of the i-th tracker in the current frame.
[0031] The variance P(k) of the motion state of the i-th tracker in the current frame is:
[0032] P(k)=AP(k-1)A T +Q
[0033] Among them, P(k-1) is the estimated error of the detection box in the k-1th frame, that is, the error of the motion state of the tracker in the previous frame predicted by the Kalman filter; P(k) is the estimated error of the detection box in the kth frame, that is, the variance (error) of the motion state of the tracker in the current frame predicted by the Kalman filter, A is the state transfer matrix, A T is the transpose of matrix A, Q is the system error;
[0034] Step S3423: Match each tracker and detection frame according to the loss matrix C to obtain a matching pair of each tracker and detection frame in the confirmation state:
[0035] Step a: For the loss matrix C of size A×B, complete it to a square matrix of size max(A,B), and the element value used for completion is greater than the maximum value of the element in the loss matrix C;
[0036] Step b: For each row of the matrix, subtract the smallest element therein;
[0037] Step c: For each column of the matrix, subtract the smallest element therein;
[0038] Step d, cover all zeros in the matrix with the least horizontal and vertical lines;
[0039] Step e: If the number of horizontal and vertical lines used to cover all 0s in the matrix is equal to max(A, B), the optimal allocation is found. If there are completed rows / columns in the optimal matching pair, or the element value of the loss matrix C corresponding to the optimal matching pair is greater than the cosine distance threshold, or the element value of the loss matrix C corresponding to the optimal matching pair is greater than the Mahalanobis distance threshold, then the tracker and detection box corresponding to the matching pair are considered to be mismatched, and the matching pair is deleted from the optimal match, and the algorithm ends; if the number of horizontal and vertical lines used to cover all 0s in the matrix is less than max(A, B), go to step f;
[0040] Step f, find the smallest element that is not covered by the horizontal or vertical line, subtract this smallest element from each row that is not completely covered by the line, add this smallest element to each column that is completely covered by the line, and return to step d;
[0041] Combine the results of each cascade matching, and obtain the unmatched tracker and unmatched detection box according to the results of each cascade matching;
[0042] Perform intersection-over-union matching on the hypothesized and unmatched trackers and unmatched detection boxes:
[0043] Calculate the intersection-and-unmatched distance between each tracker in the assumed state and unmatched and each unmatched detection frame to obtain the loss matrix D. The number of rows of the loss matrix D is the total number of all trackers in the assumed state and unmatched, the number of columns of the loss matrix D is the total number of unmatched detection frames, and the element of each row in the loss matrix D is the intersection-and-unmatched distance between the tracker in the assumed state or unmatched and each unmatched detection frame.
[0044] Match the trackers in the hypothetical state and the unmatched detection frames with the unmatched detection frames. After the matching is completed, if the element value of the loss matrix D corresponding to a matching pair is greater than the intersection-over-union distance threshold, the tracker is considered to be unmatched with the detection frame and the matching pair is deleted.
[0045] Furthermore, the specific implementation process of updating the Kalman filter parameters and the saved feature vector set of each tracker and judging the disappearance of the target and the appearance of the new target is as follows:
[0046] For the matched tracker:
[0047] Update the hit count in the Kalman filter and set the updated unmatched count of each tracker to 0;
[0048] The feature vector of the detection box matched with each tracker, i.e., the apparent feature vector output by the re-identification neural network, is saved in the feature vector set of the corresponding tracker;
[0049] For unmatched trackers:
[0050] If the tracker is in the hypothetical state, delete the tracker;
[0051] If the tracker is in the confirmation state and the number of unmatched frames after the update exceeds the set maximum lifetime frame unmatched, the tracker will be deleted.
[0052] Furthermore, the falling-into-water behavior of the tracked pedestrian is identified by first cropping the video image frame. The specific process is as follows:
[0053] For the same person in the same motion state, the video image frame is cropped according to the maximum motion area based on the tracker label and the detection frame coordinates. The maximum motion area [x min ,y min , x max ,y max ] means counting all the detection frame coordinates [x l ,y l , x r ,y r ], where x l ,y l is the upper left coordinate of the detection box, xr ,y r is the lower right coordinate of the detection box, and the upper left coordinate of the maximum motion area x min ,y min Take the upper left coordinate x of all detection boxes respectively l ,y l The minimum value in the maximum motion area, the lower right coordinate x max ,y max Take the lower right coordinate x of all detection boxes respectively r ,y r The maximum value in .
[0054] Furthermore, after the video image frame is cropped, an RGB-based water-falling behavior recognition network or a skeleton-based water-falling behavior recognition algorithm is used to recognize the water-falling behavior of the tracked pedestrian;
[0055] The RGB-based water-falling behavior recognition network uses a two-dimensional residual network with a spatiotemporal interleaving module;
[0056] The space-time interleaving module includes a deformable shift module and a differentiable time frame sampling module, where:
[0057] The deformable shift module is inserted before the convolution layer of each residual module to fuse the time dimension information. The RGB data of the time series splicing is input into the deformable shift module after 3D average pooling. The deformable shift module consists of an offset network and a weighted network. The RGB data of the time series splicing is input into the offset network and the weighted network respectively after 3D average pooling to obtain the offset and weight, and then the features and time dimensions are offset and sampled;
[0058] The differentiable time frame sampling module is set after the deformable shift module. The output of the offset network and the weighted network enters the differentiable time frame sampling module to offset and sample the feature and time dimensions to obtain RBG data that is partially cheaper in time sequence.
[0059] The differentiable time frame sampling module divides the input feature maps into several groups and shifts them by different offsets according to their groups; then, it calculates the weighted sum and the temporal dimension; finally, it concatenates the divided groups into feature maps of the same size as the input data.
[0060] Furthermore, based on the skeleton falling into water behavior recognition algorithm, the specific implementation process is as follows:
[0061] Step S421, RGB image posture estimation:
[0062] First, the image features are extracted through the first 10 feature extraction layers of the convolutional neural network VGG19, and then the output feature maps are input into the sub-network CNN_PCM responsible for predicting the joint points and the sub-network CNN_PAF responsible for predicting the limb direction of the joint points. CNN_PCM outputs the confidence map (PCM, Part Confidence Map) of the joint points, and CNN_PAF outputs the PAF limb map;
[0063] Then, combining the outputs of the sub-network CNN_PCM and the sub-network CNN_PAF, we perform an integral on the path of the two corresponding joints on the PAF limb graph, and assume that the two joints with the highest integral result belong to the same human body. This cycle can produce skeleton detection results for multiple people.
[0064] Step S422: For the joint points in each person's skeleton that cannot be accurately detected, a joint point tracking algorithm based on the optical flow method is used to determine the position;
[0065] Step S423, sort the skeletons of each person corresponding to the video stream formed by the multiple frames of images by time, obtain the skeleton sequence of each person, and use the skeleton sequence of each person to form a colored skeleton image:
[0066] For the two spatial coordinates x and y of the joint points in the skeleton sequence of a pedestrian and the confidence values of the joint points, the three channels R, G, and B of the skeleton image are generated respectively, and then the horizontal direction of the skeleton image represents the spatial position distribution of the skeleton sequence, and the vertical direction of the skeleton image represents the temporal change of the skeleton sequence;
[0067] Step S424: normalize the skeleton image according to the following formula:
[0068]
[0069] in, Represents the value of the (i, j) position in the Nth skeleton image, Represents the value of the (i, j) position in the Nth skeleton image after data normalization, I Min Represents the minimum pixel value in all skeleton images, I Max Represents the maximum pixel value in all skeleton images;
[0070] Step S425: Use convolutional neural network to extract features and classify behaviors to identify falling behaviors:
[0071] Feature extraction: A feature extraction module consisting of five convolutional layers and five ReLU layers is used to extract features from the skeleton image after data standardization to obtain a spatiotemporal feature representation that can describe a person's behavior. The convolution kernel size of the five convolutional layers is designed to be 3×3, and the number of convolution kernels is 16, 16, 32, 32, and 64 respectively;
[0072] Behavior classification: The output of feature extraction is passed through the fully connected layer, ReLU layer and Dropout layer to obtain a 64-dimensional feature vector; then the fully connected layer and Softmax activation layer are used to obtain the score of the pedestrian's behavior category. If the pedestrian's falling into water behavior score obtained by the fully connected layer and Softmax activation layer is the highest, it is considered that the pedestrian has fallen into water and an alarm is issued.
[0073] Another technical solution adopted in the embodiment of the present invention is: a water warning system based on video monitoring, comprising:
[0074] a memory for storing instructions executable by a processor;
[0075] The processor is used to execute the instructions to implement the water warning method based on video monitoring as described above.
[0076] The beneficial effects of the present invention are:
[0077] 1. The tracking algorithm is used to trim the input of behavior recognition, which makes the behavior recognition algorithm lightweight, reduces the amount of calculation, and facilitates running in edge devices.
[0078] 2. The water warning method based on video surveillance in the embodiment of the present invention can be applied to hardware scenarios with low computing power and low frame rate, thereby ensuring the warning effect while saving hardware costs.
[0079] 3. Use posture estimation to provide input for the skeleton behavior recognition algorithm, and only RGB video is required as input for the overall algorithm.
[0080] 4. It realizes automatic tracking of pedestrians near water, identification and early warning of falling into water, with low monitoring cost and all-weather monitoring, and can save monitoring videos, solving the problem of increased labor costs and gaps in monitoring time caused by manual monitoring. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0082] Figure 1Schematic diagram of the structure of a re-identification neural network according to an embodiment of the present invention.
[0083] Figure 2 Schematic diagram of a two-dimensional residual network structure with a time-interleaved network according to an embodiment of the present invention.
[0084] Figure 3 It is a schematic diagram of the internal structure of a two-dimensional residual network with a time-interleaved network according to an embodiment of the present invention.
[0085] Figure 4 It is a flow chart of a method for identifying falling-into-water behavior based on video surveillance according to an embodiment of the present invention.
[0086] Figure 5 It is a flow chart of an RGB-based posture estimation algorithm according to an embodiment of the present invention.
[0087] Figure 6 It is a flow chart of a joint point tracking algorithm based on the optical flow method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0088] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0089] Example 1
[0090] The embodiment of the present invention provides a water-impending early warning method based on video monitoring, which is characterized by following the steps below:
[0091] Step S1, the terminal is connected to the camera through the switch to obtain video stream data;
[0092] Step S2, using yolov5 and other networks to identify people in the current frame of the video stream;
[0093] Step S3: Real-time tracking of pedestrians identified in the current frame can be performed according to the following steps:
[0094] Step S31, setting a confidence threshold, filtering the detection frames of the current frame that are lower than the confidence threshold to delete the false detection frames, and at the same time, performing non-maximum suppression on the detection frames of the current frame to eliminate multiple detection frames on a target. According to the tracking effect, the inventors have found through a large number of experiments that the best effect is achieved when the confidence threshold is set to 0.3;
[0095] Step S32, read the positions of the remaining detection frames after non-maximum suppression of the current frame, and use the re-recognition neural network to extract the apparent features of the image blocks in these detection frames. The re-recognition neural network can be used Figure 1 The structure shown;
[0096] Step S33: Use the Kalman filter to predict the motion state of the tracker in the current frame, that is, the position and size of the prediction box. The specific implementation process is as follows:
[0097] Step S331: Based on the motion state of all trackers in the previous frame, i.e., the position and size of the detection frame of the previous frame, the Kalman filter is used to predict the motion state of all trackers in the current frame, i.e., the position and size of the detection frame of the current frame are predicted using the Kalman filter to obtain a predicted frame. The motion state of all trackers in the current frame, i.e., the predicted frame, is:
[0098] S(k)=AS(k-1)
[0099] Among them, S(k) is the motion state of the tracker in the kth frame predicted by the Kalman filter, that is, the size and position of the predicted box in the kth frame. The motion state contains 8 parameters [x, y, r, h, v x , v y , v r , v h ], where x, y are the center coordinates of the prediction box, r represents the aspect ratio of the prediction box, h represents the length of the prediction box, and v x , v y , v r , v h Represent the speeds of x, y, r, and h respectively; S(k-1) is the motion state of the tracker in the k-1th frame, that is, the position and size of the detection frame in the previous frame;
[0100] Step S332: After the prediction is completed, the updated unmatched times of each tracker are increased by 1;
[0101] Step S34: Based on the apparent features of the image block in the detection frame, the detection frame is used to match the tracker to obtain the optimal matching pair of the tracker and the detection frame. The specific implementation process is as follows:
[0102] Step S341, determine whether the hit count of each tracker in the hypothetical state reaches 3, if so, change the state of the tracker to the confirmed state, otherwise, keep the state of the tracker in the hypothetical state, the initial state of each tracker is the hypothetical state, the hit count of the tracker is initially 0, and the hit count of the tracker increases by 1 each time it matches;
[0103] And determine whether there is a tracker in the confirmed state. If so, perform cascade matching on the tracker in the confirmed state according to the updated unmatched times of each tracker from small to large; if not, continue to determine whether there is an initialized tracker. If there is an initialized tracker, jump to step S344 and perform intersection-union matching on the tracker in the hypothetical state; if there is no initialized tracker, jump to step S36 and initialize a new tracker using the unmatched detection box. The absence of an initialized tracker means that the initialized tracker is deleted because it exceeds the maximum number of misses.
[0104] Step S342: For the trackers in the confirmation state, cascade matching is performed from small to large according to the updated unmatched times of each tracker. The specific implementation process of cascade matching is as follows:
[0105] Step S3421, calculate the loss matrix C between the feature vector of each detection frame, that is, the apparent features of the detection frame image block extracted by the re-identification neural network and the feature vector set saved by each tracker. The specific process is:
[0106] Suppose there are A trackers in confirmation state and B detection boxes, then the size of the loss matrix C is A×B. Suppose the feature vector set saved by each tracker contains K feature vectors. For each tracker, a cosine distance matrix of size K×B is calculated. The minimum cosine distance is expressed as min(cosine distance), that is, in, is the cosine distance, It is the product of the feature vector retained in a tracker and the feature vector of a detection frame in the current frame. The maximum number of feature vectors retained by each tracker can be set to 400. Each tracker can obtain a 1×B minimum cosine distance matrix by minimizing each column of the cosine distance matrix. Each row of the loss matrix C corresponds to a tracker, and each row element corresponds to the 1×B minimum cosine distance matrix of the tracker. The 1×B minimum cosine distance matrices of A trackers are combined to obtain an A×B loss matrix C, that is, each element of the loss matrix is the minimum cosine distance between a single tracker and a single detection frame.
[0107] Step S3422, based on the loss matrix C, calculate the Mahalanobis distance between each row of the loss matrix C, i.e., the predicted box position corresponding to each tracker, and the detection box position corresponding to each column of the loss matrix C;
[0108] The process of calculating the Mahalanobis distance between each row of the loss matrix C, i.e. the predicted box position corresponding to each tracker, and the detection box position corresponding to each column of the loss matrix C is:
[0109] First, convert the x, y, w, h of the detection box to x, y, r, h, where w refers to the width of the detection box; then for each tracker, that is, each row in the loss matrix C, calculate the Mahalanobis distance between the position of the corresponding prediction box (the motion state of the tracker predicted by the Kalman filter) and the position of each detection box according to the following formula:
[0110]
[0111] Among them, d(i, j) is the Mahalanobis distance between the j-th detection box position and the i-th prediction box position, l j is the position of the jth detection box, p i is the position of the i-th prediction box, which is obtained from the motion state output by the Kalman filter of the tracker; Represents the inverse of the covariance matrix between the j-th detection box position and the i-th prediction box position. The covariance matrix between the j-th detection box position and the i-th prediction box position uses the variance P(k) of the motion state of the i-th tracker in the current frame. When the Mahalanobis distance d(i, j) is greater than the set Mahalanobis distance threshold, it means that although the apparent features of the j-th detection box and the i-th prediction box are similar, their positions are far apart and they are not tracking the same target. When the Mahalanobis distance d(i, j) is less than or equal to the set Mahalanobis distance threshold, the value of the element in the i-th row and j-th column in the loss matrix C remains unchanged.
[0112] The variance P(k) of the motion state of the i-th tracker in the current frame is:
[0113] P(k)=AP(k-1)A T +Q
[0114] Among them, P(k-1) is the estimated error of the detection box in the k-1th frame, that is, the error of the motion state of the tracker in the previous frame predicted by the Kalman filter; P(k) is the estimated error of the detection box in the kth frame, that is, the variance (error) of the motion state of the tracker in the current frame predicted by the Kalman filter, A is the state transfer matrix, A T is the transpose of matrix A, Q is the system error;
[0115] Step S3423: Match each tracker and detection frame according to the loss matrix C to obtain a matching pair of each tracker and detection frame in the confirmation state. The specific process is as follows:
[0116] Step a: For the loss matrix C of size A×B, complete it to a square matrix of size max(A,B), and the element value used for completion is greater than the maximum value of the element in the loss matrix C;
[0117] Step b: For each row of the matrix, subtract the smallest element therein;
[0118] Step c: For each column of the matrix, subtract the smallest element therein;
[0119] Step d, cover all zeros in the matrix with the least horizontal and vertical lines;
[0120] Step e, if the number of horizontal and vertical lines used to cover all 0s in the matrix is equal to max(A, B), the optimal allocation is found. If there are completed rows / columns in the optimal matching pair, or the element value of the loss matrix C corresponding to the optimal matching pair is greater than the cosine distance threshold, or the element value of the loss matrix C corresponding to the optimal matching pair is greater than the Mahalanobis distance threshold, then the tracker and the detection frame corresponding to the matching pair are considered to be mismatched, and the matching pair is deleted from the optimal match, and the algorithm ends; if the number of horizontal and vertical lines used to cover all 0s in the matrix is less than max(A, B), then go to step f; after multiple experiments by the inventor, the cosine distance threshold is preferably 0.2 according to the tracking effect; the Mahalanobis distance threshold is preferably 15.05 with a chi-square distribution value of 8 degrees of freedom and a significance of 0.05 according to the tracking effect;
[0121] Whether the loss matrix element value corresponding to the optimal matching pair is greater than the cosine distance threshold can be determined by the following process:
[0122] To facilitate programming operations, the element values in the loss matrix C that are greater than the set cosine distance threshold can be uniformly set to b, where b is greater than the cosine distance threshold. For example, when the cosine distance threshold is set to 0.2, b can be set to 0.20001. Then, if the corresponding element value of a matching pair in the loss matrix C is b, it is considered that the tracker does not match the detection frame, and the matching pair is deleted.
[0123] Whether the loss matrix element value corresponding to the optimal matching pair is greater than the Mahalanobis distance threshold can be determined by the following process:
[0124] To facilitate programming operations, the element values in the loss matrix C that are greater than the set Mahalanobis distance threshold can be uniformly set to a. a is much larger than the Mahalanobis distance threshold. For example, a can be set to 100000, so that the predicted box and the detection box corresponding to the element whose value is changed to a are far apart, indicating that the two are not tracking the same target, so that the corresponding tracker will not be matched with the detection box in the later stage. Then, it is judged that if the corresponding element value of a matching pair in the loss matrix C is a, it is considered that the tracker does not match the detection box, and the matching pair is deleted;
[0125] The number of horizontal and vertical lines used to cover all zeros in the matrix is equal to max(A,B), which means that we can find a column match for each row in the matrix. The best match is the one with the smallest loss, that is, the sum of the loss matrix values corresponding to the matching pair is the smallest.
[0126] Step f, find the smallest element that is not covered by the horizontal or vertical line, subtract this smallest element from each row that is not completely covered by the line, add this smallest element to each column that is completely covered by the line, and return to step d.
[0127] If a tracker has not been matched for a long time, the prediction variance P(k) corresponding to its Kalman filter will become larger. The increase in variance P(k) will cause the Mahalanobis distance between the prediction box and the detection box to become smaller, making the tracker that has not been matched for a long time easier to match. This is obviously unreasonable. Therefore, the number of unmatched times after update is set for cascade matching. First, cascade matching is performed on the tracker in the confirmation state with a small number of unmatched times after update, and the tracker that has been matched recently is forced to be matched first. This can solve the problem that the tracker that has not been matched for a long time is easier to match.
[0128] Step S343: combining the results of each cascade matching, and obtaining an unmatched tracker and an unmatched detection frame according to the results of each cascade matching;
[0129] Step S344: perform intersection-and-union matching on the tracker in the assumed state and the unmatched detection frame. The specific process is as follows:
[0130] Calculate the IOU (Intersection-over-Union) distance between each hypothetical and unmatched tracker and each unmatched detection frame to obtain the loss matrix D. The number of rows of the loss matrix D is the total number of all hypothetical and unmatched trackers, and the number of columns of the loss matrix D is the total number of unmatched detection frames. The element of each row in the loss matrix D is the IOU distance between the hypothetical or unmatched tracker and each unmatched detection frame. The IOU distance calculation formula is (1-IOU), and the IOU refers to the IOU of each hypothetical or unmatched tracker and each unmatched detection frame.
[0131] Match the tracker in the hypothetical state and the unmatched detection frame with the unmatched detection frame. The same matching method as step S344 can be used here. After the matching is completed, if the element value of the loss matrix D corresponding to a certain matching pair is greater than the intersection-and-union distance threshold, it is considered that the tracker does not match the detection frame, and the matching pair is deleted. After multiple experiments by the inventor, the intersection-and-union distance threshold is preferably 0.7 according to the tracking effect. For the convenience of programming operations, the elements in the loss matrix D that are greater than the set intersection-and-union distance threshold can be uniformly set to c, and c is greater than the intersection-and-union distance threshold. For example, when the intersection-and-union distance threshold is set to 0.7, c can be set to 0.700001, and then it is judged: if the element value of the loss matrix D corresponding to a certain matching pair is c, it is considered that the tracker does not match the detection frame, and the matching pair is deleted;
[0132] Step S35: Update the Kalman filter parameters and the saved feature vector set of each matched tracker, and use the unmatched tracker to determine whether the target disappears or a new target appears. The specific implementation process is as follows:
[0133] For the matched tracker:
[0134] Step S351a, updating the hit count in the Kalman filter, and setting the updated unmatched count of each tracker to 0;
[0135] Step S352a, saving the feature vector of the detection box matched with each tracker, i.e., the apparent feature vector output by the re-identification neural network, into the feature vector set of the corresponding tracker;
[0136] For unmatched trackers:
[0137] Step S351b: If the tracker is in a hypothetical state (the target disappears), delete the tracker;
[0138] Step S352b, if the tracker is in the confirmation state, and the number of unmatched times after the update exceeds the set maximum life frame unmatched, then delete the tracker;
[0139] Step S36: Initialize a new tracker using the unmatched detection frame. Each time a new tracker is initialized, the tracker number is increased by 1, and the initial state of the new tracker is the assumed state.
[0140] Step S4: Identify the pedestrian falling into water and issue an alarm to warn after identifying the pedestrian falling into water:
[0141] Step S41: perform video image frame cropping, the specific process is as follows:
[0142] In the video, for the same person in the same motion state, the video image frame is cropped according to its maximum motion area. The maximum motion area [x min ,y min , x max ,y max ] means counting all the detection frame coordinates [x l ,y l , x r ,y r ], where x l ,y l is the upper left coordinate of the detection box, x r ,y r is the lower right coordinate of the detection box, and the upper left coordinate of the maximum motion area x min ,y minTake the upper left coordinate x of all detection boxes respectively l ,y l The minimum value in the maximum motion area, the lower right coordinate x max ,y max Take the lower right coordinate x of all detection boxes respectively r ,y r The maximum value in .
[0143] The cropped video image frames are classified and saved according to the behavior status of pedestrians as training or test sets.
[0144] During training, data labeling and data preprocessing are also required:
[0145] Data annotation: In each frame of the image, the pedestrian data annotation format is Person+serial number+behavior category. The behavior category includes falling into the water, such as PersonXXXX_jump, where XXXX is the pedestrian's serial number. The pedestrian's serial number is manually annotated and is the number of the tracker.
[0146] Data preprocessing includes data cleaning and data enhancement:
[0147] Data cleaning: manual screening of unqualified data;
[0148] Data enhancement: Before cropping, the original image is enlarged or reduced in the cropping area, and the image pixels are transformed;
[0149] Step S42: Based on the video data processed in step S41, a falling water behavior recognition algorithm is used to perform falling water behavior recognition. The falling water behavior recognition algorithm may adopt an RGB-based falling water behavior recognition network or a skeleton-based falling water behavior recognition algorithm.
[0150] The RGB-based water-falling behavior recognition network uses a two-dimensional residual network with a spatiotemporal interleaving module. The specific structure is as follows: Figures 2-3 As shown, the space-time interleaving module includes a deformable shift module and a differentiable time frame sampling module, wherein:
[0151] The deformable shift module is inserted before the convolution layer of each residual module to fuse the time dimension information. The RGB data of the time series splicing is input into the deformable shift module after 3D average pooling. The RGB data of the time series splicing is a matrix of 3×T (time)×H (image height)×W (image width). The deformable shift module consists of an offset network and a weighted network. The RGB data of the time series splicing is input into the offset network and the weighted network respectively after 3D average pooling to obtain the offset and weight, and then the features and time dimensions are offset and sampled;
[0152] The differentiable time frame sampling module is set after the deformable shift module. The output of the offset network and the weighted network enters the differentiable time frame sampling module to offset and sample the feature and time dimensions to obtain RBG data that is partially cheaper in time sequence.
[0153] The differentiable time frame sampling module divides the input feature maps into several groups and shifts them by different offsets according to their groups; then, it calculates the weighted sum and the temporal dimension; finally, it concatenates the divided groups into feature maps of the same size as the input data.
[0154] In terms of architecture, the entire RGB-based water falling behavior recognition network is a ResNet network. The above modules are all modifications of the residual modules of the network. The RGB-based water falling behavior recognition network preferably uses 34-layer ResNet, with an initial channel width of 64, a dropout of 0.5, an initial learning rate of 0.0001, a time-interleaved module offset coefficient (Shift_div) of 4, a gradient descent momentum parameter of 0.9, a weight decay regularization coefficient (Weight_decay) of 0.001, and a total of 25 iteration cycles.
[0155] Framework such as Figure 4 As shown in the figure, according to the sequence number of the pedestrian obtained by tracking, the detection frame coordinates [x l ,y l , x r ,y r ], take the detection box coordinates [x l ,y l , x r ,y r ] is used to crop the image frame based on the largest area, and then it is sent to the RGB-based falling water behavior recognition network for discrimination, and finally the discrimination result is output.
[0156] The RGB-based fall behavior recognition network is made into a library function, which can be called in the tracking module. If a fall behavior occurs, an alarm signal is issued and the currently identified image frame sequence is saved.
[0157] Based on the skeleton falling water behavior recognition algorithm, the specific implementation process is as follows:
[0158] Step S421, RGB image posture estimation:
[0159] The structure of the RGB image pose estimation network is as follows Figure 5As shown, first, the image features are extracted through the first 10 feature extraction layers of the convolutional neural network VGG19, and then the output feature maps are respectively input into the sub-network CNN_PCM responsible for predicting the joint points and the sub-network CNN_PAF responsible for predicting the limb direction of the joint points. CNN_PCM outputs the confidence map (PCM, Part Confidence Map) of the joint points, and CNN_PAF outputs the joint point relationship field (PAF, Part Affinity Field) that is, the PAF limb map. Finally, the results of the sub-network CNN_PCM and the sub-network CNN_PAF are parsed to obtain the skeleton detection results of multiple people, that is, the posture estimation of multiple people. Specifically, the sub-network CNN_PCM will generate a confidence map for the same joint point of each person. Since there are multiple joint points on the human body, multiple confidence maps corresponding to the joint points of the human body are obtained. Each confidence map is a heat map, which will show the brightest point at the corresponding joint point of the human body; the sub-network CNN_PAF describes the limbs, that is, the relationship between the joint points, so there will be as many sub-networks CNN_PAF as there are limbs in the human body. On the PAF, if a pixel is located at a joint, a unit vector from joint to joint will be saved at the pixel position. For example, on the PAF of the left arm, the position of the area corresponding to the left arm has a unit vector from the left wrist joint to the left elbow joint. Combining the outputs of the sub-network CNN_PCM and the sub-network CNN_PAF, the paths of the two corresponding joints are integrated on the PAF limb graph. The two joints with the highest results can be considered to belong to the same human body. The cycle can obtain the skeleton detection results of multiple people.
[0160] Step S422: For the joint points in each person's skeleton that cannot be accurately detected, a joint point tracking algorithm based on the optical flow method is used to determine the position;
[0161] The structure of the joint tracking algorithm based on optical flow is as follows Figure 6 As shown in the figure: Use the posture estimation algorithm to extract the joint points of each frame in the video. If the joint points cannot be accurately detected in the current frame, then look for the detected joint points of the corresponding parts in the detection results of the previous frames. Since the optical flow represents the displacement of each pixel point in two consecutive frames, the position of the joint point in the previous frame can be obtained by superimposing the optical flow vector based on the position of the joint point in the previous frame, so that the problem of missed detection of joint points can be solved.
[0162] Step S423, sort the skeletons of each person corresponding to the video stream formed by the multiple frames of images by time, obtain the skeleton sequence of each person, and use the skeleton sequence of each person to form a colored skeleton image:
[0163] For the two spatial coordinates x and y of the joint points in the skeleton sequence of a pedestrian and the confidence values of the joint points, the three channels R, G, and B of the skeleton image are generated respectively. Therefore, the skeleton image is a color image, and the confidence values of the joint points are given by the PCM image. The horizontal direction of the skeleton image represents the spatial position distribution of the skeleton sequence, and the vertical direction of the skeleton image represents the time change of the skeleton sequence. More specifically, each row of the skeleton image represents the coordinates of all the joint points of a frame of the skeleton, which are arranged from left to right according to the number, and each column of the image represents the coordinates of the corresponding joint points on the skeleton at different times;
[0164] Step S424: normalize the skeleton image according to the following formula:
[0165]
[0166] in, Represents the value of the (i, j) position in the Nth skeleton image, Represents the value of the (i, j) position in the Nth skeleton image after data normalization, I Min Represents the minimum pixel value in all skeleton images, I Max Represents the maximum pixel value in all skeleton images;
[0167] Step S425: Use convolutional neural network to extract features and classify behaviors to identify falling behaviors:
[0168] Feature extraction: The feature extraction module of the convolutional neural network used contains five convolutional layers and five ReLU layers, which can ensure both accuracy and recognition speed. The convolutional layer can linearly learn the spatiotemporal features of human motion in the skeleton image, while the ReLU activation layer can increase the nonlinear ability of the network and can nonlinearly select the features extracted by the convolutional layer. The convolution kernel size of the five convolutional layers is designed to be 3×3, and the number of convolution kernels is 16, 16, 32, 32, and 64 respectively. As the number of network layers increases, the convolution kernel continuously combines low-level features into high-level features, and finally obtains a spatiotemporal feature representation that can describe a person's behavior.
[0169] Behavior classification: The output of feature extraction is passed through the fully connected layer, ReLU layer and Dropout layer to obtain a 64-dimensional feature vector, which represents the global spatiotemporal feature representation of the input sequence; the score of the pedestrian's behavior category is then obtained through the fully connected layer and Softmax activation layer. If the pedestrian's falling into water behavior score obtained by the fully connected layer and Softmax activation layer is the highest, it is considered that the pedestrian has fallen into water, and an alarm is issued for warning, realizing skeleton-based falling behavior recognition and warning.
[0170] Example 2
[0171] An embodiment of the present invention also provides a water warning system based on video surveillance, comprising: a memory for storing instructions executable by a processor; and a processor for executing the instructions to implement a water warning method based on video surveillance as described in Example 1 above.
[0172] A water warning system based on video surveillance may include an internal communication bus, a processor, a read-only memory (ROM), a random access memory (RAM), a communication port, and a hard disk. The internal communication bus can realize data communication between components of a water warning system based on video surveillance. The processor can make judgments and issue prompts. In some embodiments, the processor can be composed of one or more processors. The communication port can realize data communication outside a water warning system based on video surveillance. In some embodiments, a water warning system based on video surveillance can also send and receive information and data from the network through the communication port. A water warning system based on video surveillance may also include different forms of program storage units and data storage units, such as hard disks, read-only memories (ROM) and random access memories (RAM), which can store various data files used for computer processing and / or communication, as well as possible program instructions executed by the processor. The processor executes these instructions to implement the main part of the method. The results of the processor processing are transmitted to the subject device through the communication port and displayed on the subject interface.
[0173] The above-mentioned water-prone early warning method based on video surveillance can be implemented as a computer program, stored in a hard disk, and recorded in a processor for execution. Therefore, an embodiment of the present invention also provides a computer-readable medium storing a computer program code, and the computer program code implements the above-mentioned water-prone early warning method based on video surveillance when executed by a processor.
[0174] When a water warning method based on video surveillance is implemented as a computer program, it can also be stored in a computer-readable storage medium as a product. For example, a computer-readable storage medium may include, but is not limited to, magnetic storage devices (e.g., hard disks, floppy disks, magnetic strips), optical disks (e.g., compact disks (CDs), digital versatile disks (DVDs)), smart cards, and flash memory devices (e.g., electrically erasable programmable read-only memories (EPROMs), cards, sticks, key drives). In addition, the various storage media described in the embodiments of the present invention can represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" may include, but is not limited to, wireless channels and various other media (and / or storage media) that can store, contain and / or carry code and / or instructions and / or data.
[0175] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. Water-related early warning method based on video surveillance, It is characterized in that Follow these steps: Step S1, obtaining video stream data; Step S2, performing personnel recognition on the current frame in the video stream; Step S3: real-time tracking of pedestrians identified in the current frame; Step S4, identifying the falling-into-water behavior of the tracked pedestrian, and issuing an alarm for early warning after identifying the falling-into-water behavior; Step S3 also includes: Use the Kalman filter to predict the motion state of the tracker in the current frame, that is, the position and size of the prediction box; Based on the apparent features of the image block within the detection frame, the detection frame is used to match the tracker to obtain a matching pair of the tracker and the detection frame; Update the Kalman filter parameters and saved feature vector set of each matched tracker, and use the unmatched tracker to judge the disappearance of the target and the appearance of the new target; Initialize a new tracker using the unmatched detection frame. Each time a new tracker is initialized, the tracker number increases by 1. Based on the apparent features of the image block within the detection frame, the detection frame is matched with the tracker to obtain a matching pair of the tracker and the detection frame. The specific implementation process is as follows: Determine whether the hit count of each tracker in the hypothetical state reaches 3. If so, change the state of the tracker to the confirmed state. Otherwise, keep the state of the tracker in the hypothetical state. The initial state of each tracker is the hypothetical state. The hit count of the tracker is initially 0. Each time the tracker matches, its hit count increases by 1. Determine whether there is a tracker in the confirmed state. If so, perform cascade matching on the trackers in the confirmed state according to the values of the updated unmatched times of each tracker from small to large. If not, continue to determine whether there is an initialized tracker. If there is an initialized tracker, perform intersection-over-union matching on the tracker in the hypothetical state. If there is no initialized tracker, initialize a new tracker using the unmatched detection box. For the trackers in the confirmation state, the specific implementation process of cascade matching is as follows: Step S3421, calculate the loss matrix C between the feature vector of each detection frame, that is, the apparent features of the detection frame image block extracted by the re-identification neural network and the feature vector set saved by each tracker, the size of the loss matrix C is A×B, A is the number of trackers in the confirmation state of the current frame, B is the number of detection frames in the current frame, and each element of the loss matrix C is the minimum cosine distance between a single tracker and a single detection frame; Step S3422, calculate the Mahalanobis distance between each row of the loss matrix C, i.e., the predicted box position corresponding to each tracker, and the detection box position corresponding to each column of the loss matrix C: First, convert the x, y, w, h of the detection box to x, y, r, h, where w refers to the width of the detection box; then for each tracker, that is, each row in the loss matrix C, calculate the Mahalanobis distance between the corresponding predicted box position and each detection box position according to the following formula: Among them, d(i,j) is the Mahalanobis distance between the j-th detection box position and the i-th prediction box position, l j is the position of the jth detection box, p i is the position of the i-th prediction box, which is obtained from the motion state output by the Kalman filter of the tracker; represents the inverse of the covariance matrix between the jth detection box position and the i-th prediction box position. The covariance matrix between the jth detection box position and the i-th prediction box position uses the variance P(k) of the motion state of the i-th tracker in the current frame. The variance P(k) of the motion state of the i-th tracker in the current frame is: P(k)=AP(k-1)A T +Q Among them, P(k-1) is the estimated error of the detection box in the k-1th frame, that is, the error of the motion state of the tracker in the previous frame predicted by the Kalman filter; P(k) is the estimated error of the detection box in the kth frame, that is, the variance of the motion state of the tracker in the current frame predicted by the Kalman filter, A is the state transfer matrix, A T is the transpose of matrix A, Q is the system error; Step S3423: Match each tracker and detection frame according to the loss matrix C to obtain a matching pair of each tracker and detection frame in the confirmation state: Step a: For the loss matrix C of size A×B, complete it to a square matrix of size max(A,B), and the element value used for completion is greater than the maximum value of the element in the loss matrix C; Step b: For each row of the matrix, subtract the smallest element therein; Step c: For each column of the matrix, subtract the smallest element therein; Step d, cover all zeros in the matrix with the least horizontal and vertical lines; Step e: If the number of horizontal and vertical lines used to cover all 0s in the matrix is equal to max(A, B), the optimal allocation is found. If there are completed rows or columns in the optimal matching pair, or the element value of the loss matrix C corresponding to the optimal matching pair is greater than the cosine distance threshold, or the element value of the loss matrix C corresponding to the optimal matching pair is greater than the Mahalanobis distance threshold, then the tracker and detection box corresponding to the matching pair are considered to be mismatched, and the matching pair is deleted from the optimal match, and the algorithm ends; if the number of horizontal and vertical lines used to cover all 0s in the matrix is less than max(A, B), go to step f; Step f, find the smallest element that is not covered by the horizontal or vertical line, subtract this smallest element from each row that is not completely covered by the line, add this smallest element to each column that is completely covered by the line, and return to step d; Combine the results of each cascade matching, and obtain the unmatched tracker and unmatched detection box according to the results of each cascade matching; Perform intersection-over-union matching on the hypothesized and unmatched trackers and unmatched detection boxes: Calculate the intersection-and-unmatched distance between each tracker in the assumed state and unmatched and each unmatched detection frame to obtain the loss matrix D. The number of rows of the loss matrix D is the total number of all trackers in the assumed state and unmatched, the number of columns of the loss matrix D is the total number of unmatched detection frames, and the element of each row in the loss matrix D is the intersection-and-unmatched distance between the tracker in the assumed state or unmatched and each unmatched detection frame. Match the trackers in the hypothetical state and the unmatched detection frames with the unmatched detection frames. After the matching is completed, if the element value of the loss matrix D corresponding to a matching pair is greater than the intersection-over-union distance threshold, the tracker is considered to be unmatched with the detection frame and the matching pair is deleted.
2. The water-related early warning method based on video monitoring according to claim 1, It is characterized in that Step S3 includes: Set the confidence threshold to filter the detection frames of the current frame that are lower than the confidence threshold. At the same time, perform non-maximum suppression on the detection frames of the current frame. The positions of the remaining detection frames after non-maximum suppression of the current frame are read, and the re-identification neural network is used to extract the apparent features of the image blocks within these detection frames.
3. The water-related early warning method based on video monitoring according to claim 1, It is characterized in that The specific implementation process of using the Kalman filter to predict the motion state of the tracker in the current frame, that is, the position and size of the prediction box, is as follows: According to the motion state of all trackers in the previous frame, that is, the position and size of the detection frame in the previous frame, the Kalman filter is used to predict the motion state of all trackers in the current frame. The motion state of each tracker in the current frame is: S(k)=AS(k-1) Among them, S(k) is the motion state of the tracker in the kth frame predicted by the Kalman filter. The motion state contains 8 parameters [x, y, r, h, v x ,v y ,v r ,v h ], where x, y are the center coordinates of the prediction box, r represents the aspect ratio of the prediction box, h represents the length of the prediction box, and v x ,v y ,v r ,v h Represent the speeds of x, y, r, and h respectively; S(k-1) is the motion state of the tracker in the k-1th frame; After the prediction, the updated number of unmatched values for each tracker is increased by 1.
4. The water-prevention early warning method based on video monitoring according to claim 1, It is characterized in that The specific implementation process of updating the Kalman filter parameters and saved feature vector set of each tracker and judging the disappearance of the target and the appearance of the new target is as follows: For the matched tracker: Update the hit count in the Kalman filter and set the updated unmatched count of each tracker to 0; The feature vector of the detection box matched with each tracker, i.e., the apparent feature vector output by the re-identification neural network, is saved in the feature vector set of the corresponding tracker; For unmatched trackers: If the tracker is in the hypothetical state, delete the tracker; If the tracker is in the confirmation state and the number of unmatched frames after the update exceeds the set maximum lifetime frame unmatched, the tracker will be deleted.
5. The water-prevention early warning method based on video monitoring according to claim 1, It is characterized in that To identify the falling-into-water behavior of the tracked pedestrian, the video image frame is cropped first. The specific process is as follows: For the same person in the same motion state, the video image frame is cropped according to the maximum motion area based on the tracker label and the detection frame coordinates. The maximum motion area [x min ,y min ,x max ,y max ] means counting all the detection frame coordinates [x l ,y l ,x r ,y r ], where x l ,y l is the upper left coordinate of the detection box, x r ,y r is the lower right coordinate of the detection box, and the upper left coordinate of the maximum motion area x min ,y min Take the upper left coordinate x of all detection boxes respectively l ,y l The minimum value in the maximum motion area, the lower right coordinate x max ,y max Take the lower right coordinate x of all detection boxes respectively r ,y r The maximum value in .
6. The water-prevention early warning method based on video monitoring according to claim 5, It is characterized in that After cropping the video image frames, an RGB-based water-falling behavior recognition network or a skeleton-based water-falling behavior recognition algorithm is used to identify the falling behavior of the tracked pedestrian; The RGB-based water-falling behavior recognition network uses a two-dimensional residual network with a spatiotemporal interleaving module; The space-time interleaving module includes a deformable shift module and a differentiable time frame sampling module, where: The deformable shift module is inserted before the convolution layer of each residual module to fuse the time dimension information. The RGB data of the time series splicing is input into the deformable shift module after 3D average pooling. The deformable shift module consists of an offset network and a weighted network. The RGB data of the time series splicing is input into the offset network and the weighted network respectively after 3D average pooling to obtain the offset and weight, and then the features and time dimensions are offset and sampled; A differentiable time frame sampling module is arranged after the deformable shift module. The outputs of the offset network and the weighted network enter the differentiable time frame sampling module, and the feature and time dimensions are offset and sampled to obtain RBG data that is partially offset in time sequence. The differentiable time frame sampling module divides the input feature maps into several groups and shifts them by different offsets according to their groups; then, it calculates the weighted sum and the temporal dimension; finally, it concatenates the divided groups into feature maps of the same size as the input data.
7. The water-prevention early warning method based on video monitoring according to claim 6, It is characterized in that Based on the skeleton falling water behavior recognition algorithm, the specific implementation process is as follows: Step S421, RGB image posture estimation: First, the image features are extracted through the first 10 feature extraction layers of the convolutional neural network VGG19, and then the output feature maps are input into the sub-network CNN_PCM responsible for predicting joint points and the sub-network CNN_PAF responsible for predicting the limb direction of joint points. CNN_PCM outputs the confidence map of the joint points, and CNN_PAF outputs the PAF limb map. Then, combining the outputs of the sub-network CNN_PCM and the sub-network CNN_PAF, we perform an integral on the path of the two corresponding joints on the PAF limb graph, and assume that the two joints with the highest integral result belong to the same human body. This cycle can produce skeleton detection results for multiple people. Step S422: For the joint points in each person's skeleton that cannot be accurately detected, a joint point tracking algorithm based on the optical flow method is used to determine the position; Step S423, sort the skeletons of each person corresponding to the video stream formed by the multiple frames of images by time, obtain the skeleton sequence of each person, and use the skeleton sequence of each person to form a colored skeleton image: For the two spatial coordinates x and y of the joint points in the skeleton sequence of a pedestrian and the confidence values of the joint points, the three channels R, G, and B of the skeleton image are generated respectively, and then the horizontal direction of the skeleton image represents the spatial position distribution of the skeleton sequence, and the vertical direction of the skeleton image represents the temporal change of the skeleton sequence; Step S424: normalize the skeleton image according to the following formula: in, Represents the value of the (i, j) position in the Nth skeleton image, Represents the value of the (i, j) position in the Nth skeleton image after data normalization, I Min Represents the minimum pixel value in all skeleton images, I Max Represents the maximum pixel value in all skeleton images; Step S425: Use convolutional neural network to extract features and classify behaviors to identify falling behaviors: Feature extraction: A feature extraction module consisting of five convolutional layers and five ReLU layers is used to extract features from the skeleton image after data standardization to obtain a spatiotemporal feature representation that can describe a person's behavior. The convolution kernel size of the five convolutional layers is designed to be 3×3, and the number of convolution kernels is 16, 16, 32, 32, and 64 respectively; Behavior classification: The output of feature extraction is passed through the fully connected layer, ReLU layer and Dropout layer to obtain a 64-dimensional feature vector; then the fully connected layer and Softmax activation layer are used to obtain the score of the pedestrian's behavior category. If the pedestrian's falling into water behavior score obtained by the fully connected layer and Softmax activation layer is the highest, it is considered that the pedestrian has fallen into water and an alarm is issued.
8. Water early warning system based on video surveillance, It is characterized in that include: a memory for storing instructions executable by a processor; A processor, configured to execute the instructions to implement the method according to any one of claims 1 to 7.
