Virtual fence-based access control method and system for restricted space of water plant

CN123016355APending Publication Date: 2026-10-30CHINESE RES ACAD OF ENVIRONMENTAL SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611318013.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-28
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]然而,物理围栏在水厂受限空间的应用中存在显著不足

Benefits of technology

[0020]上述一种基于虚拟围栏的水厂受限空间准入监控方法及系统,首先从水厂受限区域获取实时视频流图像,并结合预先标定的相机参数和地面平面约束条件,为后续空间映射建立成像几何基准;继而利用目标检测与跟踪技术从图像中提取目标的像素坐标,并通过多尺度空间特征和时序运动特征的联合提取,增强对目标物形态和运动状态的表征能力;在此基础上,依据相机成像的透视投影几何原理,将图像平面中的目标位置映射至三维物理空间,精确计算目标物的三维重心坐标;随后,将虚拟围栏边界在三维空间中构建为封闭体,并采用射线法分析目标重心与该封闭体的拓扑位置关系,判定目标是否位于围栏内部;最终结合时序状态滤波与置信度累积判定机制生成准入监控结果;能够对受限区域非授权闯入行为的智能化识别与监控,提升虚拟围栏布设的灵活性和空间覆盖的连续性,减少传统物理围栏对固定安装结构的依赖,降低环境光照和瞬时扰动对监控可靠性的干扰。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123016355A_ABST
    Figure CN123016355A_ABST
Patent Text Reader

Abstract

The application relates to a virtual fence-based access monitoring method and system for a restricted space of a water plant. The method comprises the following steps: acquiring real-time video stream image data of a restricted area of the water plant, camera calibration parameters, ground plane constraint conditions and preset virtual fence boundary coordinate data; performing target detection and tracking on the image data, extracting pixel coordinates of a target object, and extracting multi-scale spatial features and time sequence motion features of the target object based on the pixel coordinates; mapping the features to a three-dimensional physical space by using a camera imaging geometric principle, and calculating three-dimensional gravity center coordinates of the target object; analyzing topological association characteristics of the three-dimensional gravity center coordinates and the virtual fence boundary by using a ray method, and determining whether the target object is located inside the restricted area; and performing time sequence confidence determination on an access state, and generating a monitoring result. The method can improve the flexibility, spatial adaptability and environmental anti-interference capability of access monitoring of the restricted area of the water plant.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data processing, and in particular relates to a method and system for monitoring access to confined spaces in water plants based on virtual fences. Background Technology

[0002] With the continuous improvement of automation and intelligent operation levels in water plants, access safety management in confined spaces (such as chemical dosing rooms, sedimentation tanks, and filter corridors) during water plant production is receiving increasing attention. These areas typically present potential risks such as rotating mechanical parts, accumulation of toxic and harmful gases, or falls from heights, requiring strict control over unauthorized personnel trespassing. Currently, access to confined spaces in water plants is primarily achieved through physical fencing (such as solid guardrails, grilles, and locks), supplemented by manual inspections or fixed infrared beam alarm devices for safety monitoring.

[0003] In traditional technologies, physical fences are rigid barriers placed at the boundaries of restricted areas to prevent unauthorized entry by mechanical means; fixed infrared beam detectors, on the other hand, trigger alarm signals by changing the on / off state of the beams placed at specific entrances and exits.

[0004] However, physical fencing has significant limitations in the application of confined spaces in water plants. Due to the compact layout of equipment in the chemical dosing room and frequent changes in maintenance access, as well as the presence of multi-level platforms and irregular structures in the sedimentation tank area, traditional physical fencing is difficult to deploy flexibly according to the site's spatial form. Its installation location is limited by pre-embedded parts and fixed structures in the ground, and cannot be dynamically adjusted as the work area changes. Furthermore, physical fencing can only cover the fixed area enclosed by its closed boundary, completely failing to provide access control for open areas of the tank surface, temporary work warning zones, and other spaces without physical barriers. In addition, infrared beam detectors are severely affected by changes in lighting, dust, and water mist, easily generating false alarms, and their linear beam detection method cannot form continuous coverage of two-dimensional or even three-dimensional spatial areas, resulting in detection blind spots. Therefore, there is an urgent need for an access monitoring solution that can adapt to the complex geometry of confined spaces in water plants, requires no physical barriers, and possesses continuous spatial sensing capabilities. Summary of the Invention

[0005] Therefore, it is necessary to provide a method and system for monitoring access to confined spaces in water plants based on virtual fences to address the aforementioned technical problems.

[0006] Firstly, this application provides a method for monitoring access to confined spaces in a water plant based on a virtual fence, including:

[0007] S1. Acquire real-time video stream image data and ground plane constraint data of the restricted area of ​​the water plant; acquire camera calibration parameters and virtual fence boundary coordinate data;

[0008] S2. Perform target detection and target tracking on real-time video stream image data to obtain the pixel coordinate data of the target; based on the pixel coordinate data of the target, extract the multi-scale spatial features and temporal motion features of the target to obtain the target feature data;

[0009] S3. Based on the camera calibration parameters, the pixel coordinate data of the target object, and the ground plane constraint conditions of the restricted area, the feature data of the target object is mapped to the three-dimensional physical space, and the three-dimensional centroid coordinate data of the target object is calculated.

[0010] S4. Based on the target object's centroid coordinate data and the virtual fence boundary coordinate data, analyze the topological association characteristics between the target object and the virtual fence boundary to obtain the admission status data;

[0011] S5. Generate access monitoring result data based on access status data.

[0012] Secondly, this application also provides a water plant confined space access monitoring system based on a virtual fence, comprising:

[0013] The data acquisition module is used to acquire real-time video stream image data and ground plane constraint data of the restricted area of ​​the water plant; and to acquire camera calibration parameters and virtual fence boundary coordinate data.

[0014] The target perception module is used to perform target detection and target tracking on real-time video stream image data to obtain the pixel coordinate data of the target; based on the pixel coordinate data of the target, it extracts the multi-scale spatial features and temporal motion features of the target to obtain the target feature data;

[0015] The 3D mapping module is used to map the feature data of the target object to a 3D physical space based on the camera calibration parameters, the pixel coordinate data of the target object, and the ground plane constraints of the restricted area, and to calculate the 3D centroid coordinate data of the target object.

[0016] The topology analysis module is used to analyze the topological association characteristics between the target object and the virtual fence boundary based on the target object's centroid coordinate data and the virtual fence boundary coordinate data, and to obtain the admission status data.

[0017] The monitoring result output module is used to generate access monitoring result data based on access status data.

[0018] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect.

[0019] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0020] The aforementioned method and system for monitoring access to confined spaces in water plants based on virtual fences first acquires real-time video stream images from the confined area of ​​the water plant. Combined with pre-calibrated camera parameters and ground plane constraints, an imaging geometric reference is established for subsequent spatial mapping. Then, target detection and tracking technology is used to extract the pixel coordinates of the target from the image. Through the joint extraction of multi-scale spatial features and temporal motion features, the ability to represent the target's morphology and motion state is enhanced. Based on this, according to the perspective projection geometry principle of camera imaging, the target position in the image plane is mapped to three-dimensional physical space, and the three-dimensional centroid coordinates of the target are accurately calculated. Subsequently, the virtual fence boundary is constructed as a closed body in three-dimensional space, and the ray casting method is used to analyze the topological positional relationship between the target's centroid and this closed body to determine whether the target is located inside the fence. Finally, an access monitoring result is generated by combining temporal state filtering and confidence accumulation judgment mechanisms. This method enables intelligent identification and monitoring of unauthorized intrusion behavior in confined areas, improves the flexibility of virtual fence deployment and the continuity of spatial coverage, reduces the dependence of traditional physical fences on fixed installation structures, and reduces the interference of ambient light and instantaneous disturbances on monitoring reliability. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart illustrating a water plant confined space access monitoring method based on a virtual fence in one embodiment.

[0023] Figure 2 This is a schematic diagram of a water plant confined space access monitoring system based on a virtual fence, as shown in one embodiment.

[0024] Figure 3 This is a schematic diagram of a computer device in one embodiment. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0026] In one embodiment, reference Figure 1 The document presents a flowchart illustrating a method for monitoring access to confined spaces in a water plant based on a virtual fence, as provided in this application. This embodiment uses the method applied to a monitoring terminal (hereinafter referred to as the terminal) as an example for illustration. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0027] S1. Acquire real-time video stream image data and ground plane constraint data of the restricted area of ​​the water plant; acquire camera calibration parameters and virtual fence boundary coordinate data.

