Anomaly detection method for covert social security behavior

By introducing regional concealment and observability and combining them with the Transformer autoencoder to analyze pedestrian trajectories, the problem of difficulty in detecting hidden social security behaviors in existing technologies is solved, and accurate identification and early warning of latent behaviors are achieved.

CN120071249BActive Publication Date: 2025-10-17TIANXUN RUIDA COMM TECH CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510144716.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-10
Publication Date
2025-10-17
Estimated Expiration
2045-02-10

AI Technical Summary

Technical Problem

Existing technologies are difficult to detect hidden social security behaviors because these behaviors do not show any abnormalities in speed, posture, etc., making them difficult to identify using existing detection methods.

Method used

Regional concealment and regional observability are introduced to measure the concealment and observability of the activity space. The region number, concealment and observability sequences are learned through the Transformer autoencoder to build a site-spotting behavior detection and early warning model.

Benefits of technology

It can accurately detect hidden social security behaviors, provide early warnings, and improve social security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120071249B_ABST
    Figure CN120071249B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of abnormal detection methods for concealment social security behavior, by grid division to target building outside monitoring video stream image;According to the grid region sequence, concealment degree sequence and observable sequence that pedestrian trajectory passes through in order are generated;Transformer self-encoder is constructed to learn the grid region sequence, concealment degree sequence and observable sequence;Acquire target building to be detected monitoring video stream, and the grid region sequence, concealment degree sequence and observable sequence of the pedestrian trajectory of video to be detected are input as input sequence into Transformer self-encoder, and reconstruction sequence is obtained;According to the error of reconstruction sequence and input sequence, calculate abnormal score, when the abnormal score exceeds the threshold value, determine that there is concealment social security behavior.The present application solves the problem that existing technology is difficult to detect concealment social security behavior.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of social security monitoring, and relates to an abnormality detection method for hidden social security behavior. BACKGROUND

[0002] Important places in modern cities, especially banks, have serious security risks. In order to effectively stop crimes and reduce social security risks, a large number of intelligent monitoring cameras and monitoring systems have been widely laid out in urban areas, and key places are the top priority. At the same time, under the impetus of video analysis and artificial intelligence, video anomaly detection technology has developed rapidly.

[0003] Those who are dangerous to social security, such as bank robbers, will repeatedly scout, observe camera positions, guard patrol situations, etc. before committing a crime, carefully planning the crime, and the behavior during this period is hidden social security behavior. If it can be accurately detected, it can provide early warning to protect social security. There are currently a variety of related technical solutions. Morais et al. proposed an abnormal behavior detection method based on skeleton feature prediction, which first extracts the skeleton trajectory of pedestrians, decomposes it into global trajectory and local body posture, and then models it with MPED-RNN, judges the abnormality by measuring the difference between the prediction and the actual situation, but the skeleton trajectory point is too many, and the algorithm calculation is large. Rodrigues et al. proposed an abnormal behavior detection model based on multiple time scales, which is a multi-layer structure, each layer learns the distribution rule of normal posture trajectory under a certain time scale, and combines the prediction results of each layer to judge the abnormality, but it is difficult to accurately balance the prediction results of each layer. Sun et al. designed an abnormal trajectory detection network, which uses YOLOv5 and Deep-Sort algorithms to extract target trajectories, processes a series of processes to obtain trajectory abnormality scores, and designs a speed calculation module to obtain speed abnormality scores, and judges whether the target is abnormal by combining the two. Georgescu et al. proposed a video anomaly detection framework based on adversarial training, which extracts the forward movement, backward movement and appearance information of the target, reconstructs and fuses the reconstruction error through the encoder to judge the abnormality.

[0004] However, the detection input of the prior art is pedestrian posture and trajectory appearance, and these motion information and time sequence information can only detect motion and speed abnormalities, i.e. significant abnormal behavior, and hidden social security behavior has no abnormalities in speed, posture, etc. Therefore, it is difficult to be detected. SUMMARY

[0005] In order to solve the above problems existing in the prior art, the application provides an abnormality detection method for concealed social security behavior, which aims to introduce a region concealment degree to measure the concealment of an activity space, introduce a region observability to measure the observability of the activity space, and establish a footmark behavior detection early warning model in accordance with the above. Compared with the existing space-time analysis method, the model introduces social attribute analysis, fuses and analyzes the social characteristics and the space-time characteristics through the region concealment degree and the region observability, and explores a new way for the incubation period social security behavior early warning research.

[0006] The object of the application can be achieved by the following technical solutions:

[0007] The application provides an abnormality detection method for concealed social security behavior, comprising the following steps:

[0008] S1, acquiring a target building external monitoring video stream data in a period of time as a training set, and extracting a pedestrian trajectory in the monitoring video stream by using a trajectory monitoring algorithm;

[0009] S2, performing grid division on each frame of video stream image, assigning a separate ID to each grid region, generating a sequence composed of ID numbers in the order of the grid regions passed by the pedestrian trajectory, and recording the sequence as a region number sequence;

[0010] S3, defining a concealment degree of each grid region according to the ratio of the number of pedestrians passing through each grid region to the total number of pedestrians of all grid regions;

[0011] S4, generating a sequence composed of the concealment degrees in the order of the grid regions passed by the pedestrian trajectory, and recording the sequence as a concealment degree sequence;

[0012] S5, taking the center of each grid region as an observation point, extending the line of sight from the observation point to the target building to obtain the visible length of the target building;

