AI-based park intrusion detection and response system
Through the AI-based campus intrusion detection system, combined with YOLOv5, LSTM and Hungarian algorithm, the coordinated optimization of dynamic risk assessment and early warning response of park intrusion behavior is achieved, the accuracy and response efficiency of intrusion detection are improved, and a closed-loop control link for environmental perception and response execution is built.
Patent Information
- Application Number
- CN202510885933.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2045-06-30
AI Technical Summary
Traditional park intrusion detection systems are prone to misjudgment when multiple targets are interlaced or ambient light changes. The false alarm rate is high, making it difficult to distinguish between real intrusion behavior and equipment mistriggering. The moving object detection algorithm has blind spots in the trajectory continuity analysis of slow moving or intermittent targets, resulting in insufficient response timeliness.
Using an AI-based campus intrusion detection system, video stream data is obtained through the target trajectory acquisition module, the YOLOv5 algorithm is called to extract two-dimensional coordinate trajectory, combined with the event density analysis module and the disturbance behavior recognition module, the LSTM model is used to analyze the vector angle changes, generate density increment and disturbance marks, and in response to the joint control execution module, the Hungarian algorithm is called to match the thermal imaging equipment, and the equipment frame rate is adjusted for joint control.
It realizes high sensitivity perception and accurate judgment of abnormal situations in complex scenarios, reduces false alarm rate, shortens response delay, forms a full-process automated security system, and reduces the dependence on manual review.
Smart Images