[0028] For example, the monitoring terminal acquires real-time video stream image data of a confined area of ​​the water plant. The confined area may include enclosed or semi-enclosed spaces such as chemical dosing rooms, sedimentation tanks, filter corridors, and manholes on the top of clear water tanks, which may contain mechanically rotating parts, accumulate toxic or harmful gases, or pose a risk of falling from a height. The real-time video stream image data can be collected by industrial network cameras deployed within the confined area. These cameras support real-time video streaming protocols, and the monitoring terminal can receive the video stream data output by the cameras through a network interface. Each frame of image data consists of a two-dimensional pixel matrix, where each element represents the light intensity value at the corresponding pixel location. Simultaneously, the monitoring terminal acquires ground plane constraint condition data for the confined area. This data consists of predefined plane equation parameters of the confined area's ground plane in the world coordinate system. The plane equation parameters may include the normal unit vector of the ground plane and the height offset of the ground plane relative to the origin of the world coordinate system. This data is obtained through prior site measurements. The monitoring terminal can also acquire camera calibration parameters, which may include intrinsic parameters, distortion coefficients, rotation matrices, and translation vectors. The intrinsic parameters matrix may contain the camera's normalized focal length and principal point coordinates, describing the camera's internal optical imaging geometry. The distortion coefficients describe the impact of radial and tangential distortion on the image point's position. The rotation matrix and translation vector describe the spatial transformation between the camera coordinate system and the world coordinate system. The monitoring terminal can also acquire virtual fence boundary coordinate data, which is a set of three-dimensional spatial boundary points pre-calibrated by maintenance personnel based on the spatial extent of the restricted area. This set of boundary points defines the geometric range of the monitored area. The monitoring terminal can store the acquired real-time video stream image data, restricted area ground plane constraint data, camera calibration parameters, and virtual fence boundary coordinate data in memory.

[0029] S2. Perform target detection and target tracking on real-time video stream image data to obtain the pixel coordinate data of the target object; based on the pixel coordinate data of the target object, extract the multi-scale spatial features and temporal motion features of the target object to obtain the target object feature data.

[0030] For example, a monitoring terminal can perform target detection and tracking on real-time video stream image data to obtain the pixel coordinate data of the target object. The pixel coordinate data can be used to represent the position of the target object in the image plane, and can include the x-coordinate and y-coordinate of the target's center of gravity in the pixel coordinate system. Based on the pixel coordinate data, the monitoring terminal can extract multi-scale spatial features and temporal motion features of the target object to obtain target object feature data. The target object feature data can include edge contour information, texture appearance information, and inter-frame displacement vector information. Edge contour information can be used to characterize the morphological boundary features of the target object in the image; texture appearance information can be used to characterize the grayscale distribution pattern of the target object's surface; and inter-frame displacement vector information can be used to characterize the direction and distance of movement of the target object between adjacent frames. Multi-scale spatial features can be obtained by processing image patches in the region where the target object is located using convolution operations with different receptive field sizes to obtain feature responses at different spatial scales. The feature responses at different spatial scales correspond to the local detail features and global morphological features of the target object, respectively. Temporal motion features can be obtained by modeling the positional changes of the target object in consecutive frames to obtain the motion trajectory features of the target object in the time dimension. The monitoring terminal can store the target object's characteristic data in memory.

[0031] S3. Based on the camera calibration parameters, the pixel coordinate data of the target object, and the ground plane constraint conditions of the restricted area, the feature data of the target object is mapped to the three-dimensional physical space, and the three-dimensional centroid coordinate data of the target object is calculated.

[0032] For example, the monitoring terminal can map the target object's feature data to a three-dimensional physical space based on camera calibration parameters, the target object's pixel coordinate data, and the ground plane constraints of the restricted area, thereby calculating the target object's three-dimensional centroid coordinate data. The three-dimensional centroid coordinate data can represent the spatial position of the target object's centroid in the world coordinate system, and can include three components: horizontal x-coordinate, horizontal y-coordinate, and vertical height coordinate. In a monocular vision imaging model, a pixel on the image plane corresponds to all three-dimensional points on a ray emanating from the camera's optical center in world space, the direction of which is determined by the camera calibration parameters and pixel coordinates. To determine the actual three-dimensional position of the target object from an infinite number of candidate points on the ray, the monitoring terminal can estimate the target object's height and horizontal offset based on its feature data, and, combined with the ground plane constraints, calculate the target object's three-dimensional spatial position through spatial geometric intersection. The monitoring terminal can store the three-dimensional centroid coordinate data in memory.

[0033] S4. Based on the target object's centroid coordinate data and the virtual fence boundary coordinate data, analyze the topological association characteristics between the target object and the virtual fence boundary to obtain the admission status data.

[0034] For example, the monitoring terminal can analyze the topological association characteristics of the target object and the virtual fence boundary based on the target object's centroid coordinate data and the virtual fence boundary coordinate data to obtain access status data. The access status data can be used to characterize the spatial positional relationship between the target object's centroid coordinates and the virtual fence boundary. The access status data includes two states: inside the virtual fence and outside the virtual fence. The topological association characteristic analysis can employ a point-to-closed region positional relationship determination method from computational geometry. Specifically, the three-dimensional spatial determination problem is decomposed into two independent sub-problems: two-dimensional positional determination in the horizontal plane and one-dimensional range determination in the vertical direction. In the horizontal plane, the monitoring terminal can determine the positional relationship between the point and the polygon obtained by projecting the horizontal projection of the target object's centroid coordinates and the two-dimensional polygon obtained by projecting the virtual fence boundary along the gravity direction. In the vertical direction, the monitoring terminal can determine whether the target object's centroid height is within the preset height coverage range of the virtual fence. The monitoring terminal can store the access status data in memory.

[0035] S5. Generate access monitoring result data based on access status data.

[0036] For example, the monitoring terminal generates access monitoring result data based on access status data. This access monitoring result data is output to the host computer display interface and alarm execution terminal of the water plant monitoring system, allowing maintenance personnel to obtain real-time access status information for targets within restricted areas. When generating access monitoring result data, the monitoring terminal performs joint analysis of current and historical access status data to eliminate instantaneous misjudgments caused by detection errors or sudden changes in illumination during single-frame image processing. Specifically, the monitoring terminal maintains a fixed-length time window, storing access status data for each frame within that window. By statistically analyzing the state sequence within the time window, it calculates the state transition frequency and the duration of abnormal states, thereby determining whether the monitoring result of the current frame should trigger an alarm. The monitoring terminal can then encapsulate the final generated access monitoring result data into structured data according to a preset format, including timestamps, target identifiers, access status, and alarm levels, and send the structured data to the host computer display interface and alarm execution terminal of the water plant monitoring system.

[0037] In the aforementioned water plant confined space access monitoring method based on virtual fences, real-time video stream images of the confined area are acquired and combined with camera calibration parameters and ground plane constraints to detect and track targets in the images to extract pixel coordinate data. Based on this, multi-scale spatial features and temporal motion features of the targets are further extracted. Based on these features and camera parameters, the targets are mapped from the two-dimensional image plane to three-dimensional physical space to calculate their centroid coordinates. Finally, the access status of the targets is determined by analyzing the topological correlation between the centroid coordinates and the virtual fence boundary coordinate data, and monitoring results are generated. Through monocular visual perception and three-dimensional spatial mapping, flexible deployment without physical barriers in the confined area is achieved. The virtual fence boundaries of arbitrary shapes and sizes can be freely configured and dynamically adjusted, improving adaptability to irregular geometric shapes in water plant confined spaces and the flexibility of access monitoring. Through layer-by-layer mapping from two-dimensional pixels to three-dimensional coordinates and topological determination, continuous coverage perception of targets inside and outside the spatial area is achieved, effectively reducing the impact of limited physical fence deployment and blind spots in fixed detection equipment, reducing the risk of false alarms and missed alarms, and enabling real-time output of accurate positioning and determination results to achieve unmanned intelligent monitoring.

[0038] In an optional embodiment, S2 includes:

[0039] S21. Perform pixel-by-pixel grayscale difference operation on the current frame image and the preset background image in the real-time video stream image data to obtain the difference intensity image data.

[0040] Optionally, the monitoring terminal can perform pixel-by-pixel grayscale difference operations on the current frame image and the preset background image in the real-time video stream image data to obtain differential intensity image data. The differential intensity image data can include pixel grayscale values. The current frame image is the image frame extracted by the monitoring terminal from the real-time video stream at the current moment. The preset background image is a background image frame pre-collected and stored when no target object exists in the restricted area; this preset background image represents the static scene grayscale distribution of the restricted area in an idle state. Pixel-by-pixel grayscale difference operation refers to subtracting the grayscale value of the same pixel position in the preset background image from the grayscale value of each pixel position in the current frame image, and taking the absolute value of the difference to obtain the differential intensity value at that pixel position. The differential intensity image data is a two-dimensional matrix composed of the differential intensity values ​​of all pixel positions. The differential intensity value of each pixel in the differential intensity image data reflects the degree of light intensity change of the current frame image relative to the background image at that pixel position. When no moving object enters the restricted area, the grayscale values ​​of the current frame image and the preset background image are basically the same at each pixel position, and the difference intensity value is close to zero. When an object enters the restricted area, the pixel grayscale values ​​of the area covered by the object change significantly, producing a large deviation from the grayscale values ​​of the corresponding positions in the background image, thus forming a high-response area in the difference intensity image data. The expression for pixel-by-pixel grayscale difference operation can be: ,in, Represents the pixel coordinates in the differential intensity image data The difference intensity value at the location, in gray levels; Indicates the pixel coordinates in the current frame image. The grayscale value at the specified location, expressed in grayscale levels; Indicates the pixel coordinates in the preset background image The grayscale value at the specified location, expressed in grayscale levels; Represents the horizontal and vertical index coordinates of the pixel plane, where, Indicates the pixel column index. Represents the pixel row index, and All units are pixels. High-response regions in differential intensity image data correspond to the positions of moving objects in the image.

[0041] S22. Perform grayscale morphological opening and closing operations on the differential intensity image data to obtain connectivity-enhanced image data.