[0013] S6, calculating the ratio of the visible length of the target building to the total length to obtain the observability of the observation point to the target monitoring;

[0014] S7, generating a sequence composed of the observability in the order of the grid regions passed by the pedestrian trajectory, and recording the sequence as an observability sequence;

[0015] S8, constructing a Transformer autoencoder to learn the region number sequence, the concealment degree sequence and the observability sequence;

[0016] S9, acquiring a target building monitoring video stream to be detected, inputting the region number sequence, the concealment degree sequence and the observability sequence of the pedestrian trajectory of the video to be detected into the Transformer autoencoder as an input sequence to obtain a reconstruction sequence;

[0017] S10. Calculate an anomaly score based on the error between the reconstructed sequence and the input sequence. When the anomaly score exceeds a preset threshold, determine that there is a concealed social security behavior.

[0018] Furthermore, the method of extracting pedestrian trajectories from a surveillance video stream using a trajectory monitoring algorithm includes the following steps:

[0019] S11. Video stream data reading and preprocessing: Read the target building's external surveillance video stream data and load it into the processing system. Then, preprocess each frame of the image, using image enhancement to improve clarity and denoising to reduce noise interference.

[0020] S12, pedestrian target detection: load the pre-trained pedestrian detection model, scan each frame of the video stream, identify the pedestrian area and output its location information and confidence score, and determine the pedestrian target based on this;

[0021] S13. Pedestrian tracking initialization: A threshold is set based on the confidence score output by pedestrian detection to screen valid pedestrian targets. A tracker is then initialized for the valid pedestrian targets. The tracker is used to predict the current frame position based on the pedestrian's previous frame state, and the subsequent tracking process is started.

[0022] S14. Pedestrian tracking and trajectory update: In subsequent frames, the tracker continues to track the initialized pedestrian target, updates the tracking status based on the match between the pedestrian's actual position and the predicted position, and records the pedestrian's position in each frame to form and continuously improve the pedestrian trajectory information.

[0023] Furthermore, the concealment degree is calculated as follows:

[0024] ,

[0025] Where, H i For the i The concealment of each grid area; n i For the i The number of pedestrians passing through the grid area; N is the total number of pedestrians in all grid areas.

[0026] Furthermore, the observability is calculated as follows:

[0027] ,

[0028] Where, V i is the observability of the target building; Visible length is the visible length of the target building; Total length is the total length of the target building.

[0029] Further, the Transformer autoencoder comprises the following construction steps:

[0030] S81, determine input and output and model architecture: take the region number sequence, the concealment sequence and the observability sequence as the model input, take the original input sequence as the expected output, and select the self-encoder based on the Transformer architecture;

[0031] S82, build the encoder: first create an input embedding layer to convert various input sequences into vector representations; build a multi-head attention layer to set multiple attention heads to capture complex relationships between sequence elements from multiple angles; add a feedforward neural network layer for nonlinear transformation to extract high-level features; finally, perform layer normalization and residual connection operations after the multi-head attention layer and the feedforward neural network layer;

[0032] S83, build the decoder: set the input embedding layer to process the initial input of the decoder; build a masked multi-head attention layer to decode sequentially using the masking technique; add a multi-head attention layer that interacts with the encoder to utilize the encoder features; set the feedforward neural network layer to complete the sequence reconstruction task, and perform layer normalization and residual connection;

[0033] S84, set the loss function and the optimizer: select the loss function to measure the difference between the decoder restored sequence and the original input sequence, and minimize the difference as the training target; select the optimizer to adjust the model parameters according to the gradient update strategy to improve the training efficiency and convergence speed;

[0034] S85, model training and evaluation: divide the data set containing related sequences into training set, validation set and test set, use the training set to train the built model, calculate the difference according to the loss function and update the parameters until the predetermined target is reached. After training, evaluate the model performance with the test set, if not up to standard, adjust the architecture, parameters or hyperparameters and retrain.

[0035] Further, in step S84, the loss function is configured as a mean square error loss function; and the optimizer is configured as a stochastic gradient descent.

[0036] Further, in step S10, the abnormal score is calculated according to the following formula:

[0037] ,

[0038] In the formula, AS represents the abnormal score; is the input concealment sequence, is the reconstructed concealment sequence; is the input observability sequence, is a reconstructed observability sequence; n is the number of elements of the sequence; represents all consecutive y IDs in the reconstructed region number sequence are the same as the input region number sequence, k is the number of consecutive IDs in the reconstructed and input region number sequences that are the same, represents that the more the number of consecutive identical IDs y is, the larger the value is; , and are weight coefficients of the concealment sequence, the observability sequence, and the region number sequence, respectively.

[0039] Further, the weight coefficients are determined by calculating the correlation coefficients of the sequences in the historical period and the known occurrence of hidden social safety behaviors.

[0040] Further, in step S10, when it is determined that there is a hidden social safety behavior, the pedestrian with abnormal behavior in the input sequence is identified.

[0041] Advantages of the present application:

[0042] By dividing the target building external monitoring video stream image into a grid; generating a region number sequence, a concealment sequence, and an observability sequence in the order of the grid region passed by the pedestrian trajectory; constructing a Transformer autoencoder to learn the region number sequence, the concealment sequence, and the observability sequence; obtaining a target building monitoring video stream to be detected, inputting the region number sequence, the concealment sequence, and the observability sequence of the pedestrian trajectory of the video to be detected into the Transformer autoencoder as an input sequence, and obtaining a reconstructed sequence; calculating an abnormal score according to the error between the reconstructed sequence and the input sequence, and determining that there is a hidden social safety behavior when the abnormal score exceeds a preset threshold. The present application solves the problem that the prior art is difficult to detect hidden social safety behaviors. BRIEF DESCRIPTION OF DRAWINGS

