Coastal zone risk early warning method based on crowd dynamic trajectory intelligent perception

By combining a multi-branch bottleneck network and the DeepSort algorithm with the YOLOv11 network, dense detection and trajectory tracking of coastal populations were achieved, solving the blind spot problem of traditional early warning methods and improving the accuracy of risk identification and the level of intelligent management.

CN123142156APending Publication Date: 2026-11-20INSPUR SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611293487.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Traditional coastal risk warning methods are unable to effectively identify potential risks, and lifeguard patrol blind spots are difficult to cover the entire area, resulting in safety hazards and the inability to detect risks in a timely manner.

Method used

By employing a deep learning-based Multibranched Bottleneck Network (MBBN) and DeepSort algorithm, combined with the YOLOv11 network, dense detection and trajectory tracking of coastal populations are achieved. Real-time early warning is provided by calculating the interaction between the trajectory and the risk area.

Benefits of technology

It improved the accuracy of coastal population detection and the precision of trajectory tracking, enabled timely early warning of potential risks, alleviated the workload of patrol personnel, and promoted the intelligentization of risk management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123142156A_ABST
    Figure CN123142156A_ABST
Patent Text Reader

Abstract

The present application provides a kind of based on crowd dynamic trajectory intelligent perception's coastal zone risk early warning method, belong to image recognition technical field, the present application includes: collecting coastal zone target crowd training sample, corresponding training dataset and test dataset are made by LabelImg marking tool;Improved YOLOv11 network, i.e. embedded multi-branching bottleneck network MBBN;4 different links are used for feature extraction, and the features of different network depths are fused;The training set is input into the improved YOLOv11 network for training, and the test set is used to verify the trained model, to generate a more stable coastal dense crowd detection model;Coastal dense crowd is detected based on the trained YOLOv11 network.Improve the accuracy of personnel matching in continuous video frames, improve the accuracy of personnel trajectory calculation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and in particular to a coastal zone risk early warning method based on intelligent perception of crowd dynamic trajectories. Background Technology

[0002] As a core area integrating "leisure, entertainment, and ecological experience," the coastal zone has seen explosive growth in demand for coastal tourism in recent years, leading to increasingly prominent contradictions between tourist activities and natural risks and management shortcomings. Given the "uncertainty" and "destructiveness" of coastal risks, effectively ensuring the safety of people in coastal areas is crucial. Among these, "hidden risks" mainly include rip currents, reefs, and underwater whirlpools. According to incomplete statistics, approximately 70% of drowning accidents at beaches worldwide are related to rip currents. Meanwhile, the risk of reefs cannot be ignored; because reefs are completely covered by seawater during high tide, tourists are prone to slipping and falling while taking photos or exploring the rocks. To address these challenges, many coastal areas have adopted solutions such as setting up warning signs and deploying regional lifeguards. However, traditional lifeguard patrol methods still have safety hazards. On the one hand, people lack risk awareness and rely solely on "common sense," easily overlooking potential risks; on the other hand, lifeguards have blind spots in their patrols, making it difficult to cover the entire area and detect risks in a timely manner. Summary of the Invention

[0003] To address the aforementioned technical problems and challenges, this invention focuses on "intelligent early warning of coastal zone risks," aiming to effectively protect the lives of people in coastal areas, alleviate the workload of lifeguards, and promote the intelligent and information-based management of coastal zones.

[0004] With the rise of deep learning, technologies such as deep learning and computer vision have enabled the analysis, processing, and decision-making of real-time video data, expanding intelligent solutions. This invention focuses on intelligent video analysis and proposes a coastal zone risk early warning method based on intelligent perception of crowd dynamic trajectories.

[0005] The technical solution of this invention is: Coastal zone risk early warning methods based on intelligent perception of population dynamic trajectories include: 1. Collect training samples from the target population in the coastal zone, and create corresponding training and test datasets using the LabelImg annotation tool; 2. Based on the objective requirements of densely populated coastal areas, intertwined hidden risks, and complex environments, this invention optimizes the traditional YOLOv11 network structure and innovatively proposes a Multiple-Branching-Bottleneck-Network (MBBN). The introduction of this structure aims to enhance the feature extraction capability of the YOLOv11 network and expand its feature fusion capability, enabling the improved YOLOv11 network to have higher accuracy and robustness in personnel detection in complex scenarios with dense crowds. 4. Input the training set into the improved YOLOv11 network for training, and use the test set to validate the trained model, generating a more stable coastal dense population detection model. 5. Detect densely populated coastal areas using the trained YOLOv11 network; Furthermore, A method for tracking densely populated population trajectories in coastal zones based on Multi-Branch Bottleneck Network (MBBN) and DeepSort algorithm includes: 1. Based on the detection results of dense coastal populations using the improved YOLOv11 network, false detection data are filtered out according to confidence level; 2. Based on the personnel location anchor box data obtained by the YOLOv11 network, the coastal zone personnel are segmented into individual images. Through the feature matching network constructed based on the Multiple-Branching-Bottleneck-Network (MBBN), a 128-dimensional feature vector representing the current personnel features is extracted. That is, each detected personnel in each image corresponds to a 128-dimensional feature vector. The 128-dimensional personnel features extracted from the current video frame image are compared with the 128-dimensional personnel features extracted from the previous video frame images. 3. Based on the personnel location anchor box data obtained from the YOLOv11 network, the DeepSort algorithm is used to predict the anchor box position of personnel in the video frame image. This mainly includes: on the one hand, using the Kalman filter algorithm to predict the personnel location anchor box and update the covariance matrix parameters; on the other hand, using the Hungarian matching algorithm to accurately match the personnel location anchor boxes detected by the YOLOv11 network and the personnel location anchor boxes predicted by the Kalman filter algorithm.