[0042] Optionally, the monitoring terminal can perform grayscale morphological opening and closing operations on the differential intensity image data to obtain connectivity-enhanced image data. Grayscale morphological opening refers to performing an erosion operation followed by a dilation operation on the differential intensity image data. The erosion operation can be used to eliminate isolated low-intensity response points caused by noise or minor fluctuations in illumination in the differential intensity image data, while the dilation operation can be used to restore the boundary range of the target area that has been reduced after the erosion operation. Grayscale morphological closing refers to performing a dilation operation followed by an erosion operation on the image data processed by the opening operation. The dilation operation can be used to fill holes and breaks inside the target area caused by uneven differential responses, while the erosion operation can be used to restore the boundary range of the target area that has been expanded after the dilation operation. Both opening and closing operations are performed by sliding a preset structuring element on the image plane. The structuring element is a pixel neighborhood template of a preset shape and size, used to define the neighborhood range of each pixel position participating in the morphological operation. The physical basis of the opening operation is to separate weakly connected adjacent regions through the erosion operation and then restore the original scale of each region through the dilation operation, thereby removing noise points and maintaining the integrity of the target area. The physical basis of the closing operation is to fill the voids and grooves inside the region through dilation, and then restore the original boundaries of each region through erosion, thereby enhancing the internal connectivity of the target region. After opening and closing operations, the target regions in the differential intensity image data constitute complete connected regions. The boundaries of each connected region are clear and there are no internal breaks. The monitoring terminal can use the image data processed by grayscale morphology opening and closing operations as connectivity-enhanced image data.

[0043] S23. Perform eight-neighbor connected component labeling on the connectivity-enhanced image data to obtain the pixel index set of each connected component.

[0044] Optionally, the monitoring terminal can perform eight-neighbor connected component labeling on the connectivity enhancement image data to obtain a set of pixel indices for each connected component. Eight-neighbor connected component labeling refers to the process of grouping adjacent high-intensity response pixels in the connectivity enhancement image data into the same connected component according to the eight-connectivity relationship between pixels. The eight-connectivity relationship is defined as: for pixels located at pixel coordinates... The center pixel, and its eight neighboring pixels are located at... , , , , , , and Location: When the difference intensity value between the center pixel and any of its neighboring pixels is greater than a preset intensity threshold, the two pixels are determined to belong to the same connected component. The specific implementation of connected component labeling uses a two-pass scanning method: The first scan traverses each pixel in the connectivity-enhanced image data from top to bottom and left to right. For pixels with a difference intensity value greater than the preset intensity threshold, it checks the labeling status of its four neighboring pixels (top left, top right, top right, and left). Based on the relationship between the neighboring labels, a temporary label is assigned to the current pixel, and the equivalence relationship between the labels is recorded. The second scan, based on the equivalence relationship recorded in the first scan, merges the temporary labels with equivalence relationships into a single final label. After eight-neighbor connected component labeling, the pixel region corresponding to each target object in the image is assigned a unique label number, and the pixel index set of each connected component is represented as... ,in, The label number representing the connected components. It is a positive integer. Indicates the first The set of all pixel coordinates within a connected region, in units of pixel coordinates.

[0045] S24. Based on the pixel index set of each connected component and the gray value of each pixel, calculate the zero-order moment and the first-order moment, and calculate the centroid position of each connected component to obtain the pixel coordinate data of the target object in the current frame.

[0046] Optionally, the monitoring terminal can calculate the zeroth and first moments based on the pixel index set and grayscale values ​​of each connected component, and calculate the centroid position of each connected component to obtain the pixel coordinate data of the target object in the current frame. The zeroth moment represents the sum of the grayscale values ​​of all pixels in the connected component, and can be used to characterize the overall intensity response of the target object in the image. The first moment represents the weighted sum of the grayscale values ​​of each pixel in the connected component and their coordinate positions, and can be used to characterize the degree of offset of the grayscale distribution of the target object relative to the image origin.

[0047] Optionally, for the first For a connected region, the formula for calculating the zeroth moment can be:

[0048] ;

[0049] in, Indicates the first The zeroth moment of each connected component, in gray levels; Indicates the first A set of pixel indices for connected components; Represents the pixel coordinates in the connectivity-enhanced image data The grayscale value at the specified location is expressed in grayscale levels.

[0050] Optionally, for the first For a connected region, the formula for calculating the first moment can be:

[0051] ;

[0052] ;

[0053] in, Indicates the first The first moment of each connected component along the horizontal axis, in units of gray level multiplied by pixels; Indicates the first The first moment of each connected component along the vertical axis, in units of gray level multiplied by pixels; The x-coordinate of a pixel, in pixels; The vertical coordinate represents the pixel, in pixels. This represents the grayscale value, expressed in grayscale levels.

[0054] Alternatively, the formula for calculating the centroid location of a connected region can be:

[0055] ;

[0056] in, Indicates the first The x-coordinate of the centroid of each connected region, in pixels; Indicates the first The ordinate of the centroid of each connected region, in pixels; The first moment in the horizontal direction is represented by gray level multiplied by pixels; The first moment in the vertical direction is represented by gray levels multiplied by pixels. This represents the zeroth moment, expressed in gray levels. The centroid position is calculated using a gray-level weighted average, where gray values ​​are used as weights to average the coordinates of all pixels within a connected component, yielding the center position of the target object in the image plane. The monitoring terminal can use the centroid positions of each connected component as the pixel coordinate data of the target object in the current frame.

[0057] In an optional embodiment, S2 further includes:

[0058] S25. Calculate the Euclidean distance between the pixel coordinate data of the current frame and the pixel coordinate data of the previous frame, and obtain the inter-frame displacement vector data of the target object based on the Euclidean distance.

[0059] Optionally, the monitoring terminal can calculate the Euclidean distance between the pixel coordinate data of the current frame and the pixel coordinate data of the previous frame, and obtain the inter-frame displacement vector data of the target object based on the Euclidean distance. The pixel coordinate data of the current frame can be represented as... ,in, Indicates the first in the current frame The index number of the target object. It is a positive integer. Indicates the current frame number The x-coordinate of the target material's center, in pixels. Indicates the current frame number The vertical coordinate of the target matter center, in pixels. The pixel coordinate data of the previous frame can be represented as... ,in, Indicates the first frame in the previous frame The index number of the target object. It is a positive integer. Indicates the previous frame number The x-coordinate of the target material's center, in pixels. Indicates the previous frame number The ordinate of the target matter center, in pixels. The Euclidean distance can be calculated using the following formula: ,in, Indicates the current frame number The target object is the same as the one in the previous frame. The Euclidean distance between each target object is expressed in pixels. The monitoring terminal can employ a nearest neighbor matching strategy for each target object in the current frame. Search for objects from all targets in the previous frame that make The target object with the smallest value As the matching object. After matching is completed, the formula for calculating the inter-frame displacement vector data can be: ,in, Indicates to make Take the minimum value Value index, It is a positive integer; Indicates the current frame number The pixel displacement of a target object relative to the matching target object in the previous frame. This represents the displacement along the horizontal axis, in pixels. This represents the displacement along the vertical axis, in pixels. Indicates the first frame in the previous frame and the first frame in the current frame. The x-coordinate of the centroid of the target object that matches the target object, in pixels; Indicates the first frame in the previous frame and the first frame in the current frame. The centroid ordinates of the target object are matched to the target object, in pixels. Inter-frame displacement vector data can be used to characterize the direction and velocity of the target object's motion in the image plane, in pixels per frame.

[0060] S26. Perform batch normalization on the pixel coordinate data to obtain standardized pixel features; perform dilated convolution with different dilation rates on the standardized pixel features in parallel to obtain spatial response feature maps at multiple scales; perform element-wise addition and fusion on the spatial response feature maps at multiple scales to obtain a fused spatial feature map; perform convolutional dimensionality reduction on the fused spatial feature map to obtain a multi-scale spatial feature map.

[0061] Optionally, the monitoring terminal can perform batch normalization on the pixel coordinate data to obtain standardized pixel features. Batch normalization transforms the pixel coordinate data along the batch dimension, ensuring that the transformed standardized pixel features follow a standard normal distribution with a mean of zero and a variance of one. The specific calculation process for batch normalization is as follows: calculate the mean and variance of all pixel coordinate data in the current batch, subtract the mean from each pixel coordinate data, and divide by the square root of the variance to obtain the standardized pixel features. The physical basis of batch normalization is that by standardizing the distribution of input data, it accelerates the training convergence of deep convolutional networks and improves the stability of training. The monitoring terminal can perform dilated convolution with different dilation rates in parallel on the standardized pixel features to obtain multi-scale spatial response feature maps. Dilated convolution refers to inserting zero values ​​between adjacent weights of the standard convolution kernel, thereby expanding the receptive field of the convolution operation without increasing the number of parameters.

[0062] Optionally, the monitoring terminal can employ three branches of dilated convolution in parallel, with the dilation rates of the three branches being respectively... , and ,in, , and The given positive integer is a preset integer that satisfies the following conditions: The kernel size of the three dilated convolution branches is [missing information]. The convolution kernel weights can be obtained through model training. The dilation rate is... The receptive field of the dilated convolution branch corresponds to the local edge detail features of the target object, and the dilation rate is... The receptive field of the dilated convolution branch corresponds to the global morphological contour features of the target object, and the dilation rate is... The receptive field of the dilated convolution branch corresponds to a medium-scale feature that lies between the local and global scales.