[0043] In order to facilitate those skilled in the art to understand, the present application will be further described below with reference to the drawings.

[0044] Figure 1 is a flowchart of an abnormality detection method for hidden social safety behaviors in the present application.

[0045] Figure 2 is a flowchart of extracting pedestrian trajectories in a monitoring video stream using a trajectory monitoring algorithm in an embodiment of the present application.

[0046] Figure 3 is a flowchart of constructing a Transformer autoencoder in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to further illustrate the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the specific implementation methods, structures, features and effects of the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments.

[0048] See also Figures 1-3 , this application provides a method for detecting anomalies in concealed social security behaviors, comprising the following steps:

[0049] S1. Obtain a period of target building exterior surveillance video stream data as a training set, and use the trajectory monitoring algorithm to extract pedestrian trajectories in the surveillance video stream;

[0050] In this example, a training set is obtained from surveillance video streams of the building's exterior over a period of time. First, a specific time period is determined for the collection, such as the past week or month, ensuring that this period covers human activity at different times of day and in different weather conditions. Then, all video streams recorded during this period are collected from surveillance cameras located around the target building (e.g., a bank). This raw, unprocessed video provides a rich source of foundational material.

[0051] Next, a trajectory monitoring algorithm is used to extract pedestrian trajectories. Advanced object detection technology is first applied to enable the algorithm to accurately locate individual pedestrians in each frame of video. This relies on detection models trained with extensive data and possessing excellent pedestrian feature recognition capabilities, such as the commonly used YOLO series of models. These models can effectively distinguish pedestrians from other objects even against complex backgrounds.

[0052] After detection, pedestrian tracking begins. Each detected pedestrian is assigned a unique identifier. Based on the correlation between their position, appearance, and other features between consecutive frames, a tracking algorithm similar to the Kalman filter is used to predict the current frame's position based on the pedestrian's state information in the previous frame and make matching corrections. This ensures tracking continuity, even if the pedestrian is temporarily obscured or their motion changes.

[0053] Finally, the position information of each tracked pedestrian in different frames is arranged in chronological order to generate a complete motion trajectory, which is presented in the form of coordinate points and accompanying timestamps, speed estimates, etc. In this way, the pedestrian trajectory in the surveillance video stream is successfully extracted, providing an important basis for subsequent analysis.

[0054] Furthermore, the method of extracting pedestrian trajectories from a surveillance video stream using a trajectory monitoring algorithm includes the following steps:

[0055] S11, video stream data reading and preprocessing: reading the target building external monitoring video stream data and loading it into the processing system, then preprocessing each frame of image, improving the definition by image enhancement and reducing noise interference by noise reduction processing;

[0056] S12, pedestrian target detection: loading a pre-trained pedestrian detection model (such as YOLO, Faster R-CNN, etc.), scanning each frame of image of the video stream, identifying the pedestrian area and outputting its position information and confidence score, and determining the pedestrian target accordingly;

[0057] S13, pedestrian tracking initialization: setting a threshold according to the confidence score output by the pedestrian detection to filter valid pedestrian targets, and initializing a tracker (such as Kalman filter tracker) for the valid pedestrian targets, using the tracker to predict the current frame position based on the previous frame state of the pedestrian, and starting the subsequent tracking process;

[0058] S14, pedestrian tracking and trajectory updating: in the subsequent frames, the tracker continuously tracks the initialized pedestrian target, updates the tracking state according to the matching situation of the actual position and the predicted position of the pedestrian, and records the position of the pedestrian in each frame to form and continuously improve the pedestrian trajectory information.

[0059] S2, grid division is performed on each frame of video stream image, each grid region is assigned a separate ID, and a sequence composed of ID numbers is generated in the order of the grid regions passed by the pedestrian trajectory, denoted as region number sequence;

[0060] In this embodiment, in the process of in-depth analysis of the target building external monitoring video stream data to extract more valuable information, the method of grid division for each frame of video stream image is adopted. Specifically, for each frame of image in the video stream, it is uniformly divided into several grid regions of the same size according to the pre-set rules. These grids are like a fine "net" that completely covers the entire image, ensuring that each pixel in the image can belong to a certain specific grid region. In order to facilitate subsequent accurate tracking and recording of the flow of pedestrian trajectory between different grid regions, each grid region is assigned a separate and unique ID number. This ID is like the exclusive "identity card" of each grid region, which can be clearly and accurately identified and distinguished in the entire analysis system.

[0061] Once a pedestrian's trajectory is successfully extracted from a surveillance video stream using a trajectory monitoring algorithm, a unique sequence can be generated based on the pedestrian's path in the image, following the order of the grid areas their trajectory passes through. This sequence consists entirely of the ID numbers corresponding to each grid area the pedestrian passed through, arranged in sequence, and is specifically recorded as the area number sequence. This generated area number sequence contains a wealth of information, demonstrating the pedestrian's movement path between different areas of the video frame in a concise and intuitive manner. This provides a crucial data foundation for further analysis of pedestrian behavior patterns, activity ranges, and interactions with the surrounding environment.

[0062] S3. Define the concealment degree of each grid area based on the ratio of the number of pedestrians passing through each grid area to the total number of pedestrians passing through all grid areas;

