A method and system for real-time detection of self-strangulation behavior in a prison scene
Patent Information
- Application Number
- CN202610558344.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-24
- Publication Date
- 2026-10-30
AI Technical Summary
当前监狱安防体系主要依托人工视频值守与智能视频分析技术开展监控工作,其中人工值守仍是多数监狱的主流模式,但该模式存在显著的固有缺陷:人工巡查的效率低下,监控覆盖范围有限,在夜间值守、多区域并发监控等场景下漏检率居高不下,已难以适配现代化监狱的智能化、精细化监管需求,因此研发具备实时性与高准确率的自缢行为检测技术,成为提升监狱安防智能化水平的关键突破口
(1)实验设置
Smart Images

Figure CN123016035A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for real-time detection of hanging behavior in prison scenes, and also to a system for implementing the method, belonging to the field of video surveillance technology. Background Technology
[0002] As the core facility for the execution of sentences and the rehabilitation of criminals, ensuring the safety of inmates is the bottom line of prison supervision and directly affects the stable operation of prison order. Currently, prison security systems mainly rely on manual video surveillance and intelligent video analysis technology for monitoring. Manual surveillance remains the mainstream model in most prisons, but this model has significant inherent drawbacks: low efficiency, limited monitoring coverage, and high missed detection rates in scenarios such as nighttime duty and concurrent monitoring of multiple areas. It is no longer suitable for the intelligent and refined supervision needs of modern prisons. Therefore, developing real-time and highly accurate suicide detection technology has become a key breakthrough in improving the level of intelligent prison security.
[0003] Deep learning-driven computer vision technology has been widely applied in the security field. Lightweight detection models such as the YOLO series have become a common choice for intelligent detection due to their fast inference speed, which can meet the frame rate requirements of real-time monitoring. However, when it comes to detecting hanging behavior in prison scenarios, these small models are limited by their shallow feature extraction dimensions. They are prone to misjudging targets in complex prison conditions such as clothing obscuring objects, low light, and iron fence obscuring objects. The actual detection accuracy is difficult to improve, and it cannot meet the high precision requirements of prison security. On the other hand, large parameter models such as InternVL and ViT have higher recognition accuracy in complex scene understanding tasks due to their deep semantic learning capabilities. However, they have fundamental bottlenecks such as slow inference speed and strict hardware computing power requirements, making it difficult to adapt to the deployment conditions of multiple cameras monitoring concurrently in prisons.
[0004] Chinese invention patent CN113223046B discloses a method for recognizing the behavior of prison personnel. This technical solution acquires surveillance images of a monitored area, determines the location information of the monitored target based on the pixel bounding boxes of the monitored target in the image, and tracks the monitored target. It then identifies the monitored target by matching the tracked monitored target with preset identity information; finally, it determines whether the monitored target's action information and location information corresponding to the identity match the preset identity's action and location information, generating an alarm if they do not match. This solves the problems of low accuracy and high latency in monitoring target behavior recognition, achieving accurate and rapid identification of prison personnel's behavior. However, the above method has a high false positive rate for detecting hanging behavior under complex conditions such as low lighting and iron fence obstruction in prisons, and it also suffers from the problems of lacking specific feature extraction and being unable to balance detection speed and recognition accuracy. Summary of the Invention
[0005] The primary technical problem to be solved by this invention is to provide a method for real-time detection of hanging behavior in prison settings.
[0006] Another technical problem to be solved by the present invention is to provide a system for real-time detection of hanging behavior in prison scenarios.
[0007] To achieve the above-mentioned technical objectives, the present invention adopts the following technical solution: According to a first aspect of the present invention, a method for real-time detection of hanging behavior in a prison setting is provided, comprising the following steps: S1: A three-level cascaded small model is used to quickly coarsely screen hanging targets in the video frames to be detected. The three-level cascaded small model includes: The detection and tracking level is used to detect and track pedestrian targets in the monitored scene, and filter invalid samples based on pedestrian density and dwell time; The attribute segmentation level is used to adaptively expand the bounding box of the tracked pedestrian target and perform pixel-level segmentation of the head, arms and ropes within the expanded area. Non-hanging targets are further filtered based on the presence or absence of ropes and spatial association rules with the head and arms. The classification and judgment level is used to overlay the segmented head, arm, and rope regions onto the original image with different color masks to form visually enhanced samples, and input them into a lightweight classification network to determine whether they are candidate targets for hanging. S2: Construct a fine-tuning dataset specifically for prison scenarios, design structured prompt templates, and use a parameter-efficient fine-tuning method to supervise and fine-tune the pre-set visual model to adapt it to the recognition of hanging behavior in prison scenarios. S3: Expand the bounding box of the suicide candidate target output in step S1 by an equal proportion, and input the expanded region into the visual large model after supervision and fine-tuning in step S2. The visual large model performs semantic-level deep verification of the suicide behavior. S4: Establish decision fusion rules based on the classification accuracy of the three-level cascaded small model and the visual large model: if both determine it as hanging, an alarm is triggered; if the three-level cascaded small model determines it as hanging while the visual large model determines it as not hanging, the conclusion of the visual large model shall prevail and no alarm shall be triggered.
[0008] Preferably, the detection and tracking level is achieved using an optimized YOLOv12 model; the optimization includes: introducing a cross-scale attention mechanism in the feature fusion network and re-clustering anchor boxes based on the pedestrian size distribution in the prison scene.
[0009] Preferably, the adaptive expansion ratio is determined based on experimental verification in a prison setting to include the key feature regions of the hanging behavior.
[0010] Preferably, the attribute segmentation level is achieved using an optimized segmentation model; the optimization includes: optimizing the anchor frame adaptation mechanism for the morphological features of ropes in prison scenes, to achieve segmentation of three types of strongly correlated features of hanging: head, arm, and rope.
[0011] Preferably, the lightweight classification network is trained on a prison scene dataset, uses a weighted loss function to solve the problem of imbalanced sample data, and outputs a binary classification result of hanging or non-hanging.
[0012] Among these, the LoRA method is preferred for efficient parameter fine-tuning, freezing the visual encoder and language base of the large visual model, and performing end-to-end training only on the model's connection layer by inserting adapters.
[0013] Among them, the fine-tuning process adopts a hybrid precision training mode, and uses cosine annealing learning rate scheduling and early stopping strategy at the same time. The early stopping strategy refers to immediately stopping training when the accuracy of the validation set does not improve or even decreases for several consecutive training rounds, in order to prevent the model from overfitting.
[0014] Preferably, the visual large model uses a combination of rope load-bearing features, limb posture logic features, and background object attribute features to perform semantic-level deep verification.
[0015] Preferably, the large visual model is the InternVL3-2B model.
[0016] According to a second aspect of the present invention, a system for real-time detection of hanging behavior in a prison setting is provided, comprising a processor and a memory; wherein the memory is coupled to the processor and is used to store a computer program, which, when executed by the processor, causes the processor to implement the aforementioned method. Compared with existing technologies, this invention constructs a decision fusion mechanism of "small model coarse screening - large model verification", designs a visual feature enhancement strategy for head, arm, and rope attribute segmentation and original image overlay segmentation mask specifically for hanging, and performs prison scene supervision and fine-tuning on the large model. It solves the problems of high misjudgment rate of hanging behavior detection in complex conditions such as low light and iron fence obstruction in prisons, which rely solely on traditional computer vision algorithms and rule matching, and the lack of specific feature extraction and inability to balance detection speed and recognition accuracy. Attached Figure Description
[0017] Figure 1 This is a flowchart of a method for real-time detection of hanging behavior in a prison setting, as shown in the first embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the effect of visual feature enhancement in the first embodiment of the present invention; Figure 3This is a schematic diagram of an example of a hanging classification sample set in the first embodiment of the present invention; Figure 4 This is a schematic diagram of the supervised fine-tuning in the first embodiment of the present invention; Figure 5 This is a schematic diagram of an example of a suicide by hanging simulation sample in the first embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the effect of pedestrian detection results in the first embodiment of the present invention; Figure 7 This is a schematic diagram illustrating the effect of the self-hanging attribute segmentation result in the first embodiment of the present invention; Figure 8 This is a schematic diagram of a typical case of hanging classification results in the first embodiment of the present invention; Figure 9 This is a schematic diagram of a system structure for real-time detection of suicide by hanging in a prison setting, as shown in the second embodiment of the present invention. Detailed Implementation
[0018] The technical content of the present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0019] First Embodiment like Figure 1 As shown, the first embodiment of the present invention provides a method for real-time detection of hanging behavior in a prison setting, which includes at least the following steps: S1: A three-level cascaded small model is used to quickly coarsely screen hanging targets in the video frames to be detected. The three-level cascaded small model includes: The detection and tracking level is used to detect and track pedestrian targets in the monitored scene, and filter invalid samples based on pedestrian density and dwell time; The attribute segmentation level is used to adaptively expand the bounding box of the tracked pedestrian target and perform pixel-level segmentation of the head, arms and ropes within the expanded area. Non-hanging targets are further filtered based on the presence or absence of ropes and spatial association rules with the head and arms. The classification and judgment level is used to overlay the segmented head, arm, and rope regions onto the original image with different color masks to form visually enhanced samples, and input them into a lightweight classification network to determine whether they are candidate targets for hanging. S2: Construct a fine-tuning dataset specifically for prison scenarios, design structured prompt templates, and use a parameter-efficient fine-tuning method to supervise and fine-tune the pre-set visual model to adapt it to the recognition of hanging behavior in prison scenarios. S3: Expand the bounding box of the suicide candidate target output in step S1 by an equal proportion, and input the expanded region into the visual large model after supervision and fine-tuning in step S2. The visual large model performs semantic-level deep verification of the suicide behavior. S4: Establish decision fusion rules based on the classification accuracy of the three-level cascaded small model and the visual large model: if both determine it as hanging, an alarm is triggered; if the three-level cascaded small model determines it as hanging while the visual large model determines it as not hanging, the conclusion of the visual large model shall prevail and no alarm shall be triggered.
[0020] In one embodiment of the present invention, step S1 includes the following sub-steps: S11: Optimize the YOLOv12 model and combine it with the Deep SORT algorithm to achieve accurate pedestrian detection and tracking in prison scenes. Based on pedestrian density and behavioral temporal characteristics, complete the first round of invalid sample filtering.
[0021] S12: Adaptively expand the bounding box of the tracked target and perform pixel-level segmentation of the head, arm, and rope. Based on the feature space association rules, complete the secondary coarse screening of non-hanging targets.
[0022] S13: Construct visually enhanced samples with mask overlays for the targets after the second coarse screening. Classify and judge them using a customized ResNet50 model to mark the hanging candidate targets.
[0023] In one embodiment of the present invention, step S2 includes the following sub-steps: S21: Collect and label images related to suicide by hanging in multiple prison scenes, construct the Prison-Suicide-8K dataset, design structured prompt templates, and provide high-quality task data for supervised fine-tuning of large models.
[0024] S22: Based on the LoRA method, the parameters of the Intern VL3-2B model are efficiently supervised and fine-tuned, which improves the accuracy of model self-hanging recognition while adapting to the single card computing power constraint.
[0025] In one embodiment of the present invention, step S3 includes the following sub-steps: S31: Perform bounding box expansion preprocessing on the hanging candidate targets output by the small model, and crop the expanded region to provide a complete input image with background information for the depth verification of the large model.
[0026] S32: Input the preprocessed image into the fine-tuned InternVL3-2B model, and combine multi-dimensional high-level features to complete the deep semantic reasoning verification of the hanging behavior.
[0027] S33: Develop decision fusion rules based on the classification accuracy of the large and small models, and combine the verification results of the large model and the coarse screening results of the small model to achieve accurate determination of hanging behavior.
[0028] The following is a detailed explanation of each implementation step of the above method: In step S1, a lightweight small model coarse screening system is constructed using a three-level cascaded architecture of "detection and tracking - attribute segmentation - classification judgment". Through progressive processing logic, the rapid coarse screening of hanging targets is achieved, invalid samples are filtered out in advance, and the computational load of subsequent large models is greatly reduced, laying the foundation for the real-time performance of the entire detection framework. In addition, each module is customized and optimized for the special characteristics of the prison scene, adapting to the engineering requirements of dense pedestrians, frequent occlusion, and fixed scene features in prisons.
[0029] In the pedestrian detection and tracking sub-step, the YOLOv12 model is fine-tuned based on a proprietary prison scene sample set. First, a cross-scale attention mechanism is introduced into the feature fusion network to dynamically adjust the weight distribution of feature maps at different scales, enhancing the feature extraction capability for pedestrians of different heights and distances, and solving the problem of missed detection caused by differences in target scale. Then, based on the pedestrian size distribution statistics of the proprietary sample set, the anchor boxes are re-clustered using the K-means clustering algorithm, and the aspect ratio and initial size of the anchor boxes are adjusted to make the anchor boxes fit the actual shape of pedestrians in the prison scene, improving the accuracy of bounding box regression and achieving accurate real-time positioning and recognition of pedestrians in the prison scene. Meanwhile, the DeepSORT algorithm is introduced to construct a pedestrian tracking system. The pedestrian detection target is input into a lightweight ResNet18 network to extract a 128-dimensional feature vector. The Kalman filter algorithm is used to establish a target motion model. The position and velocity of the target in the next frame are predicted by state estimation to assist in target association in occluded scenes. Then, the Hungarian algorithm is used to associate and match the target features of adjacent frames. The weighted value of "appearance feature similarity (weight 0.6) + motion position error (weight 0.4)" is used as the matching basis to improve the target re-identification ability after occlusion is removed and realize continuous cross-frame tracking of pedestrian targets. Based on the results of pedestrian detection and tracking, a rule-based coarse screening mechanism for prison scenarios is constructed. The first step is to conduct an initial screening based on pedestrian density characteristics. When the number of pedestrian targets in the monitoring screen is ≥2, according to the prison's management model of "two people on the same post and regular patrols", they are directly judged as non-suicide targets and excluded. The second step focuses on the behavioral timing characteristics of single-person scenarios. If the dwell time of the only pedestrian target in the monitoring screen is ≤2 seconds, according to the action sequence characteristics of suicide, which requires completing actions such as hanging ropes, tying knots, and hanging, which take more than 2 seconds, they are directly judged as non-suicide targets and excluded. This coarse screening step can effectively eliminate 45% of invalid samples, reducing the computational load of subsequent fine analysis.
[0030] In the suicide attribute segmentation sub-step, to address the issue that conventional detection bounding boxes cannot fully encompass key suicide features such as ropes and arms, the bounding box of the tracked and locked pedestrian target is adaptively expanded by 10% to the left and right and 40% upwards. This expansion ratio was determined through comparative experiments with controlled variables in the range of 5% to 50%, at which point the rope detection rate reaches 99%, ensuring complete coverage of possible rope and limb-related areas. A segmentation model fine-tuned based on a proprietary sample set (such as based on Mask2Former or a customized segmentation network) is used to perform pixel-level segmentation of the expanded region, focusing on extracting three attributes strongly correlated with suicide behavior: head, arms, and rope. The head serves as the core localization benchmark for the upper body, the arms are used to determine the interaction between the limbs and the rope, and the rope is the key carrier of suicide behavior. To adapt to the diversity and irregular shapes of ropes in prison scenes, the segmentation model uses an adaptive anchor frame adjustment mechanism to dynamically adjust the aspect ratio of the anchor frame to the range of 1:5 to 5:1, avoiding segmentation deviations of slender ropes caused by fixed anchor frames. Based on the segmentation results, a secondary coarse screening rule is constructed. If no rope feature is detected, the target is directly determined to be non-hanging. If a rope is detected, but either the "rope is more than 20% of the head's height away" or "the arm outline does not intersect with the rope" condition is met, the target is also determined to be non-hanging. This sub-step can filter out an additional 40% of invalid samples, effectively improving the processing efficiency of subsequent classification steps.
[0031] In the self-hanging classification sub-step, such as Figure 2 As shown, an enhanced visual input sample is constructed using a visual feature enhancement strategy of "overlaying the target original image with a segmentation mask image." The head, arm, and rope regions obtained from the previous segmentation are assigned masks of different colors, which are then overlaid pixel-wise with the original image. This ensures the sample simultaneously contains low-level visual texture features and high-level semantic segmentation features. Semantic masks strengthen the core feature associations of the hanging behavior, helping the model focus on key feature regions. After uniformly adjusting the visually enhanced target to a size of 224×224, it is fed into a lightweight ResNet50 classification model for fine classification. The model training phase is specifically optimized for prison scenes. Figure 3As shown, a prison scene-specific labeled dataset is first constructed, containing 3,000 hanging samples and 12,000 non-hanging samples. The hanging samples cover different time periods, different degrees of occlusion, and different prison environments. The non-hanging samples focus on easily confused behaviors that are highly similar to hanging, such as bending over, leaning, and picking up objects. Then, the weighted cross-entropy loss function is used to optimize the model parameters, setting the weight of hanging samples to 4.0 and the weight of non-hanging samples to 1.0 to solve the data imbalance problem. After training, the model outputs a binary classification result of "hanging / non-hanging" for the coarsely screened targets. Targets judged as "hanging" are marked as "hanging candidate targets" and sent to the subsequent large model verification stage, while targets judged as "non-hanging" are returned to the pedestrian tracking stage for real-time dynamic monitoring.
[0032] This step achieves pre-filtering of invalid samples through three-level cascaded lightweight processing, clearing the computational burden obstacle for subsequent in-depth verification of large models and ensuring the real-time requirements of the entire detection framework.
[0033] In step S2, to address the issues of poor scene adaptability, misjudgment and interception of security assessment-related terms, and response failure caused by excessive compliance constraints in prison suicide detection using general-purpose large-scale models, a prison-scene-specific supervised fine-tuning of the InternVL3-2B visual large-scale model is performed. Through the construction of a dedicated dataset, customized prompt template design, and efficient LoRA parameter fine-tuning strategies, prison scene adaptation of the large-scale model is achieved. While ensuring content security and compliance, this effectively solves the problems of misjudgment and interception of security assessment-related terms and excessive compliance constraints in general-purpose large-scale models. It also possesses high-accuracy semantic understanding capabilities for suicide behavior, while maintaining advantages in memory usage and inference speed, adapting to the computational constraints of single-card deployment in prisons.
[0034] In the dedicated fine-tuning dataset construction sub-step, a large-scale model fine-tuning dataset, Prison-Suicide-8K, specifically designed for prison scenarios, was built. This dataset contains 8,000 meticulously labeled images, covering typical prison scenes such as cells and activity rooms, and taking into account different time periods during the day and night to ensure the model's adaptability under diverse lighting conditions. It also includes approximately 30% partially occluded samples, covering common occlusion types in prison scenes such as iron fence occlusion and bed occlusion, to verify and improve the model's robustness in complex occlusion environments. To expand sample diversity and improve model generalization ability, three targeted data augmentation techniques were introduced: random rotation (±15°), brightness adjustment (±20%), and bounding box expansion ratio adjustment (30%–70% proportional expansion), simulating various scene changes in prison monitoring. The data annotation process adopted a dual workflow of "manual annotation + expert review." Initial annotations were completed by professional annotators, followed by secondary review and confirmation by experts in the field of prison security to ensure the accuracy and rationality of the annotation information, providing high-quality labeled data for large-scale model fine-tuning. Simultaneously, a structured prompt template was designed to improve the interpretability and consistency of the model output. The template content is: "Determine whether there is a hanging behavior in the image? If so, explain the positional relationship between the rope and the head and arms; if not, explain why. The output result is generated in the following JSON format: {"category":"hanging","answer":"yes or no","confidence":"confidence level","thoughts":"key feature description"}". By explicitly defining the core detection task and combining it with binary decision logic, the model output is strictly constrained into a standardized structured form integrating the decision result, confidence level, and key feature description. Relying on the JSON format, the structured and standardized implementation of the model output content is achieved, facilitating subsequent integration with other modules of the detection framework.
[0035] like Figure 4As shown, in the supervised fine-tuning strategy implementation sub-step, considering the computational constraints of the prison scenario, the LoRA (Low-Rank Adaptation) method from Parameter-Efficient Fine-Tuning is selected. Supervised fine-tuning of InternVL3-2B is performed based on the LLaMA-Factory framework. Compared to full fine-tuning, the LoRA method only updates a small number of model parameters, significantly reducing computational and storage overhead and adapting to resource-constrained scenarios. During the fine-tuning process, the ViT visual encoder and LLM language base of InternVL3-2B are frozen. Only the MLP connection layer, which accounts for less than 5% of the total parameters, is trained end-to-end using the LoRA adapter. This maintains the general representation capability of the encoder and base while keeping the GPU memory usage below 20GB, meeting the single-card deployment requirements. Simultaneously, optimal training parameters were configured, employing mixed-precision training (FP16) to balance training accuracy and memory usage. The batch size was set to 16, and the initial learning rate was set to 5e-5. Cosine annealing learning rate scheduling was used to dynamically adjust the learning rate with the training cycle, avoiding model overfitting. The training cycle was set to 10 epochs, and an early stopping strategy was introduced: training was immediately stopped when the validation set accuracy showed no improvement or even decreased for three consecutive training epochs, improving training efficiency and preventing overfitting. InternVL3-2B, as a large visual model using a native multimodal pre-training paradigm, has superior visual semantic understanding capabilities compared to the traditional "LLM + visual adapter" modification scheme. Its variable visual position coding (V2PE) technology can provide continuous two-dimensional position residuals on images with arbitrary aspect ratios, significantly enhancing the fine-grained understanding of the complex spatial relationship between "ropes and limbs." After scene adaptation fine-tuning in this step, it can accurately adapt to scenarios in prison monitoring with changing perspectives and severe target occlusion.
[0036] In the model performance verification and selection sub-step, the performance of InternVL3 models of different specifications was evaluated on the graphics card. The test set used 1600 images from Prison-Suicide-8K. The evaluation metrics included accuracy, memory usage, and frame latency. The results are shown in Table 1. Table 1 Comparison of Hanging Detection Performance of InternVL3 Large Model The evaluation results show that the original InternVL3-2B model achieved a hanging recognition accuracy of 85.4%, which improved to 97.29% after supervised fine-tuning, an increase of 11.89%, while maintaining a GPU memory usage of 18.5GB and a single-frame inference time of 0.25s, without significant resource burden, meeting the real-time monitoring needs of prison scenarios. In contrast, the higher-specification InternVL3-14B, 38B, and 78B original models, although showing a slight improvement in accuracy, experienced a significant increase in GPU memory usage and single-frame inference time, far exceeding the computing power capacity of a single GPU and failing to meet the deployment conditions of multiple cameras for concurrent monitoring in prisons.
[0037] Therefore, the InternVL3-2B model, after being fine-tuned for scenario adaptation in this step, has become the optimal choice for in-depth verification of suicide behavior in prison scenarios. It effectively solves the problems of misjudgment and interception of security assessment-related terms and excessive compliance constraints in general large models, avoiding rejection of response or output of invalid information, and achieves accurate assessment of suicide behavior in prison scenarios, while maintaining the adaptability of computing power and speed.
[0038] In step S3, a dual guarantee mechanism of "small model coarse screening - large model verification" is constructed. The deep semantic understanding capability of the finely tuned InternVL3-2B large model is used to perform multi-dimensional deep verification of the suicide candidate targets output by the small model, correcting the misjudgment problem of the small model in complex scenarios. At the same time, scientific decision fusion rules are designed based on the classification accuracy of the large and small models to achieve accurate judgment of suicide behavior. Finally, a five-level progressive detection closed loop of "detection and tracking - segmentation - classification - verification - decision" is formed to meet the core requirement of real-time and accurate detection of suicide behavior in prison scenarios.
[0039] In the preprocessing sub-step for hanging candidate targets, to preserve the environmental information surrounding the target (such as background objects like beds, railings, and door / window frames), and to avoid the large model missing scene semantic information due to only cropping the target area, the bounding box of the hanging candidate target output by the small model is expanded by 50% proportionally. The expanded area is then used as the input image for the large model. This expansion processing allows the large model to simultaneously analyze the relationship between the target and the surrounding scene, effectively solving the problem that the small model easily misidentifies regular objects such as beds, railings, and door / window frames as ropes. This provides complete scene information for the large model's deep semantic reasoning, improving the accuracy of the verification.
[0040] In the deep inference verification sub-step of the large model, the preprocessed input image is fed into the InternVL3-2B large model, which has been fine-tuned in step S2. Leveraging its powerful visual semantic understanding capabilities and fine-grained analysis of the "rope-limb" spatial relationship, semantic-level deep inference verification is performed. The large model analyzes three core high-level features: first, "whether the rope is load-bearing," determining whether the rope in the image has actual load-bearing characteristics, distinguishing between a real hanging rope and a hanging rope without load; second, "whether the limb posture conforms to the hanging logic," analyzing whether the pedestrian's limb posture matches the hanging, struggling, and other posture characteristics of hanging behavior, distinguishing between hanging postures and similar postures such as raising a hand to adjust clothing or leaning; and third, "whether the background object is a rope," combining scene context information to determine whether the "rope" identified by the small model is an easily confused object such as bed railings, door and window frames, or collar folds, correcting the small model's false rope detection problem. For complex images such as blurry or heavily obstructed surveillance footage, the large model can also output detailed text descriptions according to the structured prompt template designed in step S2, such as "There is a horizontal railing in the image, no rope features, and a pedestrian is bending down to pick up an item." This provides a reference for manual confirmation and subsequent prompt template optimization, achieving an effective connection between machine detection and manual review.
[0041] In the sub-step of decision fusion between the small and large models, scientific decision rules are designed based on the actual classification accuracy of the small and large models. After three-level cascade coarse screening, the classification accuracy of the small model is 94.6%, and the classification accuracy of the large model after fine-tuning is 97.3%. The large model has higher classification accuracy. Therefore, the decision rule is set as follows: if the judgment results of the small model and the large model are consistent, both being "hanging", then it is directly judged as hanging behavior, and the alarm mechanism is immediately triggered; if the results of the small model and the large model conflict, with the small model judging "hanging" and the large model judging "not hanging", then based on the higher classification accuracy of the large model, the final result is based on the conclusion of the large model, avoiding false alarms caused by misjudgment by the small model and reducing the false alarm rate of prison security.
[0042] The five-level progressive detection closed-loop and alarm implementation sub-steps integrate all content of steps S1, S2, and S3 to form a complete five-level progressive detection process of "detection tracking - segmentation - classification - verification - decision-making." Each step is seamlessly connected and progressively advanced, achieving real-time and accurate detection of suicide attempts throughout the entire process. The first three levels are completed by the three-level cascaded small model in step S1, with a total time of less than 0.02s, ensuring the real-time performance of the entire detection framework. The latter two levels are completed by the fine-tuned large model in step S2 and the decision fusion mechanism in step S3, with a total time of less than 0.25s, ensuring detection accuracy. The total time per frame of the overall process is less than 0.27s, meeting the real-time requirements of concurrent monitoring by multiple cameras in the prison. When the decision-making process determines that the act is suicide by hanging, the prison's audible and visual alarm devices are immediately triggered. At the same time, the warning information is pushed to the prison security management platform. The platform simultaneously records key information such as on-site images, detection timestamps, and target location, providing accurate information for prison security personnel to handle the situation on-site in a timely manner, forming a complete security closed loop of "detection-judgment-alarm-handling".
[0043] This invention achieves the detection objective of "speed first, accuracy second" through the collaborative work of large and small models, meets the needs of parallel deployment of multiple cameras, and adapts the memory usage to the computing power constraints of single-card deployment. It perfectly solves the triple contradiction of "speed-accuracy-adaptation cost" in the existing technology and adapts to the engineering application needs of prison scenarios.
[0044] The following describes the experimental data and results generated during the research and development of this invention: (1) Experimental setup Dataset: To ensure the effectiveness and scenario adaptability of the experiment, a dedicated suicide detection dataset, Prison-Suicide-50K, was constructed. The data sources included real surveillance footage and simulated data collection: the surveillance data consisted of three months of continuous video recordings from a prison (covering core areas such as cells, exercise yards, and corridors), which were framed to obtain 42,000 real-scene images; the self-collected simulated data consisted of 8,000 images, where professionals simulated key actions such as suicide preparation and execution. Figure 5 As shown. The dataset is divided into two classes according to behavioral labels, with a 9:1 ratio, resulting in a training set of 45,000 images and a test set of 5,000 images.
[0045] Experimental platform: Intel(R) Core(TM) i9-13900K, 128GB RAM, NVIDIA RTX 4090 (24GB VRAM); Software environment: Ubuntu 22.04 system, Python 3.10, PyTorch 1.12.0, vLLM inference framework.
[0046] Evaluation indicators: Accuracy, precision, recall, F1 score, and detection speed (FPS, Frames Per Second) are used as evaluation metrics to comprehensively measure the performance of the method.
[0047] The formulas for calculating Accuracy, Precision, Recall, and F1 are shown in formulas ① to ④.
[0048] (2) Experimental results and analysis like Figure 6 The results of the pedestrian detection experiment based on self-collected simulated data are shown in Table 2. It can be seen that the optimized YOLOv12 model can accurately select pedestrian targets in various complex scenes, with no obvious missed or duplicate detections. The specific quantitative performance of pedestrian detection and tracking is shown in Table 2. Table 2 Pedestrian detection and tracking performance As shown in Table 2, on the test set of 5000 images, the detection precision was 99.57% and the recall was 99.03%, indicating that the model has excellent recognition ability for pedestrians in prison scenes, and the speed of 116.3 FPS can meet the real-time requirements.
[0049] like Figure 7 As shown, in the complete process and results of the self-hanging attribute segmentation, the first row is the original image of the pedestrian target output by pedestrian detection and tracking; the second row is the target image after bounding box expansion; and the third row is the segmentation result image. Different color masks correspond to the head, arm, and rope, respectively. The quantization performance of the self-hanging attribute segmentation model is shown in Table 3. Table 3 Performance of Hanging Attribute Segmentation As shown in Table 3, the segmentation accuracy rates for the head, arms, and rope are 98.1%, 98.5%, and 97.1%, respectively. Among them, the rope, as the core carrier of the hanging behavior, maintains a high segmentation accuracy rate, effectively avoiding subsequent misjudgments caused by incorrect rope segmentation. The overall module speed reaches 136.8 FPS, and when processing in conjunction with the previous detection and tracking module, the total processing time is less than 0.02s, which does not affect the overall real-time performance.
[0050] To verify the effectiveness of the visual feature enhancement strategy of "target original image superimposed with segmented mask image" proposed in this invention, the inventors designed a control experiment: On the same training set (3000 self-hanging samples and 12000 non-self-hanging samples) and test set (15000 independent scene images), training samples were constructed using two methods: "original image" and "original image overlaid with segmentation mask image". The classification model was trained based on the same ResNet50 network structure and training parameters (learning rate 1e-4, batch size 32, training period 20 epochs). The performance comparison results are shown in Table 4. Table 4 Comparison of self-hanging classification performance under different training sample construction methods As shown in Table 4, the detection speed of the model is almost the same under the two sample construction methods, indicating that the superimposed mask image does not increase the computational load of the model inference and ensures the real-time requirements. In terms of classification accuracy, the accuracy of "original image superimposed segmentation mask image" reaches 98.11%, which is 2.81% higher than the "original image" method. This result fully verifies the superiority of the visual feature enhancement strategy and significantly improves classification robustness.
[0051] like Figure 8 As shown, in typical cases of suicide classification results, for groups 2 and 6, the suicide attribute segmentation model missed segmenting the head and arm, respectively. However, even with these segmentation defects, the classification model can still accurately determine the target category. The core reason is that the sample construction method of "overlaying the original image with the segmentation mask image" not only strengthens key features through masking but also fully preserves the environmental context information around the target. This makes the model robust against segmentation errors and avoids the chain of errors caused by relying solely on the segmentation result, further verifying the rationality of the visual feature enhancement strategy.
[0052] The core objective of large-scale model verification is to correct misclassified samples from small-scale models and improve overall detection accuracy. The suicide candidate targets identified by the small-scale model were input into the finely tuned InternVL3-2B visual large-scale model for secondary verification. A total of 2000 suicide candidate targets were identified, including 109 misclassified samples. The results showed that the large-scale model successfully corrected 77 misclassified samples, achieving a correction rate of 70.6%. Among these, 60% of the corrected samples were "rope misdetection" samples, such as misidentifying collar folds or security window frames as ropes, and 40% were "pose similarity misdetection," such as misidentifying a person raising their hand to adjust clothing as a suicide target pose.
[0053] To verify the superiority of the proposed "small model coarse screening + large model verification" collaborative method, two typical single-model schemes were selected for comparison: Individual small model: The optimized three-level cascaded small model (detection-tracking-segmentation-classification) of this invention is adopted. Large single model: The finely tuned InternVL3-2B model is used to directly detect the entire image.
[0054] Table 5 shows the performance comparison results of the three methods on the same experimental platform and test set: Table 5. Results of Method Comparison Analysis Horizontal comparative analysis shows that: While the standalone small model boasts the fastest detection speed (50FPS), its accuracy is low (94.6%), making it prone to false alarms and failing to meet the core requirement of "low false alarm rate" in prison scenarios. The large model alone has excellent accuracy (F1 score of 0.975), but the detection speed is only 4 FPS, which is difficult to support the parallel deployment of multiple cameras and has obvious efficiency bottleneck. The collaborative method proposed in this invention achieves an optimal balance between accuracy and speed: the accuracy (98.3%) is 3.7 percentage points higher than that of a single small model, significantly reducing the risk of false alarms; the detection speed (28FPS) meets the real-time monitoring requirements of multiple cameras; at the same time, the memory usage is close to that of a single large model, adapting to the resource constraints of single-card deployment and better meeting the engineering application requirements of prison scenarios.
[0055] Furthermore, as shown in Table 5, the results of "small model coarse screening" and "small model coarse screening + large model verification" indicate that after verification, the detection precision increased from 94.6% to 98.3%, the F1 value increased from 0.95 to 0.968, and the recall rate remained stable at 95.3%. This shows that the large model verification optimized the false positive problem without introducing new false negatives, achieving a balance between performance improvement and detection integrity.
[0056] In summary, this invention provides a real-time detection method for hanging behavior in prison scenarios using a combination of large and small models. It achieves rapid screening of hanging targets through a three-level cascaded small model, and combines it with an InternVL3-2B large model to complete deep verification and collaborative filtering, effectively solving the core contradiction of "difficulty in balancing speed and accuracy" in hanging detection in prison scenarios. Furthermore, experimental results show that the method provided by this invention outperforms single-model solutions in key indicators such as accuracy and real-time performance, significantly reducing the workload of manual monitoring and providing reliable technical support for timely intervention in hanging incidents.
[0057] Second Embodiment Based on the above method, the second embodiment of the present invention provides a system for real-time detection of hanging behavior in prison scenarios.
[0058] like Figure 9As shown, the system includes one or more processors and a memory. The memory is used to store one or more programs, which are executed by the one or more processors to implement the methods as described in the above embodiments.
[0059] The processor controls the overall operation of the system to complete all or part of the steps described above. This processor can be a central processing unit (CPU), graphics processing unit (GPU), field-programmable gate array (FPGA), application-specific integrated circuit (ASIC), digital signal processing (DSP) chip, etc. The memory stores various types of data to support the operation of the system. This data may include, for example, instructions for any application or method operating on the system, as well as application-related data. The memory can be implemented using any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, etc.
[0060] In one exemplary embodiment, the system may be implemented by a computer chip or physical entity, or by a product with certain functions, to perform the methods described above and achieve the same technical effects as those methods described above. A typical embodiment is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, an in-vehicle human-machine interface device, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0061] In another exemplary embodiment, the present invention also provides a computer-readable storage medium including program instructions that, when executed by a processor, implement the steps of the method in any of the above embodiments. For example, the computer-readable storage medium may be the memory including the program instructions described above, which can be executed by a processor to complete the above method and achieve the same technical effects as the above method.
[0062] It should be noted that the above embodiments are merely illustrative examples. The technical solutions of each embodiment can be combined, and all are within the protection scope of this invention.
[0063] The method and system for real-time detection of hanging behavior in prison scenarios provided by this invention have been described in detail above. Any obvious modifications made to this invention by those skilled in the art without departing from its essential content will constitute an infringement of the patent rights of this invention and will incur corresponding legal liability.
Claims
1. A method for real-time detection of hanging behavior in a prison setting, characterized in that... Includes the following steps: S1: A three-level cascaded small model is used to quickly coarsely screen hanging targets in the video frames to be detected. The three-level cascaded small model includes: The detection and tracking level is used to detect and track pedestrian targets in the monitored scene, and filter invalid samples based on pedestrian density and dwell time; The attribute segmentation level is used to adaptively expand the bounding box of the tracked pedestrian target and perform pixel-level segmentation of the head, arms and ropes within the expanded area. Non-hanging targets are further filtered based on the presence or absence of ropes and spatial association rules with the head and arms. The classification and judgment level is used to overlay the segmented head, arm, and rope regions onto the original image with different color masks to form visually enhanced samples, and input them into a lightweight classification network to determine whether they are candidate targets for hanging. S2: Construct a fine-tuning dataset specifically for prison scenarios, design structured prompt templates, and use a parameter-efficient fine-tuning method to supervise and fine-tune the pre-set visual model to adapt it to the recognition of hanging behavior in prison scenarios. S3: Expand the bounding box of the suicide candidate target output in step S1 by an equal proportion, and input the expanded region into the visual large model after supervision and fine-tuning in step S2. The visual large model performs semantic-level deep verification of the suicide behavior. S4: Establish decision fusion rules based on the classification accuracy of the three-level cascaded small model and the visual large model: if both determine it as hanging, an alarm is triggered; if the three-level cascaded small model determines it as hanging while the visual large model determines it as not hanging, the conclusion of the visual large model shall prevail and no alarm shall be triggered.
2. The method as described in claim 1, characterized in that... The detection and tracking level is implemented using an optimized YOLOv12 model; The optimizations include: introducing a cross-scale attention mechanism into the feature fusion network and re-clustering anchor boxes based on the pedestrian size distribution in the prison scene.
3. The method as described in claim 1, characterized in that... The adaptive expansion ratio was determined based on experimental verification in a prison setting to include key feature regions of the hanging behavior.
4. The method as described in claim 1, characterized in that... The optimized segmentation model is used to achieve the attribute segmentation level; The optimizations include: optimizing the anchor frame adaptation mechanism for the morphological characteristics of ropes in prison scenarios, to achieve segmentation of three types of strongly correlated features of hanging: head, arm, and rope.
5. The method as described in claim 1, characterized in that... The lightweight classification network is trained on a prison scene dataset and uses a weighted loss function to solve the problem of imbalanced sample data, outputting a binary classification result of hanging or non-hanging.
6. The method as described in claim 1, characterized in that... The LoRA method is used to perform efficient parameter fine-tuning, freezing the visual encoder and language base of the large visual model, and only inserting adapters into the connection layer of the model for end-to-end training.
7. The method as described in claim 6, characterized in that... The fine-tuning process employs a hybrid precision training mode, while simultaneously using cosine annealing learning rate scheduling and an early stopping strategy. The early stopping strategy refers to immediately stopping training when the accuracy of the validation set does not improve or even decreases for several consecutive training rounds, in order to prevent the model from overfitting.
8. The method as described in claim 1, characterized in that... The visual big model employs a semantic-level deep verification method that combines rope load-bearing characteristics, limb posture logic characteristics, and background object attribute characteristics.
9. The method as described in claim 8, characterized in that... The large visual model is the InternVL3-2B model.
10. A system for real-time detection of hanging behavior in a prison setting, characterized in that... It includes a processor and a memory; wherein the memory is coupled to the processor and is used to store a computer program that, when executed by the processor, causes the processor to implement the method described in any one of claims 1 to 9.
Citation Information
Patent Citations
A method and system for identifying prison personnel behavior
CN113223046B