[0063] Optionally, the monitoring terminal can perform element-wise addition and fusion processing on the spatial response feature maps at the three scales to obtain a fused spatial feature map. Element-wise addition and fusion refers to adding the response values ​​located in the same channel and at the same spatial position in the spatial response feature maps at the three scales, merging them into a single response value. The physical basis of this fusion operation is that the features extracted at different receptive field scales have different spatial frequency responses, and the effective response information at each scale can be preserved by element-wise addition.

[0064] Optionally, the monitoring terminal can perform convolutional dimensionality reduction on the fused spatial feature map to obtain a multi-scale spatial feature map. Convolutional dimensionality reduction refers to using... The convolution kernel performs convolution operations on the fused spatial feature map, reducing the number of channels in the fused spatial feature map to the preset target number of channels. Each weight of the convolutional kernel corresponds to an input channel. By weighted summing of the response values ​​of all input channels and processing them through a nonlinear activation function, the response value of the output channel is obtained, thus producing a multi-scale spatial feature map. This multi-scale spatial feature map can be used to characterize the contour response intensity and texture response intensity of an object at different spatial scales.

[0065] S27. Perform multi-layer one-dimensional temporal convolution on the inter-frame displacement vector data to obtain multi-scale temporal response features; perform fully connected mapping on the multi-scale temporal response features to obtain temporal motion feature vectors.

[0066] Optionally, the monitoring terminal performs multi-layer one-dimensional temporal convolution processing on the inter-frame displacement vector data to obtain multi-scale temporal response features. The inter-frame displacement vector data is a two-dimensional vector sequence, containing a sequence of horizontal coordinate displacement components and a sequence of vertical coordinate displacement components. One-dimensional temporal convolution refers to performing a sliding window convolution operation on the displacement vector sequence along the time dimension. The convolution kernel slides along the time axis, weights and sums the displacement values ​​within the window, and then processes them through a non-linear activation function to obtain the temporal convolution output. The multi-layer one-dimensional temporal convolution uses three stacked temporal convolutional layers. The kernel size of the first temporal convolutional layer is [missing information]. It can be used to extract short-term motion patterns between three adjacent frames; the kernel size of the second temporal convolutional layer is... It can be used to extract mid-time motion patterns between five adjacent frames; the kernel size of the third temporal convolutional layer is... This method can be used to extract long-term motion patterns between seven adjacent frames, with the kernel size measured in frames. The number of output channels in each temporal convolutional layer increases progressively to enrich the feature representation. Multi-scale temporal response features can characterize the displacement change patterns of a target object at different time scales. Short-term scales correspond to the instantaneous velocity changes of the target object, while long-term scales correspond to the motion trend and trajectory patterns. The monitoring terminal can perform fully connected mapping on the multi-scale temporal response features to obtain a temporal motion feature vector. Fully connected mapping involves flattening the multi-scale temporal response features into a one-dimensional feature vector, performing matrix multiplication with the weight matrix of the fully connected layer, adding a bias vector, and then processing it through a non-linear activation function to obtain a fixed-dimensional temporal motion feature vector. The physical basis of fully connected mapping is to globally integrate the motion information distributed across different channels and time positions in the multi-scale temporal response features, compressing it into a compact feature vector representation. The temporal motion feature vector can be used to characterize the displacement change patterns and motion trend characteristics of a target object over a time series.

[0067] S28. Perform global average pooling on the multi-scale spatial feature map to obtain the spatial feature vector; concatenate the spatial feature vector and the temporal motion feature vector to obtain the target object feature data.

[0068] Optionally, the monitoring terminal performs global average pooling on the multi-scale spatial feature map to obtain a spatial feature vector. Global average pooling refers to calculating the arithmetic mean of the response values ​​of the multi-scale spatial feature map at all spatial locations in each channel dimension, compressing the spatial response of each channel into a single value. Specifically, for the first channel in the multi-scale spatial feature map... Two-dimensional response matrix of each channel Its spatial dimensions are ,in, Indicates spatial height, in pixels. The spatial width is represented in pixels. The formula for calculating global average pooling is as follows: ,in, The eigenvectors of the spatial feature vectors represent the th The value of each element, Represents the first in a multi-scale spatial feature map The channels are located in spatial positions The response value at that location, and The units are all feature response intensities. The physical basis of global average pooling is to compress the global response in the spatial dimension, preserving the response intensity of each channel to the overall spatial shape of the target object, while eliminating the precise positional information of the target object in the image plane, thus ensuring translation invariance in subsequent feature processing. The monitoring terminal can perform vector concatenation on spatial feature vectors and temporal motion feature vectors to obtain target object feature data. Vector concatenation refers to joining the spatial feature vector and the temporal motion feature vector end-to-end along the feature dimension, merging them into a longer feature vector. Specifically, if the dimension of the spatial feature vector is... The dimension of the temporal motion feature vector is ,in and If all values ​​are preset positive integers, then the dimension of the concatenated target feature data is: The physical basis of vector concatenation is to jointly represent the spatial morphological features and temporal motion features of the target object at the feature level, so that subsequent 3D spatial mapping processing can simultaneously utilize the appearance and motion information of the target object. Target object feature data can be used to characterize the joint feature properties of the target object in terms of spatial morphology and temporal motion.

[0069] In an optional embodiment, S3 includes:

[0070] S31. Perform feature serialization on the target object feature data and expand the target object feature data according to the channel dimension to obtain the feature sequence matrix.

[0071] Optionally, the monitoring terminal can perform feature serialization processing on the target object feature data and expand the target object feature data according to the channel dimension to obtain a feature sequence matrix. The target object feature data is a multi-dimensional feature vector obtained after vector concatenation processing, and its dimension is... Feature serialization refers to segmenting or reorganizing target feature data according to a preset sequence length, converting it into a sequence-based data structure to meet the serialization input requirements of subsequent self-attention models. Channel-dimensional expansion involves arranging feature components belonging to the same semantic category in the target feature data into column vectors of a matrix according to channel order, and arranging feature components at different positions or time steps into row vectors of the matrix. Specifically, if the spatial features of the target feature data come from different spatial locations in a multi-scale spatial feature map, these spatial locations are expanded into a sequence length dimension; if the temporal features come from displacement vectors at multiple time steps, these time steps are expanded into a sequence length dimension. After feature serialization and channel-dimensional expansion, the original target feature vector is converted into a two-dimensional feature sequence matrix, where the number of rows corresponds to the sequence length, and the number of columns corresponds to the number of channels. The physical basis of feature serialization is to organize feature components from different sources into a unified serialization format, facilitating global contextual information modeling in subsequent feature interaction models.

[0072] S32. Input the feature sequence matrix into the three-dimensional centroid prediction model to obtain the predicted height of the target object and the planar projection offset vector.

[0073] Optionally, the monitoring terminal can input the feature sequence matrix into a 3D centroid prediction model to obtain the predicted height and planar projection offset vector of the target object. The 3D centroid prediction model can be a pre-trained deep learning network model used to regress and predict the geometric parameters of the target object in 3D space from the target object's feature sequence matrix. The predicted height can be used to characterize the physical height of the target object's centroid from the ground, in meters. The planar projection offset vector can be used to characterize the physical horizontal offset distance between the target object's pixel center projection point and the actual centroid ground projection point, including offset components in the horizontal x-axis and vertical axis directions, in meters. The 3D centroid prediction model can include an input embedding layer, a multi-head self-attention feature interaction layer, and a two-branch regression layer. The input embedding layer can be used to map each feature vector in the feature sequence matrix to a higher-dimensional embedding space through linear projection, expanding the feature representation capability. The multi-head self-attention feature interaction layer can contain multiple parallel self-attention heads. Each self-attention head independently calculates the feature correlation weight between any two positions in the feature sequence, and performs weighted aggregation of features at each position in the sequence based on this weight, realizing global contextual information interaction. The outputs of multiple self-attention heads are concatenated along the channel dimension and then linearly transformed to obtain the final attention fusion feature. The two-branch regression layer can contain two independent regression branches, each consisting of two stacked fully connected layers. The first fully connected layer is used to map the attention fusion feature to hidden layer features, and the second fully connected layer is used to map the hidden layer features to the final regression output. The first branch outputs the height prediction value, and the second branch outputs the planar projection offset vector.

[0074] S33. The spatial ray direction vector is calculated based on the camera calibration parameters and the pixel coordinate data of the target object. Based on the spatial ray direction vector, the height prediction value, the plane projection offset vector and the ground plane constraint conditions of the restricted area, a set of spatial geometric constraint equations is constructed. The set of spatial geometric constraint equations is solved by least squares to obtain the three-dimensional centroid coordinate data of the target object.

[0075] Optionally, the monitoring terminal can calculate the spatial ray direction vector based on the camera calibration parameters and the pixel coordinate data of the target object. The calculation process of the spatial ray direction vector is as follows: First, the pixel coordinate data of the target object is distorted by using the distortion coefficient in the camera calibration parameters to eliminate the pixel position offset caused by the radial and tangential distortion of the lens, and obtain the distorted pixel coordinates; then, the distorted pixel coordinates are converted into normalized image plane coordinates by using the inverse matrix of the intrinsic parameter matrix in the camera calibration parameters; finally, the normalized image plane coordinates are converted into the world coordinate system direction by using the inverse matrix of the rotation matrix in the camera calibration parameters, and the spatial ray direction vector is obtained. This spatial ray direction vector represents the direction of the spatial straight line that originates from the optical center of the camera and passes through the pixel position of the target object in the world coordinate system.