[0063] In this embodiment, after meticulously dividing the target building's exterior surveillance video stream into grids and obtaining the corresponding area number sequence for pedestrian trajectories, a specific method is used to define the concealment level of each grid area. Specifically, the number of pedestrians passing through each grid area is counted, and the total number of pedestrians passing through all grid areas is calculated. The concealment level of each grid area is then determined by the ratio of the number of pedestrians passing through each grid area to the total number of pedestrians passing through all grid areas.

[0064] This concealment index is crucial for identifying covert social security activities. Those attempting to engage in covert social security activities, such as criminals scouting locations or preparing to commit crimes, often choose relatively secluded areas for observation, waiting, or initial action. The calculated grid area concealment can accurately identify areas that are less frequently visited by pedestrians, i.e., those that are relatively hidden.

[0065] When analyzing surveillance video data, if certain individuals' movements are frequently observed in highly concealed areas and their behavior exhibits unusual characteristics, such as prolonged lingering or unusual behavior, this could indicate a risk of concealed social security activities. Quantitative analysis of concealment provides an effective approach to environmental characteristics, helping to more discern unusual behaviors that may harbor malicious intent amidst normal pedestrian activity. This helps provide early warnings and prevent social security incidents.

[0066] Furthermore, the concealment degree is calculated as follows:

[0067] ,

[0068] Where, H i For thei The concealment of each grid area; n i For the i The number of pedestrians passing through the grid area; N is the total number of pedestrians in all grid areas.

[0069] It should be noted that, from the above formula, it can be seen that the greater the concealment of the grid area, the fewer pedestrians pass through it.

[0070] S4. Generate a sequence of concealment degrees according to the order of the grid areas passed by the pedestrian trajectory, which is recorded as the concealment degree sequence;

[0071] In this embodiment, when a pedestrian moves outside a target building, their trajectory will sequentially pass through different grid areas. By combing through previously recorded pedestrian trajectory information and extracting the corresponding concealment value for each grid area in the order in which they passed through it, these sequentially acquired concealment values ​​are then arranged to form a complete concealment sequence. This generated concealment sequence contains rich and valuable information. It continuously and intuitively presents the changing concealment levels of the areas a pedestrian passes through throughout their activity. This is crucial for analyzing pedestrian behavior patterns and identifying potential hidden social security behaviors. For example, if a pedestrian's concealment sequence shows abnormalities such as frequent stops in high-concealment areas or prolonged periods in areas with gradually increasing concealment, combined with the pedestrian's other behavioral characteristics, it is possible to infer whether they are suspected of engaging in hidden social security behaviors, thereby providing powerful data support and decision-making basis for relevant security monitoring and risk prevention efforts.

[0072] S5. The center of each grid area is used as the observation point, and the sight line is extended from the observation point to the target building to obtain the visible length of the target building;

[0073] In this embodiment, when conducting an in-depth analysis of the target building's exterior environment, a grid-area-based observation method is employed to obtain visual information about the target building. Specifically, the center of each grid area is set as an observation point. This observation point acts as a specific observation position from which to conduct relevant observation operations on the target building.

[0074] Once the observation point is determined, the next step is to extend the line of sight from this observation point to the target building. This process simulates the line of sight of a person looking towards the target building from the center of the grid area. When extending the line of sight, various factors in the actual environment must be taken into account, such as the presence of obstructions (such as trees and other buildings), which may affect the extension of the line of sight and prevent the full view of the target building.

[0075] As the line of sight extends from the observation point toward the target building, we measure and record the length of the unobstructed portion of the target building that can be clearly seen. This is defined as the visible length of the target building. This visible length is a relative measurement that reflects the effective range within which the target building can be directly observed from the observation point at the center of a specific grid area. By obtaining the visible length of the target building corresponding to each grid area, we can further analyze the visual relationship between different grid areas and the target building, providing important data foundation for subsequent research, such as the degree of attention paid to the target building by analysts at different locations and the assessment of potential security monitoring fields of view.

[0076] S6. Calculate the ratio of the visible length of the target building to the total length to obtain the observability of the observation point for target monitoring;

[0077] In this embodiment, by setting the center of each grid area as the observation point and extending the line of sight from the observation point to the target building, the visible length of the target building from each observation point is determined. Next, in order to more accurately measure the degree of monitoring of the target building from each observation point, the indicator of "observability" is introduced. The specific calculation method is to first determine the total length of the target building. This total length can be obtained through field measurement, architectural design drawings or other reliable measurement methods. It represents the actual length scale of the target building as a whole. Then, the previously obtained visible length of the target building from each observation point is ratioed to the total length of the target building.

[0078] The result of this calculation is the observability of the target building from the observation point. This ratio intuitively reflects the degree to which the target building can be observed from a specific observation point. For example, an observability value of 1 indicates that the entire target building can be fully observed from that observation point. However, values ​​closer to 0 indicate that less of the target building can be observed from that observation point, which in turn increases the impact of factors such as obstruction, and the more limited the monitoring effect on the target building.

[0079] Furthermore, the observability is calculated as follows:

[0080] ,

[0081] wherein, V i an observable degree of the target building; Visible length a visible length of the target building; Total length a total length of the target building.

[0082] S7, generating a sequence composed of observable degrees in the order of the grid areas passed by the pedestrian trajectory, denoted as an observable degree sequence;