[0006] 4. Combining the matching results from steps 2 and 3, an accurate personnel matching anchor frame is obtained, enabling real-time matching and tracking of each person in the crowd, and recording personnel matching information and personnel trajectory information.

[0007] Furthermore, Risk area alerts based on personnel trajectory information include: 1. For high-risk areas prone to accidents, mark them in advance in video images and record the rectangular information of the risk areas; 2. Based on the trajectory information recorded in Invention 2, filter out discrete points with excessive differences; 3. Fit the trajectory line to the remaining discrete points using the least squares method; 4. Calculate whether the trajectory line intersects with the risk area rectangle. If there is an intersection, it means that the person's future activity path may enter the risk area; if there is no intersection, it means that the person's future activity path will not pass through the risk area. 5. If the trajectory line intersects with the risk area, calculate the minimum distance between the current person's position and the risk area rectangle, set a pixel distance threshold. If the minimum distance is less than the pixel distance threshold, it indicates that the person has approached the risk area. The system controls the audio equipment to broadcast a warning that the tourist is away from the risk area and notifies the patrol personnel in the area to intervene and dissuade them in time. This invention includes: 1. Video Acquisition Module: Input real-time video frame images; 2. System Algorithm Module: Based on the improved YOLOv11 network, it performs dense crowd detection and localization on the input real-time video frame images, and uses the Multi-Branch Bottleneck Network (MBBN) and DeepSort algorithm to track the trajectories of dense people in the coastal zone. Finally, it decides whether to issue a notification or alarm based on the personnel trajectory information and the risk area rectangle information. 3. System front-end module: The front-end page structure is built based on the Vue architecture and according to business requirements; 4. System backend module: Based on the Django architecture, the backend business logic is designed according to business needs, controlling the scheduling and execution of the algorithm, saving the detection images of people approaching or entering the risk area to the file server, and returning the URL address of the file storage as detection evidence; 5. System Deployment Module: To ensure system robustness and effectively improve system stability, a clustered deployment scheme based on Nginx is adopted. The hardware equipment for building an Nginx cluster mainly consists of a master proxy server, slave proxy servers, static resource servers, file storage servers, streaming media servers, and general-purpose servers. in, A multi-branch bottleneck network MBBN is built based on the CBS and Bottleneck modules of the YOLOv11 network. First, the input feature map is subjected to dimensionality reduction operation through a CBS module with a kernel of 1 and a stride of 1 to reduce the dimension of the input feature map and improve the computational efficiency of subsequent multi-link operations. The dimensionality-reduced feature map is segmented into four equal parts at the dimensionality level. The segmented feature map is subjected to feature extraction along four different links. The first link keeps the feature map unchanged; the second link involves feature extraction through the Bottleneck module once; the third link involves feature extraction through the Bottleneck module twice; and the fourth link involves feature extraction through the Bottleneck module three times. The feature extraction results from the four links are concatenated using the Concat operation, which is also the process of feature fusion. Finally, the feature map of the specified output dimension is obtained by performing a dimension transformation operation through the CBS module with a kernel of 1 and a stride of 1. The designed multi-branch bottleneck network MBBN is embedded into the feature extraction unit of the YOLOv11 network to achieve structural optimization of the YOLOv11 network.

[0008] When a sudden situation of gradient vanishing or gradient diffusion occurs in a certain link, other links can be used as a timely supplement for feature extraction.

[0009] The improved YOLOv11 network is used to detect each frame of a coastal zone video, obtaining anchor box data for the location of all people in the video frame. The data format is as follows: ,in, This indicates the coordinates of the center point of the anchor frame rectangle. This represents the width of the anchor rectangle. This represents the height of the anchor rectangle. This represents the confidence level of the detection category. First, the confidence threshold is set to 0.7, meaning that detection results for people with a confidence level below 0.7 are filtered out. Then, all people in the current frame image are segmented separately based on the anchor box data.

[0010] The beneficial effects of this invention are: 1. This invention proposes a Multiple-Branching-Bottleneck-Network (MBBN) at the feature extraction and feature fusion level of neural networks. Through multi-link feature extraction and feature fusion, it enhances the feature processing capability of YOLOv11 network in complex scenarios and improves the accuracy of personnel positioning in dense crowds.

