A psychiatric patient dangerous behavior recognition system
By using background difference and hand microtexture structure tensor field analysis in psychiatric wards, combined with group discrete acceleration analysis, we can identify handheld sharp foreign objects and warn of potential dangerous behaviors. This solves the problem of inaccurate identification of small foreign objects in existing technologies and achieves higher identification accuracy and reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- RONGJUN HOSPITAL OF HEBEI PROVINCE (BAODING PSYCHIATRIC HOSPITAL OF HEBEI PROVINCE)
- Filing Date
- 2026-04-07
- Publication Date
- 2026-07-14
AI Technical Summary
Existing image recognition technologies struggle to effectively identify sharp foreign objects, such as blade fragments or sharpened cutlery, hidden in the tiny areas of the hand in psychiatric ward settings. They are easily confused by similar edge signals caused by skin folds and lighting shadows, leading to missed detections or false alarms.
The image preprocessing module for wards is used to perform background difference operations to generate a mask of the region of interest for the hand. Through tensor field analysis of the micro-texture structure of the hand, rigid edge signals of the hand holding a sharp foreign object are screened out. Combined with the group discrete acceleration analysis module, the discrete acceleration surge value of the limbs is calculated. Through the dangerous behavior comprehensive early warning module, multimodal feature cross-validation is performed to identify potential dangerous behaviors.
It improves the accuracy of identifying potential violence or self-harm in psychiatric wards, effectively identifies small but lethal foreign objects, senses group psychological stress responses, reduces background noise interference, and enhances the accuracy and reliability of identification.
Smart Images