[0083] In this embodiment, the corresponding observable degree values are extracted in the order of the grid areas passed by the pedestrian, and are arranged in order, thereby forming a sequence composed of observable degrees, which is specially denoted as an observable degree sequence. The observable degree sequence carries rich information, which can intuitively and continuously show the dynamic changes of the observable degree of the target building in the entire activity process of the pedestrian. It is of great significance in identifying hidden social security behaviors. For example, if the observable degree sequence of a pedestrian shows that the observable degree is extremely low in a specific area and stays for a long time, or the observable degree changes abnormally, combined with other behavior characteristics of the pedestrian, such as sneaking around, frequently appearing in hidden areas, etc., it can provide strong clues for inferring whether the pedestrian has hidden social security behaviors, and further provide important data support and decision basis for relevant security monitoring and risk prevention work.

[0084] S8, constructing a Transformer autoencoder to learn the region number sequence, the concealment degree sequence, and the observable degree sequence;

[0085] In this embodiment, the Transformer autoencoder is an advanced deep learning model, which is constructed based on the Transformer architecture and mainly works cooperatively by the encoder and the decoder. The core principle is the attention mechanism. The multi-head attention mechanism in the encoder is the key, which can simultaneously examine each element of the input sequence from multiple angles, accurately calculate the correlation weight between elements, and deeply capture the complex relationship between elements at different positions in the sequence. For the region number sequence, the concealment degree sequence, and the observable degree sequence involved by us, it can understand the internal relationship between different grid areas, concealment degrees, and observable degrees. Then, the feedforward neural network layer will perform nonlinear transformation on the data processed by the attention mechanism, and further extract high-level features.

[0086] The working of the decoder is equally important. Its masked multi-head attention mechanism limits the view to only the sequence elements before the current position when calculating the attention weights, thus ensuring the step-by-step reconstruction of the original input sequence in order, avoiding the reconstruction of unreasonable information due to the acquisition of future information in advance. Moreover, the decoder is also equipped with a feedforward neural network layer to assist in the final sequence reconstruction. In the current context of analyzing covert social security behaviors, the Transformer autoencoder plays a key role in multiple aspects.

[0087] In terms of data feature mining, it can deeply analyze sequence data such as region number, concealment, and observability, and mine the hidden patterns and rules. For example, it discovers specific sequence patterns of pedestrians frequently appearing in areas with high concealment and low observability, as well as the correlation rules of different grid regions in pedestrian trajectories with changes in concealment and observability. For understanding pedestrian behavior patterns, it comprehensively grasps the behavior dynamics of pedestrians around the target building by analyzing the mutual relationship between sequences and internal change rules, and infers whether their behavior intentions are abnormal, such as deliberately avoiding areas with high observability. In terms of abnormal behavior recognition, after fully learning various sequence patterns under normal circumstances, it can detect abnormal sequences as soon as possible and provide a strong basis for identifying covert social security behaviors, thereby helping to ensure social security.

[0088] Further, the Transformer autoencoder includes the following construction steps:

[0089] Step 1: Determine input and output and model architecture

[0090] Define input and output: First, determine the input and output of the model according to the task to be processed. In the current context, the input is the region number sequence, the concealment sequence, and the observability sequence, which record the activity-related information of pedestrians around the target building from different angles. The output is expected to restore these sequences as accurately as possible in order to learn the patterns and rules in the sequences by comparing the differences between the input and the output.

[0091] Determine the model architecture: Choose to build the autoencoder based on the Transformer architecture. The Transformer architecture is known for its powerful processing capabilities for sequence data, and its core components include multi-head attention mechanisms, feedforward neural network layers, etc., which will be configured and built in detail in the following steps.

[0092] Step 2: Build the encoder part

[0093] Input Embedding Layer: Create an input embedding layer to process different types of input sequences (region number sequence, obscuring degree sequence, observability sequence) and convert them into vector representations suitable for model processing. This step can use common embedding methods such as linear embedding or embedding based on pre-trained models to ensure that each element has a suitable representation in the vector space for subsequent calculations.

[0094] Multi-Head Attention Layer: Then build a multi-head attention layer, set multiple attention heads (usually 2 to 8 or according to specific needs). Each attention head will independently calculate the correlation weight between each position and other positions in the input sequence. By parallel computing multiple attention heads, the model can capture the complex relationships between sequence elements from multiple angles. For example, for the region number sequence, the correlation between different grid regions in the pedestrian trajectory can be analyzed; for the obscuring degree sequence, the mutual influence of obscuring degree changes at different positions can be understood.

[0095] Feedforward Neural Network Layer: After the multi-head attention layer, add a feedforward neural network layer. This layer consists of multiple fully connected neurons and performs further nonlinear transformation on the features processed by the multi-head attention layer to extract more abstract and higher-level feature representations. It can enhance the model's ability to capture input sequence features and convert sequence data into a form more suitable for subsequent processing and analysis.

[0096] Layer Normalization and Residual Connection: To make the model training more stable and efficient, perform layer normalization operations after the multi-head attention layer and the feedforward neural network layer to normalize the input of each layer, reducing problems such as gradient vanishing or gradient explosion. At the same time, use residual connection to add the input of each layer to the output after processing by that layer, ensuring that gradients can be more directly transmitted between layers, which helps to alleviate the degradation problem of deep neural networks during training.

[0097] Step 3: Build the Decoder Part

[0098] Input Embedding Layer: Depending on the specific design of the decoder, an input embedding layer may need to be created to process the initial input of the decoder. If the input of the decoder is the feature vector output by the encoder, this embedding layer may further process it to make it more suitable for internal calculations of the decoder.