Figure CN120580776A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition technology, and in particular to an AI-based campus intrusion detection and response system. Background Art
[0002] The field of image recognition technology involves a technical system that uses optical sensors to collect feature information of target objects and convert it into digital signals for pattern recognition. Its core issues include image acquisition equipment deployment plans, feature information extraction algorithm design, recognition model training optimization processes, and multi-source data fusion processing mechanisms. It is primarily used for dynamic target tracking and abnormal behavior analysis in security monitoring scenarios. Traditional campus intrusion detection and response systems are perimeter protection systems based on a fixed-viewing-angle surveillance camera network architecture. They employ static background modeling technology combined with a moving object detection algorithm. By setting fixed warning zone boundary thresholds, infrared sensors generate alarm signals when a moving object crosses a preset electronic fence, and rely on a human monitoring center for video footage review.
[0003] Traditional systems are limited by fixed-viewpoint monitoring and static background modeling technology, and are prone to misjudgment when dealing with the interlaced movement of multiple targets or sudden changes in ambient lighting. Their rigid detection mechanism based on preset electronic fences is difficult to adapt to non-threatening movement scenarios such as vegetation swaying or animal intrusions, resulting in a high false alarm rate. The response mode that relies on manual review has the problem of insufficient response timeliness at night or in severe weather conditions. The triggering method of single-point infrared sensors cannot effectively distinguish between real intrusion behavior and false triggering of equipment. The moving object detection algorithm has blind spots in the trajectory continuity analysis of slowly moving or intermittently stopping targets, resulting in the risk of missing key threats. Summary of the Invention
[0004] The purpose of the present invention is to address the shortcomings of the existing technology and propose an AI-based campus intrusion detection and response system.
[0005] To achieve the above objectives, the present invention adopts the following technical solutions: An AI-based campus intrusion detection and response system includes:
[0006] The target trajectory acquisition module is used to obtain video stream data through the image perception terminal, call the YOLOv5 algorithm to extract the target's two-dimensional coordinate trajectory, establish a unique ID tag and record the displacement vector, and pass the trajectory data to the event density analysis module;
[0007] An event density analysis module is configured to obtain the trajectory data based on a time window, calculate the ratio of the number of newly added event frames to the time span, compare the difference between the current increase rate and the historical average rate, generate a density increase flag when the difference between consecutive cycles exceeds a dynamic density threshold, and transmit the density increase flag to the response joint control execution module;
[0008] The disturbance behavior recognition module is used to obtain target motion vector data, call the LSTM model to analyze the vector angle change sequence, calculate the cosine similarity of adjacent vector angles, generate a disturbance flag when the number of sign reversals and angle changes exceed a threshold, and pass the disturbance flag to the response joint control execution module;
[0009] The response joint control execution module is used to receive the density increase mark and the disturbance mark, call the Hungarian algorithm to match the mapping relationship between the thermal imaging device and the target coordinates, adjust the device frame rate to a set multiple, and generate a joint control instruction.
[0010] As a further solution of the present invention, the trajectory data specifically includes a two-dimensional coordinate sequence, a unique identity identifier, and a displacement vector parameter; the density increment mark includes an event frame time ratio, an amplification rate difference, and the number of times the cycle threshold exceeds the standard; the disturbance mark specifically refers to a vector angle sequence, a similarity fluctuation value, and a sign reversal frequency; and the joint control instruction includes a device coordinate mapping table, a frame rate adjustment multiple, and thermal imaging linkage parameters.
[0011] As a further embodiment of the present invention, the dynamic density threshold is obtained by optimizing and calculating the historical event data using a gradient descent method, including inputting the historical event rate value into a loss function and iteratively adjusting the threshold parameter until the weighted sum of the false alarm rate and the false negative rate is minimized;
[0012] The sign reversal number threshold and the angle change threshold are determined based on the 95th percentile of the statistical distribution of 100 groups of abnormal behavior samples;
[0013] The device frame rate adjustment factor = target displacement rate (m / s) × device response coefficient / reference frame rate, where the device response coefficient takes a value in the range of 0.2-0.5.
[0014] As a further solution of the present invention, the target trajectory acquisition module includes:
[0015] The video stream acquisition submodule obtains the optical signal stream through the image perception terminal, uses a frame rate adaptive mechanism to capture dynamic images, converts the original analog signal into a digital matrix format, divides the data units according to the time axis and adds millisecond-level timestamps to generate video stream data;
[0016] The coordinate parsing submodule inputs the YOLOv5 feature extraction network based on the video stream data, extracts the target edge features through a three-layer convolution kernel, uses a non-maximum suppression algorithm to eliminate overlapping detection frames, calculates the horizontal and vertical coordinate values of the target center point, and constructs a spatiotemporal mapping table to generate a two-dimensional coordinate sequence;
[0017] The trajectory identification submodule calls the two-dimensional coordinate sequence to construct a motion trajectory map, uses the Hungarian algorithm to match the target positions of adjacent time points, predicts the trajectory offset through Kalman filtering, calculates the coordinate difference between consecutive frames to construct a displacement parameter set, assigns a unique coding identifier to the complete motion path, and generates trajectory data.
[0018] As a further solution of the present invention, the Kalman filter predicted trajectory offset is combined with the Hungarian algorithm matching to correct the target position matching error through the predicted value, thereby improving the continuity of the target ID across frames.
[0019] As a further solution of the present invention, the event density analysis module includes:
[0020] The trajectory interception submodule divides the trajectory data into segments according to a preset time window, compares the event records of adjacent time nodes frame by frame, counts the number of newly added event frames, divides the value by the window time span, and obtains the event rate value;
[0021] The rate difference calculation submodule extracts the event rate value of the current time window and calculates the rate change amplitude compared with the previous window using the formula:
[0022]
[0023] Calculate the dynamic difference parameter, perform algebraic difference calculation on the current increase rate and the reference value, and generate the rate difference coefficient;
[0024] Among them, ΔR represents the dynamic difference parameter, V c Represents the current window event rate value, unit: frame / second, V p Represents the event rate value of the previous window, T w Represents the time window span coefficient, ranging from 0.8 to 1.2, W i Represents the sliding weight factor of the i-th adjacent window, which is distributed according to the exponential decay law, V si Represents the rate value of the i-th adjacent window, V base represents the benchmark rate value, which is the historical 30-day average. k represents the total number of adjacent windows and is fixed at 5.
[0025] The mark generation submodule sets a continuous cycle counter, and when it is detected that the rate difference coefficient breaks through the dynamic density threshold three times in a row, activates the increment judgment logic and outputs a density increment mark.
[0026] As a further solution of the present invention, the disturbance behavior recognition module includes:
[0027] The motion vector acquisition submodule obtains the displacement data of the target three-dimensional coordinate system, extracts the displacement increment at a fixed sampling interval, constructs the vector modulus and direction angle parameters, uses the sliding mean algorithm to reduce the noise of the original data, and generates a motion vector set;
[0028] The angle timing analysis submodule constructs an LSTM network structure. The input layer receives the motion vector set, the hidden layer stores the time step features, calculates the ratio of the dot product of adjacent vectors to the product of the module length, establishes a spatial direction change sequence, extracts the radian change gradient of consecutive time steps through bidirectional window scanning, and outputs the angle timing features.
[0029] The disturbance feature determination submodule performs a first-order difference operation on the angle time series feature, detects the starting and ending positions of the negative value interval, sets the sign reversal number threshold and the angle change threshold, and when the cumulative number of reversals exceeds the threshold and the total amount of radian change reaches the benchmark, performs a logical AND operation to combine the determination conditions and obtain a disturbance mark.
[0030] As a further solution of the present invention, the reference value of the total amount of radian change is 1.5π radians, which is determined by testing the median of the cumulative radian changes of 200 groups of abnormal trajectories.
[0031] As a further solution of the present invention, the response joint control execution module includes:
[0032] The instruction parsing submodule receives the density increment mark and the disturbance mark, verifies the timestamp and coordinate data format, extracts the three-dimensional coordinates and priority coefficients in the mark, performs a logical AND operation to merge the valid bits of the double marks, and generates a control parameter set;
[0033] The device matching submodule constructs a two-dimensional matrix of the thermal imaging device ID and the control parameter set, calculates the Euclidean distance between the device's field of view angle coverage radius and the target coordinates, iteratively solves the minimum path cost using the Hungarian algorithm, updates the device status identifier, and outputs a mapping relationship table;
[0034] The frame rate control submodule establishes a frame rate adjustment coefficient calculation model according to the device response delay and target displacement rate in the mapping relationship table, multiplies the reference frame rate by the adjustment coefficient, encapsulates the device address code and control parameters, and obtains the joint control instruction.
[0035] As a further solution of the present invention, the conversion relationship between the device response delay and the target displacement rate is frame rate adjustment factor = target displacement rate (m / s) × device response coefficient (0.2-0.5) / reference frame rate (30 frames / s).
[0036] Compared with the prior art, the advantages and positive effects of the present invention are:
[0037] In the present invention, by integrating the spatiotemporal feature analysis of the target trajectory and the motion vector pattern recognition, the dynamic risk assessment of the intrusion behavior and the coordinated optimization of the early warning response are realized. The multi-dimensional data association calculation and incremental event density monitoring are adopted to effectively improve the perception sensitivity and judgment accuracy of abnormal situations in complex scenarios. Combined with the continuous time series modeling and disturbance feature extraction of the motion vector, the ability to capture camouflaged behavior and irregular motion patterns is enhanced. Through the intelligent matching and parameter adaptive adjustment of multi-source sensing equipment, a closed-loop control link between environmental perception and response execution is constructed, which significantly reduces the dependence on manual review and shortens the response delay from behavior recognition to disposal action, forming a full-process automated security system covering early warning analysis and linkage disposal. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 This is a flow chart of the overall structure of the system of the present invention;
[0039] Figure 2 This is the internal flow chart of the target trajectory acquisition module of the present invention;
[0040] Figure 3 This is the internal flow chart of the event density analysis module of the present invention;
[0041] Figure 4 This is the internal flow chart of the disturbance behavior identification module of the present invention;
[0042] Figure 5 This is the internal flow chart of the response joint control execution module of the present invention. DETAILED DESCRIPTION
[0043] To make the purpose, technical solutions and advantages of the present invention clearer, the following is a detailed description of the technical solutions based on software implementation in conjunction with the system architecture diagram and embodiments. It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present invention and do not constitute a limitation on the scope of protection.
[0044] In the description of this invention, the system architecture relationships or data processing flows indicated by terms such as "layer," "module," "interface," "data flow," "client," and "server" are defined based on the architecture diagrams or flow charts corresponding to the embodiments. This expression is intended solely to clarify the logical relationships between the various elements of the technical solution and does not limit the physical deployment form. The term "plurality" encompasses two or more technical units, including but not limited to scalable elements such as multiple data nodes, processing threads, service instances, or functional components. The specific number will be determined based on the actual business scenario and requires special explanation.
[0045] See also Figure 1 and Figure 2 The present invention provides a technical solution: an AI-based campus intrusion detection and response system comprising:
[0046] The target trajectory acquisition module is used to obtain video stream data through the image perception terminal, call the YOLOv5 algorithm to extract the target's two-dimensional coordinate trajectory, establish a unique ID tag and record the displacement vector, and pass the trajectory data to the event density analysis module;
[0047] The target trajectory acquisition module includes:
[0048] The video stream acquisition submodule obtains the optical signal stream through the image perception terminal, uses a frame rate adaptive mechanism to capture dynamic images, converts the original analog signal into a digital matrix format, divides the data units according to the time axis and adds millisecond-level timestamps to generate video stream data;
[0049] The video stream acquisition submodule first uses a Hikvision iDS-2CD7A47E-IZHS image sensor, deployed on the campus perimeter wall at a height of 4 meters and a 30-degree pitch angle, to capture optical signal streams with a resolution of 1920x1080 pixels. The CMOS image sensor within the terminal converts the captured photons into analog electrical signals, which are then quantized into a digital matrix using a 12-bit analog-to-digital converter (ADC). An adaptive frame rate mechanism is activated, calculating the average rate of change in pixel grayscale values between two consecutive frames in real time. If this rate is less than 0.5%, the system identifies a low-motion scene and sets the acquisition frame rate to 15 frames per second. If the rate is greater than or equal to 0.5%, it identifies a high-motion scene and increases the acquisition frame rate to 30 frames per second. For example, at time t1, the average pixel change rate is 0.2%, and the frame rate is set to 15 frames per second. At time t2, due to a person entering the frame, the change rate jumps to 1.8%, and the frame rate is automatically adjusted to 30 frames per second. Each data unit, or image frame, is immediately synchronized with the campus' central time server via the Network Time Protocol (NTP) upon generation. A millisecond-accurate timestamp is appended in the format YYYYMMDDHHMMSS.sss, for example, "20250620093015.123." Ultimately, this sequence of timestamped digital matrices constitutes the video stream data delivered to the coordinate resolution submodule.
[0050] The coordinate parsing submodule inputs the YOLOv5 feature extraction network based on video stream data, extracts target edge features through a three-layer convolution kernel, uses a non-maximum suppression algorithm to eliminate overlapping detection frames, calculates the horizontal and vertical coordinates of the target center point, and constructs a spatiotemporal mapping table to generate a two-dimensional coordinate sequence;
[0051] After receiving the video stream data, the coordinate parsing submodule feeds each frame (e.g., a 1920x1080 digital matrix) into the feature extraction network of a pre-trained YOLOv5s model. The first layer of this network has a 6x6 convolution kernel with a stride of 2, which is used to quickly reduce the image size and extract coarse-grained features. The second layer has a 3x3 convolution kernel with a stride of 2, which extracts more detailed information such as edges and corners. The third layer also has a 3x3 convolution kernel with a stride of 1, which deeply integrates the feature maps of the previous layer. In a given frame, the model initially identifies two overlapping detection boxes that may belong to the same person: BoxA (confidence level 0.92) and BoxB (confidence level 0.88). The non-maximum suppression (NMS) algorithm is then applied to calculate the intersection-over-union (IoU) ratio between the two detection boxes, which is calculated by dividing the area of the intersection of the two detection boxes by the area of their union. If the calculated IoU value is 0.7, which is higher than the preset NMS threshold of 0.6, the system will eliminate the detection box BoxB with lower confidence. The pixel coordinates of the remaining BoxA are (x min =512,y min =240,x max =572,y max =480). The system then calculates the horizontal and vertical coordinates of the center point of the detection frame using the following calculation method: center =(x min +x max ) / 2 and y center =(y min +y max ) / 2. Substituting the values, we get the center coordinates (542,360). This coordinate is recorded together with the timestamp of the corresponding frame "20250620093015.156" in a time-space mapping table. The data structure of the table is a two-dimensional array, with each row containing [timestamp, x coordinate, y coordinate]. After continuous processing, a two-dimensional coordinate sequence is formed, for example
[0052] [[20250620093015.123,540,355],[20250620093015.156,542,360],...].
[0053] The trajectory identification submodule uses a two-dimensional coordinate sequence to construct a motion trajectory map, uses the Hungarian algorithm to match the target positions at adjacent time points, predicts the trajectory offset through Kalman filtering, calculates the coordinate difference between consecutive frames to construct a displacement parameter set, assigns a unique coding identifier to the complete motion path, and generates trajectory data;
[0054] The Kalman filter predicts the trajectory offset and combines it with the Hungarian algorithm to correct the target position matching error through the predicted value, thus improving the continuity of the target ID across frames.
[0055] The trajectory data specifically includes a two-dimensional coordinate sequence, a unique identifier, and a displacement vector parameter.
[0056] The trajectory identification submodule calls the two-dimensional coordinate sequence generated above to construct a motion trajectory map. At time point t1 (corresponding to frame F1), the system detects target A with coordinates (542, 360). At the next time point t2 (corresponding to frame F2), the system detects two targets, B1 (545, 366) and B2 (810, 450). At this time, the Kalman filter module first predicts that the position of target A at time F2 should be (544.5, 365.8) based on the velocity and acceleration state of target A at F1. Then, the Hungarian algorithm constructs a cost matrix to calculate the Euclidean distance between the predicted position of target A and the positions of all newly detected targets. The algorithm selects the matching pair with the lowest cost, namely (A, B1). Therefore, the system determines that B1 is the continuation of target A in the next frame and assigns B1 a unique identifier for target A (for example, a UUID "f47ac10b-58cc-4372-a567-0e02b2c3d479"). At the same time, the state of the Kalman filter uses the actual measured position of B1 (545, 366) to correct its internal model. The coordinate differences between consecutive frames are calculated and a set of displacement parameters is constructed. For example, the displacement vector from F1 to F2 is (545-542, 366-360) = (3, 6). After the complete motion path of target A (for example, all coordinate points from entering the field of view to leaving the field of view) is completed, the system assigns it a unique coding identifier "Path_20250620_0017". The resulting trajectory data integrates these three pieces of information into a structured data object: {Unique identifier: "f47ac10b-58cc-4372-a567-0e02b2c3d479", trajectory code: "Path_20250620_0017", data: [[timestamp, x, y, dx, dy], ...]}, where dx and dy represent the displacement vector parameters.
[0057] See also Figure 1 and Figure 3 ,The event density analysis module is used to obtain trajectory data based on the time window, calculate the ratio of the number of new event frames to the time span, compare the difference between the current increase rate and the historical average rate, and generate a density increase mark when the difference between consecutive cycles exceeds the dynamic density threshold, and pass the density increase mark to the response joint control execution module;
[0058] The event density analysis module includes:
[0059] The trajectory interception submodule divides the trajectory data into segments according to the preset time window, compares the event records of adjacent time nodes frame by frame, counts the number of newly added event frames, divides the value by the window time span, and obtains the event rate value;
[0060] The trajectory interception submodule divides the trajectory data segments received from the target trajectory acquisition module according to a preset 2-second time window. For example, the start and end time of a time window is from 10:00:00 to 10:00:02 on June 20, 2025. At the start of the window, the system records the unique identity identifier (ID) set in the current field of view as {ID_A, ID_B}. At the end of the window, the set is updated to {ID_A, ID_B, ID_C, ID_D}. The submodule compares the event records of the two time nodes through set difference operation, and counts the newly added event ID as {ID_C, ID_D}, so the number of newly added event frames is 2. Subsequently, this value is divided by the window time span (2 seconds) to obtain the event rate value V of the current window. c = 2 frames / 2 seconds = 1.0 frame / second. This process is repeated after each time window, generating a series of continuous event rate values.
[0061] The rate difference calculation submodule extracts the event rate value of the current time window and calculates the rate change amplitude compared with the previous window using the formula:
[0062]
[0063] Calculate the dynamic difference parameter, perform algebraic difference calculation on the current increase rate and the reference value, and generate the rate difference coefficient;
[0064] Among them, ΔR represents the dynamic difference parameter, V c Represents the current window event rate value, unit: frame / second, V p Represents the event rate value of the previous window, T w Represents the time window span coefficient, ranging from 0.8 to 1.2, W i Represents the sliding weight factor of the i-th adjacent window, which is distributed according to the exponential decay law, V si Represents the rate value of the i-th adjacent window, V base represents the benchmark rate value, which is the historical 30-day average. k represents the total number of adjacent windows and is fixed at 5.
[0065] The rate difference calculation submodule extracts the event rate value V of the current time window (e.g. 10:00:02-10:00:04) c , and calculate its difference with the rate V of the preceding window (10:00:00-10:00:02) p The calculation is done using the following formula:
[0066]
[0067] In this formula, ΔR represents the dynamic difference parameter, which is a quantitative indicator to measure the severity of the change in event rate. The calculation logic of ΔR is that it combines the instantaneous change of event rate with the recent historical fluctuation trend. By calculating the current window rate V c (Unit: frames / second) and the preceding window rate V p The absolute value of the difference between |V c -V p | and take its square root to smooth out the instantaneous sharp fluctuations; then divide it by the time window span coefficient T w , and obtain a standardized instantaneous rate of change. The summation term on the right side of the formula By calculating the rate V of the most recent k historical windows si Perform weighted summation and compare it with the reference rate V base Compare to evaluate the overall volatility level in the recent period. Among them, the weight factor W i The exponential decay over time assigns greater importance to recent data. Ultimately, the left-hand side, reflecting instantaneous changes, is multiplied with the right-hand side, reflecting recent trends, to produce a dynamic difference parameter that captures both sudden events and cyclical fluctuations. The formula's benefit lies in combining instantaneous changes (the square root term) with historical relative fluctuations (the summation term), making ΔR more responsive to true anomalous events while also being more robust to regular, cyclical peaks in foot traffic, effectively distinguishing between sporadic gatherings and the early stages of a true intrusion risk.
[0068] First, assign values to each parameter. Assume that the event rate value V in the current time window (TC) is c The calculated value is 1.8 frames / second. The event rate value V of the previous time window (TP) p 1.0 frame / second. Time window span coefficient T w The value of T is determined through experiments. The experiment selected 500 hours of surveillance video in the park under different weather conditions and different time periods. w The test was conducted in the interval [0.8, 1.2] with a step size of 0.05, and the false positive rate (FPR) and false negative rate (FNR) of the system were evaluated under each set of values. Finally, it was found that when T w When the value is 0.95, the weighted evaluation function F = 0.6 × FPR + 0.4 × FNR obtains the minimum value. Therefore, set T w =0.95. The total number of adjacent windows k is fixed to 5. Sliding weight factor W i According to the exponential decay law W i =e -0.4(i-1)The weights are: W1 = 1.0, W2 ≈ 0.670, W3 ≈ 0.449, W4 ≈ 0.301, W5 ≈ 0.202. This set of weights is based on the analysis of historical data, and the attenuation coefficient is 0.4 to balance the influence of new and old data. The rate value V of the i-th adjacent window is si (From most recent to most recent) are obtained through historical records, which are:
[0069] V s1 ,V s2 ,V s3 ,V s4 ,V s5 ] = [1.0, 1.1, 0.9, 0.8, 1.0] frames per second. Base rate value V base The event rate is obtained by extracting the event rate values of the same time period every day (for example, from 10 am to 11 am) in the past 30 days and calculating their arithmetic mean. For example, the total number of new events in this period in 30 days is 10,800, and the total duration is 30 days × 1 hour / day × 3600 seconds / hour = 108,000 seconds, then V base =10800 / 108000=0.1 frames / second. Substitute the above values into the formula for calculation:
[0070] Summation term calculation:
[0071] Σ=(1.0×1.0 / 0.1)+(0.670×1.1 / 0.1)+(0.449×0.9 / 0.1)+(0.301×0.8 / 0.1)+(0.202×1.0 / 0.1)=10+7.37+4.041+2.408+2.02=25.839;
[0072]
[0073] The result 24.314 is a quantitative indicator of the growth rate of event density.
[0074] The mark generation submodule sets a continuous cycle counter. When it detects that the rate difference coefficient exceeds the dynamic density threshold three times in a row, it activates the increment judgment logic and outputs a density increment mark.
[0075] The dynamic density threshold is obtained by optimizing the historical event data through the gradient descent method, which includes inputting the historical event rate value into the loss function and iteratively adjusting the threshold parameter until the weighted sum of the false alarm rate and the missed alarm rate is minimized;
[0076] Density increase marks include event frame time ratio, increase rate difference, and number of times the cycle threshold is exceeded.
[0077] The marker generation submodule sets a continuous cycle counter with an initial value of 0. The dynamic density threshold is set as follows: 500 event segments marked as "abnormal clusters" and 500 "normal peaks" in the historical data are collected, and the ΔR value of each segment is extracted. These ΔR values are used as input and a gradient descent method is applied to optimize a loss function L(θ) = Σw fp I(ΔR normal >θ)+Σw fn I(ΔR abnormal ≤θ), where θ is the dynamic density threshold, I(...) is the indicator function (takes 1 when the condition is true and 0 otherwise), w fp and w fn are the penalty weights for false positives and false negatives, respectively (e.g., set to 0.7 and 0.3). θ is adjusted through 200 iterations until the loss function L(θ) converges to a minimum. This method calculates a dynamic density threshold of 15.0. The rate difference coefficient of 24.314 obtained in the previous example is compared with the threshold of 15.0. If 24.314 > 15.0, it is determined to be a breakthrough. At this point, the continuous cycle counter increments by 1, becoming 1. In the next two consecutive time windows, if the calculated ΔR value continues to be greater than 15.0, the counter will accumulate to 3. When the counter value reaches 3, the increment judgment logic is activated, and the system generates a density increment flag. This flag is a data structure containing the following: {Event frame time ratio: 1.8 frames / second, Amplification rate difference: 24.314, Number of cycle threshold violations: 3}.
[0078] See also Figure 1 and Figure 4 ,The disturbance behavior recognition module is used to obtain the target motion vector data, call the LSTM model to analyze the vector angle change sequence, calculate the cosine similarity of the angles of adjacent vectors, generate a disturbance mark when the number of sign reversals and the angle change exceeds the threshold, and pass the disturbance mark to the response joint control execution module;
[0079] The disturbance behavior recognition module includes:
[0080] The motion vector acquisition submodule obtains the displacement data of the target three-dimensional coordinate system, extracts the displacement increment at a fixed sampling interval, constructs the vector modulus and direction angle parameters, uses the sliding mean algorithm to reduce the noise of the original data, and generates a motion vector set;
[0081] The motion vector acquisition submodule obtains the displacement data of a specified target from the target trajectory acquisition module, for example, a continuous two-dimensional coordinate sequence for the target ID "f47ac10b-58cc-4372-a567-0e02b2c3d479." The system extracts displacement increments at a fixed sampling interval of 100 milliseconds (i.e., every three frames at 30 fps). For example, at t = 0.0s, t = 0.1s, t = 0.2s, and t = 0.3s, the target coordinates are P0 (545, 366), P1 (548, 372), P2 (550, 380), and P3 (547, 386), respectively. This constructs three raw displacement vectors: V1 = P1 - P0 = (3, 6), V2 = P2 - P1 = (2, 8), and V3 = P3 - P2 = (-3, 6). Subsequently, the system applies a sliding mean algorithm with a window size of 3 to these raw data for noise reduction. The first vector V1′ after processing is calculated as (V1+V2+V3) / 3, but in order to maintain the time sequence correspondence, the center is usually aligned in actual applications. For example, the smoothed vector V′ t Calculated from its neighboring vector: V′ t =(V t-1 +V t +V t+1 ) / 3. Apply this algorithm to a longer vector sequence to obtain a smoothed motion vector set, where each vector contains the modulus and direction angle atan2(dy,dx) parameters.
[0082] The angle timing analysis submodule constructs an LSTM network structure. The input layer receives the motion vector set, the hidden layer stores the time step features, calculates the ratio of the dot product of adjacent vectors to the module-length product, establishes a spatial direction change sequence, extracts the radian change gradient of consecutive time steps through bidirectional window scanning, and outputs the angle timing features.
[0083] The angle time series analysis submodule constructs a long short-term memory (LSTM) network structure consisting of an input layer, a hidden layer, and an output layer. The hidden layer has 64 units. The input layer receives the denoised motion vector set, such as the sequence [V′1, V′2, V′3, V′4, ...]. At each LSTM time step, the hidden layer updates its internal cell state based on the current input vector and the hidden state at the previous time step. The core calculation is to analyze the directional changes between adjacent vectors. For two consecutive vectors in the sequence, such as V′2 = (dx2, dy2) and V′3 = (dx3, dy3), the system calculates their dot product V′2·V′3 = dx2×dx3+dy2×dy3 and their respective moduli |V′2| and |V′3|. The cosine value of the angle, or cosine similarity, is calculated as cos(θ) = (V′2·V′3) / (|V′2| × |V′3|). This calculation creates a sequence of spatial directional changes—a time series of cosine similarity values, such as [0.91, 0.85, -0.23, -0.45, 0.88, ...]. The LSTM network learns the temporal dependencies in this sequence through its gating mechanism. Next, a bidirectional window scans the sequence, extracting the continuous radian gradient around each time point—the rate of change of acos(cos(θ))—as the angle time series feature output.
[0084] The disturbance feature determination submodule performs a first-order difference operation on the angle time series features, detects the starting and ending positions of the negative value interval, sets the sign reversal number threshold and the angle change threshold, and performs a logical AND operation to combine the determination conditions when the cumulative number of reversals exceeds the threshold and the total radian change reaches the benchmark, obtaining a disturbance flag.
[0085] The reference value of the total radian change is 1.5π radians, which is determined by testing the median of the cumulative radian change of 200 sets of abnormal trajectories;
[0086] The sign reversal number threshold and angle change threshold are determined based on the 95th percentile of the statistical distribution of 100 sets of abnormal behavior samples;
[0087] The disturbance mark specifically refers to the vector angle sequence, similarity fluctuation value, and sign reversal frequency.
[0088] The disturbance feature determination submodule receives the aforementioned angle time series features, namely the cosine similarity sequence [0.91, 0.85, -0.23, -0.45, 0.88, ...]. First, a first-order difference operation is performed on the sequence to obtain the rate of change sequence: [-0.06, -1.08, -0.22, 1.33, ...]. The system detects the start and end positions of the negative value interval in the difference sequence. When the sequence value changes from positive to negative (for example, from 0.85 to -0.23), it is recorded as a sign reversal. The system counts the number of sign reversals within a preset time window (for example, 5 seconds). The threshold for the number of sign reversals is set based on a statistical analysis of 100 sets of annotated abnormal behavior samples (such as wandering back and forth and fighting).
[0089]
[0090]
[0091] Table 1: Statistical distribution of the number of sign reversals in abnormal behavior samples
[0092] As shown in Table 1, the statistical data of these 100 samples are sorted and the 95th percentile is taken. Assuming the calculated 95th percentile is 4, the sign reversal threshold is set to 4. The angle change threshold is set based on analyzing the cumulative radian change of 200 sets of abnormal trajectories. The total turning angle of these trajectories within 5 seconds (∑(acos(cos_similarity))) is calculated, and the median of the total turning angle of all samples is taken. If the calculated median is 1.5π radians (270 degrees), it is set as the total radian change baseline. When a target's motion trajectory has more than 4 cumulative sign reversals within 5 seconds and its cumulative radian change is greater than 1.5π, the result of the logical AND operation (count>4)∧(total_angle>1.5π) is true. At this time, the system combines the judgment conditions and generates a disturbance mark, which is a data object containing {vector angle sequence: [0.91, 0.85, -0.23, ...], similarity fluctuation
[0093] Values: [-0.06, -1.08, -0.22, ...], Sign reversal frequency: 4 times / 5 seconds}.
[0094] See also Figure 1 and Figure 5 , the response joint control execution module is used to receive the density increment mark and the disturbance mark, call the Hungarian algorithm to match the mapping relationship between the thermal imaging device and the target coordinates, adjust the device frame rate to the set multiple, and generate the joint control instruction;
[0095] The response joint control execution module includes:
[0096] The instruction parsing submodule receives the density increment mark and the disturbance mark, verifies the timestamp and coordinate data format, extracts the three-dimensional coordinates and priority coefficients in the mark, performs a logical AND operation to merge the valid bits of the double marks, and generates a control parameter set;
[0097] The command parsing submodule receives the density increment marker from the event density analysis module and the disturbance marker from the disturbance behavior identification module at its input. For example, at 2025-06-2010:00:15.200, the system receives a density increment marker for the target ID "f47ac10b-58cc-4372-a567-0e02b2c3d479" with a timestamp of 10:00:14.800. Simultaneously, it receives a disturbance marker for the same target with a timestamp of 10:00:15.100. The system first verifies the timestamps of the two markers. The difference, 15.100 - 14.800 = 0.3 seconds, is less than the preset 1-second correlation window, thus determining the event as a valid correlation. The system then verifies the coordinate data format in the marker, confirming it is in (x, y) floating-point format. The system extracts the target's latest three-dimensional coordinates from the markers (assuming the Z coordinate is (547, 386, 0) obtained by mapping it to a fixed ground surface) and their respective priority coefficients. The priority coefficient for the density-increasing marker is set based on the number of violations, for example, 0.6 for three violations; the priority coefficient for the disturbance marker is set based on the frequency of inversions, for example, 0.8 for four inversions per five seconds. The system performs a logical AND operation to confirm that both markers have valid bits set to 1. The two priority coefficients are then multiplied together to obtain a final combined priority of 0.6 × 0.8 = 0.48. The coordinates and priorities are then combined to generate the control parameter set: {Target ID: "f47ac10b-...", Coordinates: (547, 386, 0), Priority: 0.48}.
[0098] The device matching submodule constructs a two-dimensional matrix of thermal imaging device IDs and control parameter sets, calculates the Euclidean distance between the device's field of view coverage radius and the target coordinates, iteratively solves the minimum path cost using the Hungarian algorithm, updates the device status identifier, and outputs a mapping relationship table.
[0099] The device matching submodule receives the above control parameter set. The park has deployed three Dahua DH-TPC-PT8621A thermal imaging devices, with device IDs T-Cam01, T-Cam02, and T-Cam03. The system constructs a two-dimensional matrix of thermal imaging device IDs and control parameter sets. This matrix is used to calculate the matching cost between each available device and the target. The core of the cost calculation is the Euclidean distance between the center point of the device's field of view and the target coordinates. Assume that the center of the field of view of T-Cam01 currently points to the coordinates (600,400) and T-Cam02 points to (200,200). The target coordinates are (547,386). Calculate the distance:
[0100]
[0101]
[0102] The Hungarian algorithm uses these distances as cost inputs and iteratively solves for the allocation solution that minimizes the total cost. In this single-target scenario, the algorithm selects T-Cam01, which has the lowest cost, for matching. The system then updates T-Cam01's status identifier to "Tracking" and outputs a mapping table containing the following: {Target ID: "f47ac10b-...", Allocation Device ID: "T-Cam01"}.
[0103] The frame rate control submodule establishes a frame rate adjustment coefficient calculation model based on the device response delay and target displacement rate in the mapping relationship table, multiplies the reference frame rate by the adjustment coefficient, encapsulates the device address code and control parameters, and obtains the joint control instruction;
[0104] The conversion relationship between device response delay and target displacement rate is: frame rate adjustment factor = target displacement rate (m / s) × device response coefficient (0.2-0.5) / reference frame rate (30 frames / s);
[0105] The joint control instructions include the device coordinate mapping table, frame rate adjustment multiples, and thermal imaging linkage parameters.
[0106] The frame rate control submodule locks the device T-Cam01 based on the output mapping table. The system establishes a frame rate adjustment coefficient calculation model to adjust the device's frame rate in real time. This adjustment is based on the device's response latency and target displacement rate. Device response latency, including network latency and pan / tilt rotation latency, is determined through device calibration testing. For example, the average response latency of the T-Cam01 is 150 milliseconds. The target displacement rate is obtained from motion vector acquisition. For example, the latest smoothed vector modulus corresponds to 3.5 meters per second. The device response coefficient was set through an experiment consisting of 200 tracking tests. In the experiment, different coefficient values were selected between 0.2 and 0.5 to observe which coefficient optimally kept the target in the center of the frame at different target speeds. Experimental data showed that a coefficient of 0.4 performed best for targets moving at 3-5 meters per second. Therefore, the device response coefficient was set to 0.4. The base frame rate was the device's default 30 frames per second. The frame rate adjustment factor was calculated as follows:
[0107] Frame rate adjustment factor = 1 + (target displacement rate (m / s) × device response coefficient) / base frame rate (frames / s). Substituting the values: frame rate adjustment factor = 1 + (3.5 × 0.4) / 30 = 1 + 1.4 / 30 ≈ 1 + 0.0467 ≈ 1.0467. The new frame rate will be 30 × 1.0467 ≈ 31.4 frames / s, which the system rounds up to 32 frames / s. Finally, the system encapsulates the device address code (e.g., T-Cam01's IP address), control parameters (new frame rate 32 frames / s), and thermal imaging linkage parameters (e.g., switching to "Human Highlight" mode) to form the final linkage control command, which is sent to the T-Cam01 control interface via the network: {Device address: "192.168.1.101", Frame rate: 32, Thermal imaging mode: "HumanHighlight", Target coordinates: [547, 386, 0]}.
[0108] The above examples illustrate preferred implementations of the present invention. Any equivalent adjustments to the technical solutions based on software engineering methods are within the scope of protection, including but not limited to: implementing algorithmic logic using different programming languages, service-oriented reconfiguration of functional modules, adjusting data interaction protocols, optimizing resource scheduling strategies, and other technical improvements. Any implementation scheme derived from reasonable modifications to the data processing flow, service call chain, or system architecture level that does not depart from the core technology of the present invention shall be deemed to be within the scope of protection defined by the claims of the present invention.
Claims
1. An AI-based campus intrusion detection and response system, characterized by: The system comprises: The target trajectory acquisition module is used to obtain video stream data through the image perception terminal, call the YOLOv5 algorithm to extract the target's two-dimensional coordinate trajectory, establish a unique ID tag and record the displacement vector, and pass the trajectory data to the event density analysis module; An event density analysis module is configured to obtain the trajectory data based on a time window, calculate the ratio of the number of newly added event frames to the time span, compare the difference between the current increase rate and the historical average rate, generate a density increase flag when the difference between consecutive cycles exceeds a dynamic density threshold, and transmit the density increase flag to the response joint control execution module; The disturbance behavior recognition module is used to obtain target motion vector data, call the LSTM model to analyze the vector angle change sequence, calculate the cosine similarity of adjacent vector angles, generate a disturbance flag when the number of sign reversals and angle changes exceed a threshold, and pass the disturbance flag to the response joint control execution module; The response joint control execution module is used to receive the density increase mark and the disturbance mark, call the Hungarian algorithm to match the mapping relationship between the thermal imaging device and the target coordinates, adjust the device frame rate to a set multiple, and generate a joint control instruction.
2. The AI-based campus intrusion detection and response system according to claim 1 is characterized in that: The trajectory data specifically includes a two-dimensional coordinate sequence, a unique identity identifier, and a displacement vector parameter. The density increment mark includes the event frame time ratio, the amplification rate difference, and the number of times the cycle threshold is exceeded. The disturbance mark specifically refers to the vector angle sequence, the similarity fluctuation value, and the sign reversal frequency. The joint control instruction includes a device coordinate mapping table, a frame rate adjustment multiple, and thermal imaging linkage parameters.
3. The AI-based campus intrusion detection and response system according to claim 2 is characterized in that: The dynamic density threshold is obtained by optimizing and calculating the historical event data using a gradient descent method, including inputting the historical event rate value into a loss function and iteratively adjusting the threshold parameter until the weighted sum of the false alarm rate and the missed alarm rate is minimized; The sign reversal number threshold and the angle change threshold are determined based on the 95th percentile of the statistical distribution of 100 groups of abnormal behavior samples; The device frame rate adjustment factor = target displacement rate (m / s) × device response coefficient / reference frame rate, where the device response coefficient takes a value in the range of 0.2-0.
5.
4. The AI-based campus intrusion detection and response system according to claim 3 is characterized in that: The target trajectory acquisition module includes: The video stream acquisition submodule obtains the optical signal stream through the image perception terminal, uses a frame rate adaptive mechanism to capture dynamic images, converts the original analog signal into a digital matrix format, divides the data units according to the time axis and adds millisecond-level timestamps to generate video stream data; The coordinate parsing submodule inputs the YOLOv5 feature extraction network based on the video stream data, extracts the target edge features through a three-layer convolution kernel, uses a non-maximum suppression algorithm to eliminate overlapping detection frames, calculates the horizontal and vertical coordinate values of the target center point, and constructs a spatiotemporal mapping table to generate a two-dimensional coordinate sequence; The trajectory identification submodule calls the two-dimensional coordinate sequence to construct a motion trajectory map, uses the Hungarian algorithm to match the target positions of adjacent time points, predicts the trajectory offset through Kalman filtering, calculates the coordinate difference between consecutive frames to construct a displacement parameter set, assigns a unique coding identifier to the complete motion path, and generates trajectory data.
5. The AI-based campus intrusion detection and response system according to claim 4 is characterized in that: The Kalman filter prediction trajectory offset is combined with the Hungarian algorithm matching to correct the target position matching error through the prediction value, thereby improving the continuity of the target ID across frames.
6. The AI-based campus intrusion detection and response system according to claim 5 is characterized in that: The event density analysis module includes: The trajectory interception submodule divides the trajectory data into segments according to a preset time window, compares the event records of adjacent time nodes frame by frame, counts the number of newly added event frames, divides the value by the window time span, and obtains the event rate value; The rate difference calculation submodule extracts the event rate value of the current time window and calculates the rate change amplitude compared with the previous window using the formula: Calculate the dynamic difference parameter, perform algebraic difference calculation on the current increase rate and the reference value, and generate the rate difference coefficient; Among them, ΔR represents the dynamic difference parameter, V c Represents the current window event rate value, unit: frame / second, V p Represents the event rate value of the previous window, T w Represents the time window span coefficient, ranging from 0.8 to 1.2, W i Represents the sliding weight factor of the i-th adjacent window, which is distributed according to the exponential decay law, V si Represents the rate value of the i-th adjacent window, V base represents the benchmark rate value, which is the historical 30-day average. k represents the total number of adjacent windows and is fixed at 5. The mark generation submodule sets a continuous cycle counter, and when it is detected that the rate difference coefficient breaks through the dynamic density threshold three times in a row, activates the increment judgment logic and outputs a density increment mark.
7. The AI-based campus intrusion detection and response system according to claim 6 is characterized in that: The disturbance behavior recognition module includes: The motion vector acquisition submodule obtains the displacement data of the target three-dimensional coordinate system, extracts the displacement increment at a fixed sampling interval, constructs the vector modulus and direction angle parameters, uses the sliding mean algorithm to reduce the noise of the original data, and generates a motion vector set; The angle timing analysis submodule constructs an LSTM network structure. The input layer receives the motion vector set, the hidden layer stores the time step features, calculates the ratio of the dot product of adjacent vectors to the product of the module length, establishes a spatial direction change sequence, extracts the radian change gradient of consecutive time steps through bidirectional window scanning, and outputs the angle timing features. The disturbance feature determination submodule performs a first-order difference operation on the angle time series feature, detects the starting and ending positions of the negative value interval, sets the sign reversal number threshold and the angle change threshold, and when the cumulative number of reversals exceeds the threshold and the total amount of radian change reaches the benchmark, performs a logical AND operation to combine the determination conditions and obtain a disturbance mark.
8. The AI-based campus intrusion detection and response system according to claim 7 is characterized in that: The reference value of the total amount of radian change is 1.5π radians, which is determined by testing the median of the cumulative radian changes of 200 groups of abnormal trajectories.
9. The AI-based campus intrusion detection and response system according to claim 8, characterized in that: The response joint control execution module includes: The instruction parsing submodule receives the density increment mark and the disturbance mark, verifies the timestamp and coordinate data format, extracts the three-dimensional coordinates and priority coefficients in the mark, performs a logical AND operation to merge the valid bits of the double marks, and generates a control parameter set; The device matching submodule constructs a two-dimensional matrix of the thermal imaging device ID and the control parameter set, calculates the Euclidean distance between the device's field of view angle coverage radius and the target coordinates, iteratively solves the minimum path cost using the Hungarian algorithm, updates the device status identifier, and outputs a mapping relationship table; The frame rate control submodule establishes a frame rate adjustment coefficient calculation model according to the device response delay and target displacement rate in the mapping relationship table, multiplies the reference frame rate by the adjustment coefficient, encapsulates the device address code and control parameters, and obtains the joint control instruction.
10. The AI-based campus intrusion detection and response system according to claim 9, characterized in that: The conversion relationship between the device response delay and the target displacement rate is frame rate adjustment factor = target displacement rate (m / s) × device response coefficient (0.2-0.5) / reference frame rate (30 frames / s).
Citation Information
Patent Citations
Infrared image target detection method and system based on deep learning
CN118644723A
Distributed monitoring campus safety early warning method and system
CN118887598A
Security monitoring method and equipment
CN119296045A
Security and protection method and device based on full-range feature recognition and four-dimensional trajectory tracking
CN119720064A
Load-balanced processing method, device, and system for intelligent video of CCTV based on artificial intelligence model
KR102727474B1
Cited By
Multi-source array animal intelligent monitoring and driving method and system based on target recognition
CN120894751A
Smart park data security access method and system based on dynamic identification
CN121239468A
Park energy consumption monitoring system based on AI digital twinning
CN121684554A
Distributed optical fiber vibration event detection method and system
CN121829735A