[0076] Optionally, the monitoring terminal can construct a set of spatial geometric constraint equations based on the spatial ray direction vector, predicted height, planar projection offset vector, and ground plane constraints of the confined area, and then solve the set of spatial geometric constraint equations using least squares to obtain the three-dimensional centroid coordinate data of the target object. The expression of the set of spatial geometric constraint equations can be:

[0077] ;

[0078] in, Represents three-dimensional centroid coordinate data. , , and These represent the coordinate components of the three-dimensional barycentric coordinate data in the three orthogonal directions of the world coordinate system. , and The units are all meters; This represents the three-dimensional coordinate vector of the camera's optical center in the world coordinate system, in meters. The scale factor represents the direction along the space ray. Represents the direction vector of a spatial ray; The normal unit vector representing the ground plane constraint conditions of the restricted area; The initial projection coordinate vector represents the pixel coordinate data of the target object projected onto the ground plane. This initial projection coordinate vector is the initial three-dimensional position obtained by projecting the pixel coordinate data onto the ground plane through inverse perspective projection transformation, and the unit is meters. This represents the predicted altitude, in meters. The three-dimensional extended form representing the plane projection offset vector. This represents the offset component in the horizontal x-axis direction, in meters. This represents the offset component in the horizontal ordinate direction, in meters. This indicates no offset component in the vertical direction, and the unit is meters. This indicates transpose. The physical meaning of this system of equations is as follows: the first equation indicates that the target object lies on a spatial ray emitted from the optical center of the camera; the second equation indicates that the center of gravity of the target object is located above the ground at a height of [missing information]. On the horizontal plane; the third equation indicates that the horizontal offset of the target object's center of gravity relative to the ground projection point is determined by the plane projection offset vector predicted by the model. The system of equations contains three unknowns. , and and auxiliary variables There are four unknowns and three equations that constitute an overdetermined constraint. The monitoring terminal can use the least squares method to solve the overdetermined system of equations and obtain the optimal solution that minimizes the sum of squared residuals of each equation as the three-dimensional centroid coordinate data.

[0079] In an optional embodiment, the 3D centroid prediction model includes an input embedding layer, a multi-head self-attention feature interaction layer, and a two-branch regression layer. The training process of the 3D centroid prediction model includes:

[0080] S301. Obtain historical video stream image data and historical 3D coordinate ground truth data of the restricted area of ​​the water plant, and construct the model training set and model validation set.

[0081] Optionally, the monitoring terminal can acquire historical video stream image data and historical 3D coordinate ground truth data of the restricted area of ​​the water plant to construct a model training set and a model validation set. The historical video stream image data consists of video stream data of the restricted area collected and stored by the monitoring terminal within a past time period, including image sequences under various lighting conditions and target poses. The historical 3D coordinate ground truth data consists of the actual 3D spatial coordinates of the target objects corresponding to the historical video stream image data. This ground truth data is obtained synchronously through auxiliary measurement equipment such as laser rangefinders or binocular vision systems deployed within the restricted area, or through manual calibration. The monitoring terminal can divide the historical video stream image data into training samples and validation samples according to chronological order. The training samples can be used for iterative optimization of model parameters, while the validation samples can be used to monitor the model's generalization performance on unseen data. The division ratio is executed according to a preset ratio to ensure that the data distribution of the training set and validation set is similar. The monitoring terminal can perform data augmentation processing on the historical video stream image data, including random cropping, random flipping, and random brightness adjustment, to expand the diversity of training samples and improve the model's generalization ability.

[0082] S302. The input embedding layer, multi-head self-attention feature interaction layer and dual-branch regression layer are concatenated in sequence to obtain the three-dimensional centroid prediction network framework. The three-dimensional centroid prediction network framework is then initialized to obtain the initial three-dimensional centroid prediction model.

[0083] Optionally, the monitoring terminal can sequentially concatenate the input embedding layer, the multi-head self-attention feature interaction layer, and the two-branch regression layer to obtain a 3D centroid prediction network framework, and initialize the 3D centroid prediction network framework to obtain an initial 3D centroid prediction model. The input embedding layer can be a linear projection layer, with its input dimension equal to the number of channels in the feature sequence matrix, and its output dimension being a preset embedding dimension. The multi-head self-attention feature interaction layer can contain... A stack of self-attention blocks, The default positive integer; each self-attention block contains a multi-head self-attention sublayer and a feedforward sublayer. The multi-head self-attention sublayer can contain... A parallel self-attention head, The parameters are preset positive integers; each self-attention head independently calculates the query matrix, key matrix, and value matrix, and calculates the attention weights through a scaled dot product attention mechanism; the multi-head self-attention sub-layer and the feedforward sub-layer are each followed by residual connections and layer normalization operations. The bi-branch regression layer can contain two independent regression branches. The first regression branch can be used to output the height prediction value, and the second regression branch can be used to output the two components of the planar projection offset vector. The monitoring terminal can use a preset initialization method to initialize the trainable parameters of each layer in the 3D centroid prediction network framework to obtain the initial 3D centroid prediction model.

[0084] S303. Extract historical feature sequence data from the model training set, and perform linear projection mapping on the historical feature sequence data through the input embedding layer to obtain multidimensional embedded features.

[0085] Optionally, the monitoring terminal can extract historical feature sequence data from the model training set, and perform linear projection mapping on the historical feature sequence data through the input embedding layer to obtain multi-dimensional embedded features. The historical feature sequence data is a feature sequence matrix obtained by sequentially performing target detection and tracking, feature extraction, and feature serialization on the historical video stream image data in the model training set. The formula for calculating the linear projection mapping input to the embedding layer can be... ,in, This represents a historical feature sequence matrix, with the unit being an eigenvector. This represents the weight matrix of the input embedding layer; This represents the bias vector of the input embedding layer; This represents multidimensional embedding features.

[0086] S304. Input the multi-dimensional embedded features into the multi-head self-attention feature interaction layer to perform feature interaction calculation and obtain the historical attention fusion features.

[0087] Optionally, the monitoring terminal can input the multi-dimensional embedded features into a multi-head self-attention feature interaction layer for feature interaction computation to obtain historical attention fusion features. The multi-head self-attention feature interaction layer can be used to model the global correlation of each position in the multi-dimensional embedded features. Through parallel computation and result fusion of multiple self-attention heads, historical attention fusion features containing global contextual information are obtained.

[0088] S305. Input the historical attention fusion features into the dual-branch regression layer, and output the historical height prediction value and the historical plane projection offset vector respectively.

[0089] Optionally, the monitoring terminal can input historical attention fusion features into a two-branch regression layer, outputting a historical height prediction value and a historical plane projection offset vector, respectively. The first branch of the two-branch regression layer can be used to map the historical attention fusion features into a scalar output to obtain the historical height prediction value in meters. The second branch of the two-branch regression layer can be used to map the historical attention fusion features into a two-dimensional vector output to obtain the historical plane projection offset vector in meters.

[0090] S306. Construct a loss function based on historical height prediction values, historical plane projection offset vectors, and historical three-dimensional coordinate ground truth data, and calculate the loss value.

[0091] Optionally, the monitoring terminal can construct a loss function based on historical height prediction values, historical planar projection offset vectors, and historical 3D coordinate ground truth data to calculate the loss value. The loss function adopts a multi-task joint loss form, simultaneously constraining the accuracy of the three sub-tasks: height prediction, planar offset prediction, and final 3D coordinate prediction. The expression for the loss value can be:

[0092] ;

[0093] in, This represents the loss value, expressed in square meters. This represents historical height predictions, in meters. This represents the true height component in historical 3D coordinate ground value data, in meters. The L2 norm squared represents the difference between the predicted height and the actual height, used to constrain the accuracy of the model in the height prediction task, and is expressed in meters squared. Represents the historical plane projection offset vector. Both components are in meters; This represents the true plane offset vector corresponding to the historical 3D coordinate ground truth data. Both components are in meters; The squared norm of the difference vector between the predicted and actual offset values ​​is used to constrain the accuracy of the model in the task of plane offset prediction. The unit is the square of meters. This represents the predicted 3D centroid coordinates calculated using a set of spatial geometric constraint equations based on historical height predictions and historical planar projection offset vectors. All three coordinate components are in meters; Represents historical three-dimensional coordinate true value data. All three coordinate components are in meters; The squared L2 norm of the difference vector between the predicted 3D coordinates and the true 3D coordinates is used to constrain the accuracy of the model in the final 3D coordinate prediction task, and the unit is the square of meters. , and These represent the adjustment factors used to balance the weights of each loss.

[0094] S307. Based on the loss value, iteratively train the initial three-dimensional centroid prediction model until the loss value on the model validation set meets the preset convergence condition, and obtain the trained three-dimensional centroid prediction model.

[0095] Optionally, the monitoring terminal can iteratively train the initial 3D centroid prediction model based on the loss value until the loss value on the model validation set meets the preset convergence condition, thus obtaining the trained 3D centroid prediction model. Iterative training can employ a mini-batch stochastic gradient descent optimization algorithm. For each training batch, a preset number of samples are randomly sampled from the training set, and the average loss value of that batch is calculated. The gradient of each trainable parameter in the model relative to the loss value is calculated using the backpropagation algorithm, and the trainable parameters are updated according to the gradient direction using the optimization algorithm. After each training round, the monitoring terminal can evaluate the current model using the validation set and calculate the average loss value on the validation set. When the average loss value on the validation set no longer decreases for a preset number of consecutive rounds or the decrease is less than a preset threshold, the model is deemed to have met the convergence condition, training is stopped, and the current model parameters are saved, resulting in the trained 3D centroid prediction model.