Figure CN122391947A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to a system for recognizing dangerous behaviors of psychiatric patients. Background Technology
[0002] Image recognition technology encompasses the core technologies of computer vision, pattern recognition, and digital image processing. It aims to use computers to process, analyze, and understand images or video sequences in order to identify targets and objects of various patterns.
[0003] Existing image recognition technologies, when dealing with specific scenarios in psychiatric wards, often rely on general object detection models or single motion feature analysis. In practice, these general algorithms typically make judgments based on global features. For sharp foreign objects hidden in the tiny areas of the hand, such as blade fragments or sharpened cutlery, they are easily confused by similar edge signals caused by skin folds or lighting shadows due to their small size or indistinct texture features, leading to missed detections or false alarms. Therefore, improvements are needed. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing a system for identifying dangerous behaviors in psychiatric patients.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a system for identifying dangerous behaviors of psychiatric patients, comprising: The ward image preprocessing module is used to perform background subtraction operation on frame images according to the ward video monitoring stream to separate foreground moving targets, generate a region of interest mask for the hands of ward personnel, traverse the internal pixels of the region of interest mask for the hands of ward personnel and calculate the gradient vectors in the horizontal and vertical directions, and establish a tensor field of hand micro-texture structure. The foreign object structure tensor analysis module is used to perform eigenvalue decomposition on the gradient covariance matrix based on the microtexture structure tensor field of the hand to obtain principal curvature data, calculate the salient edge response value of the pixel, filter the continuous linear pixel clusters with the salient edge response value of the pixel higher than the rigidity set value, and generate the rigid edge signal of the handheld sharp foreign object. The group discrete acceleration analysis module is used to calculate and obtain the current geometric center coordinates of the group based on the position of the centroid of the ward personnel mapped by the rigid edge signal of the handheld sharp foreign object, and to calculate and generate the discrete acceleration surge value of the personnel's limbs based on the distance from the centroid of each target to the current geometric center coordinates of the group. The dangerous behavior comprehensive early warning module is used to compare the difference between the surge value of the discrete acceleration of the person's limbs and the preset group panic safety threshold, calculate the positive pulse deviation amplitude, search the risk classification lookup table and match the positive pulse deviation amplitude level with the existence state of the rigid edge signal, trigger the corresponding intervention logic, and generate the dangerous behavior identification result of psychiatric patients.
[0006] Preferably, the step of obtaining the tensor field of the microtexture structure of the hand is as follows: The frame images are obtained by decoding the video surveillance stream in the ward. Background subtraction is performed on the frame images to generate a foreground motion pixel mask. The pixel set within the preset skin color threshold range is selected. The pixel set is marked with connected components and filled with holes to generate a mask of the region of interest for the hands of the ward personnel. Based on the region of interest mask of the patient's hand, the pixels inside the region of interest mask of the patient's hand are traversed pixel by pixel, the horizontal gray-level gradient vector of the pixel is calculated, the vertical gray-level gradient vector of the pixel is calculated, and the sequence of horizontal and vertical gradient vectors of the pixels inside the region of interest mask of the patient's hand is generated. Based on the sequence of horizontal and vertical gradient vectors of pixels inside the mask of the region of interest on the hands of patients in the ward, the gradient covariance matrix is calculated for each pixel. The gradient covariance matrix results are organized in the order of pixel coordinates to form a continuous tensor mapping, generating a tensor field of hand micro-texture structure.
[0007] Preferably, the step of obtaining the saliency edge response value of the pixel is as follows: Based on the tensor field of the microtexture structure of the hand, the gradient covariance matrix is extracted pixel by pixel, and the gradient covariance matrix is decomposed into eigenvalues. The maximum and minimum eigenvalues obtained by the decomposition are recorded as the principal values of each pixel. The principal value distribution matrix is constructed by combining the pixel coordinate information to obtain the principal curvature data. Based on the principal curvature data, the saliency edge response value of each pixel is calculated.
[0008] Preferably, the step of acquiring the rigid edge signal of the handheld sharp foreign object is as follows: Based on the salient edge response value of the pixel, a rigidity threshold is set, and all pixels are traversed. Pixels with salient edge response values greater than the rigidity threshold are marked as candidate points. Continuous linear pixel clusters are formed by clustering according to spatial connectivity. The gradient direction consistency distribution within each pixel cluster is calculated and compared with the main axis direction of the hand region. Linear pixel clusters with directional deviations but consistent internal directions are identified, and a rigid edge signal for a sharp foreign object in hand is generated.
[0009] Preferably, the step of obtaining the current group geometric center coordinates is as follows: Based on the centroid position of the ward personnel mapped by the rigid edge signal of the handheld sharp foreign object, the horizontal and vertical coordinates of the centroid of each ward personnel are read in chronological order, and the average of the horizontal and vertical coordinates is calculated to obtain the current geometric center coordinates of the group.
[0010] Preferably, the step of obtaining the discrete acceleration surge value of the human limb is as follows: Based on the current geometric center coordinates of the group, calculate the Euclidean distance from the centroid of each patient in the ward to the geometric center coordinates of the group. Take the average of all Euclidean distances within the same time frame as the average radial distance of that frame. Calculate continuously and sort by time to obtain the average radial distance time series. Based on the average radial distance time series, the discrete acceleration surge value of the human limbs is calculated.
[0011] Preferably, the step of obtaining the positive pulse deviation amplitude is as follows: Calculate the difference between the surge value of the discrete acceleration of the personnel's limbs and the safety threshold of the group panic. If the difference is less than zero, set it to zero and mark the time position and the magnitude of the difference. Organize the deviation records in chronological order and generate a positive pulse deviation magnitude.
[0012] Preferably, the steps for obtaining the results of the identification of dangerous behaviors in psychiatric patients are as follows: Retrieve the risk grading lookup table and locate the risk level corresponding to the positive pulse deviation amplitude range. Read the presence status requirements of the rigid edge signal of the handheld sharp foreign object configured for the risk level and generate a risk grading matching result by combining time and location. The presence state of the rigid edge signal of the handheld sharp foreign object is compared with the presence state requirements in the risk classification matching result. The trigger judgment is executed according to the intervention logic of successful matching and the trigger mark is recorded to generate the identification result of dangerous behavior of psychiatric patients.
[0013] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, background subtraction is performed on the ward video surveillance stream to separate foreground moving targets and extract pixel sets that meet the skin color threshold, concentrating computational resources on the high-risk hand area and avoiding background clutter interference. A tensor field for the micro-texture structure of the hand is constructed by calculating the gradient vectors in the horizontal and vertical directions, enabling a refined characterization of the texture direction and structural features of local pixels at the microscopic level. Eigenvalue decomposition is used to obtain principal curvature data and calculate the salient edge response values of pixels. A nonlinear gating mechanism is combined to amplify strong edge signals and suppress weak texture noise, capturing the rigid edge features of sharp foreign objects held in the hand, overcoming the sensitivity of traditional edge detection to skin wrinkles or changes in lighting. Rigid edge signals are generated based on the selected continuous linear pixel clusters, enabling the identification of small and potentially lethal foreign objects. Furthermore, the geometric center coordinates and average radial distance of the group are calculated based on the centroid position of the ward personnel. By quantifying the explosive surge in the dispersion acceleration of personnel limbs during crowd diffusion or contraction, and combining this with stability analysis of historical movement states, the invention distinguishes between normal personnel flow and sudden panic-induced group dispersion behavior. By comparing the surge value with the group panic safety threshold and matching it with rigid edge signal states, and through a cross-validation mechanism of multimodal features, the system can capture individual dangerous carriers while sensing group psychological stress responses, thereby improving the accuracy of identifying potential violent or self-harming behaviors in complex psychiatric scenarios. Attached Figure Description
[0014] Figure 1 This is a system flowchart of the present invention. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0016] Please see Figure 1 The present invention provides a technical solution: a system for identifying dangerous behaviors of psychiatric patients, comprising: The ward image preprocessing module is used to perform background subtraction on frame images based on the ward video monitoring stream to separate foreground moving targets, generate a region of interest mask for the hands of ward personnel, traverse the pixels inside the region of interest mask for the hands of ward personnel and calculate the gradient vectors in the horizontal and vertical directions, and establish a tensor field for the micro-texture structure of the hands. The foreign object structure tensor analysis module is used to perform eigenvalue decomposition on the gradient covariance matrix based on the micro-texture structure tensor field of the hand to obtain principal curvature data, calculate the salient edge response value of the pixel, filter continuous linear pixel clusters with salient edge response values higher than the rigidity set value, and generate rigid edge signal of the handheld sharp foreign object. The group discrete acceleration analysis module is used to calculate and obtain the current geometric center coordinates of the group based on the position of the centroid of the ward personnel mapped by the rigid edge signal of the handheld sharp foreign object, and to calculate and generate the discrete acceleration surge value of the personnel's limbs based on the distance from the centroid of each target to the current geometric center coordinates of the group. The comprehensive early warning module for dangerous behaviors compares the difference between the surge value of the discrete acceleration of a person's limbs and the preset group panic safety threshold, calculates the deviation amplitude of the positive impulse, retrieves the risk classification lookup table and matches the positive impulse deviation amplitude level with the existence state of the rigid edge signal, triggers the corresponding intervention logic, and generates the identification results of dangerous behaviors of psychiatric patients.
[0017] The steps for obtaining the tensor field of the microtexture structure of the hand are as follows: The frame images are obtained by decoding the video surveillance stream in the ward. Background subtraction is performed on the frame images to generate a foreground motion pixel mask. The pixel set within the preset skin color threshold range is selected. The pixel set is marked with connected components and filled with holes to generate a mask of the region of interest for the hands of the ward personnel. Based on the region of interest mask of the patient's hand, the pixels inside the region of interest mask of the patient's hand are traversed pixel by pixel, the horizontal gray-level gradient vector of the pixel is calculated, the vertical gray-level gradient vector of the pixel is calculated, and the sequence of horizontal and vertical gradient vectors of the pixels inside the region of interest mask of the patient's hand is generated. Based on the sequence of horizontal and vertical gradient vectors of pixels inside the mask of the region of interest on the hands of patients in the ward, the gradient covariance matrix is calculated for each pixel. The gradient covariance matrix results are organized in the order of pixel coordinates to form a continuous tensor mapping, generating a tensor field of hand micro-texture structure.
[0018] Specifically, based on the frame images obtained from the decoded video surveillance stream in the ward, a frame buffer for background modeling is first established, with the buffer size set to [value missing]. The background model is updated by calculating the pixel grayscale differences between consecutive frames. A Gaussian mixture model is used to fit the background, and a learning rate is set. To adapt to slow changes in lighting, the current frame is compared with the background model using a difference operation to calculate the difference image, and a foreground determination threshold is set. This threshold is set based on the average ambient light intensity in the ward. If the absolute value of the difference between pixels is greater than... This is then marked as a foreground moving target, thereby generating a foreground moving pixel mask. Next, the frame image in RGB color space is converted to YCbCr color space, as shown in the conversion formula. Components are Calculations show that Components are Calculations show that Components are Calculations show that, within this color space, a numerical range for skin tone discrimination is set, and an empirical range is selected as the filtering criterion. The lower limit of the component is 133 and the upper limit is 173. The lower limit of the component is 77 and the upper limit is 127. Simultaneously, by traversing all pixels within the foreground moving pixel mask, the following conditions will be met. and Pixels meeting the conditions are preserved to form a preliminary set of skin color pixels. For noise and broken areas present in this set, structuring elements for morphological operations are defined. Select a circular structural element with a radius of 3 pixels, and first perform an expansion operation. The calculation formula is as follows: ,in A set of pixels As a structural element, The displacement is used to fill the small holes inside the hand region. Then, an erosion operation is performed to smooth the boundaries and remove isolated small noise points. Finally, connected component analysis is performed on the processed binary image to calculate the pixel area of each connected component and set an area threshold. The pixel threshold is calculated based on the camera resolution and the monitoring distance in the ward, and areas smaller than [a certain size] are excluded. For non-hand connected regions, retain the largest connected region as the hand region to generate a mask of the region of interest for the hands of patients in the ward.
[0019] Based on the region of interest mask of the patient's hand, the coordinates of the region marked as 1 in the mask image are read, a pixel index list is constructed, and the pixels inside the region of interest mask of the patient's hand are traversed pixel by pixel in row-major order. For each traversed pixel... Select its surroundings The gray values within the neighborhood are convolved, and the Sobel operator is used as the gradient calculation kernel. The horizontal convolution kernel is defined. for Define the vertical convolution kernel for Calculate the horizontal grayscale gradient vector of a pixel. The calculation formula is: ,in Indicates the image in coordinates grayscale value at that location and Similarly, the vertical grayscale gradient vector of the pixel is calculated as the neighborhood offset. The calculation formula is: During the calculation process, if neighboring pixels exceed the image boundary, an edge copying and filling method is used, which replaces the value of the nearest boundary pixel with the calculated value. and The numerical values are normalized and limited to... For each coordinate point, the range is designed to facilitate storage and subsequent calculations. Establish gradient vector These vectors are then stored in the buffer according to their spatial positional relationship in the original image, generating a sequence of horizontal and vertical gradient vectors for the pixels inside the mask of the region of interest of the patient's hand.
[0020] Based on the sequence of horizontal and vertical gradient vectors of pixels within the mask representing the region of interest of patients' hands, the gradient vector data stored in the buffer is retrieved. For each pixel within the mask, its corresponding horizontal gradient is used... with vertical gradient Construct the initial gradient product matrix The calculation formula is: To extract local structural features of the texture and suppress noise interference, the initial matrix needs to be smoothed, and the size of the Gaussian smoothing window is defined. Set the standard deviation of the Gaussian function The standard deviation is preset based on the average scale of hand texture, and a Gaussian weighted template is calculated. The formula is ,in The coordinates are relative to the window, and their values range from 1 to 2. The initial gradient product matrix centered at the current pixel is weighted and summed using this weight template to calculate the smoothed gradient covariance matrix. The calculation process is expressed as follows: ,in and It is the gradient value at the corresponding position in the neighborhood. This calculation process generates a gradient value for each pixel. A positive semi-definite symmetric matrix, which describes the principal direction and coherence of texture within a local region, is used to calculate all the obtained values according to the row and column scanning order of the image. The matrix is mapped back to the corresponding pixel coordinates to construct a tensor field data structure with the same resolution as the original image, generating a tensor field for the micro-texture structure of the hand.
[0021] The steps for obtaining the saliency edge response value of a pixel are as follows: Based on the tensor field of the microtexture structure of the hand, the gradient covariance matrix is extracted pixel by pixel. The gradient covariance matrix is decomposed into eigenvalues. The largest and smallest eigenvalues obtained by the decomposition are recorded as the principal values of each pixel. The principal value distribution matrix is constructed by combining the pixel coordinate information to obtain the principal curvature data. Based on the principal curvature data, the salient edge response value of each pixel is calculated using the following formula: ; in, For pixels The saliency edge response value of the pixel. For pixels The largest eigenvalue of the gradient covariance matrix. For pixels The minimum eigenvalue of the gradient covariance matrix. To prevent extremely small positive numbers with a denominator of zero, It represents the average value of the maximum eigenvalues of all pixels in the tensor field of the microtexture structure of the hand.
[0022] Specifically, based on the tensor field of the micro-texture structure of the hand, the gradient covariance matrix is extracted pixel by pixel. First, a data buffer with the same dimension as the input tensor field is allocated in memory to store the calculated feature data. Then, each coordinate point in the tensor field is traversed according to the raster scan order. Read the structure tensor matrix stored at this location. ,in Corresponding to the squared component of the horizontal gradient, Corresponding to the squared component of the vertical gradient, and For mixed gradient components and To obtain the geometric features describing the local texture anisotropy, an analytical method is used to solve for the eigenvalues of the second-order real symmetric matrix. First, the trace of the matrix is calculated. and determinant Next, calculate the discriminant of the characteristic equation. The maximum value function is introduced here to eliminate the problem of negative square roots caused by floating-point operation errors. Then, the two eigenvalues are obtained using the quadratic formula. and The larger eigenvalue is named the largest eigenvalue through numerical comparison. The smaller eigenvalue is named the smallest eigenvalue. These two values represent the energy intensity of the image at that pixel along the principal gradient direction and the secondary gradient direction, respectively. Finally, the calculated... and The values are then filled into the corresponding feature maps. Simultaneously, a matrix of the same size as the original image is constructed to record the distribution of the principal feature values for each pixel. A global accumulator is maintained concurrently during the traversal process to record all valid pixels. The sum of these values yields the principal curvature data.
[0023] In the formula for calculating the saliency edge response value of a pixel, by combining local structural coherence and global energy saliency, it is possible to suppress low-contrast background clutter (such as skin texture) and enhance the rigid edge response of high contrast. The first term is the coherence factor, which uses the eigenvalue difference ratio to measure the directional uniformity of local texture. The second term is the intensity weighting factor, which uses an exponential decay form to perform nonlinear mapping based on the saliency of gradient energy relative to the global average level, thereby achieving accurate capture of sharp foreign object edges. For pixels The maximum eigenvalue of the gradient covariance matrix, which represents the gradient energy in the direction of the most drastic gray-level change within a local region, is obtained by reading the coordinates of the tensor field of the hand's micro-texture structure. The matrix data is processed using an eigenvalue decomposition algorithm to extract the largest eigenvalue. For example, when detecting the reflection at the edge of a metal knife, the gray value at that location surges from 50 to 200, exhibiting a dramatic gradient change. The calculated largest eigenvalue of the covariance matrix might reach... This value directly reflects the sharpness of the edge; For pixels The minimum eigenvalue of the gradient covariance matrix, which represents the energy of gray-level change perpendicular to the principal gradient direction, is typically caused by noise or isotropic textures. The steps to obtain this eigenvalue are as follows: Similarly, for coordinates... The matrix data is subjected to eigenvalue decomposition to extract the minimum eigenvalue. For example, in the linear structure of the cutting edge of the aforementioned tool, the grayscale change along the cutting edge direction is very small, and the calculated minimum eigenvalue may only be... The smaller the value, the more pronounced the directionality of the structure; To prevent extremely small positive numbers with a denominator of zero, we set... ; This parameter represents the average of the maximum eigenvalues of all pixels in the tensor field of the hand's microtexture structure. It serves as a global adaptive normalization benchmark, reflecting the average texture activity level in the current scene. The steps to obtain this parameter are: traversing all pixels within the mask... For each pixel, sum its maximum eigenvalue. Get the sum Through formula Calculations show that, for example, in a full-image statistical analysis, if the total number of pixels is 1000 and the sum of feature values is 500000, then... This value is used to adaptively offset the effects of changes in light intensity.
[0024] Calculations based on parameters: For example, if the currently processed pixel is located at a suspected tool edge, the obtained parameter values are as follows: , , , .
[0025] First, calculate the coherence factor on the left side of the formula: ; ; Term1 ; Next, calculate the intensity weighting factor on the right side of the formula: ; ; Term2 ; Finally, calculate the total response value: ; The results show that the salient edge response value of this pixel is about 0.9231 (close to the theoretical maximum value of 1.0), indicating that this point not only has a high degree of consistency in direction (contributed by Term1), but also its edge intensity is much higher than the average level of the background (contributed by Term2), thus it is determined to be a strongly salient edge point.
[0026] The steps for obtaining the rigid edge signal of a handheld sharp foreign object are as follows: Based on the salient edge response value of each pixel, a rigidity threshold is set. All pixels are traversed, and pixels with salient edge response values greater than the rigidity threshold are marked as candidate points. Continuous linear pixel clusters are formed by clustering according to spatial connectivity. The gradient direction consistency distribution within each pixel cluster is calculated and compared with the main axis direction of the hand region. Linear pixel clusters with directional deviations but consistent internal directions are identified, and a rigid edge signal for a sharp foreign object in hand is generated.
[0027] Specifically, a rigid threshold is set based on the saliency edge response value of each pixel. This threshold is set using an adaptive statistical thresholding method. First, the histogram distribution of the edge response values of all pixels in the hand region of the current frame is calculated, and then the mean value is calculated. with standard deviation According to the normal distribution Criteria, setting rigid setpoints ,in This is an empirical coefficient, with a value range of 3.0 to 4.0. For example, if the calculated mean is 0.1 and the standard deviation is 0.05, then... ,but All pixels Value and Pixels with values greater than the specified value are marked as 1, and the rest as 0, generating a binary edge map. Then, connected component labeling is performed on the binary map, spatially adjacent feature points are clustered, and the geometric moments of each pixel cluster are calculated to extract the major axis length. With minor axis length Calculate the aspect ratio Simultaneously, gradient histograms are used to statistically analyze the directional consistency of gradients within clusters. Furthermore, over 80% of the pixel gradient direction deviations within the cluster are within... If the angle is within the range, calculate the angle between the principal direction of the linear cluster and the principal axis of hand anatomy (from wrist to fingertip). If the angle is greater than... If the linear structure is determined to be outside the contour of the hand itself, it is identified as the edge of an external rigid object, and a rigid edge signal of a sharp foreign object in the hand is generated.
[0028] The steps to obtain the current group's geometric center coordinates are as follows: Based on the centroid position of the ward personnel mapped by the rigid edge signal of the handheld sharp foreign object, the horizontal and vertical coordinates of the centroid of each ward personnel are read in chronological order, and the average of the horizontal and vertical coordinates is calculated to obtain the current geometric center coordinates of the group.
[0029] Specifically, based on the centroid position of the ward personnel mapped by the rigid edge signal of the handheld sharp foreign object, the horizontal and vertical coordinates of the centroid of each ward personnel are read sequentially over time. First, a temporary data list is established to store the coordinates of all valid targets in the current frame. This list can dynamically accommodate the location information of multiple personnel locked by the monitoring system within the ward. By accessing the shared memory area of the video analysis backend, the bounding box centroid data of each ward personnel is extracted one by one. During the reading process, the validity of the coordinates is verified, and the horizontal coordinate is... and the vertical axis Compare with the camera's resolution range, for example, to verify. Is it between 0 and 1920 and If the coordinates are between 0 and 1080, outlier values caused by occlusion or detection jitter are removed. The verified coordinate data are then pushed into a temporary data list. The list is then traversed, and the horizontal and vertical coordinate accumulators are initialized to zero. During the traversal, the horizontal coordinate value of each person is accumulated into the horizontal coordinate accumulator, and the vertical coordinate value is accumulated into the vertical coordinate accumulator. At the same time, the total number of valid persons in the list is counted. After traversing all persons, the sum of the horizontal coordinate accumulators is divided by the total number of valid persons to obtain the average horizontal coordinate of the current group. The sum of the vertical coordinate accumulators is divided by the total number of valid persons to obtain the average vertical coordinate of the current group. Finally, these two average values are combined into a two-dimensional coordinate point, which represents the geometric centroid of the distribution of persons in the ward at the current moment. This point is marked as the group reference origin of the current frame and used to calculate the radial movement trend of each dispersed individual relative to this center to obtain the geometric center coordinates of the current group.
[0030] The steps for obtaining the discrete acceleration surge value of a person's limbs are as follows: Based on the current geometric center coordinates of the group, calculate the Euclidean distance from the centroid of each patient in the ward to the geometric center coordinates of the group. Take the average of all Euclidean distances within the same time frame as the average radial distance of that frame. Calculate continuously and sort by time to obtain the time series of the average radial distance. Based on the mean radial distance time series, the surge value of discrete acceleration of the human limbs is calculated using the following formula: ; in, For the surge value of the discrete acceleration of the human limbs, For time points The instantaneous acceleration is calculated using the following formula: ,in For time points The average radial distance, The interval between adjacent time points For time points The instantaneous radial velocity, obtained through the formula calculate, For time points The average value of the instantaneous radial velocity within the previous window, For time points The variance of the instantaneous radial velocity within the previous window, To prevent extremely small positive numbers with a denominator of zero.
[0031] Specifically, in the formula for calculating the discrete acceleration surge value of a person's limbs, the original acceleration signal is weighted with confidence by assessing the degree of deviation of the current instantaneous velocity from the historical velocity distribution. This effectively suppresses false high acceleration noise caused by video tracking drift or key point jumps, ensuring that the extracted surge value can truly reflect the substantial discrete movements of the group in a state of panic, which have physical inertia and continuity. For time points The instantaneous acceleration, which reflects the rate of change of the average radial distance, i.e., the acceleration of population diffusion, is obtained by: calculating the average radial distance sequence using the second-order central difference method, with the following formula: ,in For time points The average radial distance, For example, frame interval , Then the acceleration can be calculated; For time points The instantaneous radial velocity, which reflects the instantaneous rate of population diffusion, is obtained by calculating it using the first-order backward difference method. The calculation formula is as follows: For example, based on the distance data above, ; For time points The average instantaneous radial velocity within the previous window, which represents the velocity baseline of recent motion, is obtained by setting the sliding window length. Extracting time points Calculate the average of the previous 15 speed values; for example, the average speed over the past 15 frames is... ; For time points The variance of the instantaneous radial velocity within the previous window measures the stability of recent velocity fluctuations. The steps to obtain this variance are as follows: Based on the velocity data within the aforementioned window, calculate its variance value. For example, if the velocity fluctuations are small, the variance calculation result is... ; To prevent extremely small positive numbers with a denominator of zero, we set it to... .
[0032] Calculations based on parameters: Set time interval .
[0033] Read the average radial distance of three consecutive frames: , , .
[0034] The first step is to calculate the instantaneous velocity. : ; The second step is to calculate the instantaneous acceleration. : ; The third step is to obtain historical window statistics: , , .
[0035] Step 4: Calculate the exponential weighting term: ; ; ; Fifth step, calculate the weighted acceleration value at the current moment: ; This result indicates that at the current time point Although the original acceleration is as high as However, due to the current speed Slightly deviated from the historical average This results in a weighting coefficient of approximately 0.37, and the final effective surge value is 459.85. This indicates that the system recognizes that the action has a certain degree of suddenness, but in order to eliminate noise interference, its amplitude is moderately smoothed and suppressed. If the speed completely conforms to the historical trend (i.e., the deviation is 0), the weight is 1, and all acceleration values are retained.
[0036] The steps for obtaining the positive pulse deviation amplitude are as follows: The difference between the surge value of the discrete acceleration of the personnel's limbs and the safety threshold of the group panic is calculated. When the difference is less than zero, it is set to zero and the time position and difference amplitude are marked. The deviation records are sorted in chronological order and a positive pulse deviation amplitude is generated.
[0037] Specifically, the difference between the surge value of the discrete acceleration of a person's limbs and the safety threshold for group panic is calculated. First, the surge value of the discrete acceleration of the person's limbs in the current frame is read from memory. This surge value is a quantitative indicator based on the weighted acceleration calculation in the previous step, for example, a value of 459.85. Then, the preset safety threshold for group panic is retrieved. The setting process of this threshold is based on the statistical data of behavior in the ward under normal non-emergency conditions. At the beginning of the equipment deployment, a one-week baseline data collection period is set to record the discrete acceleration data of people in the ward under normal scenarios such as eating, free movement, and sleeping. A total of about 1 million sample points are collected. The statistical distribution characteristics of these sample points are calculated, and the 99.5th percentile value is selected as the basic safety line. For example, the statistically obtained peak daily acceleration is 120 cm / s². Considering measurement errors and accidental collisions, a safety margin coefficient of 1 is set. .2, then the calculated safety threshold for group panic is 120 multiplied by 1.2, which equals 144 cm / s². Subtract the current surge value of 459.85 from the threshold of 144 to obtain a difference of 315.85. If the calculated surge value at a certain moment is 100, which is less than the threshold of 144, the result is negative. In this case, the difference is forcibly set to zero, indicating that no abnormal surge exceeding the safety range has occurred. For the calculated non-zero positive value, it is bound to the current timestamp to create a pulse event object containing the time point and amplitude value. For example, the time is marked as 14:30:05:12 and the amplitude is 315.85. These objects are stored in a circular queue in the order of their occurrence. Invalid records with consecutive zero values are removed, and only keyframe data with positive amplitude are retained to form a continuous sequence of danger precursor descriptions and generate a positive pulse deviation amplitude.
[0038] The steps for obtaining the results of risky behavior identification in psychiatric patients are as follows: Search the risk grading lookup table and locate the risk level corresponding to the positive pulse deviation amplitude range. Read the presence status requirements of the rigid edge signal of the handheld sharp foreign object configured for the risk level and generate the risk grading matching result by combining the time and location. The presence status of the rigid edge signal of a handheld sharp foreign object is compared with the presence status requirements in the risk grading matching results. Trigger judgment is executed according to the intervention logic of successful matching, and trigger markers are recorded to generate the identification results of dangerous behaviors of psychiatric patients.
[0039] Specifically, the risk grading lookup table is retrieved to locate the risk level corresponding to the positive impulse deviation amplitude range. First, the risk grading lookup table stored in the configuration database is loaded. This table is constructed based on the intensity grading standards of historical hazardous events, dividing the positive impulse deviation amplitude into four increasing intervals: Interval 1 is set to 0 to 100, corresponding to the low-risk attention level; Interval 2 is set to 100 to 300, corresponding to the medium-risk alert level; Interval 3 is set to 300 to 600, corresponding to the high-risk intervention level; and Interval 4 is set to above 600, corresponding to the extremely high-risk emergency level. The definition of these intervals references the correlation analysis between the amplitude of patient limb movements and the destructive force in 300 past clinical records. For example, for the amplitude value of 315.85 calculated in the previous step, it is compared with the interval in the lookup table. The system compares the data and determines that it falls within the range of 300 to 600, thus locating it as a high-risk intervention level. It then reads the additional attribute configurations listed under this risk level, including the requirement for the presence of a rigid edge signal of a handheld sharp foreign object. For example, in the high-risk intervention level, the configuration item stipulates that "if a sharp foreign object signal is present, the risk level will be upgraded to extremely high; if not, the current level will be maintained," or the configuration item directly defines that "a secondary confirmation must be performed in conjunction with the foreign object signal." The system reads these specific logical judgment conditions and packages the current time and location information with the locked risk level and the foreign object presence requirement to form an intermediate state assessment data package for further processing. This data package clarifies the level to which the intensity of the action belongs at the current moment and the auxiliary conditions required for subsequent judgment, generating a risk classification matching result.
[0040] Comparing the presence status of the rigid edge signal of a handheld sharp foreign object with the presence status requirements in the risk grading matching results, the sharp foreign object detection result generated in the previous image processing steps is first retrieved. This result is a Boolean status indicator, such as "True" indicating that a rigid edge such as a metal knife has been detected, and "False" indicating that it has not been detected. This status is then compared with the logical requirements read from the risk grading matching results to perform a logical truth operation. For the high-risk intervention level corresponding to an amplitude value of 315.85 in the aforementioned case, if the foreign object signal status is "True," the condition for "upgrading to extremely high risk" is met, and the highest level of intervention logic is triggered. If the foreign object signal status is "False," the high risk level is maintained. At the risk intervention level, secondary intervention logic is triggered. For different intervention logics, corresponding preset instructions are executed. For example, for the highest level intervention, the instructions include immediately cutting off the power to the ward automatic door to lock the area, triggering the red alarm light at the nurse station to flash, and automatically dialing the security department's communication terminal. For secondary intervention, the instructions include triggering the yellow alarm light to stay on and recording the event log. While executing the judgment process, the specific time of triggering, the matched original amplitude value, the foreign object detection status, and the final activated intervention strategy number are recorded in the system log as the basis for subsequent medical retrospective. Finally, the output includes a conclusion containing specific danger type definitions such as "armed riot" or "unarmed agitation", generating the dangerous behavior identification results for psychiatric patients.
Claims
1. A system for identifying dangerous behaviors in psychiatric patients, characterized in that, The system includes: The ward image preprocessing module is used to perform background subtraction operation on frame images according to the ward video monitoring stream to separate foreground moving targets, generate a region of interest mask for the hands of ward personnel, traverse the internal pixels of the region of interest mask for the hands of ward personnel and calculate the gradient vectors in the horizontal and vertical directions, and establish a tensor field of hand micro-texture structure. The foreign object structure tensor analysis module is used to perform eigenvalue decomposition on the gradient covariance matrix based on the microtexture structure tensor field of the hand to obtain principal curvature data, calculate the salient edge response value of the pixel, filter the continuous linear pixel clusters with the salient edge response value of the pixel higher than the rigidity set value, and generate the rigid edge signal of the handheld sharp foreign object. The group discrete acceleration analysis module is used to calculate and obtain the current geometric center coordinates of the group based on the position of the centroid of the ward personnel mapped by the rigid edge signal of the handheld sharp foreign object, and to calculate and generate the discrete acceleration surge value of the personnel's limbs based on the distance from the centroid of each target to the current geometric center coordinates of the group. The dangerous behavior comprehensive early warning module is used to compare the difference between the surge value of the discrete acceleration of the person's limbs and the preset group panic safety threshold, calculate the positive pulse deviation amplitude, search the risk classification lookup table and match the positive pulse deviation amplitude level with the existence state of the rigid edge signal, trigger the corresponding intervention logic, and generate the dangerous behavior identification result of psychiatric patients.
2. The psychiatric patient risk behavior identification system according to claim 1, characterized in that, The steps for obtaining the tensor field of the microtexture structure of the hand are as follows: The frame images are obtained by decoding the video surveillance stream in the ward. Background subtraction is performed on the frame images to generate a foreground motion pixel mask. The pixel set within the preset skin color threshold range is selected. The pixel set is marked with connected components and filled with holes to generate a mask of the region of interest for the hands of the ward personnel. Based on the region of interest mask of the patient's hand, the pixels inside the region of interest mask of the patient's hand are traversed pixel by pixel, the horizontal gray-level gradient vector of the pixel is calculated, the vertical gray-level gradient vector of the pixel is calculated, and the sequence of horizontal and vertical gradient vectors of the pixels inside the region of interest mask of the patient's hand is generated. Based on the sequence of horizontal and vertical gradient vectors of pixels inside the mask of the region of interest on the hands of patients in the ward, the gradient covariance matrix is calculated for each pixel. The gradient covariance matrix results are organized in the order of pixel coordinates to form a continuous tensor mapping, generating a tensor field of hand micro-texture structure.
3. The dangerous behavior identification system for psychiatric patients according to claim 1, characterized in that, The steps for obtaining the salient edge response value of the pixel are as follows: Based on the tensor field of the microtexture structure of the hand, the gradient covariance matrix is extracted pixel by pixel, and the gradient covariance matrix is decomposed into eigenvalues. The maximum and minimum eigenvalues obtained by the decomposition are recorded as the principal values of each pixel. The principal value distribution matrix is constructed by combining the pixel coordinate information to obtain the principal curvature data. Based on the principal curvature data, the saliency edge response value of each pixel is calculated.
4. The dangerous behavior identification system for psychiatric patients according to claim 1, characterized in that, The steps for obtaining the rigid edge signal of the handheld sharp foreign object are as follows: Based on the salient edge response value of the pixel, a rigidity threshold is set, and all pixels are traversed. Pixels with salient edge response values greater than the rigidity threshold are marked as candidate points. Continuous linear pixel clusters are formed by clustering according to spatial connectivity. The gradient direction consistency distribution within each pixel cluster is calculated and compared with the main axis direction of the hand region. Linear pixel clusters with directional deviations but consistent internal directions are identified, and a rigid edge signal for a sharp foreign object in hand is generated.
5. The dangerous behavior identification system for psychiatric patients according to claim 1, characterized in that, The steps for obtaining the current group geometric center coordinates are as follows: Based on the centroid position of the ward personnel mapped by the rigid edge signal of the handheld sharp foreign object, the horizontal and vertical coordinates of the centroid of each ward personnel are read in chronological order, and the average of the horizontal and vertical coordinates is calculated to obtain the current geometric center coordinates of the group.
6. The dangerous behavior identification system for psychiatric patients according to claim 1, characterized in that, The steps for obtaining the surge value of discrete acceleration of the human limbs are as follows: Based on the current geometric center coordinates of the group, calculate the Euclidean distance from the centroid of each patient in the ward to the geometric center coordinates of the group. Take the average of all Euclidean distances within the same time frame as the average radial distance of that frame. Calculate continuously and sort by time to obtain the average radial distance time series. Based on the average radial distance time series, the discrete acceleration surge value of the human limbs is calculated.
7. The psychiatric patient dangerous behavior identification system according to claim 1, characterized in that, The steps for obtaining the positive pulse deviation amplitude are as follows: Calculate the difference between the surge value of the discrete acceleration of the personnel's limbs and the safety threshold of the group panic. If the difference is less than zero, set it to zero and mark the time position and the magnitude of the difference. Organize the deviation records in chronological order and generate a positive pulse deviation magnitude.
8. The dangerous behavior identification system for psychiatric patients according to claim 1, characterized in that, The steps for obtaining the results of the identification of dangerous behaviors in psychiatric patients are as follows: Retrieve the risk grading lookup table and locate the risk level corresponding to the positive pulse deviation amplitude range. Read the presence status requirements of the rigid edge signal of the handheld sharp foreign object configured for the risk level and generate a risk grading matching result by combining time and location. The presence state of the rigid edge signal of the handheld sharp foreign object is compared with the presence state requirements in the risk classification matching result. The trigger judgment is executed according to the intervention logic of successful matching and the trigger mark is recorded to generate the identification result of dangerous behavior of psychiatric patients.