[0011] 2. This invention integrates the personnel feature matching results of the MBBN network with the personnel matching results of the DeepSort algorithm, thereby improving the accuracy of personnel matching in continuous video frames and the precision of personnel trajectory calculation.

[0012] 3. The calculation results of this invention predict the subsequent activity trajectory of personnel. Based on the relative positional relationship between the predicted trajectory and the risk area rectangle, it determines in real time whether personnel are approaching or entering the risk area, promptly issuing alarms and notifying patrol personnel. Based on multi-dimensional data analysis, the accuracy of decision-making is improved.

[0013] 4. This invention can serve as an auxiliary tool for coastal zone risk management, making the risk management process more intelligent and detailed, which helps alleviate the workload of coastal zone patrol personnel and promotes the informatization and intelligentization of coastal zone risk management.

[0014] Additional advantages of the present invention will be given in the following detailed description, and the advantages will be highlighted in the following description or will be understood through practical experience of the invention. Attached Figure Description

[0015] Figure 1 This is a design structure diagram of the Multi-Branch Bottleneck Network (MBBN) in Embodiment 1 of the present invention; Figure 2 This is a training result diagram of the optimized YOLOv11 network in Embodiment 1 of the present invention; Figure 3 This is a diagram showing the detection results of coastal personnel in Embodiment 1 of the present invention; Figure 4 This is a flowchart of the positioning anchor frame matching based on Multi-Branch Bottleneck Network (MBBN) in Embodiment 2 of the present invention; Figure 5 This is a plotting result of the personnel tracking trajectory in Embodiment 3 of the present invention; Figure 6 This is an algorithm flowchart of the coastal zone risk early warning method based on intelligent perception of population dynamic trajectory in Embodiment 3 of the present invention; Figure 7 This is a framework diagram of the coastal zone risk early warning system in Embodiment 4 of the present invention. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0017] 1. This invention proposes a Multiple-Branching-Bottleneck-Network (MBBN), which employs four different links for feature extraction and fuses features from different network depths. Embedding YOLOv11 into the MBBN network structure has several advantages. First, it expands the network depth of YOLOv11, improving feature extraction capabilities and increasing the accuracy of personnel detection. Second, different links correspond to different network depths, exhibiting high sensitivity to both small and large targets in images. Third, compared to the traditional single-branch sequential structure, the four-branch link structure is more stable; when a link experiences sudden events such as gradient vanishing or gradient diffusion, other links can quickly compensate.

[0018] 2. An anchor box matching algorithm based on Multi-Branch Bottleneck Network (MBBN) is proposed. According to the anchor box information for personnel detection in the improved YOLOv11 network, the personnel image is segmented from the original video frame image. The personnel image is represented by a one-dimensional vector of length 128 through the MBBN network. Then, by calculating the cosine distance, the personnel features in the two frames are compared and the personnel matching situation in the two frames is recorded.

[0019] 3. A method for tracking the trajectories of densely populated people in coastal zones is proposed, based on Multi-Branch Bottleneck Network (MBBN) and the DeepSort algorithm. This is achieved by designing hyperparameters as follows: The weighting function combines the person matching results of the MBBN network with those of the DeepSort algorithm, integrating the appearance and motion features of people to improve the accuracy of person matching.

[0020] 4. A risk area alarm method based on personnel trajectory information is proposed. This method utilizes personnel trajectory arrays... The system uses data to fit a straight line of motion trajectory, predicts subsequent motion paths, and performs intersection and position determination between the fitted straight line of motion trajectory and the plotted risk area rectangle. Based on the set pixel distance threshold, it comprehensively determines whether personnel have violated regulations by approaching or entering the risk area and issues timely warnings.

[0021] 5. A coastal zone risk early warning system based on intelligent perception of dynamic human trajectories is proposed. The system effectively combines the front-end module, back-end module, and algorithm module to form a complete detection system, which serves as an intelligent tool for coastal zone risk management and makes the risk management process more intelligent and detailed.

[0022] Example 1 This embodiment discloses a coastal zone crowd identification method based on an improved YOLOv11 network, including: Input a real-time video frame image; This invention utilizes an improved YOLOv11 network to locate and detect crowds in video frames. Considering the density of crowds in coastal areas and the near-to-far image distortion in video frames, and to enhance feature extraction capabilities for small targets, especially children, this invention proposes a Multiple-Branching Bottleneck Network (MBBN). This MBBN network reconstructs the traditional YOLOv11 network to adapt to the detection task in this scenario. The following sections describe this implementation from three aspects: YOLOv11 network reconstruction, model training, and model testing.

[0023] Step 1: YOLOv11 network reconstruction YOLOv11 is an efficient and accurate target detection network model, but for coastal population detection applications, further improvements are needed in the model's feature extraction and global feature fusion capabilities.