[0096] In an optional embodiment, S4 includes:

[0097] S41. Construct a three-dimensional closed boundary body from the virtual fence boundary coordinate data to obtain a three-dimensional closed boundary body; project the three-dimensional closed boundary body onto the ground plane along the gravity direction to obtain a set of horizontally projected two-dimensional polygon boundary coordinates.

[0098] Optionally, the monitoring terminal can perform 3D closed boundary body construction processing on the virtual fence boundary coordinate data to obtain a 3D closed boundary body. The virtual fence boundary coordinate data can be a set of 3D spatial boundary points pre-marked by maintenance personnel. This set of points contains multiple discrete 3D coordinate points, each corresponding to a vertex of the virtual fence in a preset arrangement order. 3D closed boundary body construction refers to combining discrete boundary coordinate points into a closed 3D spatial region according to preset topological connection rules. The space defined by this closed region is the restricted space range monitored by the virtual fence. Specifically, the monitoring terminal can connect adjacent vertices with straight line segments to form boundary edges based on the connection relationship of the boundary coordinate points. The boundary edges enclosing the same plane are combined into boundary surfaces, and multiple boundary surfaces enclose a closed 3D polyhedron. The internal region of the 3D closed boundary body is the spatial range for determining whether a target object has intruded. The monitoring terminal projects the 3D closed boundary body onto the ground plane along the direction of gravity to obtain a set of horizontally projected 2D polygon boundary coordinates. Projecting along the direction of gravity onto the ground plane refers to projecting the coordinates of all vertices of a three-dimensional closed boundary volume perpendicularly to the ground plane along the direction of gravity, ignoring the vertical height components of each vertex and retaining only the horizontal plane coordinate components. The projected edges of the three-dimensional closed boundary volume form the edges of a two-dimensional polygon, and the projected faces of the three-dimensional closed boundary volume merge to form the internal region enclosed by the two-dimensional polygon. After projection, the closed volume in three-dimensional space is simplified to a two-dimensional polygon on the ground plane, and the set of boundary coordinates of the horizontally projected two-dimensional polygon is represented as... ,in This represents the total number of vertices of the horizontally projected two-dimensional polygon. It is a positive integer. Indicates the first The horizontal plane coordinate components of each vertex and The unit is meters. From to This indicates the vertex number arranged in counter-clockwise order.

[0099] S42. Calculate the edge vector sequence by performing edge vector sequence calculation on the boundary coordinate set of the horizontally projected two-dimensional polygon.

[0100] Optionally, the monitoring terminal can perform edge vector sequence calculation on the boundary coordinate set of the horizontally projected two-dimensional polygon to obtain an edge vector sequence. Edge vector sequence calculation refers to calculating the direction vector of each edge of the horizontally projected two-dimensional polygon sequentially according to the order of the vertices. For the... The edge vector is calculated starting from the first edge. The vertex points to the first A vertex, when equal At that time, the first The edge from the first The vertex points to the first A series of vertices form a closed polygon. The sequence of edge vectors is represented as follows: , of which The direction vector of the edge The calculation formula can be: , among which, when hour, ; Indicates the first The direction vector of the edge, The x-axis component is The unit is meters. The ordinate component is The unit is meters. The physical meaning of the edge vector sequence is to represent the geometric shape information of the polygon as the direction and length of each side, which can be used for subsequent calculations to determine the intersection points of rays and edges.

[0101] S43. Starting from the horizontal projection point of the three-dimensional centroid coordinate data, construct a ray along the positive horizontal direction; count the intersection points of the ray and each side in the edge vector sequence to obtain the initial number of intersection points.

[0102] Optionally, the monitoring terminal can construct a ray along the positive horizontal direction, starting from the horizontal projection point of the 3D centroid coordinate data, and count the intersection points of the ray and each edge in the edge vector sequence to obtain the initial number of intersection points. The horizontal projection point of the 3D centroid coordinate data can be represented as... ,in, This represents the horizontal x-axis component of the three-dimensional centroid coordinate data, in meters. This represents the horizontal ordinate component of the three-dimensional centroid coordinate data, in meters. From point... Construct a ray along the positive horizontal direction ,in, For ray parameters, It is a non-negative real number. This represents a unit vector in the positive horizontal direction. The monitoring terminal can sequentially calculate the intersection points of the ray and each edge in the edge vector sequence. If a ray intersects with an edge in the two-dimensional plane, and the intersection point lies within the positive semi-axis of the ray and within the edge segment, then this intersection point is counted in the initial number of intersection points. The initial number of intersection points is denoted as... , It is a dimensionless non-negative integer. When a ray passes through a vertex of a horizontally projected two-dimensional polygon, the following determination rule is used: calculate the lateral signs of the two edges adjacent to that vertex in the ray direction. and ,in, Represents the unit vector in the positive horizontal direction. This represents the cross product operation of two-dimensional vectors. Represents the relationship between the ray direction vector and the first... The sign of the cross product of the direction vectors of the edges. The value is , or , Represents the relationship between the ray direction vector and the first... The sign of the cross product of the direction vectors of the edges. The value is , or The unit is dimensionless. This represents a symbolic function. If... If the ray passes through the same side of a vertex, that vertex is counted as a single intersection point in the initial number of intersection points; if If a ray passes through an edge opposite to a vertex, that vertex is counted as one of two intersections in the initial number of intersections. The physical basis of this determination rule is to determine the positional relationship between a point and a polygon by the number of intersections between the ray and an edge. When a ray passes through a vertex, the lateral sign is used to determine whether the two adjacent edges of the vertex are on the same side or opposite side of the ray, thus eliminating ambiguity in the intersection count.

[0103] S44. Determine the odd or even number of initial intersection points to obtain the horizontal position determination result.

[0104] Optionally, the monitoring terminal can perform parity determination on the initial number of intersection points to obtain the horizontal position determination result. The parity determination logic is as follows: if the initial number of intersection points... If the number of initial intersection points is odd, then the horizontal projection point is determined to be inside the horizontally projected two-dimensional polygon, and the horizontal position determination result is assigned as the first state value, which indicates that the horizontal projection point is inside the polygon; if the initial number of intersection points is odd... If the number of intersections is even, the horizontal projection point is determined to be outside the horizontally projected two-dimensional polygon. The horizontal position determination result is assigned as the second state value, which indicates that the horizontal projection point is outside the polygon. The physical basis of this determination method is the ray method principle in computational geometry, that is, when the number of intersections between a ray emanating from any point in the plane and the closed polygon is odd, the point is inside the polygon; when the number of intersections is even, the point is outside the polygon. This principle is based on the Jordan curve theorem.

[0105] S45. Determine the vertical range of the height component of the three-dimensional centroid coordinate data to obtain the vertical position determination result.

[0106] Optionally, the monitoring terminal can perform vertical range determination processing on the height component of the three-dimensional centroid coordinate data to obtain the vertical position determination result. The height component of the three-dimensional centroid coordinate data is... The unit is meters. Optionally, the calculation formula for determining the vertical range can be:

[0107] ;

[0108] in, This indicates the result of the vertical position determination. It is a Boolean value, and its value is... This indicates that the center of gravity of the target object is within the vertical coverage area of ​​the virtual fence, and the value is [value missing]. This indicates that the center of gravity of the target object is outside the vertical coverage area of ​​the virtual fence; This represents the smallest vertical coordinate component of a three-dimensional closed boundary volume in the direction of gravity, expressed in meters. This represents the maximum vertical coordinate component of a three-dimensional closed boundary volume in the direction of gravity, expressed in meters. This represents the height component of the three-dimensional centroid coordinate data, in meters.

[0109] S46. Perform a logical AND synthesis on the horizontal and vertical position determination results to obtain the three-dimensional spatial position determination result.

[0110] Optionally, the monitoring terminal can perform a logical AND operation on the horizontal and vertical position determination results to obtain a three-dimensional spatial position determination result. The logical AND operation involves performing a logical AND operation on the horizontal and vertical position determination results. If the horizontal position determination result indicates the location is inside the virtual fence and the vertical position determination result indicates the location is within the virtual fence, then the logical AND result indicates the three-dimensional spatial position is outside the virtual fence. The three-dimensional spatial position determination result is represented as follows: ,in, This represents the logical AND operator. For is a boolean value, taking the value of The time indicates that the three-dimensional centroid coordinates are located inside the three-dimensional closed boundary volume, and the value is [value missing]. The time indicates that the three-dimensional centroid coordinates are located outside the three-dimensional closed boundary volume. The physical basis of this logic and synthesis is that a point in three-dimensional space is located inside the closed volume if and only if the horizontal projection of the point is inside the horizontal projection polygon of the closed volume and the height of the point is within the vertical height range of the closed volume.

[0111] S47. Based on the three-dimensional spatial location determination result and the authorization certificate status, obtain the access status data.

