A cloud-edge collaborative security video structuring method and a storage medium
By forming erasure and growth scan sequences at edge nodes and mapping and calibrating them in the cloud, the problem of trajectory segment continuation in security video structuring under occlusion areas is solved, achieving efficient target recognition and continuation.
Patent Information
- Application Number
- CN202611353402.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-02
- Publication Date
- 2026-11-27
AI Technical Summary
In security video structuring, there is a problem that the structured trajectory segments before and after the occlusion of the same target caused by fixed occlusion areas are difficult to accurately continue, especially when processing edge nodes, where the trajectory segments before and after occlusion lack physical connection.
By using image recognition models at edge nodes, target detection, visible foreground segmentation, and target tracking are obtained, forming erasure scan sequences and growth scan sequences. These sequences are then mapped to the same boundary reference coordinates in the cloud. The scene calibration relationship of the occlusion boundary is used to determine the structured trajectory segments of the same target.
It effectively continues the target records before and after occlusion, reduces the amount of data uploaded to edge nodes, improves the accuracy of trajectory continuation, and solves the problem of identity ambiguity in multi-target occlusion areas.
Smart Images

Figure CN123182104A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of security video structuring technology, and in particular to a cloud-edge collaborative security video structuring method and storage medium. Background Technology
[0002] Security video structuring typically involves fixed cameras continuously capturing scene video, using image recognition models to detect targets from video frames, extract target categories and locations, and form target trajectories. These trajectories are then converted into structured records for easy retrieval and statistical analysis. To balance on-site response and centralized management, target detection, foreground segmentation, and short-range tracking can be performed at edge nodes close to the cameras. The structured results generated by these edge nodes are aggregated in the cloud and correlated across time periods. Chinese patent application CN115171007A discloses a scene monitoring method, device, equipment, and storage medium based on edge computing. It utilizes a neural network model at the edge device side to determine and output abnormal information from monitoring images, reflecting a general technical form for edge-side execution of monitoring image recognition tasks.
[0003] Within fixed fields of view such as warehouse aisles, factory entrances and exits, and equipment areas, pillars, shelf ends, door frames, or equipment casings can create persistent occlusion zones. When a target enters this occlusion zone, its visible area gradually shrinks until it disappears completely, and it gradually reappears from the other side when it leaves. When edge nodes track targets based solely on the currently visible image, they often assign different local target identifiers to the two trajectory segments before and after occlusion. If edge nodes only send structured results such as target bounding boxes, categories, and trajectories to the cloud to reduce continuous uploads, the cloud will lose the pixel change process at the occlusion boundary, making it difficult to recover the physical connection between the two trajectory segments.
[0004] Existing occlusion processing methods can predict a target's hiding location based on its position and speed before disappearing, and can also compare its appearance features after it reappears. However, targets may pause or change speed within the occlusion zone, causing significant deviations in the extrapolated position based on elapsed time. When multiple targets of the same type, color, or model pass through the same occlusion zone consecutively, the appearance features before and after occlusion lack sufficient distinguishability. Simply extending the trajectory holding time does not provide new evidence for target identification and easily leads to the erroneous merging of different targets close to the same occlusion zone.
[0005] While a fixed occlusion makes the central portion of the target image invisible, its position and boundaries remain unchanged over time. During the process of the target disappearing from one side of the occlusion and reappearing from the other, the changes in contact between the visible foreground and the occlusion boundaries on both sides still retain information about the target's outline being segmented. How to convert these contact changes into a small-data-volume structured sequence at the edge, and how to use this structured sequence in the cloud to continue target records before and after the occlusion, while simultaneously handling pairing ambiguities caused by changes in target speed and the continuous passage of multiple targets, are the technical problems that cloud-edge collaborative security video structuring needs to solve. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to provide a cloud-edge collaborative security video structuring method and storage medium to solve the problem that it is difficult to accurately continue the structured trajectory segments before and after the same target is obscured by static obscuration areas.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: A cloud-edge collaborative method for structuring security videos includes: Acquire surveillance video captured by a fixed camera, where static obstruction areas within the field of view sequentially have entry and exit boundaries along a preset passage direction; The edge nodes utilize an image recognition model to perform target detection, visible foreground segmentation, and target tracking, obtaining an entry-side structured trajectory segment that terminates before the entry boundary and an exit-side structured trajectory segment that begins after the exit boundary. When the visible foreground mask of the target contacts the entry boundary, the reduction in visible foreground area and the boundary contact chord distribution are obtained by the boundary normal displacement, forming an erasure scan sequence; When the visible foreground mask of the candidate target contacts the departure boundary, the increase in visible foreground area and the boundary contact chord distribution are obtained according to the boundary normal displacement, forming a growth scanning sequence; The edge nodes send the structured trajectory fragments and corresponding scanning sequences to the cloud in a cloud-edge collaborative manner; Based on the scene calibration relationship between the two boundaries, the cloud transforms the erasure scan sequence and the growth scan sequence to the same boundary reference coordinates, and determines the sequence pair in which the area reduction and area increase are consistent and the boundary contact chord distribution is consistent under the same displacement phase; When the sequence pair satisfies the spatiotemporal constraints of the static occlusion area, the two corresponding structured trajectory segments are configured as the same structured target identifier.
[0008] Optionally, the static occlusion area is determined by a pre-written occlusion region polygon; The boundary segment where the polygon of the occluded area first intersects the target trajectory along the preset travel direction is determined as the entry boundary, and the boundary segment that subsequently intersects the target trajectory is determined as the exit boundary. Boundary strips are set on the visible sides of the entry boundary and the exit boundary respectively. Targets that belong to the preset rigid target category, whose foreground mask aspect ratio changes less than the contour stabilization threshold when fully visible before and after entry, whose mask principal axis direction difference is less than the attitude stabilization threshold, and which pass through the boundary strip along the preset passage direction are identified as contour-stabilized targets for sequence pairing.
[0009] Optionally, for each displacement sampling position of the erase scan sequence or the growth scan sequence: Calculate the visible foreground mask area difference between adjacent displacement sampling positions, and divide the visible foreground mask area difference by the foreground mask area when the target is fully visible before contacting the corresponding boundary or after leaving the corresponding boundary to obtain the normalized area change. Obtain the foreground pixel segments that are continuously distributed along the boundary tangential direction within the corresponding boundary strip of the visible foreground mask, and determine the tangential length and tangential centroid position of the foreground pixel segments as the boundary contact chord distribution; The normalized area change, the normalized tangential length of the projection height when the target is fully visible, and the normalized tangential centroid position of the boundary length are used to form the boundary scan element corresponding to the displacement sampling position.
[0010] Optionally, a boundary strip is set on the visible side of the corresponding boundary, and the optical flow between adjacent video frames is calculated within the visible foreground mask of the boundary strip to obtain the median component of the optical flow in the normal direction of the corresponding boundary. The absolute value of the median component is accumulated along the duration of the period in which the erasure scan sequence or the growth scan sequence is formed to obtain the boundary scan displacement; The corresponding reduction or increase in the visible foreground area and the boundary contact chord distribution are resampled according to the equal boundary scan displacement interval, and the ratio of the boundary scan displacement to the total displacement corresponding to a complete scan is used as the displacement phase.
[0011] Optionally, the scene calibration relationship includes a first coordinate transformation from the tangential coordinates of the entry boundary to the boundary reference coordinates, a second coordinate transformation from the tangential coordinates of the exit boundary to the boundary reference coordinates, and projection scale coefficients corresponding to the entry boundary and the exit boundary, respectively. The tangential centroid position of the boundary contact chord distribution is corrected by using the first coordinate transformation and the second coordinate transformation respectively, and the tangential length of the boundary contact chord distribution is corrected by using the corresponding projection scale coefficient. Under the same displacement phase, the normalized area reduction in the erasure scan is correlated with the normalized area increase in the growth scan, and the corrected tangential length and tangential centroid position are correlated.
[0012] Optionally, the static blocking area blocks a one-way, branchless passageway that prohibits targets from crossing; The edge nodes maintain the hidden occupancy of the static occupancy area. For each target's erase scan at the entry boundary, the hidden occupancy is increased by one count unit, and for each target's growth scan at the exit boundary, the hidden occupancy is decreased by one count unit. The moment when the hidden occupancy increases from zero and then returns to zero, and when the boundary strips set on the visible side of the entry boundary and the exit boundary are restored to a static background, is determined as the batch reset moment. The erase scan sequence and growth scan sequence obtained between adjacent batch reset moments are classified into the same occlusion passage batch.
[0013] Optionally, the cloud can establish candidate pairs that prohibit order crossover according to the completion order of each erasure scan sequence at the entry boundary and the completion order of each growth scan sequence at the exit boundary. Within the blocked passage batch, solve for the order-preserving pairing result that minimizes the sum of the scan sequence difference and passage time deviation of each candidate pairing; When the hidden occupancy does not return to zero within the preset longest passage time, the number of the erasure scan sequence and the number of the growth scan sequence are not equal, or the difference between the minimum scan sequence exceeds the pairing threshold, the occluded passage batch is marked as an abnormal batch and the corresponding structured trajectory segments are kept independent of each other.
[0014] Optionally, both the entry-side structured trajectory segment and the exit-side structured trajectory segment include a camera identifier, a static occlusion area identifier, a boundary identifier, a local trajectory identifier, a target category, a data acquisition timestamp, a target detection box, a visible foreground mask index, and a preset travel direction; Both the erasure scan sequence and the growth scan sequence include displacement phase, normalized area change, normalized tangential length, normalized tangential centroid position, and corresponding local trajectory identifier.
[0015] Optionally, the area residual between the normalized area reduction of the erasure scan and the normalized area increase of the growth scan under the same displacement phase, the chord length residual between the tangential lengths corrected by the scene calibration relationship, and the position residual between the tangential centroid positions corrected by the scene calibration relationship are calculated respectively. The area residual, chord length residual, and position residual of multiple displacement phases are weighted and accumulated to obtain the scan sequence difference; The corresponding erasure scan sequence is determined to match the growth scan sequence only when the difference between the minimum scan sequence and the minimum scan sequence is less than the pairing threshold, and the difference between the difference between the second smallest scan sequence and the minimum scan sequence is greater than the uniqueness threshold.
[0016] The present invention also discloses a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the cloud-edge collaborative security video structuring method of the present invention.
[0017] The beneficial effects of this invention are as follows: This invention addresses the problem of a fixed occlusion area causing the same target to be fragmented into structured trajectory segments on the entry and exit sides. Instead of treating the occlusion process merely as a missing interval, it utilizes the technical feature of segmenting the visible contour of the target from a static occlusion boundary. At the entry boundary, an erasure scan sequence is obtained, forming a decreasing visible foreground area and a change in contact chords. At the exit boundary, a growth scan sequence is obtained, forming an increasing visible foreground area and a change in contact chords. After mapping the two sequences to the same boundary reference coordinates in the cloud, the same target is identified by the correspondence between area reduction and increase under the same displacement phase and the correspondence between contact chord distribution. This transforms trajectory breakpoints caused by pillars, shelves, or door frames into contour evidence that can be used for trajectory continuation. Compared to simply comparing the appearance of a single frame before and after occlusion or simply extrapolating the hidden position, the boundary scan sequence preserves the structural information of the target contour being continuously segmented along the direction of motion, and edge nodes can be paired in the cloud without uploading complete videos before and after occlusion.
[0018] This invention also addresses the issue of target velocity changes at boundaries stretching or compressing time series. It utilizes the cumulative optical flow of visible foreground pixels along the boundary normal to characterize boundary scan displacement, resampling and erasing scans at equal displacement intervals rather than equal time intervals. When the target pauses briefly or passes through the boundary at different speeds, the same contour section still falls within similar displacement phases. Furthermore, leveraging the positional invariance of the two occlusion boundaries in a fixed field of view, the tangential coordinates and projection scale are calibrated separately, transforming the contact chord distribution on both sides to the same reference coordinates. The displacement phase and scene calibration together serve the core contour scan pairing, reducing the interference of velocity differences and perspective scale differences on scan sequence comparison.
[0019] This invention further addresses the problem of identity swapping when multiple similar targets consecutively enter the same occlusion area, by comparing pairs one by one. It utilizes the hidden occupancy conservation and passage order conservation inherent in unidirectional, branchless, and prohibited-overtaking occlusion passage segments. Hidden occupancy is increased by complete erasure events and decreased by complete growth events. An occupancy batch is closed when the occupancy reaches zero and the background is restored on both sides. The cloud solves for order-preserving pairings within the same batch, preventing cross-identity by using the scanning sequence to distinguish targets and eliminating identity cross-combinations by the physical order of the passage segments. When the count is not closed or the sequence difference is too large, the trajectory remains independent, preventing a missed detection from propagating erroneous structured identifiers to subsequent batches. Attached Figure Description
[0020] Figure 1 This is a schematic diagram of the overall architecture for cloud-edge collaborative deployment between the cloud, edge nodes, and fixed cameras, provided in an embodiment of the present invention. Figure 2 A scene geometry diagram showing the static occlusion area, entry boundary, exit boundary, and preset passage direction provided in an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the segment-by-segment erasure comparison of the target forming an erasure scanning sequence at the boundary, as provided in an embodiment of the present invention. Figure 4 This is a schematic diagram illustrating the segmented growth control of the target forming a growth scan sequence away from the boundary, provided by an embodiment of the present invention. Figure 5 This is a geometric schematic diagram of the boundary contact chord distribution and boundary scanning elements provided in an embodiment of the present invention. Figure 6 This is a schematic diagram illustrating the mechanism of boundary scan displacement and equal boundary scan displacement interval resampling provided in an embodiment of the present invention; Figure 7 A geometrical diagram illustrating the calibration of the entry and exit boundaries to the same boundary reference coordinates, provided in an embodiment of the present invention. Figure 8 This is a timing diagram illustrating the hidden occupancy changes, batch reset, and order-preserving pairing provided in an embodiment of the present invention.
[0021] Figure labeling: 10-Fixed camera; 20-Edge node; 30-Cloud; 40-Static occlusion area; 43-Boundary strip; 44-Contour-stable target; 45-Visible foreground mask; 52-Boundary contact chord distribution; 53-Boundary scan element; 60-Boundary scan displacement; 62-First coordinate transformation; 63-Second coordinate transformation; 64-Boundary reference coordinates; 65-Projection scale coefficient; 50-Erase scan sequence; 51-Growth scan sequence; 70-Hidden occupancy; 71-Batch reset time; 72-Occlusion passage batch; 73-Order-preserving pairing result. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0023] When a fixed camera 10 encounters an obstruction with a long-term unchanging position, the same target will form disconnected local tracks on both sides of the obstruction in the surveillance video. It is difficult to reliably reconstruct the target identity when multiple similar targets pass by consecutively, based solely on the disappearance location, reappearance time, or single-frame appearance. However, when a rigid target passes a fixed obstruction boundary, its visible outline does not disappear or appear instantaneously, but is continuously captured as the target crosses the boundary. The decreasing area and changing contact chord of the same outline on the entry side correspond to the increasing area and changing contact chord of the outline on the exit side. This embodiment of the invention utilizes this principle. The edge node 20 obtains the outline scanning sequence at the obstruction boundary through image recognition. This outline scanning sequence, along with the structured trajectory segments on both sides, is sent to the cloud 30 in a cloud-edge collaborative manner. The cloud 30 then eliminates speed and viewing angle differences and completes sequence pairing. Thus, without continuously uploading complete video, the trajectory segments before and after the obstruction can be concatenated into the same structured target identifier based on the outline evidence at the boundary. The above scheme and its various embodiments are described below with reference to the accompanying drawings.
[0024] like Figure 1 As shown, a fixed camera 10 is installed on one side or above the passage, and its imaging range covers the visible areas on both the entry and exit sides of a static obstruction. The fixed camera 10 sends video frames and acquisition timestamps to edge nodes 20, which perform image recognition, short-range tracking, and scan sequence generation. The cloud 30 receives the structured results in small amounts and performs cross-obstruction continuation. This deployment leaves pixel-level processing on-site, while sequence comparison and cross-batch identification management are centralized in the cloud 30. A single cloud 30 can connect to multiple edge nodes 20, and each edge node 20 can also process video streams from one or more fixed cameras 10, but observations on both sides within the same obstruction passage batch 72 are taken from the same fixed field of view.
[0025] In one embodiment, the fixed camera 10 uses a constant focal length and disables automatic pan-tilt rotation during operation. The camera frame rate can be between 20 and 60 frames per second, and the resolution can be between 1280×720 pixels and 3840×2160 pixels, depending on the narrowest discernible outline of the target. After scene calibration is completed, if the camera's installation position, focal length, or cropping area changes, the edge node 20 stops using the original scene calibration relationship and issues a recalibration flag to prevent the old boundary coordinates from being used in the new image. The fixed camera 10 and the edge node 20 can use a real-time streaming protocol, or the camera can directly output decoded video frames; both implementations retain the camera's acquisition timestamp, and the decoding time is only used as the edge processing time and does not replace the acquisition time.
[0026] The image recognition model running on edge node 20 performs object detection and visible foreground segmentation on each frame, and associates instances in adjacent frames that are spatially continuous, of the same category, and have similar appearance embeddings as local trajectories. Optionally, the image recognition model employs a shared convolutional backbone or a visual transformer backbone, which is then connected to a detection head, an instance segmentation head, and an appearance embedding head, and finally formed by Kalman prediction and Hungarian matching to create a short-range multi-object tracker. The detection confidence threshold can be selected in the range of 0.40 to 0.85, and the mask binarization threshold can be selected in the range of 0.30 to 0.70. For targets entering and leaving the vicinity of the boundary, the association cost increases the weight of the mask cross-union ratio, so that the local trajectory remains intact during the gradual occlusion stage until the effective mask is insufficient for segmentation.
[0027] The image recognition model is trained using videos accumulated from 10 fixed cameras located near the deployment positions, and unique video clips are extracted under conditions of bright light, shadow, and partial occlusion. The model input consists of pixels from a single frame or adjacent video frames, labeled with the target category and detection box, as well as instance masks and cross-frame identities for the same target. The detection head is trained using classification loss and bounding box intersection-union loss, the instance segmentation head uses pixel cross-entropy loss and Dice loss, and the appearance embedding head uses triplet loss or contrastive loss. The features output by the embedding head are only used to calculate the association cost between adjacent frame instances and are not used as the model's raw input. The model can employ a multi-head network with a shared backbone, or it can cascade existing YOLO detection networks, Mask R-CNN segmentation networks, and re-identification networks into a single image recognition processing chain.
[0028] Training is conducted offline before deployment, using the training set to update the parameters of the aforementioned heads, and an independent validation set is used to determine the stopping point. After deployment, manually verified false detection samples are collected and updated offline every 1 to 6 months. The number of model parameters can be between 5 million and 80 million, with the specific number determined based on the GPU memory of the 20 edge nodes and the real-time frame rate. During the cold start phase when there are insufficient samples, an image recognition model pre-trained on a general target dataset can be loaded, and then fine-tuned using 500 to 5000 frames of labeled images from the deployment scenario. If there are not enough instance mask labels initially, candidate masks can be generated using background subtraction within the detection box, and then manually corrected as segmentation labels. Scan sequence pairing is only enabled after the mask intersection-union ratio on the independent validation set reaches the set requirements.
[0029] When updating the model, the previous version is retained, and detection recall, mask boundary error, and association interruption rate are compared on the same validation set. If any metric of the new version falls below the operating limit, edge node 20 continues to use the previous version, and structured data generation is not interrupted due to training failure. As an alternative implementation, appearance embedding can be output by an independently pre-trained re-identification network, whose parameters are frozen during initial deployment; after accumulating 1000 to 20000 pairs of scene samples with cross-frame identity labels, it is then fine-tuned with triplet loss. Regardless of whether a shared embedding head or an independent network is used, Hungarian matching uses the embedding distance, mask crossover ratio, and motion prediction distance to form the association cost.
[0030] Reference Figure 2 The static occlusion area 40 is the image area within the field of view of the fixed camera 10 that is continuously obscured by a pillar, shelf end, door frame, or equipment casing. The static occlusion area 40 is recorded as a closed polygon in image coordinates. The polygon boundary segment first crossed by the target trajectory along a preset travel direction is designated as the entry boundary, and the boundary segment subsequently crossed by the trajectory in the same direction is designated as the exit boundary. Boundary strips 43 are respectively set on the visible sides of the entry and exit boundaries. The boundary strips 43 are used to limit the calculation range of mask, optical flow, and background restoration judgments. This processing can eliminate contour jitter far from the occlusion boundary, allowing the scan volume to primarily reflect the segmented capture of the target contour by the occluding object.
[0031] The static occlusion zone 40 can be manually calibrated. Before the target passes through, the calibrator selects several vertices of the occlusion's outer contour to form a polygon. Then, at least two direction points are sequentially selected along the channel centerline to determine the preset travel direction. Multiple historical target trajectories are intersected with the polygon, and the entry and exit boundaries are verified according to the order of intersection. The width of the boundary strip 43 along the local normal can be 8 to 48 pixels, or 0.02 to 0.12 times the projection height of the fully visible target. When the image resolution changes, using an aperture relative to the projection height can maintain an approximately constant proportion of the actual contour covered by the strip. The calibration results simultaneously record the camera identification, static occlusion zone identification, image resolution, and effective time to prevent the mixing of coordinates from different camera positions.
[0032] In other embodiments, the static occlusion region 40 can be semi-automatically calibrated based on a long-term background map. Edge nodes 20 calculate the median background value per pixel from videos spanning 7 to 30 consecutive days. Line segments are extracted from the edges of stable objects that account for 90% to 99.9% of the long-term background. Candidate regions are then selected from multiple stable travel trajectories that are continuously traversed by the trajectories and have no target foreground in between for a long period. The long-term background percentage is the ratio of the number of frames where a pixel falls within the background grayscale tolerance band to the total number of sampled frames. Candidate polygons are still manually confirmed for their entry side, exit side, and travel direction to avoid using temporary objects or shadow edges as static occlusion boundaries. The background map can be created separately before and after the nighttime lighting switch, and the corresponding calibration record is called according to the current lighting state during runtime.
[0033] When the boundary is curved, either entering or leaving the boundary, it can be divided into multiple linear approximate segments based on arc length. Each segment's length is 0.1 to 0.5 times the projected height of the fully visible target, with adjacent segments sharing endpoints. The segment the target mask contacts is used as the local tangent, the perpendicular direction pointing into the static occlusion area 40 as the local normal on the entry side, and the perpendicular direction pointing from the interior of the static occlusion area 40 into the visible area as the local normal on the departure side. When the target crosses a segment endpoint, the tangential coordinates and normal optical flow are linearly fused within the overlapping arc length of adjacent segments according to the distance from the endpoint. This segmental linearization method ensures that subsequent area differences still originate from the complete mask, while the contact chord and displacement only use local coordinates near the target's current contact position.
[0034] Figure 2The contour-stabilized target 44 can be a warehouse handling vehicle, a work vehicle traveling along a fixed channel, a turnover box carried by a conveyor line, or a rigid vehicle whose outer contour remains basically unchanged during a single pass. The preset rigid target category is determined by samples from each category in the independently calibrated video. Only categories where the same target maintains the same category before and after entry and whose instance mask is complete are added to the enabled list. For each category, the aspect ratio change and principal axis direction difference of the complete visible mask are statistically analyzed. The contour stabilization threshold can be from 0.05 to 0.25, representing the upper limit of the allowable relative aspect ratio change; the attitude stabilization threshold can be from 5 degrees to 25 degrees, representing the allowable difference between the principal axis direction before entry and after exit.
[0035] The contour-stabilized target 44 also needs to continuously pass through the boundary strips 43 on both sides along the preset travel direction. Specifically, the projection of the trajectory velocity on the preset travel direction can be set to a positive velocity, and the frames with positive velocities are required to account for 80% to 100% of the scanning duration, while excluding targets that turn, reverse, or move laterally for a long time near the boundary. Pedestrians, swinging robotic arms, and flexible bags are prone to significant posture changes during a single pass and are not included in the preset rigid target category by default. If the specific scenario still requires handling pedestrians, the contour stabilization threshold and posture stabilization threshold can be relaxed, but the anomaly rejection requirements can be increased. For example, the scan sequence can only be continued if the difference is in the top 5% to 20% of the independently calibrated samples and there are no approximate suboptimal candidates; otherwise, the two local trajectories should be kept independent of each other.
[0036] The preset rigid target category is only used for coarse screening during runtime. Edge node 20 also calculates the complete visible contour features for each trajectory segment. For the complete visible masks of 5 to 20 consecutive frames before entry and after exit, the aspect ratio and principal axis angle are calculated frame by frame, and then the median of the aspect ratio is taken; the principal axis angle is first expanded in 180-degree cycles based on the direction of the first frame, and then the median of the angle is taken. This processing is a frame-by-frame scalar, and the median of the unregistered mask of the moving target is not calculated pixel by pixel. Edge node 20 uploads the complete visible aspect ratio and principal axis direction as additional fields of the structured trajectory segment to the cloud 30.
[0037] The cloud-based system verifies the stability of the contour for each incoming and outgoing candidate pair. The relative aspect ratio change is calculated by dividing the absolute value of the difference between the fully visible aspect ratios of both sides by the larger of the two values. The principal axis direction difference is the smallest angle between the two principal axis angles within a 180-degree period. Only candidate pairs whose relative aspect ratio change is below the contour stability threshold, whose principal axis direction difference is below the pose stability threshold, and whose category is in the enabled list are identified as contour stabilization targets for this sequence pairing. The cloud-based system only uses the two scalars uploaded with the structured fragment and does not need to dereference the local mask index of the edge node 20.
[0038] Edge node 20 continuously outputs local trajectory identifiers, categories, and detection boxes before the target approaches the entry boundary, and also outputs a visible foreground mask 45. The position of the local trajectory point is taken as the centroid of the visible foreground mask 45; when the mask is incomplete, the midpoint of the bottom edge of the detection box is used as the substitute position. The entry-side structured trajectory segment only saves the trajectory points that have not yet crossed the entry boundary at the representative position, and takes the last trajectory point located on the visible side of the entry boundary as the segment endpoint. After the target touches the boundary, the mask and timestamps that are continuously acquired are only written to the erase scan event and are no longer extended into the entry-side structured trajectory segment.
[0039] After the candidate target reappears at the boundary, edge node 20 establishes a new local trajectory identifier, but the early mask on the inner side of the boundary is only used to grow scan events. Only after the representative location crosses to the visible side of the boundary and continuously satisfies the effective tracking conditions is that point used as the starting point of the structured trajectory segment on the departure side. The number of consecutive contact frames can be from 2 to 8 frames to suppress single-frame contact or single-frame departure events caused by segmentation noise. Thus, pixel observations during boundary contact can be used entirely to generate the scan sequence, while the two structured trajectory segments still terminate before entering the boundary and begin after leaving the boundary, respectively.
[0040] The foreground mask 45 is the set of pixels in the image that belong to the current target and are not covered by static occlusions. For example... Figure 3 As shown, the visible foreground mask 45 gradually shrinks from a complete state at the boundary until it is covered by the static occlusion area 40. The visible foreground mask 45 is primarily obtained by applying a target probability map output from the aforementioned instance segmentation head through mask binarization thresholding, then filling small holes using a 3×3 to 9×9 pixel closing operation, and retaining the main body region connected to the center of the current trajectory detection box through connected component filtering. If the background is stable, color difference can also be performed between the current frame and the long-term background image within the detection box, and the instance segmentation result can be used to limit the difference region; the intersection of the two is used as the visible foreground mask 45.
[0041] For two adjacent displacement sampling positions on the entry side, first count the number of visible foreground mask pixels at the previous position (45 pixels), then subtract the number of pixels at the next position; if the difference is less than zero, take zero, and the resulting non-negative value is the reduction in visible foreground area for that sampling interval. Arrange the area reduction, contact chord features, and displacement phase at each sampling position in ascending displacement order to form the erasure scan sequence 50. The reason for taking a non-negative value for the area reduction is that jitter at the segmentation edge may cause the mask area at adjacent positions to briefly rebound, and this rebound is not the contour section of the occluder; truncating it to zero can preserve the consistency of the erasure direction, and the total area deviation caused by the rebound is normalized by the complete area and absorbed by subsequent multi-phase accumulation.
[0042] For example, if the mask areas of three adjacent displacement sampling positions on the entry side are 2400 pixels, 2110 pixels, and 1790 pixels, respectively, then the area reduction amounts between the two sampling intervals are 290 pixels and 320 pixels, respectively. If the next position receives 1810 pixels due to edge jitter, then the original difference of this interval is negative, and the area reduction amount is recorded as 0 pixels. (Refer to...) Figure 3 As the target moves along the boundary normal for a certain distance, the static occlusion area 40 cuts off a section of the visible outline; therefore, arranging the area reduction by normal displacement rather than by video frame number allows the target to leave a comparable sequence of outline sections at different speeds.
[0043] Reference Figure 4 As can be seen, the foreground mask 45 gradually expands from a small area to a complete state at the departure boundary. For two adjacent displacement sampling positions on the departure side, the number of mask pixels at the later position is subtracted from the number of mask pixels at the previous position. If the difference is less than zero, it is also taken as zero. The resulting non-negative value is used as the increase in the visible foreground area. The growth scan sequence 51 is constructed by the increase in area, contact chord features, and displacement phase in ascending displacement order. If the mask areas at the three positions are 260 pixels, 570 pixels, and 900 pixels, then the adjacent area increases are 310 pixels and 330 pixels. The normal directions of the entry-side erasure and the departure-side growth are both conventionally defined as the positive direction of target passage. Therefore, the same displacement phase expresses the same proportion of the target from the first contact to the completion of one boundary scan, rather than the absolute left-right direction of the two boundaries in the image.
[0044] Area changes only reflect the number of pixels in each cross-section; targets with different shapes may still have similar area sequences. To preserve the position and width of the cross-section along the boundary tangent, edge node 20 projects the visible foreground mask 45 along the local normal into a one-dimensional tangential occupancy vector within the boundary strip 43. For each tangential pixel position, the number of pixels belonging to the mask within the strip normal width is counted and then divided by the total number of effective strip pixels at that position; the tangential occupancy ratio can be between 0.30 and 0.70, with positions higher than this ratio considered occupied and positions lower than this ratio considered unoccupied. This projection compresses strips from 8 to 48 pixels wide into a single boundary truncated line, with the chord length not increasing proportionally with the strip width.
[0045] like Figure 5 As shown, adjacent occupied positions in the one-dimensional tangential occupancy vector are merged into continuous foreground pixel segments. Isolated segments with lengths less than 0.01 to 0.05 times the tangential projection size of the complete target along the boundary are removed as noise, and the set of remaining pixel segments constitutes the boundary contact chord distribution 52. The chord length is the sum of the tangential lengths of each retained pixel segment, and the tangential centroid is the average position of the center position of each segment weighted by its length. If the boundary strip 43 crosses the image edge, the occupancy ratio is calculated only based on the actual existing effective strip pixels to prevent missing image areas from being counted as idle foreground.
[0046] As an example, at a certain sampling location, two consecutive foreground pixel segments are obtained in the local tangential direction. The first segment extends from 12 pixels to 28 pixels, and the second segment extends from 34 pixels to 46 pixels. Counting discrete pixels including the endpoints, the lengths of the two segments are 17 pixels and 13 pixels, respectively, with a total tangential length of 30 pixels. The centers of the two segments are located at 20 pixels and 40 pixels, respectively. The tangential centroid is the sum of 20 x 17 and 40 x 13 divided by 30, resulting in approximately 28.67 pixels. In the case of multiple segments, the number of segments, the length of each segment, and the centroid of each segment are retained for diagnostic purposes. However, when used for the fixed-length boundary scan element 53, the total tangential length and the weighted tangential centroid are used to ensure a uniform dimension across different sampling locations.
[0047] The boundary scan element 53 consists of three quantities arranged in a fixed order: the first is the normalized area change, the second is the normalized tangential length, and the third is the normalized tangential centroid position. The normalized area change equals the current non-negative area decrease or increase divided by the fully visible foreground area of the target before it enters the boundary or after it has completely crossed and left the boundary. The normalized tangential length equals the chord length divided by the projection height along the local boundary tangential when the target is fully visible. The normalized tangential centroid position equals the source image tangential centroid coordinates divided by the pixel arc length of the corresponding boundary. All three quantities are dimensionless at the edge, eliminating the influence of the target imaging area, the target tangential projection scale, and the source image boundary length, respectively.
[0048] The complete visible foreground area can be taken as the median of the mask area for the 5 to 20 consecutive frames before the target enters the boundary, and the median of the area for the 5 to 20 consecutive frames after the target completely leaves the boundary strip 43. The target projection height is obtained by taking the median of the circumscribed dimension of the mask along the local boundary tangent within the same frame segment, which is consistent with the chord length direction of the boundary contact chord distribution 52. The boundary length is the pixel arc length of the entire entry or exit boundary; for piecewise linearized curved boundaries, the centroid position is first added to the cumulative starting arc length of the current segment in the entire boundary, and then divided by the total arc length of the entire boundary. After this processing, the centroid positions generated by different segments still fall on the same continuous boundary coordinates.
[0049] Some displacement sampling locations may lack effective masks due to reflections or motion blur. If there are effective boundary scan elements (53) before and after the missing location, and the consecutive missing values do not exceed 5% to 20% of the uniform sequence length, then linear interpolation is performed on the three components according to the displacement phase. If the area component interpolation results in a negative value, it is still truncated to zero; the normalized tangential length limiting range can be 0 to 1.5, and the normalized tangential centroid limiting range can be 0 to 1. When the consecutive missing values exceed this proportion, the current scan sequence is recorded as an incomplete sequence and will not participate in automatic continuation. Interpolation only fills in the gap between the existing two observations and does not extrapolate the contour before or after the scan begins or ends.
[0050] For example, in the boundary scan element 53 with phase 0.40, the three components are 0.08, 0.42, and 0.35, respectively, and in the boundary scan element 53 with phase 0.50, the three components are 0.12, 0.50, and 0.39, respectively. When phase 0.45 is missing, the first component after linear interpolation is 0.10, the second component is 0.46, and the third component is 0.37. If the calculation results at both ends of the area component are negative due to noise, the negative values are truncated to 0 before interpolation; if the normalized tangential length or normalized tangential centroid position obtained by interpolation exceeds the aforementioned effective range, the endpoint of the corresponding range is taken. In this numerical example, the three quantities correspond to the normalized area change, the normalized tangential length, and the normalized tangential centroid position, respectively.
[0051] The video frame interval may fluctuate due to network decoding or processing scheduling. Directly comparing frames with the same sequence number can misinterpret speed changes as contour differences. Therefore, edge node 20 calculates the two-dimensional optical flow of adjacent video frames within the intersection of the boundary strip 43 and the visible foreground mask 45. Optionally, the optical flow can be achieved by using the pyramid Lucas-Kanade method to track the inner corners of the strip, or by using Farnebäck dense optical flow. Edge node 20 projects each effective optical flow vector onto the current local boundary normal, removes outlier vectors whose size exceeds 5 to 10 times the median of the frame, and then takes the median of the remaining normal components. The median is insensitive to minor misclassifications at mask edges and local texture loss.
[0052] The median normal optical flow of adjacent frames can be positive or negative. The absolute value of the edge node 20 is accumulated over the duration of one erasure or growth cycle to obtain... Figure 6 The boundary scan displacement is 60. Absolute value accumulation prevents brief detection jitter from canceling out the already passed contour displacement, but to avoid in-place jitter artificially increasing the displacement, normal components below 0.05 pixels to 0.5 pixels can be set to zero. If the sign of continuous normal components is opposite to the preset passage direction within 3 to 10 frames, the current target is judged as backward or turning, the scan sequence stops and enters abnormal recording, and a matching sequence is forcibly generated without using absolute value accumulation.
[0053] The total displacement of a complete scan is taken as the final value of the boundary scan displacement of 60 during the period from the initial stable contact boundary to the complete disappearance or full manifestation of the mask. For example... Figure 6 As shown, the motion distances of adjacent frames in the above column are unequal, and frame-by-frame sampling will result in scan points with uneven density. The following divides the total displacement into several displacement intervals, forming a phase sequence independent of velocity. All interval endpoints are uniformly arranged from 0 to the final value of the total displacement, and the endpoint phase is the cumulative endpoint bits minus the total displacement. The displacement phase of each boundary scan element 53 is taken as the phase of the midpoint of the corresponding interval. When the total displacement is less than 0.1 to 0.3 times the projection width of the complete target, it indicates insufficient scan travel, and the current sequence will not enter pairing.
[0054] The resampling sequence length can be 16 to 64 boundary scan elements 53, and a fixed length N is used for the same static occlusion region 40. The edge node 20 sets N equal displacement intervals and sets one more interval endpoint than the number of intervals. The edge node 20 first divides the visible foreground area at each original scan point by the complete visible foreground area to form a normalized visible area curve that changes with cumulative displacement, and then performs linear interpolation on this area curve at all interval endpoints. On the erasing side, the area of the front point of each interval is subtracted from the area of the back endpoint, and negative values are truncated to 0. On the growth side, the area of the front point is subtracted from the area of the back endpoint, and negative values are truncated to 0, thus obtaining N area changes. The chord length and centroid are interpolated at the midpoint of each interval and combined with the area changes of the same interval to form a boundary scan element 53. Both sides use the midpoint phase of the interval, thus forming an equal-length vector with N elements in the erasing scan sequence 50 and the growth scan sequence 51.
[0055] Edge node 20 binds each boundary scan element 53 to the timestamp of the nearest video frame acquisition. Video frames and structured tracks from the same camera use the same monotonic clock, and the timestamp alignment tolerance can be from 5 milliseconds to 100 milliseconds; when the time difference between the scan element and the track point exceeds this tolerance, the current scan element is recorded as time misaligned and automatic pairing stops. In cross-device deployments, time synchronization can be achieved through network time protocols or precision time protocols, but the passage duration is always calculated from the entry completion time and departure start time within the same clock domain. If the two sides are observed by different cameras, additional clock offset calibration and cross-camera spatial calibration are required; this variant is not a necessary condition for the same fixed field of view implementation.
[0056] Entering and leaving the boundary typically involve different directions and perspective scales within the frame of the fixed camera 10; therefore, the uncalibrated normalized centroid and normalized chord length cannot be directly compared. (Refer to...) Figure 7 The dimensionless tangential coordinates entering the boundary are mapped to the boundary reference coordinates 64 through the first coordinate transformation 62, and the dimensionless tangential coordinates leaving the boundary are mapped to the same boundary reference coordinates 64 through the second coordinate transformation 63. The normalized chord lengths on both sides are then multiplied by the corresponding projection scale factor 65. The boundary reference coordinates 64 use dimensionless coordinates from 0 to 1, with the origin corresponding to the left edge of the channel's top-view reference plane, and the positive direction consistent with the lateral direction from the left to the right of the channel, thus avoiding the two image boundaries from obtaining mirror centroids due to opposite orientations.
[0057] The first coordinate transformation 62 and the second coordinate transformation 63 can be calibrated using a calibration plate or a rigid target of known size. When using a calibration plate, at least four non-collinear control points are collected near the entry and exit boundaries, respectively. The tangential coordinates of the control points in the source image are divided by the total arc length of the corresponding source image boundary to obtain local dimensionless coordinates from 0 to 1. The lateral position of the control points in the channel reference plane is divided by the reference channel width to obtain reference coordinates from 0 to 1. When the boundary is approximately a straight line, a one-dimensional affine transformation is fitted to the two sets of local coordinates and reference coordinates respectively. When the perspective change is significant, the homography transformation from the image plane to the channel reference plane is first estimated using the control points, and then the transformed lateral position is divided by the reference channel width. When the calibration residual is greater than 0.02 to 0.10 times the width of the complete target, control points are added or the current linear boundary segment is shortened before re-estimation.
[0058] When calibrating using a target of known size, the same rotating box can pass through the entry and exit boundaries at multiple lateral positions, recording the local dimensionless coordinates of its contact chord centroid on both sides. The lateral center position of the rotating box in the channel is divided by the reference channel width to obtain a common reference value. Least-square fitting is then performed on the two sets of corresponding points to obtain the first coordinate transformation 62 and the second coordinate transformation 63. Before fitting, the positive direction of the tangential coordinates on both sides is unified according to the preset passage direction; if the tangential direction of one side of the image is opposite to the reference lateral direction, the scaling factor of the coordinate transformation is negative. This direction convention ensures that contact chords on the same side of the same entity contour, close to the channel, have similar positions in the boundary reference coordinates 64.
[0059] The projection scale factor 65 is used to correct the chord lengths on both sides, which have already been normalized by the target projection height, to the same dimensionless scale. During calibration, the same rigid target is allowed to pass through the two boundaries multiple times. The normalized chord lengths on the entering and leaving sides are calculated at the same displacement phase. The average of the two is used as the reference normalized chord length for that phase. The reference value is then divided by the local normalized chord length on each side to obtain the dimensionless scale of the corresponding side. The median or piecewise linear fit is performed on multiple scales along the boundary tangential and displacement phase to form the projection scale factor 65. During runtime, only the normalized tangential length in the second dimension is multiplied by this factor. The centroid position is corrected by coordinate transformation, and the area components are not multiplied by this factor. The projection scale factor 65 can be used in a relative scale range of 0.2 to 5.0.
[0060] For curved boundaries, each linear approximation segment stores the local coordinate transformation and projection scale factor 65, while also storing the start and end intervals of the segment mapped to the boundary reference coordinates 64. When the target's boundary contact chord distribution 52 crosses two adjacent segments, the pixel segment is cut according to the segment intersection point, the local dimensionless centroid of each segment is transformed, and the local normalized chord length of each segment is multiplied by the corresponding dimensionless ratio, and then merged in the boundary reference coordinates 64; the overall centroid is obtained by weighting the corrected chord lengths of each segment. This processing does not require the curved boundary to satisfy a single affine relation as a whole, nor does it cause centroid jumps when the target crosses the segment endpoints.
[0061] After completing coordinate and scale corrections, Cloud30 acquires two sets of 3D boundary scan elements 53 at each identical displacement phase. The first dimension of the erase side vector is the normalized area reduction, the second dimension is the corrected normalized tangential length, and the third dimension is the corrected normalized tangential centroid position. The growth side vectors are arranged sequentially as the normalized area increase, the corrected normalized tangential length, and the corrected normalized tangential centroid position. If the two sequences use the same resampling sequence length, they correspond one-to-one according to the index; if the historical version lengths are different, Cloud30 first interpolates the longer sequence to the uniform length specified by the current occlusion area according to the displacement phase, and then calculates the residual.
[0062] At each displacement phase, the area residual is the absolute value of the difference between the normalized area decrease and the normalized area increase; the chord length residual is the absolute value of the difference between the normalized tangential lengths on both sides after correction; and the position residual is the absolute value of the difference between the normalized tangential centroid positions on both sides after correction. When a phase is obtained through interpolation due to a gap, a confidence coefficient of 0.5 to 0.9 can be applied to that phase; when both sides of the same phase are measured, the confidence coefficient is set to 1. The residuals of all phases are weighted and averaged according to the confidence coefficients to avoid the difference value increasing linearly with the number of sampling points when the sequence is long.
[0063] The differences in the scan sequence are further weighted and accumulated using three types of average residuals. The area residual weight can be set from 0.30 to 0.60, the chord length residual weight from 0.20 to 0.50, and the position residual weight from 0.10 to 0.40, with the sum of the three after normalization being 1. When the outline area of the warehouse handling vehicle is stable but its lateral position oscillates within the lane, the area residual weight can be increased and the position residual weight decreased; when the lateral position of the turnover box is stable within a narrow aisle, the position residual weight can be increased. The weights are determined by independently calibrated passing samples and are not temporarily changed during operation based on the candidate differences of the batch to be paired.
[0064] The pairing threshold can be set between 0.05 and 0.40, representing the maximum allowable difference in scanned sequences; the uniqueness threshold can be set between 0.02 and 0.20, representing the minimum interval that must exist between the second smallest and smallest differences. Specific values are determined using independently calibrated samples: manually confirmed sequence pairs of the same target are used as positive samples, and sequence pairs from the same batch but with different identities but the same category are used as negative samples. The thresholds are iterated through on the calibration set, and values that meet the preset mismatch upper limit are selected. Then, another set of verification samples is used for validation. The batch to be paired only uses the frozen thresholds for judgment and cannot be used simultaneously to determine the thresholds and prove the current pairing is valid.
[0065] The cloud-based algorithm first calculates the scan sequence differences between each eraser candidate and all growth candidates that meet the category, orientation, and time conditions. Contour evidence is considered unique only when the minimum scan sequence difference is below the pairing threshold, and the difference between the second smallest scan sequence difference and the minimum scan sequence difference is greater than the uniqueness threshold. If there is only one temporally valid candidate, the low quantile of the difference between negative samples of the same category in the independent calibration set can still be used as a virtual second smallest difference, preventing a single candidate from being automatically accepted due to a lack of competition when the contours are clearly mismatched.
[0066] Spatiotemporal constraints for passage include consistency in target category, consistency in entry and exit directions, exit event following entry event, and passage duration within the calibration range. The permissible passage duration for a target can range from 0.5 seconds to 120 seconds, with specific upper and lower limits determined by expanding the 1st to 99th quantile values of independently calibrated passage samples by 10% to 30%. Cloud30 can divide the difference between the candidate passage duration and the calibrated median duration of the same category by the calibrated interquartile range to obtain the dimensionless passage duration deviation. The passage duration weight can be set from 0.05 to 0.40 to provide auxiliary constraints among multiple candidates with similar contours, but the passage duration does not replace the consistency judgment of the scan sequence itself.
[0067] When the scan sequence differences, uniqueness, and spatiotemporal constraints are all satisfied, the cloud 30 generates a global structured target identifier, registering the entry-side local trajectory identifier and the exit-side local trajectory identifier as two consecutive segments of this global identifier. The original local identifiers are still stored in the mapping table to trace the original processing results of the edge nodes 20. If any condition is not satisfied, the two trajectory segments remain independent of each other, and forced pairing is not achieved by relaxing the threshold. This rejection branch ensures that a segmentation error or orientation anomaly only affects the current candidate and does not propagate the erroneous identity to subsequent structured records.
[0068] The above pairwise judgment is suitable for situations where there are few targets hidden at the same time. When multiple similar targets enter the static occlusion area 40 in succession, selecting only the smallest local difference may still result in the same departure candidate being selected repeatedly, or in identity combinations that are the opposite of the physical passage order. Figure 2The illustrated embodiment further confines the static blocking zone 40 to a one-way, branchless, and prohibited-overtaking passage. One-way means the target only passes in a preset direction; branchless means there are no junctions between the entry and exit boundaries for the target to enter or exit; prohibited-overtaking means that a target that has already been erased cannot pass over a target that enters later within the blocking zone. This condition can be met by conveyor lines, single-lane guardrail passages, and rack-to-rack passages that allow only one transport vehicle to pass at a time.
[0069] In scenarios where the aforementioned physical conditions are not met, order-preserving batch constraints are not enabled. For example, if there is a turning branch road behind an obstruction, and the target can stop inside the obstruction and leave from another exit, or if the passage width allows two vehicles to pass side-by-side, the entry order is no longer necessarily equal to the exit order. In this case, a pairwise judgment can be made using only the scan sequence difference and the passage time-space constraints, or an obstruction area and boundary can be set separately for each branch; the pairing result of prohibiting intersection cannot be used as sufficient evidence for identity establishment. By clarifying the applicable conditions during the scenario calibration stage, it is possible to avoid replacing non-existent physical order constraints with algorithmic constraints during operation.
[0070] Edge node 20 maintains each static occlusion region 40 that meets the conditions. Figure 8 The hidden occupancy of 70 is represented by a solid line. Hidden occupancy 70 represents the number of targets that have completed erasure upon entering the boundary but have not yet completed growth upon leaving the boundary. The step height of the solid line corresponds to the current count value. When the system first runs stably and both boundary strips 43 are empty, the initial value of hidden occupancy 70 is set to 0. The count increases by 1 for each valid erasure event and decreases by 1 for each valid growth event. The capacity limit can be from 1 to 20 targets, rounded down based on the occlusion segment length divided by the minimum safe distance for targets of the same category. When the increased count exceeds the capacity limit, the current batch is immediately marked as abnormal; subsequent events are still recorded but automatic trajectory merging is not performed.
[0071] The erasure event is considered complete when the target mask transitions from its first stable contact with the boundary to an effective area that is 1% to 5% below the full area, during which the displacement phase advances from 0 to at least 0.8 to 1.0. The growth event is considered complete when the target mask transitions from its first stable appearance after leaving the boundary to an area that is 80% to 100% of the full visible area. Changing the hidden occupancy 70 using a complete event can prevent false counting caused by the target briefly contacting and then leaving near the boundary. If the same local trajectory repeatedly contacts the boundary, the edge node 20 counts only the first complete state transition based on the local trajectory identifier and the event state machine.
[0072] Figure 8The hidden occupancy 70 is represented by a solid line. This solid line rises by a step when the erase scan sequence 50 is completed, and falls by a step when the growth scan sequence 51 is completed. The preset maximum passage time can be from 1 second to 180 seconds, and is obtained by adding a margin of 10% to 50% to the upper limit of the target's allowed passage time range. After the hidden occupancy 70 increases from 0, the current batch remains open as long as it has not returned to 0; after the count returns to 0, it is necessary to confirm that both the entry and exit boundary strips 43 have restored a static background before formation. Figure 8 The batch reset time is 71. The simultaneous satisfaction of count closure and image background recovery can prevent the batch from being closed prematurely when targets not recognized by the model are still near the boundary.
[0073] Static background restoration compares the current boundary strip 43 pixel-by-pixel with the corresponding long-term background image. The static background restoration threshold can be 0.01 to 0.08 of the strip area, representing the upper limit of the percentage of pixels whose color difference exceeds the background tolerance; the background restoration duration can be 3 to 30 frames. When the percentage of difference pixels on both sides is lower than the static background restoration threshold and the background restoration duration is continuously met, edge node 20 confirms that the strip has been cleared. When a sudden change in lighting causes both sides to deviate significantly from the background simultaneously, the background template corresponding to the lighting state is switched first; if no template is available, batch reset judgment is paused and the scene state is marked as abnormal.
[0074] The erase scan sequence 50 and the growth scan sequence 51 collected between two adjacent batch reset times 71 constitute an occlusion passage batch 72. The start time of the batch is the time when the hidden occupancy amount 70 first increases from 0 and the erase is completed. The end time is the next batch reset time 71 that satisfies the conditions of count zeroing and background restoration on both sides. If no target passes through after a certain reset time, that time is both the end point of the previous batch and the starting point of the zero state for the next batch. The batch number is generated by the camera identifier, the static occlusion area identifier, and the monotonically increasing sequence number. After the device reconnects offline, it will not have the same batch number as the historical batch.
[0075] Within a single occlusion passage batch 72, cloud 30 arranges the entry sequence by erasure completion time and the exit sequence by growth completion time. The first entry sequence can only form a candidate with the first or subsequent exit sequence, but once an entry sequence is paired with an exit sequence, subsequent entry sequences can only be paired with objects after that exit sequence. This restriction forms a non-overlapping candidate set. Figure 8 The order-preserving pairing result 73 is represented by a connection in the same order; the non-intersecting connections correspond to the first entering profile stable target 44 leaving first, which conforms to the physical order of the prohibited passage segment.
[0076] In some embodiments, the cloud 30 employs dynamic programming to determine the order-preserving pairing result 73. The dynamic programming state consists of the number of processed incoming sequences and the number of processed outgoing sequences. When transitioning from one state to the next, the current incoming and outgoing sequences can be paired, or unpaired sequences that cannot be reliably identified can be marked as unpaired anomalies. The pairing cost equals the scan sequence difference plus the passage time deviation multiplied by the passage time weight. Unpaired transitions are subject to a fixed penalty determined by an independently calibrated false detection rate. The cloud 30 recursively progresses from an empty state to a state where all sequences have been processed, and backtracks along the path of minimum cumulative cost to obtain a global result that maintains the order.
[0077] Dynamic programming only compares candidates that are of the same category and whose passage time falls within the allowable range; the cost of other combinations is set to unreachable. If different rigid target categories exist in the same batch, candidates can be established by category first, and then solved on the shared order. When category detection may cause confusion, a category substitution cost of 0.05 to 0.30 can be set for pre-registered compatible categories. Each pair in the final path must still meet the pairing threshold and uniqueness threshold separately; a single obviously inconsistent sequence pair cannot be accepted simply because the global cumulative cost is small. Global optimization solves the combination selection among multiple qualified candidates without changing the minimum requirements for a single pair of contour evidence.
[0078] When the hidden occupancy 70 does not return to 0 within the preset maximum passage time, the current occluded passage batch 72 is marked as an abnormal batch. If the number of erase scan sequences 50 and growth scan sequences 51 are not equal, they are also marked as abnormal; even if the number is equal, if the minimum scan sequence difference exceeds the pairing threshold, or if the uniqueness threshold between the best and second-best sequences is not met, no automatic merging result is generated. The structured trajectory segments on both the entry and exit sides in the abnormal batch retain their original local trajectory identifiers. The cloud 30 can attach a pending review status, but will not use the closest time rule to fill in missing pairings.
[0079] When an erase event is missed, the hidden occupancy 70 may drop to a negative value upon receiving a growth event. Edge node 20 does not save a negative count; instead, it clamps the count to 0 and writes it to the missing entry event flag. When a growth event is missed, the count will remain greater than 0 even after exceeding the maximum passage time. Both situations trigger anomaly recovery: the automatic pairing of the current batch is frozen, events on both sides are saved, and the boundary strips 43 on both sides are allowed to restore their static backgrounds. After the stripes are cleared and the preset maximum passage time is exceeded, edge node 20 seals the unclosed batch as an anomaly, resets the hidden occupancy 70 to 0, and then creates a new batch from the next complete erase event.
[0080] When the device restarts, it does not directly continue counting from the unverified count value. After edge node 20 starts, it first loads the scene calibration and the most recent batch number, and then observes the boundary strips 43 on the entry and exit sides. If both sides meet the static background restoration conditions, and no erasure or growth events are detected within a preset maximum passage time, a zero-occupancy state is established and this moment is recorded as the new batch reset moment 71. If any strip has a foreground, the system remains in a recovery waiting state, and the collected trajectory fragments are marked as restart transition data; automatic pairing is restored after both sides are cleared. This process avoids including targets that were still hidden before the restart in the new batch after the restart.
[0081] Back Figure 1 The structured trajectory segments output by edge node 20 on both the entry and exit sides include camera identifiers, static occlusion area identifiers, and boundary identifiers, as well as local trajectory identifiers, target categories, and acquisition timestamps. Each trajectory point further stores the index of the target detection bounding box and the visible foreground mask 45, and records the preset travel direction along with the segment. The segment header also stores the complete visible aspect ratio and principal axis direction already calculated on the edge side, for cloud 30 to verify the contour stability candidate by candidate. The index of the visible foreground mask 45 does not upload the entire mask to cloud 30, but points to the compressed mask entry in the local cache of edge node 20; this entry is jointly located by the camera identifier, frame timestamp, and instance number.
[0082] Both the erasure scan sequence 50 and the growth scan sequence 51 are saved in ascending order of displacement phase. Each element includes the displacement phase, normalized area change, and normalized tangential length, as well as the normalized tangential centroid position and the corresponding local trajectory identifier. The sequence header first saves the camera identifier and static occlusion area identifier, then saves the boundary identifier, sequence type, and integrity flag. After receiving the data, the cloud 30 first selects the scene calibration version according to the camera identifier and occlusion area identifier, and then checks the start and end phases and the number of elements of the sequence. Two sequences with inconsistent scene calibration versions cannot be directly paired and need to be transformed according to their respective versions or keep the trajectories independent.
[0083] Edge node 20 can set up a circular buffer for the visible foreground mask 45 index, the original scan elements, and the most recent video frames. The circular buffer capacity can be set to a video duration of 30 to 600 seconds, or configured in 256 to 36,000 frames; it must at least cover the sum of the preset maximum throughput and network retransmission margin. Buffer entries are written according to the acquisition timestamp, and when space is insufficient, normal batch data that has been confirmed and received by the cloud 30 is overwritten first. Abnormal batches that have not yet been confirmed and restart transition data have a higher retention priority to avoid circular overwriting that would cause subsequent verification to lose boundary evidence.
[0084] Timestamp alignment is performed by edge node 20 when data enters the buffer. Video frames, mask indices, and local trajectory points all use the same 64-bit timestamp, as does the boundary scan element 53. When a scan element is calculated from two adjacent frames, the timestamp of the next frame can be bound, and the index of the previous frame can be saved in the record. When cloud node 30 receives out-of-order network packets, it first rearranges them according to timestamp and in-sequence index. If consecutive missing packets are found, retransmission is requested. When the retransmission window exceeds the capacity of the circular buffer, edge node 20 returns a data overwrite flag, and cloud node 30 classifies the corresponding batch as abnormal instead of using incomplete sequence pairing.
[0085] Normal batches only send structured trajectory segments, erase scan sequences 50 and grow scan sequences 51, along with scene calibration versions and summary values for verification, to the cloud 30. Edge node 20 does not continuously upload complete monitoring videos. For abnormal batches, short videos can be retained before and after the event. The retention time for abnormal short videos can be 3 to 30 seconds before the event and 3 to 60 seconds after the event, with video segments indexed by batch number. Whether abnormal videos are retrieved by the cloud 30 is determined by the implementation configuration; when bandwidth is limited, only local storage is maintained and a review notification is output; when bandwidth allows and the management issues a retrieval command, the corresponding segments are uploaded.
[0086] Cloud-edge collaborative transmission can employ message queues or interfaces based on the Hypertext Transfer Protocol (HTTP). Each structured data packet carries an edge node 20 identifier, an incrementing message sequence number, and a content digest. The cloud 30 deduplicates messages by sequence number and returns an acknowledgment. During network interruptions, edge node 20 continues to generate trajectories and scan sequences locally and writes them to a persistent queue in batches; these are then retransmitted sequentially after network recovery. The retransmission delay does not alter the acquisition timestamp or travel duration, thus preventing network latency from being mistaken for the target's dwell time within the obstructed area.
[0087] In one warehousing embodiment, a fixed camera 10 views the end of the shelving and a single-lane transport aisle from above, forming a static obstruction zone 40 at the end of the shelving. Preset rigid target categories include forklifts and rectangular tote box carriers; pedestrian categories are disabled for automatic continuation. During the calibration phase, 30 to 200 single-target passage samples and 20 to 100 batches of continuous passage samples are collected. The identities of the individuals are manually verified. The first batch of samples is used to determine coordinate transformations, weights, and thresholds, while the second batch of samples is used to verify the mismatch rate. During operation, even if the transport vehicle pauses briefly behind the shelving, its boundary scan displacement 60 is still accumulated according to the actual movement, and the departure-side growth sequence is not stretched in phase due to the pause time.
[0088] In one embodiment of the turnover box, the turnover box is shielded by a constant-speed or variable-speed conveyor line passing through the equipment casing. When the outer contours of the turnover boxes are similar, the grooves, handle notches, or stacking height variations in the boundary contact chord distribution 52 will be distributed across different displacement phases, forming contour evidence that is more stable than single-frame color, in conjunction with area variations. If the contours of two turnover boxes are indeed indistinguishable, a uniqueness threshold will reject the approximate candidate; at this time, the order-preserving constraint itself does not add new distinguishing evidence, and the system retains the independent trajectory or relies on external barcode information for assistance. The external barcode can be used as a verification field, but it does not change the contour-scanning-based processing chain of this invention.
[0089] Edge node 20 can consist of a processor, memory, and a video decoder, and is equipped with a network interface. The processor performs image recognition modeling and masking, as well as optical flow calculation, scan element generation, and maintenance of hidden occupancy 70. The memory stores scene calibration and model parameters, as well as structured trajectories and a circular buffer. The network interface sends structured data to the cloud 30 and receives confirmation or abnormal video retrieval commands. The cloud 30 can be implemented by a single server or server cluster. Its processor first performs coordinate transformation and phase alignment, then performs scan sequence difference calculation, dynamic programming order-preserving pairing, and global target identification management. The processing responsibilities are consistent with the data flow of the aforementioned methods, eliminating the need to repeatedly perform frame-by-frame segmentation of the original video on the cloud 30.
[0090] As an alternative implementation, edge node 20 and cloud 30 can be deployed at different computing layers within the same campus, or they can consist of an edge gateway and a remote computing center. Cloud-edge collaboration emphasizes that pixel-level image recognition is completed on the side closer to the video source, while cross-occlusion sequence comparison and global identifier management are completed on the aggregation side, without limiting it to a specific network operator. If the computing power of edge node 20 is sufficient to handle a small number of occluded areas, candidate differences can be pre-calculated on the edge side, and then the difference matrix along with the scanning sequence can be sent to cloud 30 for verification; cloud 30 still makes the final identifier configuration based on the frozen scene calibration and threshold.
[0091] This invention also provides a computer-readable storage medium. The computer-readable storage medium can be a solid-state memory or a disk, or a read-only memory or a non-volatile memory card. When the computer program stored thereon is executed by a processor, the processor acquires video captured by the fixed camera 10, performs target detection, visible foreground segmentation and trajectory extraction at the edge, and generates a boundary scan sequence; at the cloud 30, it performs coordinate correction, sequence pairing, and structured target identification configuration. The computer program can be encapsulated separately for the edge execution part and the cloud 30 execution part, and they work collaboratively through agreed-upon data fields and scene calibration versions.
[0092] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Those skilled in the art should understand that modifications can be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features, and such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A cloud-edge collaborative method for structuring security videos, characterized in that, include: Acquire surveillance video captured by a fixed camera, where static obstruction areas within the field of view sequentially have entry and exit boundaries along a preset passage direction; The edge nodes utilize an image recognition model to perform target detection, visible foreground segmentation, and target tracking, obtaining an entry-side structured trajectory segment that terminates before the entry boundary and an exit-side structured trajectory segment that begins after the exit boundary. When the visible foreground mask of the target contacts the entry boundary, the reduction in visible foreground area and the boundary contact chord distribution are obtained by boundary normal displacement, forming an erasure scan sequence; when the visible foreground mask of the candidate target contacts the exit boundary, the increase in visible foreground area and the boundary contact chord distribution are obtained by boundary normal displacement, forming a growth scan sequence. The edge nodes send the structured trajectory segments and corresponding scanning sequences to the cloud in a cloud-edge collaborative manner; the cloud transforms the erasure scanning sequence and the growth scanning sequence to the same boundary reference coordinates based on the scene calibration relationship between the two boundaries, and determines sequence pairs where the area reduction and area increase are consistent under the same displacement phase and the boundary contact chord distribution is consistent; when the sequence pairs satisfy the spatiotemporal constraints of the static occlusion area, the corresponding two structured trajectory segments are configured as the same structured target identifier.
2. The cloud-edge collaborative security video structuring method according to claim 1, characterized in that, The static occlusion area is determined by a pre-written occlusion region polygon; The boundary segment where the polygon of the occluded area first intersects the target trajectory along the preset travel direction is determined as the entry boundary, and the boundary segment that subsequently intersects the target trajectory is determined as the exit boundary. Boundary strips are set on the visible sides of the entry boundary and the exit boundary respectively. Targets that belong to the preset rigid target category, whose foreground mask aspect ratio changes less than the contour stabilization threshold when fully visible before and after entry, whose mask principal axis direction difference is less than the attitude stabilization threshold, and which pass through the boundary strip along the preset passage direction are identified as contour-stabilized targets for sequence pairing.
3. The cloud-edge collaborative security video structuring method according to claim 2, characterized in that, For each displacement sampling position of the erase scan sequence or the growth scan sequence: Calculate the visible foreground mask area difference between adjacent displacement sampling positions, and divide the visible foreground mask area difference by the foreground mask area when the target is fully visible before contacting the corresponding boundary or after leaving the corresponding boundary to obtain the normalized area change. Obtain the foreground pixel segments that are continuously distributed along the boundary tangential direction within the corresponding boundary strip of the visible foreground mask, and determine the tangential length and tangential centroid position of the foreground pixel segments as the boundary contact chord distribution; The normalized area change, the normalized tangential length of the projection height when the target is fully visible, and the normalized tangential centroid position of the boundary length are used to form the boundary scan element corresponding to the displacement sampling position.
4. The cloud-edge collaborative security video structuring method according to claim 1, characterized in that, A boundary strip is set on the visible side of the corresponding boundary. The optical flow between adjacent video frames is calculated within the visible foreground mask of the boundary strip, and the median component of the optical flow in the normal direction of the corresponding boundary is obtained. The absolute value of the median component is accumulated along the duration of the period in which the erasure scan sequence or the growth scan sequence is formed to obtain the boundary scan displacement; The corresponding decrease or increase in the visible foreground area and the boundary contact chord distribution are resampled according to the equal boundary scan displacement interval, and the ratio of the boundary scan displacement to the total displacement corresponding to a complete scan is used as the displacement phase.
5. The cloud-edge collaborative security video structuring method according to claim 4, characterized in that, The scene calibration relationship includes a first coordinate transformation from the tangential coordinates of the entry boundary to the boundary reference coordinates, a second coordinate transformation from the tangential coordinates of the exit boundary to the boundary reference coordinates, and the projection scale coefficients corresponding to the entry boundary and the exit boundary, respectively. The tangential centroid position of the boundary contact chord distribution is corrected by using the first coordinate transformation and the second coordinate transformation respectively, and the tangential length of the boundary contact chord distribution is corrected by using the corresponding projection scale coefficient. Under the same displacement phase, the normalized area reduction in the erasure scan is correlated with the normalized area increase in the growth scan, and the corrected tangential length and tangential centroid position are correlated.
6. The cloud-edge collaborative security video structuring method according to claim 1, characterized in that, The static blocking area blocks a one-way, branchless passageway that prohibits targets from crossing. The edge nodes maintain the hidden occupancy of the static occupancy area. For each target's erase scan at the entry boundary, the hidden occupancy is increased by one count unit, and for each target's growth scan at the exit boundary, the hidden occupancy is decreased by one count unit. The moment when the hidden occupancy increases from zero and then returns to zero, and when the boundary strips set on the visible side of the entry boundary and the exit boundary are restored to a static background, is determined as the batch reset moment. The erase scan sequence and growth scan sequence obtained between adjacent batch reset moments are classified into the same occlusion passage batch.
7. The cloud-edge collaborative security video structuring method according to claim 6, characterized in that, The cloud platform establishes candidate pairs that prohibit order crossover based on the completion order of each erasure scan sequence at the entry boundary and the completion order of each growth scan sequence at the exit boundary. Within the blocked passage batch, solve for the order-preserving pairing result that minimizes the sum of the scan sequence difference and passage time deviation of each candidate pairing; When the hidden occupancy does not return to zero within the preset longest passage time, the number of the erasure scan sequence and the number of the growth scan sequence are not equal, or the difference between the minimum scan sequence exceeds the pairing threshold, the occluded passage batch is marked as an abnormal batch and the corresponding structured trajectory segments are kept independent of each other.
8. The cloud-edge collaborative security video structuring method according to claim 1, characterized in that, Both the entry-side structured trajectory segment and the exit-side structured trajectory segment include camera identifier, static occlusion area identifier, boundary identifier, local trajectory identifier, target category, acquisition timestamp, target detection box, visible foreground mask index, and preset travel direction; Both the erasure scan sequence and the growth scan sequence include displacement phase, normalized area change, normalized tangential length, normalized tangential centroid position, and corresponding local trajectory identifier.
9. The cloud-edge collaborative security video structuring method according to claim 3, characterized in that, Calculate the area residual between the normalized area reduction of the erasure scan and the normalized area increase of the growth scan under the same displacement phase, the chord length residual between the tangential lengths corrected by the scene calibration relationship, and the position residual between the tangential centroid positions corrected by the scene calibration relationship. The area residual, chord length residual, and position residual of multiple displacement phases are weighted and accumulated to obtain the scan sequence difference; The corresponding erasure scan sequence is determined to match the growth scan sequence only when the difference between the minimum scan sequence and the minimum scan sequence is less than the pairing threshold, and the difference between the difference between the second smallest scan sequence and the minimum scan sequence is greater than the uniqueness threshold.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the cloud-edge collaborative security video structuring method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Scene monitoring method and device based on edge calculation, equipment and storage medium
CN115171007A