[0024] This invention proposes a Multiple-Branching-Bottleneck Network, the design structure of which is shown in the attached figure. Figure 1 As shown, this network structure mainly consists of CBS modules and Bottleneck modules. The design principle of this network structure is as follows: ① First, let's introduce the basic structures of the CBS and Bottleneck modules. The CBS module, as the basic convolutional unit of the YOLOv11 network, mainly consists of three parts: convolution operation (Conv), normalization layer (BatchNorm), and activation function layer (ReLU activation function, Swish activation function). In the convolution operation (Conv), K (kernel size) represents the kernel size, for example... , s(stride) represents the stride of the convolution window; the Bottleneck module consists of two CBS modules and a residual module, and is mainly used for feature extraction and feature fusion.

[0025] ②Based on the CBS module and the Bottleneck module, this invention constructs a multi-branch bottleneck network (MBBN). First, the input feature map is subjected to dimensionality reduction operation through a CBS module with a kernel of 1 and a stride of 1. The purpose of this step is to reduce the dimensionality of the input feature map and improve the computational efficiency of subsequent multi-link operations.

[0026] ③ The feature map from step ② is segmented at the dimensionality level into 4 equal parts. For example, the feature map is composed of... W represents the feature map dimension (number of channels), height, and width, respectively. If the feature map dimension after dimensionality reduction is... After segmentation, each feature map has a dimension of . .

[0027] ④ The feature map after segmentation in step ③ is subjected to feature extraction according to 4 different links. The first link keeps the feature map unchanged; the second link, the feature map is subjected to feature extraction once by the Bottleneck module; the third link, the feature map is subjected to feature extraction twice by the Bottleneck module; the fourth link, the feature map is subjected to feature extraction three times by the Bottleneck module. ⑤ Perform a concat concatenation operation on the feature extraction results of the four links in step 4, which is also a feature fusion process. Finally, perform a dimensionality transformation operation through a CBS module with a kernel of 1 and a stride of 1 to obtain a feature map of the specified output dimension.

[0028] ⑥ The designed multi-branch bottleneck network MBBN is embedded into the feature extraction unit of the YOLOv11 network to achieve structural optimization of the YOLOv11 network.

[0029] For the location detection of people in coastal zones, the above optimization scheme has the following benefits: ① After feature map segmentation, feature extraction is performed through four different links. Taking the fourth link as an example, the feature map is extracted through the Bottleneck module three times, which expands the network depth of the YOLOv11 network, improves the feature extraction capability, and improves the accuracy of personnel detection.

[0030] ② By concatenating the features extracted from four different networks using the Concat operation, feature map fusion at different network depths was achieved. A deeper network results in a larger model size and stronger feature extraction capabilities, focusing more on global image information; a shallower network results in a smaller model size and weaker feature extraction capabilities, focusing more on local image information, i.e., small target information. Based on this idea, the first and second networks, being shallower, are more sensitive to small target features in video frames, easily detecting children or small groups of targets at a distance in the video frame. The third and fourth networks, being deeper, have stronger feature extraction capabilities and are more sensitive to people closer to the camera, i.e., larger targets. Therefore, the MBBN network can effectively fuse feature information from different target groups.

[0031] ③ This optimization scheme greatly improves the robustness of the model. Compared with the traditional single-branch sequential structure, the 4-branch link structure is more stable. When a sudden situation such as gradient vanishing or gradient disappearance occurs in a certain link, other links can be used to supplement it in time and make appropriate corrections to the feature extraction results, so that the model has high stability in both the training and prediction stages.

[0032] Step 2: Model Training The hardware environment for network training in this embodiment is an Ubuntu operating system and an NVIDIA GeForce GTX 1080 Ti graphics card; the software environment is Python, with the deep learning part implemented using the PyTorch framework. During model training, the initial learning rate (lr0) was set to 0.01, the maximum iteration period (Epoch) was set to 1000, and the training batch size was set to 16. After training, the model training results were evaluated based on the convergence of the loss function and the precision metric. The obtained training results are shown in the attached figure. Figure 2 As shown, attached Figure 2 In this context, "Smoothing" represents the smoothing coefficient, adjusting the smoothness of the training curve. Recall, on the other hand, refers to the ratio of correctly predicted positive samples to the total number of positive samples, and its calculation formula is as follows: ④ The feature map after segmentation in step ③ is subjected to feature extraction according to 4 different links. The first link keeps the feature map unchanged; the second link, the feature map is subjected to feature extraction once by the Bottleneck module; the third link, the feature map is subjected to feature extraction twice by the Bottleneck module; the fourth link, the feature map is subjected to feature extraction three times by the Bottleneck module. ⑤ Perform a concat concatenation operation on the feature extraction results of the four links in step 4, which is also a feature fusion process. Finally, perform a dimensionality transformation operation through a CBS module with a kernel of 1 and a stride of 1 to obtain a feature map of the specified output dimension.

[0033] ⑥ The designed multi-branch bottleneck network MBBN is embedded into the feature extraction unit of the YOLOv11 network to achieve structural optimization of the YOLOv11 network.