[0112] Optionally, the monitoring terminal can obtain access status data based on the three-dimensional spatial location determination result and the authorization credential status. The authorization credential status can be used to indicate whether the target object possesses a valid authorization credential to enter the restricted area. The authorization credential status is a Boolean value, with a value of [value to be filled in]. This indicates that the target object possesses a valid authorization certificate, and its value is [value missing]. The status indicates that the target object does not possess a valid authorization certificate. The mapping logic for the access status data is as follows: If the 3D spatial location determination result is that it is located outside the 3D closed boundary, then permitted access status data is generated, indicating that the target object has not entered the restricted area and no alarm needs to be triggered; if the 3D spatial location determination result is that it is located inside the 3D closed boundary and the authorization certificate status is valid, then permitted access status data is generated, indicating that the target object possesses a valid authorization certificate and is allowed to move within the restricted area; if the 3D spatial location determination result is that it is located inside the 3D closed boundary and the authorization certificate status is no valid authorization certificate, then prohibited access status data is generated, indicating that the target object has entered the restricted area without authorization and an alarm needs to be triggered. Access status data is used to characterize whether the target object is allowed to be inside the restricted area at the current moment, and the unit is status enumeration value.

[0113] In an optional embodiment, S5 includes:

[0114] S51. Update the time-series state queue of the admission state data and historical admission state cache data to obtain the current time window state sequence.

[0115] Optionally, the monitoring terminal can perform time-series state queue update processing on the access status data and historical access status cache data to obtain the current time window state sequence. The access status data is a Boolean state value generated in step S47 at the current frame time, representing the access determination result of the target object at the current time. The value is either "allow access" or "prohibit access," and the unit is a state enumeration value. The historical access status cache data is stored in the memory of the monitoring terminal to record the access status data of past frames. The storage format of the cache data is a state value sequence arranged in chronological order. The time-series state queue update processing refers to appending the current frame's access status data to the end of the historical access status cache data and removing historical state data exceeding the preset time window length from the beginning of the cache data, thereby maintaining a fixed-length state sequence. The preset time window length is... frame, Let be a preset positive integer, and be the unit of frames. After the time-series state queue update process, the current time window state sequence can be represented as follows: ,in, Indicates the current frame sequence number index. It is a positive integer, and the unit is a frame. This represents the admission status data for the current frame. For state enumeration values, This represents the admission status data of the earliest frame within the time window. These are the state enumeration values.

[0116] S52. Perform state transition statistics on the current time window state sequence to obtain state transition statistics.

[0117] Optionally, the monitoring terminal can perform state transition statistics processing on the current time window state sequence to obtain state transition statistics. State transition statistics processing refers to traversing and analyzing the current time window state sequence to count the number of transitions from an allowed access state to a prohibited access state and the number of consecutive frames in the prohibited access state. Specifically, the monitoring terminal can traverse the state changes between adjacent frames in the time window state sequence; when the access state of a certain frame is allowed access and the access state of the next frame is prohibited access, the transition count is increased. The number of transitions is expressed as... , It is a non-negative integer. Simultaneously, the monitoring terminal counts the number of consecutive frames in the prohibited access state at the end of the time window state sequence; that is, it counts the number of frames with consecutive prohibited access states by tracing back from the current frame. This statistic is expressed as... , Represents a positive integer, with the unit being frames. State transition statistics. It is a one-dimensional vector containing the number of transitions. and consecutive frames Two components. The physical basis of state transition statistical processing is to quantify the frequency characteristics of the target object changing from a legal state to an illegal state and the duration characteristics of the abnormal state, so as to provide a quantitative basis for subsequent confidence determination.

[0118] S53. Perform confidence-weighted judgment on the state transition statistics and access status data to obtain the access monitoring judgment result.

[0119] Optionally, the monitoring terminal can perform confidence-weighted judgment processing on the state transition statistics and admission status data to obtain the admission monitoring judgment result. Confidence-weighted judgment processing refers to combining the admission status data and state transition statistics of the current frame for comprehensive judgment, in order to reduce the impact of false detections in a single frame on the judgment result. The judgment logic is as follows: if the admission status data of the current frame... If access is permitted, the access monitoring result will be directly output as "normal," indicating that there are no abnormal intrusion events in the current monitoring area. If the current frame's access status data... If the access is denied, then further examine the state transition statistics: if the number of transitions... The number of consecutive frames exceeds the first preset threshold. If the number of transfers exceeds the second preset threshold, the access monitoring result will be output as an intrusion confirmation status. This status indicates that an intrusion event has been confirmed after multiple frames of timing verification. Less than or equal to the first preset threshold or the number of consecutive frames. If the threshold is less than or equal to the second preset threshold, the output access monitoring result is "Intrusion Pending Confirmation," indicating that a suspected intrusion has been detected, but the temporal confidence level is insufficient, requiring further observation. Both the first and second preset thresholds are preset positive integers. The physical basis for the confidence-weighted judgment process is the principle of time-series state confidence accumulation. Single-frame instantaneous judgment may result in false detections; verifying state consistency across multiple consecutive frames improves the reliability of the judgment result.

[0120] S54. Map alarm levels to the entry monitoring judgment results to obtain alarm level codes.

[0121] Optionally, the monitoring terminal can perform alarm level mapping processing on the access monitoring judgment result to obtain an alarm level code. The alarm level mapping processing performs code conversion according to a preset mapping relationship between the judgment result and the alarm level: If the access monitoring judgment result is in a normal state, it is mapped to a first alarm level code, indicating that no alarm operation needs to be triggered. If the access monitoring judgment result is in an intrusion pending confirmation state, it is mapped to a second alarm level code, indicating that a primary alarm is triggered, and this alarm level corresponds to prompting maintenance personnel to manually review the monitoring screen. If the access monitoring judgment result is in an intrusion confirmed state, it is mapped to a third alarm level code, indicating that an emergency alarm is triggered, and this alarm level corresponds to automatically executing audible and visual alarms and access interception operations. Alarm Level Code These are discrete enumerated values. The physical basis for alarm level mapping processing is to convert qualitative judgment results into hierarchical quantization codes to support the multi-level response mechanism of the water plant monitoring system.

[0122] S55. Encapsulate the alarm level code, access status data, and access monitoring judgment results to obtain access monitoring result data.

[0123] Optionally, the monitoring terminal can encapsulate the alarm level code, access status data, and access monitoring judgment result to obtain access monitoring result data. The monitoring result encapsulation process combines the alarm level code, access status data, and access monitoring judgment result into a structured data object according to a preset data encapsulation format. The preset data encapsulation format includes a data header and a data body. The data header contains a data identifier and timestamp information, while the data body contains a target object identifier field, an access status data field, an access monitoring judgment result field, and an alarm level code field. The access status data field can be used to record the access judgment result of the current frame, the access monitoring judgment result field can be used to record the comprehensive judgment result after time-series verification, and the alarm level code field can be used to record the current alarm level. The monitoring terminal can send the encapsulated structured data object to the host computer display interface of the water plant monitoring system via the communication network for visual display, and simultaneously send it to the alarm execution terminal to trigger the corresponding alarm response operation.

[0124] In the aforementioned water plant confined space access monitoring method based on virtual fences, real-time video stream image data of the confined area is acquired and combined with camera calibration parameters and ground plane constraints. Target detection and tracking are performed on the real-time video stream image data to extract the pixel coordinates of the target object. Then, based on these pixel coordinates, multi-scale joint features of the target object in the spatial and temporal dimensions are extracted. Using these joint features, the three-dimensional centroid coordinates of the target object are calculated through three-dimensional spatial mapping. Finally, topological association determination is performed based on the three-dimensional centroid coordinates and the virtual fence boundary coordinates. Finally, monitoring results are generated based on the access status. This method enables continuous three-dimensional spatial perception of the water plant confined area through monocular vision, adapts to the flexible deployment requirements of complex irregular spaces such as chemical dosing rooms and sedimentation tanks, improves the flexibility and spatial coverage of virtual fence deployment, reduces false alarm rates caused by ambient light and dust interference, effectively reduces the installation and maintenance costs of physical fences, and achieves real-time intelligent monitoring of unauthorized intrusion.

[0125] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0126] Based on the same inventive concept, this application also provides a virtual fence-based water plant confined space access monitoring system for implementing the aforementioned virtual fence-based water plant confined space access monitoring method. The solution provided by this system is similar to the implementation described in the above method. Therefore, the specific limitations of one or more embodiments of the virtual fence-based water plant confined space access monitoring system provided below can be found in the limitations of the virtual fence-based water plant confined space access monitoring method described above, and will not be repeated here.

[0127] In one exemplary embodiment, such as Figure 2 As shown, a schematic diagram of a water plant confined space access monitoring system 10 based on a virtual fence is provided, including:

[0128] Data acquisition module 11 is used to acquire real-time video stream image data and ground plane constraint data of the restricted area of ​​the water plant; and to acquire camera calibration parameters and virtual fence boundary coordinate data.

[0129] The target perception module 12 is used to perform target detection and target tracking on real-time video stream image data to obtain the pixel coordinate data of the target; based on the pixel coordinate data of the target, it extracts the multi-scale spatial features and temporal motion features of the target to obtain the target feature data.

[0130] The 3D mapping module 13 is used to map the feature data of the target object to a 3D physical space based on the camera calibration parameters, the pixel coordinate data of the target object and the ground plane constraint conditions of the restricted area, and to calculate the 3D centroid coordinate data of the target object.

[0131] The topology analysis module 14 is used to analyze the topological association characteristics between the target object and the virtual fence boundary based on the target object's centroid coordinate data and the virtual fence boundary coordinate data, and to obtain the admission status data.

[0132] The monitoring result output module 15 is used to generate access monitoring result data based on the access status data.

[0133] In one embodiment, such as Figure 3 A computer device 300 is provided, comprising:

[0134] At least one processor 301, and at least one memory 302 communicatively connected to said processor 301; said memory stores application code executable by said processor, said application code being executed by said processor to enable said processor to perform the steps of a virtual fence-based water plant confined space access monitoring method as described above;

[0135] The computer device may also include: sensor 303;

[0136] The processor 301, memory 302, and sensor 303 can be connected via bus 304 or other means. The figure shows an example of connection via bus 304. Figure 3 The character is represented by a single thick line, but this does not mean that there is only one bus or a type of bus.

[0137] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0138] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0139] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.

Claims

1. A method for monitoring access to confined spaces in a water plant based on virtual fences, characterized in that, The method includes: S1. Acquire real-time video stream image data and ground plane constraint data of the restricted area of ​​the water plant; acquire camera calibration parameters and virtual fence boundary coordinate data; S2. Perform target detection and target tracking on the real-time video stream image data to obtain the pixel coordinate data of the target object; based on the pixel coordinate data of the target object, extract the multi-scale spatial features and temporal motion features of the target object to obtain the target object feature data; S3. Based on the camera calibration parameters, the pixel coordinate data of the target object, and the ground plane constraint conditions of the restricted area, the feature data of the target object is mapped to a three-dimensional physical space, and the three-dimensional centroid coordinate data of the target object is calculated. S4. Based on the target object's centroid coordinate data and the virtual fence boundary coordinate data, analyze the topological association characteristics of the target object and the virtual fence boundary to obtain access status data; S5. Based on the access status data, generate access monitoring result data.

2. The method according to claim 1, characterized in that, S2 includes: S21. Perform pixel-by-pixel grayscale difference operation on the current frame image and the preset background image in the real-time video stream image data to obtain differential intensity image data; the differential intensity image data includes pixel grayscale values; S22. Perform grayscale morphological opening and closing operations on the differential intensity image data to obtain connectivity-enhanced image data; S23. The connectivity-enhanced image data is labeled with eight neighbor connected components to obtain a set of pixel indices for each connected component; S24. Based on the pixel index set of each connected component and the gray value of each pixel, calculate the zero-order moment and the first-order moment, and calculate the centroid position of each connected component to obtain the pixel coordinate data of the target object in the current frame.

3. The method according to claim 2, characterized in that, S2 further includes: S25. Calculate the Euclidean distance between the pixel coordinate data of the current frame and the pixel coordinate data of the previous frame, and obtain the inter-frame displacement vector data of the target object based on the Euclidean distance. S26. Batch normalize the pixel coordinate data to obtain standardized pixel features; perform dilated convolutions with different dilation rates on the standardized pixel features in parallel to obtain multiple scale spatial response feature maps; fuse the multiple scale spatial response feature maps element-wise to obtain a fused spatial feature map; perform convolutional dimensionality reduction on the fused spatial feature map to obtain a multi-scale spatial feature map; wherein, the multi-scale spatial feature map is used to characterize the contour response intensity and texture response intensity of the target object at different spatial scales; S27. Perform multi-layer one-dimensional temporal convolution on the inter-frame displacement vector data to obtain multi-scale temporal response features; perform fully connected mapping on the multi-scale temporal response features to obtain temporal motion feature vectors; wherein, the temporal motion feature vectors are used to characterize the displacement change law and motion trend characteristics of the target object in the time series; S28. Perform global average pooling on the multi-scale spatial feature map to obtain a spatial feature vector; concatenate the spatial feature vector and the temporal motion feature vector to obtain the target object feature data; wherein, the target object feature data is used to characterize the joint feature characteristics of the target object in spatial morphology and temporal motion.

4. The method according to claim 1, characterized in that, S3 includes: S31. Perform feature serialization on the target object feature data, and expand the target object feature data according to the channel dimension to obtain a feature sequence matrix; S32. Input the feature sequence matrix into the three-dimensional centroid prediction model to obtain the height prediction value and the planar projection offset vector of the target object; wherein, the height prediction value is used to characterize the physical height of the target object's centroid from the ground, and the planar projection offset vector is used to characterize the physical horizontal offset distance between the target object's pixel center projection point and the actual centroid ground projection point; S33. A spatial ray direction vector is calculated based on the camera calibration parameters and the pixel coordinate data of the target object; a set of spatial geometric constraint equations is constructed based on the spatial ray direction vector, the predicted height, the planar projection offset vector, and the ground plane constraint conditions of the restricted area; the set of spatial geometric constraint equations is solved by least squares to obtain the three-dimensional centroid coordinate data of the target object; the expression of the set of spatial geometric constraint equations is: in, This is the three-dimensional centroid coordinate data. , , and These represent the coordinate components of the three-dimensional barycentric coordinate data in three orthogonal directions in space. This represents the three-dimensional coordinate vector of the camera's optical center in the world coordinate system. The scale factor represents the direction along the space ray. The normal unit vector represents the ground plane constraint condition of the restricted area. The initial projection coordinate vector representing the pixel coordinate data of the target object projected onto the ground plane. This indicates transpose.

5. The method according to claim 4, characterized in that, The 3D centroid prediction model includes an input embedding layer, a multi-head self-attention feature interaction layer, and a two-branch regression layer. The training process of the 3D centroid prediction model includes: S301. Obtain historical video stream image data and historical 3D coordinate ground value data of the restricted area of ​​the water plant, and construct the model training set and model validation set; S302. The input embedding layer, the multi-head self-attention feature interaction layer and the dual-branch regression layer are sequentially concatenated to obtain a three-dimensional centroid prediction network framework, and the three-dimensional centroid prediction network framework is initialized to obtain an initial three-dimensional centroid prediction model. S303. Extract historical feature sequence data from the model training set, and perform linear projection mapping on the historical feature sequence data through the input embedding layer to obtain multidimensional embedded features; S304. Input the multi-dimensional embedded features into the multi-head self-attention feature interaction layer to perform feature interaction calculation and obtain historical attention fusion features; S305. Input the historical attention fusion feature into the dual-branch regression layer, and output the historical height prediction value and the historical plane projection offset vector respectively. S306. Construct a loss function based on the historical height prediction value, the historical plane projection offset vector, and the historical three-dimensional coordinate ground value data, and calculate the loss value; the expression for the loss value is: ; in, Indicates the loss value. This represents the historical height prediction value. This represents the true height component in the historical 3D coordinate ground truth data. Represents the historical plane projection offset vector. This represents the true plane offset vector corresponding to the historical 3D coordinate ground truth data. This represents the predicted 3D centroid coordinates calculated based on historical height predictions and historical planar projection offset vectors. Represents historical three-dimensional coordinate true value data. , and These represent the adjustment factors used to balance the weights of each loss. The squared norm of a vector is denoted by 2. S307. Based on the loss value, iteratively train the initial three-dimensional centroid prediction model until the loss value on the model validation set meets the preset convergence condition, and obtain the trained three-dimensional centroid prediction model.

6. The method according to claim 1, characterized in that, S4 includes: S41. Construct a three-dimensional closed boundary body from the virtual fence boundary coordinate data to obtain a three-dimensional closed boundary body; project the three-dimensional closed boundary body onto the ground plane along the direction of gravity to obtain a set of horizontally projected two-dimensional polygon boundary coordinates. S42. Calculate the edge vector sequence on the set of boundary coordinates of the horizontally projected two-dimensional polygon to obtain the edge vector sequence; S43. Starting from the horizontal projection point of the three-dimensional centroid coordinate data, construct a ray along the positive horizontal direction; count the intersection points of the ray and each side in the edge vector sequence to obtain the initial number of intersection points. S44. Determine whether the number of initial intersection points is odd or even to obtain the horizontal position determination result; S45. Determine the vertical range of the height component of the three-dimensional centroid coordinate data to obtain the vertical position determination result. S46. Perform a logical AND synthesis on the horizontal position determination result and the vertical position determination result to obtain a three-dimensional spatial position determination result; S47. Based on the three-dimensional spatial location determination result and the authorization certificate status, the access status data is obtained.

7. The method according to claim 1, characterized in that, S5 includes: S51. Update the time-series state queue of the admission state data and the historical admission state cache data to obtain the current time window state sequence; S52. Perform state transition statistics on the current time window state sequence to obtain state transition statistics; S53. Perform a confidence-weighted determination on the state transition statistics and the access status data to obtain the access monitoring determination result; S54. Map the access monitoring judgment result to an alarm level to obtain an alarm level code; S55. Encapsulate the alarm level code, the access status data, and the access monitoring judgment result to obtain the access monitoring result data.

8. A water plant confined space access monitoring system based on virtual fences, characterized in that, The system includes: The data acquisition module is used to acquire real-time video stream image data and ground plane constraint data of the restricted area of ​​the water plant; and to acquire camera calibration parameters and virtual fence boundary coordinate data. The target perception module is used to perform target detection and target tracking on the real-time video stream image data to obtain the pixel coordinate data of the target object; based on the pixel coordinate data of the target object, it extracts the multi-scale spatial features and temporal motion features of the target object to obtain the target object feature data; The three-dimensional mapping module is used to map the feature data of the target object to a three-dimensional physical space based on the camera calibration parameters, the pixel coordinate data of the target object, and the ground plane constraint conditions of the restricted area, and to calculate the three-dimensional centroid coordinate data of the target object. The topology analysis module is used to analyze the topological association characteristics of the target object and the virtual fence boundary based on the target object's centroid coordinate data and the virtual fence boundary coordinate data, and to obtain the admission status data. The monitoring result output module is used to generate access monitoring result data based on the access status data.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.