[0099] Masked Multi-Head Attention Layer: Set up a masked multi-head attention layer, similar to the multi-head attention layer in the encoder, but here use the masking technique. The mask will restrict the model to only see the sequence elements before the current position when calculating attention weights, preventing the model from seeing future information during decoding, ensuring the order and reasonableness of the decoding process. In this way, the decoder can gradually reconstruct the original input sequence based on existing information.

[0100] Multi-Head Attention Layer Interaction with Encoder: Add a multi-head attention layer to interact with the feature vectors output by the masked multi-head attention layer. By applying the multi-head attention mechanism again, the decoder can better utilize the features extracted by the encoder to further accurately reconstruct the original input sequence.

[0101] Feedforward Neural Network Layer: Similarly, set up a feedforward neural network layer to further nonlinearly transform the features processed in the previous steps to complete the reconstruction task of the original input sequence.

[0102] Layer Normalization and Residual Connection: Like the encoder, layer normalization and residual connection operations are also performed between the layers of the decoder to ensure stable and efficient training, and to alleviate the degradation problem.

[0103] Step 4: Set up loss function and optimizer

[0104] Select Loss Function: To measure the difference between the sequence restored by the decoder and the original input sequence, select an appropriate loss function. Common ones like Mean Squared Error (MSE) loss function, which quantifies this difference by calculating the average of the squares of the differences between the corresponding elements of the restored sequence and the original sequence. The training goal of the model is to minimize the value of this loss function, so that the decoder can accurately reconstruct the original input sequence as much as possible.

[0105] Select Optimizer: At the same time, select an appropriate optimizer to adjust the parameters of the model, so that the model can continuously progress towards minimizing the loss function. Common optimizers such as Stochastic Gradient Descent (SGD) and its variants (such as Adagrad, Adadelta, Adam, etc.), which update the model's parameters according to different gradient update strategies to improve the training efficiency and convergence speed of the model.

[0106] Step 5: Model training and evaluation

[0107] Prepare training data: Divide the collected data set containing region number sequences, concealment sequences and observability sequences into training set, validation set and test set according to certain proportions. Usually, the training set is used to train the model, the validation set is used to adjust the parameters and hyperparameters of the model during training, and the test set is used to evaluate the performance of the model finally.

[0108] Model training: The Transformer autoencoder is trained using the training set. During training, the training set data is fed into the model's encoder in batches. After encoding and decoding, a restored sequence is obtained. The difference between the restored sequence and the original sequence is then calculated using a pre-defined loss function. The optimizer then uses this difference to update the model's parameters. This training process is repeated until the model reaches a predetermined training goal, such as when the loss function value drops to an acceptable level or a certain number of training rounds have been completed.

[0109] Model Evaluation: After training is complete, the model is evaluated using the test set. Model performance is assessed by calculating metrics such as loss function value, precision, and recall (determined based on the specific task requirements) on the test set. If the model performance does not meet expectations, adjustments to the model architecture, parameters, or hyperparameters may be necessary, and retraining may be necessary until satisfactory performance is achieved.

[0110] S9. Obtain the surveillance video stream of the target building to be detected, and input the area number sequence, concealment sequence, and observability sequence of the pedestrian trajectory in the video to be detected as the input sequence into the Transformer autoencoder to obtain a reconstructed sequence;

[0111] In this example, to conduct in-depth analysis and monitoring of pedestrian activity and related environmental characteristics around a target building, we first need to obtain surveillance video stream data of the target building to be inspected. These surveillance video streams are like a dynamic information repository, fully recording the flow of people and changes in the scene around the target building within a specific time period.

[0112] Next, we applied the same analytical methods previously employed to extract key information about pedestrian trajectories from the acquired surveillance video stream. Specifically, we generated corresponding region number sequences, concealment degree sequences, and observability degree sequences based on the order of the grid regions the pedestrian trajectories passed through.

[0113] The area number sequence can clearly show the order in which pedestrians pass through the various grid areas outside the target building, reflecting the distribution characteristics of pedestrian activity paths in different areas; the concealment sequence quantifies the concealment degree of each area from the perspective of pedestrian activity based on the ratio of the number of pedestrians passing through each grid area to the total number of pedestrians passing through all grid areas; the observability sequence is obtained by calculating the ratio of the visible length of each grid area as an observation point to the total length of the target building. It reflects the changes in the observability of the target building when observed from different areas.

[0114] After the generation of the above three sequences, they are inputted into the already constructed and well-trained Transformer autoencoder as input sequences. With its powerful ability to extract and learn features from sequential data, the Transformer autoencoder will perform deep processing on the input sequences.

[0115] Through components such as multi-head attention mechanism and feedforward neural network layers in the encoder part, the input sequences are feature-encoded to capture the intrinsic relationships and hidden patterns between sequence elements. Then, the decoder part tries to restore a sequence as similar as possible to the original input based on the feature vectors output by the encoder, and this final obtained sequence is the reconstructed sequence.

[0116] The reconstructed sequence obtained is of great significance for further analyzing pedestrian behavior patterns and identifying possible covert social security behaviors. By comparing the differences between the input sequence and the reconstructed sequence, we can find abnormal situations in pedestrian activities, such as changes in the concealment or observability of certain areas in the reconstructed sequence that do not conform to the normal pattern, or abnormal deviations in the area number sequence of the pedestrian trajectory, etc., thereby providing strong data support and decision basis for relevant security monitoring and risk prevention work.

[0117] S10, calculate an anomaly score according to the error between the reconstructed sequence and the input sequence, and determine that there is a covert social security behavior when the anomaly score exceeds a preset threshold.