[0034] For the location detection of people in coastal zones, the above optimization scheme has the following benefits: ① After feature map segmentation, feature extraction is performed through four different links. Taking the fourth link as an example, the feature map is extracted through the Bottleneck module three times, which expands the network depth of the YOLOv11 network, improves the feature extraction capability, and improves the accuracy of personnel detection.

[0035] ② By concatenating the features extracted from four different networks using the Concat operation, feature map fusion at different network depths was achieved. A deeper network results in a larger model size and stronger feature extraction capabilities, focusing more on global image information; a shallower network results in a smaller model size and weaker feature extraction capabilities, focusing more on local image information, i.e., small target information. Based on this idea, the first and second networks, being shallower, are more sensitive to small target features in video frames, easily detecting children or small groups of targets at a distance in the video frame. The third and fourth networks, being deeper, have stronger feature extraction capabilities and are more sensitive to people closer to the camera, i.e., larger targets. Therefore, the MBBN network can effectively fuse feature information from different target groups.

[0036] ③ This optimization scheme greatly improves the robustness of the model. Compared with the traditional single-branch sequential structure, the 4-branch link structure is more stable. When a sudden situation such as gradient vanishing or gradient disappearance occurs in a certain link, other links can be used to supplement it in time and make appropriate corrections to the feature extraction results, so that the model has high stability in both the training and prediction stages.

[0037] Step 2: Model Training The hardware environment for network training in this embodiment is an Ubuntu operating system and an NVIDIA GeForce GTX 1080 Ti graphics card; the software environment is Python, with the deep learning part implemented using the PyTorch framework. During model training, the initial learning rate (lr0) was set to 0.01, the maximum iteration period (Epoch) was set to 1000, and the training batch size was set to 16. After training, the model training results were evaluated based on the convergence of the loss function and the precision metric. The obtained training results are shown in the attached figure. Figure 2 As shown, attached Figure 2 In this context, "Smoothing" represents the smoothing coefficient, adjusting the smoothness of the training curve. Recall, on the other hand, refers to the ratio of correctly predicted positive samples to the total number of positive samples, and its calculation formula is as follows:

[0038] In the formula, True Positives (TP) represents the number of samples correctly classified as positive, i.e., the number of samples whose actual class and predicted class are both positive; False Negative (FN) represents the number of samples incorrectly classified as negative, i.e., the number of samples whose actual class is positive but whose predicted class is negative.

[0039] Step 3: Model Testing By optimizing the model training parameters and obtaining the optimal model training weights, the trained YOLOv11 network was applied to coastal zone population detection. The detection results are shown in the attached figure. Figure 3 As shown in the figure, the experimental results demonstrate that the YOLOv11 model incorporating the Multiple-Branching-Bottleneck-Network achieves high detection accuracy for both children and small, distant targets. This indicates that the 4-link branching feature extraction structure can effectively optimize the YOLOv11 network in terms of feature extraction and feature fusion.

[0040] Example 2 This embodiment discloses a method for tracking the trajectories of densely populated people in coastal zones based on Multi-Branch Bottleneck Network (MBBN) and DeepSort algorithm, including: The location anchor box results from the crowd detection in Example 1 are used to predict and match location anchor boxes using the DeepSort algorithm. The specific implementation process is as follows: Step 1: Anchor box matching based on Multi-Branch Bottleneck Network (MBBN) ① Using an improved YOLOv11 network, each frame of a coastal zone video is detected to obtain anchor box data for the location of all people in the video frame. The data format is as follows: ,in, This indicates the coordinates of the center point of the anchor frame rectangle. This represents the width of the anchor rectangle. This represents the height of the anchor rectangle. This represents the confidence level of the detection category. First, a confidence threshold of 0.7 is set, meaning that detection results for people with a confidence level below 0.7 are filtered out. Then, all people in the current frame image are segmented separately based on the anchor box data. ② A personnel feature extraction network is constructed based on the Multi-Branch Bottleneck Network (MBBN), and transformed into a one-dimensional vector of length 128 through a fully connected layer. The personnel images segmented separately in step ① are input into the feature extraction network, and finally the personnel features are represented by a one-dimensional vector of length 128.

[0041] ③ After step ②, all people in the two consecutive frames can be represented by a one-dimensional vector of length 128. Then, the cosine distance between the feature vectors of each person in the two consecutive frames is calculated. The magnitude of the cosine distance indicates the matching degree of the people in the two consecutive frames. The smaller the cosine distance, the higher the matching degree. In this design, considering the discrepancy between the total number of people in consecutive frames due to people leaving and entering the frame, a cosine distance threshold is needed to ensure matching accuracy. For example, if the previous frame detected 5 people, corresponding to 5 one-dimensional vectors of length 128, and the current frame shows one more person entering, detecting 6 people, corresponding to 6 one-dimensional vectors of length 128, then the cosine distance is calculated between each feature vector of the current frame and each feature vector of the previous frame. If only the minimum cosine distance is selected as the standard for matching people, all people will be matched, inevitably resulting in one false match. Therefore, a maximum cosine distance needs to be set. Only those values ​​less than this threshold and satisfying the minimum cosine distance can be used as the matching standard. This invention sets the maximum cosine distance to 0.15. The formula for calculating the cosine distance is as follows:

[0042] ④ Based on the personnel feature matching criteria in step ③, obtain the personnel detection anchor boxes with the highest matching degree in the two consecutive frames, and record the anchor box information. The detailed anchor box matching process is attached. Figure 4 As shown.

[0043] Step 2: Kalman filter algorithm for anchor frame prediction ①Based on YOLOv11 network personnel detection results Similar to step ① in step one, set the confidence threshold to 0.7, that is, filter out the test results of personnel with a confidence level lower than 0.7. Defined as a spatial model, where, To indicate the aspect ratio, i.e. To represent motion state, a motion velocity model is added to the spatial vectors in their respective image coordinate systems. Therefore, the tracking model of the positioning anchor frame consists of two parts: a spatial model and a motion model, which can be represented as an 8-dimensional state space vector. ; ② In the prediction phase of the Kalman filter algorithm, firstly, using the posterior estimate from the previous time step (k-1), the prior estimate of the state at the current time step k is obtained through the state transition matrix F transformation:

[0044] Among them, according to the equations of motion defined in physics The above formula can be expressed as:

[0045] Then, the posterior covariance estimate from the previous time step (k-1) is used to calculate the prior covariance estimate from the current time step k:

[0046] in, This represents the prior estimate of the covariance at the current time k. This represents the posterior estimate of the covariance at the previous time step (k-1). This represents the initial noise matrix.

[0047] ③ In the update phase of the Kalman filter algorithm, firstly, the Kalman gain matrix is ​​calculated. The formula is as follows:

[0048]

[0049] in, The observation matrix, i.e., the actual anchor frame position at time k, is represented by an 8-dimensional state space vector. Only keep as Spatial model data; The measurement state covariance matrix; Then, the prior estimates of the Kalman filter are... Through the observation matrix Project the image onto the measurement space and calculate the measured value. residual The formula is as follows:

[0050] After substituting the data, the above formula can be expressed as:

[0051] Then, the predicted and measured values ​​from the Kalman filter are fused according to the Kalman gain to obtain the posterior estimate. The announcement is as follows:

[0052] Finally, the posterior covariance of the Kalman filter is calculated, i.e., the updated covariance matrix value. The formula is:

[0053] ④ As time k changes, the Kalman filter algorithm iterates multiple times to obtain an accurate covariance estimation matrix. Based on the input personnel positioning anchor frame data and the motion model, it can effectively predict the anchor frame position after the personnel move.

[0054] Step 3: Use the Hungarian algorithm to perform anchor box matching. At time k, the detection data of the personnel positioning anchor frame is obtained through the YOLOv11 network. At the same time, the anchor frame prediction is performed by the Kalman filter algorithm. The predicted data of the personnel positioning anchor frame is obtained by calculating the covariance matrix at time k-1. Therefore, it is necessary to determine which two anchor frames select the same person based on the matching degree between the predicted anchor frame and the detected anchor frame, so as to realize the tracking and matching of the person.

[0055] First, the Mahalanobis distance between the detected data and the predicted data of the anchor frame needs to be calculated. The calculation formula is as follows:

[0056] in, and These represent the detection distribution and the predicted distribution, respectively. The covariance matrix between the two distributions; Finally, calculate The sum of the elements in the matrix, if The minimum sum of the matrices indicates a successful anchor box match. For example, the minimum sum of the matrices indicates a successful anchor box match. Each predicted anchor box data and all The first set of real-world anchor frame data is calculated using the above formula to obtain the first set of data. The similarity between each predicted anchor box and each real detected anchor box is calculated. If the similarity between two of them is the smallest, then the degree of matching between the two is considered to be higher, and the anchor box matching is finally completed.

[0057] Step 4: Using hyperparameters The weighting function merges the two matching schemes from step 1 and step 3. In step 1, feature extraction and cosine distance are performed using the Multi-Branch Bottleneck Network (MBBN) to achieve anchor box matching at the image appearance feature level. Simultaneously, in step 3, anchor box matching is achieved based on runtime information using a motion model and Mahalanobis distance. To effectively fuse the two matching schemes, the fusion formula designed in this paper is as follows:

[0058] In the above formula, Indicates the first The predicted anchor box data and the first The similarity of the detected anchor box data is as follows: the smaller the value, the higher the similarity, that is, the higher the degree of matching. The hyperparameters are set; the vector represents the first... After the predicted anchor boxes are extracted by the Multi-Branch Bottleneck Network (MBBN), they become one-dimensional vectors of length 128. Indicates the first After the detection anchor boxes are extracted by the Multibranched Bottleneck Network (MBBN), they become one-dimensional vectors of length 128. Indicates the first The predicted anchor box data and the first The similarity obtained after the detection anchor boxes are processed by the Hungarian matching algorithm.