[0118] In this embodiment, the anomaly score is calculated according to the error between the reconstructed sequence and the input sequence. This error calculation process is an important means to measure the deviation degree of the model's reconstruction effect from the original input. Specifically, we will calculate the difference between each element in the input sequence (corresponding to the area number, concealment, and observability at each time step or position) and the corresponding element in the reconstructed sequence. Then, according to certain calculation rules, these differences are integrated to form a value that quantifies the overall error degree, which is the anomaly score.

[0119] When the abnormal score is calculated, it is compared with a preset threshold. The preset threshold is determined based on a large number of experiments, data analysis, and evaluation of possible normal and abnormal situations in combination with actual application scenarios. It represents a boundary between normal behavior patterns and possible hidden social security behaviors. When the abnormal score exceeds the preset threshold, it is determined that there is a hidden social security behavior. This is because, under normal circumstances, a well-trained Transformer autoencoder should be able to better reconstruct the input sequence, so that the error between the reconstructed sequence and the input sequence is kept within a relatively small range. Once the abnormal score exceeds the threshold, it means that the features of the current input pedestrian trajectory-related sequence deviate greatly from the normal patterns learned by the model. This deviation is likely due to abnormal behavior of the pedestrian, such as deliberately choosing to stay in a hidden area for a long time, avoiding areas with high observability to engage in suspicious activities, etc. These behaviors are often associated with hidden social security behaviors. In this way, the error between the reconstructed sequence and the input sequence is used to calculate the abnormal score, and the preset threshold is used for judgment, thereby providing an effective quantitative analysis method for timely discovering and identifying hidden social security behaviors, which helps to strengthen the safety monitoring and risk prevention of the target building's surrounding environment.

[0120] ;

[0121] Further, the abnormal score is calculated by the following formula:

[0122] ,

[0123] wherein AS represents the abnormal score; is the input concealment sequence, is the reconstructed concealment sequence; is the input observability sequence, is the reconstructed observability sequence; and n is the number of elements of the sequence. represents the probability that all consecutive y IDs in the reconstructed region number sequence are the same as the input region number sequence, k is the number of consecutive identical IDs in the reconstructed and input region number sequences, represents that the more consecutive identical IDs y, the larger the value; 、 and are weight coefficients of the concealment sequence, the observability sequence, and the region number sequence, respectively.

[0124] The weight coefficients are determined by analyzing and statistically analyzing a large amount of historical data (including pedestrian-related sequence data that has been confirmed to have or not have hidden social security behaviors).

[0125] Correlation analysis: Calculate the correlation coefficient of each sequence with the occurrence of known covert social security behavior. The higher the correlation of the sequence, the higher the weight given in the judgment. For example, after analysis, it is found that the correlation between the concealment sequence and the occurrence of covert social security behavior is the strongest, the observability sequence is second, and the region number sequence is third. Therefore, the weight distribution can be adjusted accordingly, such as setting the weight of the concealment sequence to 50%, the weight of the observability sequence to 30%, and the weight of the region number sequence to 20%.

[0126] In addition, some feature importance evaluation tools in machine learning algorithms can also be used, such as the feature importance index in the random forest algorithm. The region number sequence, the concealment sequence, and the observability sequence are input as features, and the importance scores of each feature (i.e., each sequence) are obtained through model training and analysis. Then, the weights are allocated according to the score proportion.

[0127] Further, in step S10, when it is determined that there is a covert social security behavior, the pedestrian with abnormal behavior in the input sequence is identified.

[0128] In this embodiment, it is necessary to further analyze which pedestrians in the input sequence have abnormal behavior. Only when the specific abnormal behavior pedestrians are identified, can subsequent monitoring, investigation or prevention measures be taken more targetedly. In order to realize the identification of pedestrians with abnormal behavior, the input sequence is analyzed in more detail. First, review the region number sequence to see if there is an abnormal pattern in the order of grid regions passed by each pedestrian's trajectory. For example, do some pedestrians frequently enter and exit grid regions with high concealment and low observability, or do their trajectories appear to be circuitous, long-stay, etc. in certain regions, which do not conform to the normal flow direction. Through analysis of these region number sequence features, some pedestrians with suspicious behavior can be preliminarily screened out.

[0129] Secondly, further confirmation is made in combination with the concealment sequence. Observe the concealment of the grid regions passed by the pedestrians preliminarily screened out. If it is found that a pedestrian often passes through regions with extremely high concealment and stays there for a long time, it further increases the possibility of abnormal behavior. In addition, the observability sequence can also provide important clues. If a pedestrian's trajectory always appears in regions with extremely low observability, or the observability suddenly decreases significantly when passing through certain regions and is accompanied by abnormal stay behavior, it also suggests that the pedestrian may have abnormal behavior.

[0130] By considering the features of the region number sequence, the concealment sequence, and the observability sequence, pedestrians with abnormal behavior in the input sequence can be more accurately identified, thereby laying a solid foundation for further monitoring, investigation, and taking appropriate security measures for these specific pedestrians, effectively ensuring the safety and order of the environment around the target building.

[0131] The above merely describes the preferred embodiments of the present application, and is not intended to limit the present application in any form. Although the present application has been disclosed with the preferred embodiments as above, it is not intended to limit the present application. Any person skilled in the art can make some changes or modifications to the above disclosed technical content to obtain equivalent embodiments with equivalent changes, without departing from the technical solution of the present application. Any modification, change, and equivalent modification of the above embodiments, which is made according to the technical essence of the present application, without departing from the technical solution of the present application, still belongs to the scope of the technical solution of the present application.

Claims

1. A method for detecting anomalies in concealed social security behaviors, characterized by: The following steps are involved: S1. Obtain a period of target building exterior surveillance video stream data as a training set, and use the trajectory monitoring algorithm to extract pedestrian trajectories in the surveillance video stream; S2. Divide each frame of the video stream into a grid, assign a separate ID to each grid area, and generate a sequence of ID numbers according to the order of the grid areas passed by the pedestrian trajectory, which is recorded as the area number sequence; S3. Define the concealment degree of each grid area based on the ratio of the number of pedestrians passing through each grid area to the total number of pedestrians passing through all grid areas; S4. Generate a sequence of concealment degrees according to the order of the grid areas passed by the pedestrian trajectory, which is recorded as the concealment degree sequence; S5. The center of each grid area is used as the observation point, and the sight line is extended from the observation point to the target building to obtain the visible length of the target building; S6. Calculate the ratio of the visible length of the target building to the total length to obtain the observability of the observation point for target monitoring; S7. Generate a sequence of observable degrees according to the order of the grid areas passed by the pedestrian trajectory, which is recorded as the observable degree sequence; S8. Construct a Transformer autoencoder to learn the region number sequence, concealment sequence, and observability sequence; S9. Obtain the surveillance video stream of the target building to be detected, and input the area number sequence, concealment sequence, and observability sequence of the pedestrian trajectory in the video to be detected as the input sequence into the Transformer autoencoder to obtain a reconstructed sequence; S10. Calculate an anomaly score based on the error between the reconstructed sequence and the input sequence. When the anomaly score exceeds a preset threshold, determine that there is a concealed social security behavior.

2. The method for detecting anomalies in concealing social security behaviors according to claim 1, characterized in that: The method of extracting pedestrian trajectories from a surveillance video stream using a trajectory monitoring algorithm includes the following steps: S11. Video stream data reading and preprocessing: Read the target building's external surveillance video stream data and load it into the processing system. Then, preprocess each frame of the image, using image enhancement to improve clarity and denoising to reduce noise interference. S12, pedestrian target detection: load the pre-trained pedestrian detection model, scan each frame of the video stream, identify the pedestrian area and output its location information and confidence score, and determine the pedestrian target based on this; S13. Pedestrian tracking initialization: A threshold is set based on the confidence score output by pedestrian detection to screen valid pedestrian targets. A tracker is then initialized for the valid pedestrian targets. The tracker is used to predict the current frame position based on the pedestrian's previous frame state, and the subsequent tracking process is started. S14. Pedestrian tracking and trajectory update: In subsequent frames, the tracker continues to track the initialized pedestrian target, updates the tracking status based on the match between the pedestrian's actual position and the predicted position, and records the pedestrian's position in each frame to form and continuously improve the pedestrian trajectory information.

3. The method for detecting anomalies in concealing social security behaviors according to claim 1, characterized in that: The calculation formula of the concealment degree is: , Where, H i For the i The concealment of each grid area; n i For the i The number of pedestrians passing through the grid area; N is the total number of pedestrians in all grid areas.

4. The method for detecting anomalies in concealing social security behaviors according to claim 1, characterized in that: The observability is calculated as follows: , Where, V i is the observability of the target building; Visible length is the visible length of the target building; Total length is the total length of the target building.

5. The method for detecting anomalies in concealing social security behaviors according to claim 1, characterized in that: The Transformer autoencoder includes the following construction steps: S81. Determine the input, output, and model architecture: Use the region number sequence, concealment sequence, and observability sequence as the model input, and the original input sequence as the expected output. Select the Transformer architecture to build the autoencoder. S82. Build the encoder: First, create an input embedding layer to convert various input sequences into vector representations; build a multi-head attention layer, setting multiple attention heads to capture the complex relationships between sequence elements from multiple angles; add a feedforward neural network layer to perform nonlinear transformations to extract high-level features; Finally, layer normalization and residual connection operations are performed after the multi-head attention layer and the feedforward neural network layer respectively; S83, build decoder: set up input embedding layer to process initial input of decoder; Build a masked multi-head attention layer and use masking technology to decode in sequence; Add a multi-head attention layer that interacts with the encoder to utilize encoder features; set up a feedforward neural network layer to complete the sequence reconstruction task, and perform layer normalization and residual connections; S84. Set the loss function and optimizer: Select a loss function to measure the difference between the decoder's restored sequence and the original input sequence, with minimizing this difference as the training goal; select an optimizer to adjust model parameters based on the gradient update strategy to improve training efficiency and convergence speed; S85. Model training and evaluation: Divide the dataset containing related sequences into training set, validation set, and test set. Use the training set to train the constructed model, calculate the difference based on the loss function, and update the parameters until the predetermined goal is achieved.

6. The method for detecting anomalies in concealing social security behaviors according to claim 5, characterized in that: In step S84, the loss function is configured as a mean square error loss function; and the optimizer is configured as stochastic gradient descent.

7. The method for detecting anomalies in concealing social security behaviors according to claim 1, characterized in that: In step S10, when it is determined that there is a behavior of concealing social security, pedestrians with abnormal behavior in the input sequence are identified.

Citation Information

Patent Citations

  • Personnel group behavior monitoring method based on video analysis

    CN114863352A

  • Airport security check behavior pattern analysis and abnormal state detection method and system

    CN114898257A