[0059] Example 3 This embodiment discloses a risk area alarm method based on personnel trajectory information, including: ① Using Example 2, the location anchor frames of the same person in consecutive video frames are matched, and the matched anchor frame data is recorded in a one-dimensional array. The array data format is as follows: As a record of the person's movement trajectory, in order to ensure the timeliness of the recorded trajectory, a maximum of 40 latest anchor box matching results will be retained.

[0060] ② In the video frame, the center point of the trajectory array from step ① is... The personnel trajectory paths were plotted and connected, and the plotting results are attached. Figure 5 As shown. In the appendix Figure 5 In the middle, the narrow road area connected by reefs is a risk area. The reef road is narrow and slippery, and the water level on both sides is relatively deep, so the risk factor is high.

[0061] ③ Based on the personnel trajectory array, predict the movement trend of the personnel. Use the LinearRegression model from the scikit-learn library to determine the center point of the trajectory array. A straight line is fitted to obtain the equation of the line. Risk areas are manually marked on the video feed to obtain the positional information of the risk area rectangles. Then, it is determined whether the fitted trajectory line intersects with the risk area rectangle. If an intersection exists, it indicates that the person's subsequent movement trajectory may enter the risk area, requiring further confirmation of the person's positional distance to the risk area. The latest anchor frame center point of the person is calculated. The minimum distance is the vertical distance from the rectangle of the risk area. If the minimum distance is less than the pre-set pixel distance threshold, it indicates that the person has approached the risk area. The system will control the audio equipment to broadcast a warning that the tourist should stay away from the risk area and notify the patrol personnel in the area to intervene and dissuade them in time. The pixel distance threshold is related to the installation position of the camera and needs to be adjusted according to the size of the video screen, because the distance is described in pixels.

[0062] Through detailed explanations of Examples 1, 2, and 3, the algorithm flow of the coastal zone risk early warning method based on intelligent perception of population dynamic trajectories is summarized and presented in the attached flowchart. Figure 6 As shown. Example 4

[0063] This embodiment discloses a coastal zone risk early warning system based on intelligent perception of population dynamic trajectories. The overall system framework is shown in the attached figure. Figure 7 Mainly includes: Step 1: Capture real-time video frame images from the camera.

[0064] Step 2: Build a front-end page based on the Vue architecture. This will display real-time video frame detection results and provide early warning alerts.

[0065] Step 3: Build the system backend based on the Django architecture, embedding a personnel detection algorithm based on the improved YOLOv11 network, a personnel tracking and matching algorithm based on the multi-branch bottleneck network MBBN and DeepSort, and a risk area early warning decision algorithm, scheduling the execution order of the algorithms, and connecting the frontend, backend, database and other data access services.

[0066] Step 4: System testing. Based on the functional requirements of each module, test the system's performance and fix any bugs or related issues.

[0067] Step 5: System Deployment. To improve system stability and robustness, this system deployment adopts an Nginx-based clustered deployment scheme. This deployment architecture mainly consists of a master proxy server, slave proxy servers, static resource servers, file storage servers, streaming media servers, and back-end ordinary servers. The file storage servers store images of personnel illegally entering risk areas detected by the algorithm model.

[0068] Based on computer vision and deep learning technologies and combined with software development technology, a coastal zone risk early warning system based on intelligent perception of dynamic human trajectories was developed. On the one hand, the algorithm was implemented and its stability and reliability were tested. On the other hand, the system can serve as an auxiliary tool for coastal zone risk management, making the risk management process more intelligent and detailed. It can help alleviate the workload of coastal zone patrol personnel and promote the informatization and intelligentization of coastal zone risk management, and has broad application prospects.

[0069] Those skilled in the art will recognize that the units, i.e., algorithm steps, of the various examples described in connection with this embodiment can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0070] The above description is merely a preferred embodiment of the present invention and is used only to illustrate the technical solution of the present invention, and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A coastal zone risk early warning method based on intelligent perception of population dynamic trajectories, characterized in that, include: 1) Collect training samples from the target population in the coastal zone, and create corresponding training and test datasets using the LabelImg annotation tool; 2) Based on the objective needs of densely populated coastal areas, intertwined hidden risks, and complex environments, the YOLOv11 network was improved by embedding a Multiple-Branching-Bottleneck-Network, abbreviated as MBBN; four different links were used for feature extraction, and features from different network depths were fused. 4) Input the training set into the improved YOLOv11 network for training, and use the test set to validate the trained model to generate a more stable coastal dense population detection model. 5) Detect dense populations in coastal areas based on the trained YOLOv11 network.

2. The method according to claim 1, characterized in that, Tracking trajectories of densely populated coastal areas based on Multi-Branch Bottleneck Network (MBBN) and DeepSort algorithm includes the following steps: 1) Based on the detection results of dense coastal populations using the improved YOLOv11 network, false detection data are filtered out according to confidence level; 2) Based on the personnel location anchor box data obtained by the YOLOv11 network, the coastal zone personnel are segmented into single images. Through the feature matching network constructed based on the Multi-Branch Bottleneck Network (MBBN), a 128-dimensional feature vector representing the current personnel features is extracted. That is, each detected personnel in each image corresponds to a 128-dimensional feature vector. The 128-dimensional personnel features extracted from the current video frame image are compared with the 128-dimensional personnel features extracted from the previous video frame images. 3) Based on the personnel location anchor box data obtained by the YOLOv11 network, the anchor box position of the personnel in the video frame image is predicted by the DeepSort algorithm, including: on the one hand, the personnel location anchor box is predicted and the covariance matrix parameter is updated by the Kalman filter algorithm; on the other hand, the personnel location anchor box detected by the YOLOv11 network and the personnel location anchor box predicted by the Kalman filter algorithm are matched by the Hungarian matching algorithm. 4) Combining the matching results of steps 2) and 3), we obtain accurate personnel matching anchor boxes, complete the real-time matching and tracking of each person in the crowd, and record personnel matching information and personnel trajectory information.

3. The method according to claim 2, characterized in that, Issue alerts for risk areas, including: 1) For high-risk areas prone to accidents, mark them in advance in video images and record the rectangular information of the risk areas; 2) Based on the recorded trajectory information, filter out discrete points whose differences exceed the set value; 3) Fit the trajectory line to the remaining discrete points using the least squares method; 4) Calculate whether the trajectory line intersects with the risk area rectangle. If there is an intersection, it means that the person's future activity path may enter the risk area; if there is no intersection, it means that the person's future activity path will not pass through the risk area. 5) If the trajectory line intersects with the risk area, calculate the minimum distance between the current person's position and the risk area rectangle, set a pixel distance threshold. If the minimum distance is less than the pixel distance threshold, it indicates that the person has approached the risk area. Control the audio equipment to broadcast a warning that tourists should stay away from the risk area, and notify the patrol personnel in the area to intervene and dissuade them in time.

4. The method according to claim 3, characterized in that, This method includes the following modules: 1) Video acquisition module: Input real-time video frame images; 2) System Algorithm Module: Based on the improved YOLOv11 network, dense crowd detection and localization are performed on the input real-time video frame images. The trajectory tracking of dense people in the coastal zone is performed through the multi-branch bottleneck network MBBN and the DeepSort algorithm. Finally, the system decides whether to issue a notification or alarm based on the personnel trajectory information and the risk area rectangle information. 3) System front-end module: The front-end page structure is built based on the Vue architecture and according to business requirements; 4) System backend module: Based on the Django architecture, the backend business logic is designed according to business needs, the scheduling and execution of the algorithm are controlled, the detection images of people approaching or entering the risk area are saved to the file server, and the URL address of the file storage is returned as the detection evidence. 5) System Deployment Module: An Nginx-based clustered deployment solution is adopted; the hardware devices for building the Nginx cluster include a master proxy server, slave proxy servers, static resource servers, file storage servers, and streaming media servers.

5. The method according to claim 1, characterized in that, A multi-branch bottleneck network MBBN is built based on the CBS and Bottleneck modules of the YOLOv11 network. First, the input feature map is subjected to dimensionality reduction operation through a CBS module with a kernel of 1 and a stride of 1 to reduce the dimension of the input feature map and improve the computational efficiency of subsequent multi-link operations. The dimensionality-reduced feature map is segmented into four equal parts at the dimensionality level. The segmented feature map is subjected to feature extraction along four different links. The first link keeps the feature map unchanged; the second link involves feature extraction through the Bottleneck module once; the third link involves feature extraction through the Bottleneck module twice; and the fourth link involves feature extraction through the Bottleneck module three times. The feature extraction results from the four links are concatenated using the Concat operation, which is the process of feature fusion. Finally, the feature map is transformed by the CBS module with a kernel of 1 and a stride of 1 to obtain the feature map of the specified output dimension. The designed multi-branch bottleneck network MBBN is embedded into the feature extraction unit of the YOLOv11 network to achieve structural optimization of the YOLOv11 network.

6. The method according to claim 5, characterized in that, When a sudden situation of gradient vanishing or gradient diffusion occurs in a certain link, other links can be used as a timely supplement for feature extraction.

7. The method according to claim 2, characterized in that, The improved YOLOv11 network is used to detect each frame of a coastal zone video, obtaining anchor box data for the location of all people in the video frame. The data format is as follows: ,in, This indicates the coordinates of the center point of the anchor frame rectangle. This represents the width of the anchor rectangle. This represents the height of the anchor rectangle. This represents the confidence level of the detection category. First, the confidence threshold is set to 0.7, meaning that detection results for people with a confidence level below 0.7 are filtered out. Then, all people in the current frame image are segmented separately based on the anchor box data.