Anomaly detection method for spatio-temporal coupling pattern of human flow-noise in medical scene
By constructing a zonal periodic baseline and coupling tendency index in medical buildings, and combining neighborhood contrast features and functional modulation convolution, an interaction-enhanced temporal convolutional encoder was designed. This solved the problem of accurate detection of abnormal pedestrian-noise coupling in medical buildings, and improved the accuracy and interpretability of the detection.
Patent Information
- Application Number
- CN202611223668.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-13
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2046-08-13
AI Technical Summary
Existing technologies struggle to accurately identify localized abnormalities in patient flow-noise coupling within medical buildings, easily misjudging normal peak patient visits as abnormalities. Furthermore, the models lack interpretability and fail to effectively utilize the normal coupling patterns and temporal attention patterns of each functional area.
We employ a combined approach of partitioned periodic baseline, coupling tendency index, neighborhood contrast features, functional modulation convolution, and prototype-guided attention, along with training using a dual-term composite loss, to construct an interaction-enhanced temporal convolutional encoder for end-to-end training to identify abnormal synchronous coupling between people and noise.
It achieves accurate identification of local human-noise coupling anomalies in medical settings, improves the interpretability of the model and the response differences to different functional areas, and maintains stable expression of normal patterns and sensitivity to anomalies.
Smart Images

Figure CN122758239B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of time-series anomaly detection technology in medical buildings, and in particular to an anomaly detection method for the spatiotemporal coupling pattern of people flow and noise in medical scenarios. Background Technology
[0002] Medical buildings are a type of highly functional, densely populated public building. Their internal spaces are clearly divided according to the treatment process into different functional areas such as registration and payment areas, waiting areas, consultation room corridors, rest areas, and pharmacies. These areas are interconnected through horizontal and vertical circulation systems, jointly supporting a continuous and orderly patient flow. Patients and their accompanying persons move within the building according to the triage process, resulting in a distribution pattern of people flow that is highly tied to the building's functional layout in both time and space. At the same time, due to the different uses and design intentions of different areas, their acoustic characteristics also differ significantly: waiting areas naturally accommodate a large amount of conversation and inquiries, making them social spaces that allow for higher noise levels; rest areas are designed as quiet recovery spaces, requiring a lower acoustic environment; and consultation room corridors primarily serve a passageway function, with noise mainly consisting of brief footsteps and whispers.
[0003] During normal operation of a medical building, the flow of people and noise in each functional area exhibits a spatiotemporal coupling pattern closely related to the building's usage schedule and patient flow cycle. Taking the outpatient building as an example, the registration and payment area experiences a simultaneous peak in both flow of people and noise at the beginning of each day due to the concentrated processing of procedures; the waiting area reaches its peak flow density during specific times in the morning, with noise levels mainly affected by conversations and announcements. Both rise and fall almost synchronously in time. This normal flow of people-noise coupling relationship, determined by the functional layout of the medical building, has significant characteristics of periodic changes on a weekly and hourly basis. Differences in patient volume between weekdays and weekends, and differences in outpatient hours between morning and afternoon, are systematically reflected in the flow of people and noise data in various areas of the building. In the same medical building, the flow density and sound pressure level in the first-floor outpatient hall on Monday morning can be much higher than in the rest corridor on the top-floor ward floor, but these are all within the normal operating conditions allowed by the building's functional design and do not indicate the occurrence of abnormal events.
[0004] What truly needs attention is the sudden, abnormal coupling of pedestrian and noise flow within specific spaces of a medical building, deviating from its inherent functional rhythm. When an unusual surge in pedestrian flow occurs in a consultation room corridor due to temporary congestion, disputes, or emergencies, environmental noise levels rise synchronously, with the two exhibiting a high degree of temporal coordination. This abnormal coupling behavior is spatially concentrated in individual grids, and temporally manifests as pedestrian and noise levels simultaneously exceeding the historical normal levels for that grid during the same week and time period, with a strong synchronous relationship between the two. Capturing such anomalies requires establishing a perception and judgment framework for different functional spaces within the medical building that aligns with their usage patterns. This framework should be able to understand that high pedestrian and noise levels in the waiting area on Monday mornings are reasonable, while also being able to keenly detect sudden synchronous fluctuations in rest areas or corridors during off-peak hours. This allows for precise identification of unusual events in specific spaces within the broader context of the building's normal operation.
[0005] Existing technologies objectively suffer from the following shortcomings: Standardization using global statistics ignores normal differences in weekday and hourly cycles across different functional areas, easily misclassifying normal peak patient visits as abnormal; coupling anomaly judgment relies on implicit model learning, lacking modeling of the core condition of "both significantly elevated and highly synchronized changes," making single-channel fluctuations or asynchronous peaks prone to false alarms; using the same network parameters and indiscriminate pooling strategy for all spatial grids fails to utilize the normal lag coupling patterns and temporal attention patterns of each functional area to guide feature extraction, easily diluting key anomaly information; training relies solely on classification labels, failing to model and constrain the normal coupling rhythms and attention patterns of different functional areas, resulting in poor model interpretability and a lack of consistency in normal sample attention mechanisms.
[0006] Therefore, this invention proposes an anomaly detection method for the spatiotemporal coupling pattern of people flow and noise in medical scenarios to solve the above problems. Summary of the Invention
[0007] To address the shortcomings of existing technologies, this invention proposes an anomaly detection method for spatiotemporal coupling patterns of people and noise in medical scenarios. This invention employs a combined scheme of partitioned periodic baseline, coupling tendency index, neighborhood contrast features, functional modulation convolution, and prototype-guided attention, along with training using a dual-term composite loss, to accurately identify synchronous coupling anomalies of localized people and noise in medical settings.
[0008] The technical solution of this invention is an anomaly detection method for the spatiotemporal coupling pattern of people flow and noise in a medical setting, comprising the following steps: S1. Divide the medical site into spatial grids with unique numbers according to the actual building structure. Collect the flow of people, A-weighted sound pressure level of environmental noise, temperature, relative humidity and PM2.5 concentration in each spatial grid simultaneously. After being aligned with a unified timestamp, generate a multivariate monitoring data stream according to the preset sampling interval. Extract continuous data from the multivariate monitoring data stream according to a fixed time window and label it with anomaly tags to form a training sample set. S2. Data representation and functional semantic mining are performed on the prior of the coupling between people and noise in medical places. Personalized periodic baselines are established for each spatial grid and the coupling anomaly tendency index is calculated to generate an enhanced feature matrix. Spatial contrast deviation is further constructed, and normal coupling pattern prototypes and normal attention target distributions are extracted for each functional area. Finally, the extended enhanced feature matrix, functional labels, normal coupling pattern prototype library and normal attention target distribution set are output. S3. Construct an interaction-enhanced temporal convolutional encoder to encode the augmented feature matrix and obtain high-level temporal features; combine the normal coupling mode prototype to perform attention pooling on the high-level temporal features and output the anomaly probability; construct the total loss function based on the real anomaly label and the normal attention target distribution, perform end-to-end training on the encoder and attention pooling structure, and save the trained detection model and its parameters. S4. Deploy the trained detection model to the medical site monitoring system to conduct online detection of abnormal human flow-noise coupling on the real-time monitoring data stream of each spatial grid.
[0009] S1 is as follows: The medical facility is divided into multiple spatial grids according to the standard dimensions or functional area boundaries. Each grid is assigned a unique number. The functional areas include the registration and payment area, waiting area, consultation room corridor, rest area, and pharmacy. Multivariate monitoring data are collected synchronously within each spatial grid, including pedestrian flow data collected by a passenger flow counting device, environmental noise A-weighted sound pressure level data collected by a sound level meter, and temperature, relative humidity, and PM2.5 concentration data collected by environmental sensors. All monitoring channels are aligned with a unified timestamp and form a multivariate monitoring data stream according to a preset sampling interval; continuous time-series data is extracted from the data stream according to a fixed time window length to form a monitoring sample; For each fixed time window, the monitoring samples are labeled with real anomaly labels to distinguish between normal states and abnormal states caused by the coupling of pedestrian flow and noise. Finally, the training sample set is composed of all labeled monitoring samples.
[0010] S2 is as follows: S2.1. Establish a week-hour dual-period baseline for each spatial grid, and combine the synchronous exceedance of pedestrian flow and environmental noise within the current fixed time window with the synchronous change intensity to generate a coupling anomaly tendency index and embed it into the feature system to obtain an enhanced feature matrix. S2.2 Calculate the spatial contrast deviation of the current spatial grid relative to its surrounding neighborhood, and fuse it with the enhanced feature matrix to obtain the expanded enhanced feature matrix; at the same time, perform functional clustering of the spatial grid based on long-term historical monitoring data to obtain the functional labels of each grid, and extract the normal coupling mode prototype and normal attention target distribution of the corresponding functional partition.
[0011] S2.1 specifically refers to: Obtain all monitoring data of the current spatial grid within a fixed time window, and sort them according to the sampling time to obtain the original multivariate time series matrix; For each sampling time within the window, the monitoring data of the same week and the same hour in the same historical period of the spatial grid are extracted, and the historical periodic mean and standard deviation of the pedestrian flow and the A-weighted sound pressure level of the environment noise are calculated respectively. In this way, the standardized deviation of the two types of data relative to the historical normal level is obtained, forming the standardized deviation vector of pedestrian flow and the standardized deviation vector of noise. The percentage of sampling times in which both types of standardized deviation values simultaneously exceed a preset anomaly threshold within a fixed time window is statistically analyzed to obtain the proportion of simultaneous exceedances of pedestrian flow and noise; the correlation coefficient between the two types of standardized deviation vectors is calculated to characterize the intensity of their synchronous change. The simultaneous exceedance ratio of pedestrian flow and noise is nonlinearly fused with the synchronous change intensity to obtain the coupling anomaly tendency index; the original multivariate time series matrix, the two types of standardized deviation vectors and the coupling anomaly tendency index are concatenated along the feature dimension to obtain the enhanced feature matrix.
[0012] The process of constructing and expanding the enhanced feature matrix based on spatial contrast deviation in S2.2 is as follows: Based on the spatial layout of the medical facility and the grid adjacency relationship, the first-order spatial neighborhood set of the current spatial grid is determined; the average standardized deviation of the pedestrian flow between the current grid and all grids in the neighborhood within a fixed time window is calculated, and the difference between the two is used as the spatial contrast deviation of pedestrian flow; the spatial contrast deviation of noise is obtained using the same calculation logic; the two types of spatial contrast deviations are expanded into feature columns with the same length as the time dimension, and concatenated with the enhanced feature matrix along the feature dimension to obtain the expanded enhanced feature matrix.
[0013] The extraction process of functional clustering, normal coupling pattern prototypes, and normal attention target distribution in S2.2 is as follows: Based on the long-term historical statistical characteristics of all spatial grids, a grid functional feature vector is constructed. Functional partitions are divided using a clustering algorithm, and a corresponding functional label is assigned to each spatial grid. For each functional partition, all historical fixed-time windows marked as normal are collected, and the lag cross-correlation vectors of the two types of standardized deviation vectors in each window under different lag orders are calculated. The lag cross-correlation vectors of all windows are averaged to obtain the normal coupling mode prototype of the functional partition. The prototypes of all functional partitions together constitute the normal coupling mode prototype library. For each functional partition's historical normal window, the matching score between the local coupling features and the normal coupling pattern prototype at each sampling time is calculated and normalized to obtain the normal attention distribution of a single window; the attention distribution of all normal windows within the partition is averaged and normalized again to obtain the normal attention target distribution of that functional partition; the target distributions of all functional partitions together constitute the set of normal attention target distributions.
[0014] The S3 interaction-enhanced temporal convolutional encoder includes multiple layers of residual blocks stacked sequentially. Each residual block contains dilated causal convolution branches, interactive convolution branches, functional modulation modules, and residual connections. Dilated causal convolution branches are used to extract temporal variation patterns at different time scales while preserving temporal causality; Interactive convolutional branches are used to extract the instantaneous multiplicative coupling relationship between the semantic features of pedestrian flow and the semantic features of noise; The functional modulation module is used to generate modulation parameters based on the functional labels of the spatial grid, and to perform channel-by-channel scaling and offset on the fused temporal features; Residual connections are used to preserve features from previous layers and improve network training stability.
[0015] The generation process of high-level time series features in S3 is as follows: The augmented feature matrix corresponding to the spatial grid is used as the encoder input, and the corresponding functional label embedding vector is read according to the functional label of the spatial grid. In each residual block, the main temporal features are first extracted by dilated causal convolution, and then the pedestrian flow semantic features and noise semantic features are projected separately. After element-wise multiplication, the instantaneous coupling features are obtained, and then interactive flow coupling features are obtained by interactive convolution. The main temporal features and interactive flow coupling features are weighted and fused to obtain the fused temporal features. The channel-wise scaling factor and offset are generated by using the function label embedding vector. Functional modulation is then performed on the fused temporal features, and finally added to the channel-aligned output feature residual of the previous layer to obtain the output feature of the current residual block. After processing all residual blocks layer by layer, the high-level timing characteristics of the encoder's final output are obtained.
[0016] The calculation process for the anomaly probability in S3 is as follows: Based on the functional labels of the current spatial grid, the corresponding normal coupling mode prototype is read from the normal coupling mode prototype library and the attention query vector is obtained through mapping transformation; the feature vectors of each time step of the high-level temporal features are mapped to key vectors respectively. Calculate the attention score by scaling the dot product of the attention query vector and the key vector at each time step, and then normalize it to obtain the attention weight at each sampling time step; The high-level temporal features are weighted and summed along the time dimension using attention weights to obtain a window representation vector. The window representation vector is then input into the classification layer, and the anomaly probability of the current fixed time window is output through the activation function.
[0017] The specific methods for the total loss function and training optimization in S3 are as follows: The binary cross-entropy classification loss is calculated based on the true anomaly labels of the training samples and the anomaly probabilities output by the model. For all samples labeled as normal in the training samples, the difference between the attention distribution output by the model and the normal attention target distribution of the corresponding functional partition is calculated to obtain the attention regularization loss; abnormal samples are not included in the calculation of attention regularization loss. The classification loss and attention regularization loss are weighted and combined to obtain the total loss function. The optimization objective is to minimize the total loss function. All trainable parameters of the encoder, attention pooling structure and classification layer are updated end-to-end until the preset training termination condition is met.
[0018] The effects described in the invention are merely those of the embodiments, and not all the effects of the invention. The above technical solutions have the following advantages or beneficial effects: This invention discloses an anomaly detection method for spatiotemporal coupling patterns of pedestrian flow and noise in medical scenarios. It constructs a coupling anomaly tendency index that integrates the proportion of simultaneous exceedances and the intensity of synchronous changes, and introduces spatial neighborhood contrast deviation to inject coupling anomaly priors and spatial local discrimination information into the data. It extracts the hysteresis cross-correlation structure of each functional region from historical normal data as a prototype of the normal coupling pattern and maps it to an attention query vector, replacing global pooling or self-attention to achieve temporal attention guidance at the functional region level. It designs an interaction enhancement encoder with functional label embedding modulation, generating channel-wise scaling and offset parameters through functional labels, enabling shared convolutional kernels to produce differentiated responses to different functional regions. Simultaneously, it utilizes the element-wise product of flow and noise semantic features to extract instantaneous multiplicative coupling. During training, it applies attention distribution constraints based on functional regions only to normal samples, ensuring their temporal attention patterns conform to normal rhythms, while not constraining abnormal samples, thus preserving anomaly sensitivity while stabilizing the expression of normal patterns. Attached Figure Description
[0019] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.
[0020] Figure 1 This is a schematic diagram of the method flow of the present invention.
[0021] Figure 2 This is a schematic diagram of the standardized deviation vector of human traffic.
[0022] Figure 3 This is a schematic diagram of the noise-normalized deviation vector.
[0023] Figure 4 A schematic diagram illustrating the process of extracting a prototype of the normal coupling mode between spatial contrast deviation and functional area.
[0024] Figure 5 This is a prototype diagram of the normal coupling mode for different functional partitions.
[0025] Figure 6 This is a joint distribution density map of the normalized deviation values of human flow and noise.
[0026] Figure 7 A flowchart illustrating the interaction-enhanced temporal convolutional encoder.
[0027] Figure 8 This is a schematic diagram of the training process for aligning attention pooling with the normal coupling mode. Detailed Implementation
[0028] To clearly illustrate the technical features of this solution, the invention will be described in detail below through specific implementation methods and in conjunction with the accompanying drawings.
[0029] like Figure 1 As shown, an anomaly detection method for spatiotemporal coupling patterns of people flow and noise in a medical setting includes the following steps: S1. Divide the medical site into spatial grids with unique numbers according to the actual building structure. Collect the flow of people, A-weighted sound pressure level of environmental noise, temperature, relative humidity and PM2.5 concentration in each spatial grid simultaneously. After being aligned with a unified timestamp, generate a multivariate monitoring data stream according to the preset sampling interval. Extract continuous data from the multivariate monitoring data stream according to a fixed time window and label it with anomaly tags to form a training sample set. S2. Data representation and functional semantic mining are performed on the prior of the coupling between people and noise in medical places. Personalized periodic baselines are established for each spatial grid and the coupling anomaly tendency index is calculated to generate an enhanced feature matrix. Spatial contrast deviation is further constructed, and normal coupling pattern prototypes and normal attention target distributions are extracted for each functional area. Finally, the extended enhanced feature matrix, functional labels, normal coupling pattern prototype library and normal attention target distribution set are output. S3. Construct an interaction-enhanced temporal convolutional encoder to encode the augmented feature matrix and obtain high-level temporal features; combine the normal coupling mode prototype to perform attention pooling on the high-level temporal features and output the anomaly probability; construct the total loss function based on the real anomaly label and the normal attention target distribution, perform end-to-end training on the encoder and attention pooling structure, and save the trained detection model and its parameters. S4. Deploy the trained detection model to the medical site monitoring system to conduct online detection of abnormal human flow-noise coupling on the real-time monitoring data stream of each spatial grid.
[0030] In a specific implementation, step S1, the multi-grid monitoring data collection and abnormal sample construction in medical facilities, is as follows: The medical facility is divided into multiple spatial grids according to its actual building structure, and each spatial grid is assigned a unique grid number. The spatial grids can be divided according to regular dimensions or according to the boundaries of actual functional areas such as registration and payment areas, waiting areas, consultation room corridors, rest areas, and pharmacies. Within each spatial grid, pedestrian flow, A-weighted sound pressure level of ambient noise, temperature, relative humidity, and PM2.5 concentration are collected synchronously. In one implementation, pedestrian flow can be obtained through video passenger flow counting devices, infrared counting devices, or access control counting devices; A-weighted sound pressure level of ambient noise can be obtained through a sound level meter; and temperature, relative humidity, and PM2.5 concentration can be obtained through environmental monitoring sensors. Each monitoring channel is aligned using a unified timestamp and forms a multivariate monitoring data stream according to a preset sampling interval. The sampling interval can be 30 seconds, 1 minute, or 5 minutes. Then, continuous data is extracted from the multivariate monitoring data stream according to a fixed time window to form a monitoring sample with time sequence. The fixed time window length can be 30 minutes to 120 minutes. For example, when the sampling interval is 1 minute and the fixed time window length is 60 minutes, each fixed time window contains 60 sampling moments. Anomaly labels are applied to each fixed time window; the actual anomaly label is denoted as... ,in, Indicates the sample index. This indicates that no abnormalities in pedestrian-noise coupling occurred within the corresponding fixed time window. This indicates an anomaly in the coupling of pedestrian flow and noise occurring within a fixed time window. In one implementation, the anomaly label is manually marked, for example, by combining manual inspection records, video review results, medical facility event records, and actual changes in pedestrian flow and A-weighted sound pressure level of environmental noise. Based on this, a training sample set is ultimately formed. The training sample set consists of a dataset of multiple samples with grid numbers, fixed time windows, and true anomaly labels. The spatial grid corresponding to each training sample is denoted as . For simplicity, when processing individual spatial grids and fixed time windows in subsequent steps, the current spatial grid will be uniformly denoted as... .
[0031] In a specific implementation, step S2, which involves data representation and functional semantic mining of the prior knowledge of the coupling between people flow and noise in medical settings, is as follows: Multivariate time-series data for medical facilities include pedestrian traffic, A-weighted sound pressure level of ambient noise, temperature, relative humidity, and PM2.5 concentration. Anomalies in pedestrian-noise coupling are usually manifested by both pedestrian traffic and A-weighted sound pressure level of ambient noise being significantly higher than the historical levels of the current spatial grid, and the two showing a strong synchronous change relationship within the current fixed time window.
[0032] Different functional areas have different weekly cycles, hourly cycles, and normal fluctuation ranges. For example, waiting areas typically have higher patient traffic and A-weighted sound pressure levels on weekday mornings, while rest areas usually maintain lower levels during the same period. If a uniform global statistic is directly used to process the entire spatial grid, it is easy to identify normal peak patient visits as anomalies, and it is also difficult to clearly express the coupled anomaly conditions where patient traffic and A-weighted sound pressure levels simultaneously exceed limits and change synchronously.
[0033] This invention establishes personalized periodic baselines based on spatial grids, weekdays, and hourly time periods. It calculates the standardized deviation of pedestrian traffic and A-weighted sound pressure levels of environmental noise relative to historical levels for the same period, and integrates the simultaneous exceedance ratio with the intensity of synchronous changes into a coupling anomaly tendency index. Furthermore, it combines spatial contrast deviation between the current spatial grid and adjacent spatial grids, functional labels, normal coupling pattern prototypes, and normal attention target distribution to form a data representation carrying periodic priors, spatial priors, and functional semantic priors. The specific steps are as follows: S2.1, Mesh Personalized Periodic Baseline Stripping and Coupling Anomaly Tendency Index Embedding Different spatial grids exhibit varying normal ranges in terms of pedestrian traffic and A-weighted sound pressure levels of ambient noise. Using a uniform mean and standard deviation fails to effectively distinguish between normal functional differences and genuine anomalies. This invention establishes a week-hour dual-period baseline for each spatial grid and generates a coupling anomaly tendency index based on the synchronous exceedance and intensity of synchronous changes in pedestrian traffic and A-weighted sound pressure levels within the current fixed time window. The specific steps are as follows: 1) Obtaining the spatial grid Within the current fixed time window, pedestrian traffic, A-weighted sound pressure level of ambient noise, temperature, relative humidity, and PM2.5 concentration are collected and arranged in chronological order of sampling time to obtain the original multivariate time series matrix. Original multivariate time series matrix This refers to the time-series data matrix of the current spatial grid, consisting of 5 monitoring channels within the current fixed time window, with a size of [missing information]. ,in, This indicates the total number of sampling moments contained in the current fixed time window.
[0034] Among them, the original multivariate time series matrix The first characteristic channel is the flow rate, the second characteristic channel is the A-weighted sound pressure level of ambient noise, the third characteristic channel is the temperature, the fourth characteristic channel is the relative humidity, and the fifth characteristic channel is the PM2.5 concentration. In one implementation, the flow rate is measured in person-minutes (if the sampling interval is not 1 minute, it needs to be converted to an equivalent number of person-minutes), the A-weighted sound pressure level of ambient noise is measured in dB(A), the temperature is measured in degrees Celsius (°C), the relative humidity is measured in percentage (%), and the PM2.5 concentration is measured in μg / m³.
[0035] Original multivariate time series matrix Each row corresponds one-to-one with each sampling time to preserve the temporal variation of multivariate monitoring data within the current fixed time window. In one implementation, the sampling interval is 1 minute, and the fixed time window length is 60 minutes. Original multivariate time series matrix The size is .
[0036] 2) For each sampling moment within the current fixed time window, determine the corresponding weekday and hour period, and extract them from the spatial grid. Data from the same week and hour in the past several weeks were extracted from historical monitoring data, and the historical periodic mean and standard deviation of the A-weighted sound pressure level of pedestrian flow and environmental noise were calculated respectively.
[0037] Specifically, the first The weekday index corresponding to each sampling time is denoted as . The corresponding hourly time period index is denoted as ,in, This indicates the sampling time sequence number within the current fixed time window. ; Used to distinguish between Monday and Sunday Used to distinguish between 24-hour periods within a day.
[0038] Spatial grid On week 1 hour period The historical average of pedestrian traffic over a given period is denoted as: The standard deviation of historical traffic flow over a period of time is denoted as Historical average pedestrian traffic is used to characterize the spatial grid. Based on the normal baseline of pedestrian traffic for the corresponding week and hour, the historical periodic standard deviation of pedestrian traffic is used to characterize the normal fluctuation range of pedestrian traffic around the normal baseline.
[0039] Furthermore, spatial grid On week 1 hour period The historical average noise period is denoted as The standard deviation of the noise history period is denoted as The historical periodic mean of noise is used to characterize the spatial grid. The normal baseline for the A-weighted sound pressure level of ambient noise for the corresponding week and hour period is used, and the historical periodic standard deviation of noise is used to characterize the normal fluctuation range of the A-weighted sound pressure level of ambient noise around the normal baseline.
[0040] Furthermore, the historical periodic mean and historical periodic standard deviation are statistically analyzed separately according to spatial grids, and the historical periodic mean and historical periodic standard deviation are not shared between different spatial grids, thereby preserving the normal variation patterns of different functional areas.
[0041] In one implementation, a week-hour dual-period baseline is established using historical monitoring data from the past 8 weeks. For sampling data at 9:00 AM Monday, only a spatial grid is used. Historical period mean and standard deviation are calculated using historical monitoring data corresponding to 9:00 AM on Mondays over the past 8 weeks, without using data from other weeks or other hourly periods.
[0042] 3) Based on the current sampling time's pedestrian flow value, the historical periodic mean of pedestrian flow, and the historical periodic standard deviation of pedestrian flow, calculate the standardized deviation of pedestrian flow relative to the normal level of the same period in history, and obtain the standardized deviation vector of pedestrian flow. ,Right now Simultaneously, the standardized deviation of the A-weighted sound pressure level of environmental noise relative to the historical normal level is calculated using the same processing method, resulting in the noise standardized deviation vector. ,Right now .
[0043] in, Representing spatial grid In the Standardized deviation of pedestrian flow at each sampling time; Representing spatial grid In the The original pedestrian flow values at each sampling time; Representing spatial grid In the The noise standardization deviation at each sampling time; Representing spatial grid In the The raw ambient noise A-weighted sound pressure level at each sampling time.
[0044] Furthermore, based on the sampling time sequence, all standardized deviation values of pedestrian flow are arranged into a standardized deviation vector of pedestrian flow. Arrange all the noise normalization deviation values (in chronological order of sampling time) to form the noise normalization deviation vector. Standardized Deviation Vector of Pedestrian Flow and noise-normalized deviation vector The lengths are all .
[0045] It should be noted that a positive standardized deviation value indicates that the current measurement value is higher than the historical average value of the same period within the spatial grid; the larger the standardized deviation value, the greater the deviation of the current measurement value from the normal fluctuation range of the same period in history. By standardizing according to the spatial grid, weekday, and hourly time period, it is possible to avoid directly classifying normal peaks in functional areas such as waiting areas as abnormal.
[0046] It should also be noted that when the historical period standard deviation corresponding to a certain week and hour is 0, the corresponding historical period standard deviation is replaced with a preset minimum positive value before standardization is performed. This minimum positive value can be set according to the measurement resolution of the monitoring equipment and is only used to ensure the effectiveness of the standardization calculation.
[0047] 4) Based on the standardized deviation vector of pedestrian flow and noise-normalized deviation vector At each sampling time, it is determined whether the standardized deviation of pedestrian flow and the standardized deviation of noise simultaneously exceed a preset anomaly threshold. The proportion of simultaneous pedestrian-noise exceedance is obtained by taking the proportion of the number of sampling times that simultaneously exceed the preset anomaly threshold to the total number of sampling times in the current fixed time window. , is represented as: ; in, Representing spatial grid The ratio of simultaneous exceedance of pedestrian flow and noise within the current fixed time window, with a value range of [value missing]. ; This indicates an indicator function; it takes the value 1 if the condition within the parentheses is true, and 0 otherwise. This represents the logical AND operation; This represents the standardized deviation threshold, used to limit the minimum degree of abnormal deviation of the measured value relative to the normal level of the same period in history. It can be 2 to 3, for example, 2.5.
[0048] It should be noted that only when both the standardized deviation of pedestrian flow and the standardized deviation of noise at the same sampling time are greater than the abnormal standardization deviation threshold will the condition be considered. Only at that sampling moment will the number of simultaneous exceedances be counted, thereby suppressing single-channel abnormal responses caused by only an increase in pedestrian traffic or only an increase in the A-weighted sound pressure level of ambient noise.
[0049] In one embodiment, for example, the current fixed time window contains 60 sampling moments, of which 12 sampling moments simultaneously satisfy the condition that the pedestrian flow standardization deviation is greater than 2.5 and the noise standardization deviation is greater than 2.5. Therefore, the pedestrian-noise simultaneous exceedance ratio is considered acceptable. .
[0050] 5) Based on the combined changes in the standardized deviation of pedestrian flow and the standardized deviation of noise within the current fixed time window, calculate the standardized deviation vector of pedestrian flow. Deviation vector from noise standardization Pearson correlation coefficient between .
[0051] In the specific implementation, the mean values of the pedestrian flow standardized deviation vector and the noise standardized deviation vector are first calculated within the current fixed time window. Then, the degree of coordinated change of the corresponding elements of the two vectors relative to their respective means is calculated, and the scale is normalized using the fluctuation amplitudes of the two vectors, resulting in: ; in, Representing spatial grid The correlation coefficient between pedestrian flow and noise within the current fixed time window ranges from [value missing]. ; Represents the standardized deviation vector of pedestrian flow. The mean; Represents the noise normalization deviation vector The mean.
[0052] In one implementation, the absolute value of the correlation coefficient is taken. As the synchronous change intensity of pedestrian flow and A-weighted sound pressure level of environmental noise within a fixed time window. Absolute value of the correlation coefficient. The closer the correlation coefficient is to 1, the higher the degree of synchronization between the two monitoring channels; the absolute value of the correlation coefficient The closer it is to 0, the weaker the linear synchronization relationship between the two monitoring channels.
[0053] It should be noted that the absolute value of the correlation coefficient is used to describe the intensity of synchronous changes and is not used as the sole result for anomaly detection. This is determined by comparing the correlation coefficient with the proportion of simultaneous exceedances of pedestrian flow and noise levels. By combining these methods, a high coupling anomaly response can be ensured only when both monitoring channels exceed the normal level for the same period in history.
[0054] 6) The proportion of both pedestrian flow and noise exceeding the limit with the absolute value of the correlation coefficient Nonlinear fusion is performed to obtain a spatial grid. Coupling anomaly tendency index within the current fixed time window .
[0055] In the specific implementation, first calculate the absolute value of the correlation coefficient. implement The result is then calculated by exponentiation and compared with the ratio of simultaneous exceedance of pedestrian flow and noise. Multiplying, and finally compressing the result to a stable numerical range using the hyperbolic tangent function, i.e. .
[0056] in, This represents the coupling anomaly tendency index, with a value range of [value missing]. It is used to continuously characterize the tendency of abnormal crowd-noise coupling to occur within the current fixed time window; Represents the hyperbolic tangent function; This represents the exponential scaling factor, used to control the impact of the simultaneous exceedance ratio of pedestrian flow and noise and the intensity of synchronous change on the overall magnitude of the coupling anomaly tendency index. It can be set from 0.5 to 2, for example, 1. This represents the correlation intensity sharpening index, used to amplify the difference between high and low synchronous change intensities. It can be set to 1 to 3, for example, 2.
[0057] In one embodiment, as an example, when , , and When the hyperbolic tangent function is Coupling Abnormality Tendency Index Approximately 0.161. If Keep it at 0.2, while If the input to the hyperbolic tangent function decreases to 0.3, then the input to the hyperbolic tangent function decreases to... Coupling Abnormality Tendency Index The corresponding reduction.
[0058] It should be noted that when the simultaneous exceedance ratio of pedestrian flow and noise is low, the coupling anomaly tendency index remains low even if the absolute value of the correlation coefficient is high; when both the simultaneous exceedance ratio of pedestrian flow and noise and the absolute value of the correlation coefficient are high, the coupling anomaly tendency index increases accordingly. This coupling anomaly tendency index introduces both common exceedance conditions and synchronous change conditions, which can directly provide subsequent models with continuous prior information on whether the current fixed time window has a coupling anomaly tendency, and avoid high responses from single-channel anomalies or random fluctuations without synchronous relationships.
[0059] 7) Convert the original multivariate time series matrix Standardized Deviation Vector of Pedestrian Flow and noise-normalized deviation vector Concatenate along the feature dimension and couple the anomaly tendency index. Copy to length of The coupling anomaly tendency index column is further concatenated along the feature dimension to obtain the enhanced feature matrix. ,Right now .
[0060] in, Representing spatial grid The corresponding enhanced feature matrix has a size of ; Indicates length is A column vector of all 1s, used to couple the scalar form of the anomalous tendency index. Copy to feature columns consistent with the time dimension; square brackets indicate column concatenation along the feature dimension.
[0061] Furthermore, the enhanced feature matrix The first five feature channels retain the original measurement information, the sixth feature channel is the human flow standardized deviation value, the seventh feature channel is the noise standardized deviation value, and the eighth feature channel is the coupling anomaly tendency index.
[0062] It should be noted that the coupling anomaly tendency index This refers to the window-level features corresponding to the current fixed-time window. Copying the same coupling anomaly tendency index to all sampling moments within the current fixed-time window can enhance the feature matrix. Each sampling time point carries the same window-level coupled prior, without changing the relative changes of the original multivariate time series data at different sampling times.
[0063] In one embodiment, such as Figure 2 and Figure 3 As shown, the graph displays standardized deviation values and simultaneous exceedance indicators, comprising two sub-graphs, one above the other, showing the standardized deviation vector of pedestrian flow. Figure 2 ) and noise normalization deviation vector ( Figure 3 The curve shows the change along the sampling time. The horizontal axis represents the sampling time number in minutes; the vertical axis represents the standardized deviation value, which is dimensionless. Figure 2 and Figure 3 The red dashed line marks the standardized deviation threshold, and the red scatter dots highlight the sampling time when the standardized deviation of pedestrian flow and the standardized deviation of noise both exceed the threshold. There is a continuous set of points that exceed the threshold at the same time in the middle of the window.
[0064] S2.2 Spatial contrast deviation construction and functional area normal coupling mode prototype extraction Judging anomalies solely based on the temporal changes of a single spatial grid is insufficient to distinguish between overall population growth in medical facilities and localized abnormal events. When medical facilities enter their peak patient season, population flow and A-weighted sound pressure levels in most adjacent spatial grids may increase synchronously; during localized congestion or sudden events, anomalies are typically concentrated in a few spatial grids and significantly higher than surrounding grids. This invention calculates the deviation of the current spatial grid from its first-order spatial neighborhood to enhance the separability between localized anomalies and regional co-changes; simultaneously, it divides functional zones based on the long-term statistical patterns of each spatial grid and extracts the population-noise lag coupling pattern and temporal attention patterns of each functional zone under normal conditions, such as... Figure 4 As shown, the specific steps are as follows: 1) Determine the spatial grid based on the spatial layout of the medical facility and the adjacency relationships between the spatial grids. First-order spatial neighborhood set First-order spatial neighborhood set This refers to spatial grids A collection of spatial grids that are directly adjacent in physical space.
[0065] When using regular grid partitioning, it can be compared with spatial grids. Spatial grids sharing edges or vertices are defined as adjacent spatial grids, i.e., a first-order spatial neighborhood set is constructed using the eight-neighbor method. For spatial grids separated by walls, closed doors, or inaccessible areas, the corresponding adjacency relationships can be canceled based on the actual spatial connectivity. Spatial grids located at the boundaries of medical facilities retain only the actually existing adjacent spatial grids.
[0066] In one embodiment, for example, the medical facility follows The space is divided into regular spatial grids, with internal spatial grids having a maximum of 8 adjacent spatial grids, and boundary spatial grids or spatial grids constrained by building structures having fewer than 8 adjacent spatial grids. Furthermore, Represents the set of first-order spatial neighborhoods The number of adjacent spatial grids included.
[0067] 2) Calculate the spatial grid separately and the first-order spatial neighborhood set The average standardized deviation of pedestrian flow in each adjacent spatial grid within the current fixed time window, and the spatial grid Average standardized deviation of pedestrian traffic minus the first-order spatial neighborhood set The average standardized deviation of pedestrian flow is used to obtain the spatial comparison deviation of pedestrian flow. , is represented as: ; in, Representing spatial grid Spatial deviation of pedestrian flow within the current fixed time window; Represents the set of first-order spatial neighborhoods Adjacent spatial grids in; Representing adjacent spatial grids In the Standardized deviation of pedestrian flow at each sampling time.
[0068] It should be noted that the deviation in the comparison of pedestrian flow space A value significantly greater than 0 indicates a spatial grid. The abnormal level of pedestrian traffic is higher than that of the surrounding spatial grid, and the current change is more likely to be a local anomaly; spatial deviation of pedestrian traffic. When it is close to 0, it indicates a spatial grid. With similar levels of pedestrian flow changes to surrounding spatial grids, the current changes are more likely to be a common regional phenomenon; spatial deviation in pedestrian flow. When less than 0, it indicates a spatial grid. The degree of change in pedestrian traffic is lower than that of the surrounding spatial grid.
[0069] 3) The spatial grid is calculated using the same processing method as the spatial deviation comparison of pedestrian flow. Noise spatial contrast deviation within the current fixed time window , is represented as: ; in, Representing spatial grid Noise spatial contrast deviation within the current fixed time window; Representing adjacent spatial grids In the The noise standardization deviation at each sampling time.
[0070] It should be noted that the spatial contrast deviation of the noise Used to characterize spatial grids The degree of anomalous environmental noise A-weighted sound pressure level relative to the surrounding spatial grid. When the spatial contrast deviation of pedestrian traffic... Deviation from noise space When the value is significantly positive, it indicates that the combined increase in pedestrian flow and A-weighted sound pressure level of environmental noise is concentrated near the current spatial grid, which can provide a spatial discrimination basis for identifying local pedestrian-noise coupling anomalies.
[0071] It should also be noted that for independent spatial grids without adjacent spatial grids, the spatial deviation of pedestrian flow can be compared. Deviation from noise space Setting it to 0 indicates that spatial neighborhood comparison information is not introduced.
[0072] 4) Compare the spatial deviation of pedestrian flow. Deviation from noise space Copy each to a length of The feature columns, and the enhanced feature matrix Concatenating along the feature dimensions yields the augmented and enhanced feature matrix. ,Right now .in, Representing spatial grid The corresponding augmented feature matrix has a size of ; Indicates length is A column vector of all 1s, used to represent the spatial deviation in scalar form. and Copy as time dimension Consistent feature columns are used to splice along the feature dimensions.
[0073] It should be noted that the expanded and enhanced feature matrix In enhancing the feature matrix Based on the existing 8 feature channels, one additional feature channel for spatial contrast deviation of pedestrian flow and one for spatial contrast deviation of noise are added. Both the spatial contrast deviation of pedestrian flow and the spatial contrast deviation of noise are window-level scalars corresponding to the current fixed time window. By copying them to all sampling times, the subsequent model can perceive the overall deviation level of the current spatial grid relative to the surrounding spatial grid when processing any sampling time.
[0074] 5) Construct grid function statistical feature vectors based on the long-term historical statistical characteristics of all spatial grids, and use the K-means algorithm to perform functional clustering on all spatial grids to obtain the function label of each spatial grid. .
[0075] The grid function statistical feature vector consists of the average pedestrian flow, average A-weighted sound pressure level of environmental noise, average temperature, average relative humidity, average PM2.5 concentration, variance of each monitoring channel, and correlation coefficient between pedestrian flow and A-weighted sound pressure level of environmental noise in the long-term historical monitoring data of the current spatial grid. In addition, each statistical feature is subjected to uniform numerical normalization before clustering to avoid unreasonable impact of different dimensions and different numerical ranges on the clustering distance.
[0076] In the specific implementation, the grid function statistical feature vector corresponding to each spatial grid is used as one clustering sample, and the number of functional clusters is set to [value missing]. The K-means algorithm is used to iteratively update the cluster centers, and the spatial grid is divided into the nearest clusters based on the distance between the feature vectors of the grid and each cluster center. After clustering, the spatial grid... The cluster number is used as the function label. Functional tags The range of values is to This is used to distinguish normal pedestrian-noise coupling patterns in different functional areas and is not used as anomaly labels. For example, the number of functional clusters. The clustering results correspond to the registration and payment area, waiting area, consultation room corridor, rest area, and pharmacy, respectively.
[0077] It should be noted that the K-means algorithm is only used to obtain functional groups based on long-term statistical patterns and is not used for anomaly detection within a single fixed time window. When the spatial functional layout of medical facilities remains unchanged, the established functional labels can be reused.
[0078] 6) For each functional partition The collection function is tagged as Furthermore, the historical normal fixed time window with a true anomaly label of 0 is used, and the lag correlation values of the standardized deviation vector of pedestrian flow and the standardized deviation vector of noise under different lag orders are calculated for each historical normal fixed time window to obtain the corresponding lag cross-correlation vector.
[0079] Among them, functional partition numbering The range of values is to The maximum lag order is denoted as... The lag order is denoted as ,in, For each lag order The pedestrian flow standardized deviation vector and the noise standardized deviation vector are time-aligned according to the lag order, and the correlation value is calculated using only the sampling times that exist simultaneously after alignment.
[0080] In practical implementation, the calculation method for the lagged cross-correlation vector of each historical normal fixed time window is as follows: Let the standardized deviation vector of the pedestrian flow within this window be... The noise standardization deviation vector is The lengths are all For each lag order ( from arrive Perform the following operations: Take the first step of the traffic flow sequence To the At the nth sampling time, take the nth sampling time of the noise sequence To the Each sampling time point is equivalent to shifting the noise sequence relative to the pedestrian flow sequence. At each sampling time point, the Pearson correlation coefficient of the two aligned sequences is calculated as the lag order. The lagged correlation values at each lag order are then calculated; then, the lagged correlation values at all lag orders are sorted according to... Arranged in ascending order, these form the lagged cross-correlation vector corresponding to the historical normal fixed time window, with a length of [length missing]. .
[0081] It should be noted that positive hysteresis indicates a delayed change in the A-weighted sound pressure level of ambient noise relative to the flow of people, negative hysteresis indicates an earlier change in the A-weighted sound pressure level of ambient noise relative to the flow of people, and zero-order hysteresis indicates synchronous changes in the flow of people and the A-weighted sound pressure level of ambient noise at the same sampling time. All historical normal fixed time windows use a consistent definition of hysteresis direction.
[0082] In one embodiment, for example, the sampling interval is 1 minute, and the maximum hysteresis order is... The lag analysis covers the variation of A-weighted sound pressure level of environmental noise relative to pedestrian flow from 10 minutes before to 10 minutes after the change. The length of the lag cross-correlation vector corresponding to each historical normal fixed time window is... .
[0083] 7) For functional partitions The functional partitions are obtained by averaging the lagged cross-correlation vectors corresponding to all historical normal fixed time windows element by element according to the same lag order. Normal coupling mode prototype .
[0084] Specifically, functional zones are set up. Include The first historical normal fixed time window, the The lagged cross-correlation vector corresponding to each historical normal fixed-time window is denoted as . ,in, .
[0085] In practical implementation, the normal coupling mode prototype according to The calculation method is as follows. Among them, Indicates functional partition The normal coupling mode prototype, with a length of ; Indicates functional partition Inner The lagged cross-correlation vector corresponding to a historical normal fixed time window.
[0086] It should be noted that the normal coupling mode prototype Each element corresponds to an average correlation value at a given lag order, used to characterize the functional partition. Under normal conditions, there is a typical advance, synchronization, or delay relationship between changes in pedestrian traffic and changes in A-weighted sound pressure level of ambient noise.
[0087] In one embodiment, for example, the waiting area may exhibit a synchronous increase in the A-weighted sound pressure level of ambient noise within a short period of time after an increase in the number of people, while the consultation room corridor may exhibit a certain lag in the A-weighted sound pressure level of ambient noise relative to the number of people. Establishing normal coupling mode prototypes for different functional zones can avoid the loss of normal functional differences caused by using a uniform coupling mode to describe all functional areas.
[0088] Furthermore, the normal coupling mode prototypes corresponding to all functional partitions constitute a normal coupling mode prototype library. During the model training and online detection phases, prior knowledge of the functional partition to which any spatial grid belongs is provided to generate attention query vectors, which guide the model to focus on temporal positions related to normal coupling patterns.
[0089] 8) For functional partitions For each historical normal fixed time window, a local coupling feature vector is constructed based on the standardized deviation of pedestrian flow and the standardized deviation of noise near each sampling time. The local coupling feature vector and the normal coupling pattern prototype are then calculated. The similarity between them is used to obtain the normal coupling matching score corresponding to each sampling time.
[0090] In one implementation, for the first [time period] within a historical normal fixed time window Each sampling time, according to the lag order , will the The standardized deviation of pedestrian flow at the sampling time and the first sampling time The noise normalization deviations at each sampling time are paired, and their product is calculated to form a locally coupled feature vector. The locally coupled feature vector is then processed at different lag orders. The element at the location is denoted as , is represented as: ; in, Indicates the first Within a historically normal fixed time window, the first Each sampling time at the lag order Local coupling eigenvalues under; This indicates the corresponding historical normal fixed time window in the [number]th [year]. Standardized deviation of pedestrian flow at each sampling time; This indicates the corresponding historical normal fixed time window in the [number]th [year]. The noise standardization deviation at each sampling time.
[0091] In this implementation, when When the data exceeds the effective sampling range of the current fixed time window, data is not supplemented from other fixed time windows; instead, this lagging position is ignored during similarity calculation. A local coupling feature vector is formed by the local coupling feature values corresponding to all effective lagging positions at the current sampling time. Locally coupled feature vectors Characterization in the Within a historically normal fixed time window, taking the first... Based on the pedestrian flow at each sampling time, the local instantaneous coupling structure of the A-weighted sound pressure level of the surrounding environmental noise at different hysteresis orders is analyzed.
[0092] Furthermore, in the locally coupled feature vector Prototype of normal coupling mode Calculate the cosine similarity at the common effective lag positions to obtain the first... The normal coupling matching score at each sampling time. A higher normal coupling matching score indicates that the pedestrian-noise hysteresis coupling structure near the current sampling time is closer to the functional zone. The normal coupling mode.
[0093] Furthermore, the normal coupling matching scores for all sampling moments within the same historical normal fixed time window are softmax normalized along the time dimension to obtain the normal attention distribution corresponding to that historical normal fixed time window. The length of the normal attention distribution is... All elements are positive and the sum of the elements is 1.
[0094] Furthermore, functional zoning The normal attention distribution of all historical normal fixed time windows is averaged element by element at the same sampling time, and the average result is normalized again (that is, each element of the average vector is divided by the sum of all elements of the vector to obtain the final normal attention target distribution). The sum of all elements is 1, thus obtaining the functional partition. Normal attention target distribution .
[0095] Among them, the distribution of normal attentional targets The length is , its first The elements are denoted as , Indicates functional partition Under normal conditions, the first The average target attention weight at each sampling time. The normal attention target distributions corresponding to all functional zones constitute the normal attention target distribution set. This characterizes the distribution of typical importance of different sampling times within a fixed time window for describing the pedestrian-noise coupling pattern of each functional area under normal conditions.
[0096] In one embodiment, for example, the normal distribution of attentional targets for the functional area of "waiting area" length This distribution may occur between 10 and 30 minutes after the doctor begins seeing patients (i.e., to ) corresponding element A higher value indicates that, under normal conditions, the crowd-noise coupling characteristics during this period are most critical for describing the normal pattern of the "waiting area"; while the normal distribution of attentional targets in the "rest area" may be relatively uniform throughout the time window.
[0097] It should be noted that the normal attention target distribution is only used to constrain the temporal attention results of normal samples during the training phase, and does not directly participate in the attention constraint of abnormal samples. This allows the temporal attention pattern of normal samples to be consistent with the historical normal coupling rhythm of the corresponding functional partition, while allowing the attention weight of abnormal samples to be concentrated at the actual sampling time when the abnormality occurs.
[0098] It should also be noted that the above processing expands and enhances the feature matrix. Provides raw measurement information, period deviation information, coupling anomaly tendency information, and spatial comparison information for the current fixed time window; function labels Provides functional semantics corresponding to spatial grids; normal coupling mode prototype library. Provides normal pedestrian flow-noise lag relationships for different functional zones; sets of normal attention target distributions. Provides the time-related patterns of different functional partitions under normal conditions.
[0099] In one embodiment, such as Figure 5 The diagram shows the prototype diagrams of the normal coupling modes for different functional areas, comparing the prototype diagrams of the waiting area and the rest area. The horizontal axis represents the lag order in minutes; negative values indicate that the A-weighted sound pressure level of environmental noise precedes the change in pedestrian flow, while positive values indicate that the A-weighted sound pressure level of environmental noise lags behind the change in pedestrian flow. The vertical axis represents the average correlation coefficient, which is dimensionless. The prototype of the waiting area shows a significant peak near zero lag, reflecting that pedestrian flow and noise change almost synchronously; the prototype of the rest area shows a slight increase in the positive lag direction, indicating a slight delay in noise change.
[0100] In one embodiment, such as Figure 6 As shown, the plot displays the joint probability density map of pedestrian-noise standardized deviation values. A contour-colored map is used to illustrate the two-dimensional joint probability density distribution of pedestrian and noise standardized deviation values across a large number of sampling times. Brighter areas indicate denser data points, and the overall distribution shows a positive correlation. The horizontal axis represents pedestrian standardized deviation values (dimensionless), the vertical axis represents noise standardized deviation values (dimensionless), and the color represents frequency (dimensionless count).
[0101] In a specific implementation, the training of the spatiotemporal anomaly detection model guided by functional modulation and coupling prototype in step S3 is as follows: Different functional zones exhibit variations in the strength of the pedestrian-noise coupling and their sensitivity to anomalies. Using the exact same temporal convolutional response range across all spatial grids makes it difficult to accommodate the normal behavioral differences between functional zones such as waiting areas, consultation room corridors, and rest areas. Furthermore, simply linearly superimposing pedestrian flow and noise features makes it difficult to directly extract their common changes at the same sampling time; using indiscriminate global pooling easily overlooks the fact that different functional zones have different temporal attention patterns under normal conditions. This invention constructs an interaction-enhanced temporal convolutional encoder, utilizing functional label embedding to perform channel-wise scaling and offsetting of each layer's convolutional features, and extracting instantaneous coupling features through element-wise multiplication of pedestrian flow semantic features and noise semantic features; further, it generates attention queries using normal coupling pattern prototypes and constrains the attention results of normal samples using normal attention target distributions. The specific steps are as follows: S3.1 Interaction-enhanced temporal convolutional encoder Interaction-enhanced temporal convolutional encoders consist of sequentially stacked... Each residual block consists of a dilated causal convolution branch, an interactive convolution branch, a functional modulation process, and residual connections. The dilated causal convolution branch extracts temporal variation patterns at different time scales; the interactive convolution branch extracts the instantaneous multiplicative coupling relationship between flow semantic features and noise semantic features; and the functional modulation process adjusts the response intensity of different feature channels according to the functional partition of the spatial grid. Figure 7 As shown, the specific steps are as follows: 1) Spatial grid The corresponding augmented feature matrix As input to the interaction-enhanced temporal convolutional encoder, and defining the initial input features of the encoder. ,Right now , refers to spatial grid The corresponding encoder initial input feature has a size of The temporal dimension of the encoder's initial input features corresponds to the current fixed time window. At each sampling time, the feature dimensions correspond to the original measurement value, standardized deviation value, coupling anomaly tendency index, and spatial contrast deviation.
[0102] 2) Based on the spatial grid Functional tags Read the corresponding function label embedding vector from the trainable function embedding matrix. Functional label embedding vector This refers to the dense vector formed by mapping discrete function labels to a continuous feature space, with a dimension of . ; The dimension of the feature embedding vector can be 8, 16, or 32, for example, 16. It should be noted that the feature embedding matrix is updated synchronously with other trainable parameters during model training.
[0103] In practice, spatial grids belonging to the same functional partition read the same functional label embedding vector, while spatial grids belonging to different functional partitions read different functional label embedding vectors. Through the functional label embedding vectors, the subsequent network can adjust the response range of each feature channel according to the functional semantics of the spatial grid.
[0104] In one embodiment, for example, if a spatial grid and If they both belong to the "waiting area" (functional label 2), then the functional label embedding vectors they read are... Same; if spatial grid If it belongs to "Rest Area" (functional label 4), then it reads the functional label embedding vector. The difference lies in the vector. The network can assign a set of scaling and offset parameters to the feature channels of the "waiting area," making it more tolerant of large fluctuations in noise and traffic, while assigning a different set of parameters to the "rest area," making it more sensitive to small fluctuations.
[0105] 3) in the In the residual block of layer, the first Layer output features Enter the first Layer dilated causal convolution, to obtain the first Layer principal time series characteristics .in, Represents the residual block level index. ; The size is ; Indicates the first The number of feature channels in the layer output features; Indicates the first The main temporal features output by the layer dilated causal convolution branch have a size of ; Indicates the first The number of output feature channels of the layer residual block.
[0106] In one implementation, the first The layer dilated causal convolution uses a one-dimensional convolution kernel of length 3, and reads input features at temporal intervals according to the corresponding dilation rate. Causal convolution calculates the... When using the output of the sampling time step, only the first sampling time step is used. The sampling time and the first Data from before a sampling time step is used, while data from subsequent sampling time steps are not used, thus maintaining the temporal causality required for online anomaly detection. The convolution operation employs left-side causal padding matched to the dilation rate, ensuring that the time length before and after convolution remains constant. .
[0107] In this implementation, the interaction-enhanced temporal convolutional encoder includes The residual block has layers 1 through 4 with dilation rates of 1, 2, 4, and 8 respectively, and the number of output feature channels is as follows: , , and As the expansion rate increases layer by layer, subsequent residual blocks can extract the variation patterns of pedestrian traffic and A-weighted sound pressure levels of environmental noise over a longer time range without significantly increasing the network depth.
[0108] 4) Based on the first Layer output features , respectively through the first Layer flow semantic projection and the first Layer noise semantic projection yields flow semantic features. and noise semantic features .
[0109] In one implementation, the first Layer flow semantic projection and the first Both layer noise semantic projections are implemented using one-dimensional convolutions of length 1. These one-dimensional convolutions perform linear combination only along the feature channel directions, without changing the time duration. Furthermore, the number of output feature channels for both semantic projections is set to... Thus, the semantic features of traffic and noise semantic features All dimensions are .
[0110] Among them, flow semantic projection is used to extract from the first... The layer output features are used to extract feature combinations related to pedestrian flow, pedestrian flow standardized deviation, pedestrian flow spatial contrast deviation, and related high-rise response; noise semantic projection is used to extract feature combinations related to environmental noise A-weighted sound pressure level, noise standardized deviation, noise spatial contrast deviation, and related high-rise response.
[0111] It should be noted that using trainable semantic projection instead of fixed division of high-level feature channels can ensure that traffic semantic features and noise semantic features have the same size, while allowing the model to continuously learn feature combinations corresponding to traffic semantics and noise semantics during multi-layer encoding.
[0112] 5) Semantic features of traffic and noise semantic features Perform element-wise multiplication to obtain the first... Layer instantaneous coupling characteristics; then the first Layer instantaneous coupling feature input first Layer-by-layer interactive convolution, to obtain the th Layer interaction flow coupling characteristics .
[0113] In practice, element-wise multiplication is performed at the same sampling time and the same feature channel position. When both the traffic flow semantic feature and the noise semantic feature have a large response at the same position, the absolute value of the corresponding product increases; when only one semantic feature has a large response or both semantic features have weak responses, the corresponding product is smaller. Through element-wise multiplication, the multiplicative interactive information formed by the co-change of traffic flow semantics and noise semantics at the same sampling time can be directly enhanced.
[0114] In one implementation, the first Inter-layer convolution uses a one-dimensional convolutional kernel of length 3, aggregating the first convolutional layer within adjacent sampling time ranges. Layer instantaneous coupling characteristics. The number of output feature channels of the layer interactive convolution is set to And by filling and maintaining the time as , making the first Layer interaction flow coupling characteristics With the Layer principal time series characteristics Having the same size .
[0115] It should be noted that the first Layer-interactive convolutional branches do not replace the first Layer dilated causal convolution branch. Layer dilated causal convolution branches are used to extract the overall temporal variation patterns. Interactive convolutional branches are used to supplement the multiplicative interactive information between pedestrian flow semantics and noise semantics.
[0116] 6) The first Layer principal time series characteristics With the Layer interaction flow coupling characteristics Fusion was performed based on the same sampling time and the same feature channels, and the interaction flow intensity coefficient was used. Adjustment The contribution of the layer interactive flow coupling characteristics is obtained. Layer fusion temporal characteristics.
[0117] Among them, the interactive flow intensity coefficient To balance information on regular time variations and pedestrian-noise interaction, a value between 0.1 and 1 can be used, for example, 0.5. When the interaction flow intensity coefficient... As the coefficient increases, the model's response to synchronous changes in flow semantic features and noise semantic features improves; when the interaction flow intensity coefficient increases... When reduced, the model relies more on the first... The main temporal features extracted by the layer dilated causal convolution branch.
[0118] 7) Embed function labels into vectors Enter the number respectively Layer scaling modulation network and the first Layer offset modulation network, to obtain the first Layer scaling factor vector and the Layer offset vector .
[0119] Among them, the Layer scaling factor vector and the first The dimension of the layer offset vector is 1. , respectively with the Layer output Each feature channel corresponds one-to-one; the first Layer scaling modulation network and the first All layer offset modulation networks can be implemented using a 2-layer fully connected network, with the intermediate layer using the ReLU activation function.
[0120] In the specific implementation, the dimension is The Layer scaling factor vector and the first The layer offset vector is copied along the time dimension to form a layer with size [missing information]. The modulation parameter matrix enables the modulation parameters corresponding to the same functional partition to be applied to all sampling moments within the current fixed time window, while allowing different feature channels to use different scaling amplitudes and offsets.
[0121] It should be noted that the first The layer scaling factor vector is used to adjust the response intensity of different functional partitions on each feature channel. Layer offset vectors are used to adjust the response baseline of different functional areas on each feature channel. For example, the waiting area has a relatively high tolerance range for continuous increases in both pedestrian flow and noise, while the rest area is more sensitive to the same changes. By generating modulation parameters through functional label embedding vectors, shared temporal convolution parameters can be used to form different feature response ranges in different functional areas.
[0122] 8) Use the first Layer scaling factor vector and the first Layer offset vector pair Layer fusion timing features are modulated channel by channel, and the modulated branch output is then compared with the first... The residuals of the layer output features after channel alignment are summed to obtain the result of the first layer. Output characteristics of layer residual blocks .
[0123] In specific implementation, the first The calculation process for the layer residual block is expressed as follows: ; ; in, Indicates the first The branch output of the layer after functional modulation has a size of ; Indicates the first Layer output features, size is ; Indicates the first Layer dilated causal convolution; Indicates the first Inter-layer convolution; Represents element-wise product; Indicates the first Channel alignment operation in layer residual connections.
[0124] In one implementation, when Channel alignment operation Using identity mapping, the first... Layer output features; when At that time, a one-dimensional convolution of length 1 is used to convert the first... The number of feature channels of the layer output features is converted to Then, the residuals are added together. The channel alignment operation is only used to ensure that the dimensions on both sides of the residual connection are consistent, and does not change the time length.
[0125] It should be noted that the first Layer scaling factor vector and the first Layer offset vector with size The When performing calculations on the temporal features of the layer fusion, broadcasting is carried out along the time dimension so that the same functional modulation parameters are used at each sampling time.
[0126] 9) Execute layers 1 through 1 in sequence according to the residual block layer index. The processing of the layer residual blocks yields the final layer output features of the encoder. The encoder's final layer output features This refers to expanding and enhancing the feature matrix. The high-level temporal feature formed after encoding all residual blocks has a size of [size missing]. ,in, This indicates the number of output feature channels in the last residual block.
[0127] It should be noted that the encoder's final layer output features The time dimension of the current fixed time window is retained, and a high-level feature vector is formed at each sampling time, which integrates period deviation information, spatial comparison information, human flow-noise interaction information and functional semantic information.
[0128] It should also be noted that, by dilated causal convolution, the temporal receptive field can be expanded layer by layer while maintaining temporal causality; by element-wise multiplication of flow semantic features and noise semantic features, the synchronous interaction of two physical quantities can be directly highlighted; by functional modulation, different functional partitions can share the main encoder parameters while having different feature channel response ranges; and by residual connection, the features of the previous layer can be preserved and the training stability of multi-layer encoders can be improved.
[0129] S3.2, Training Aligned with Attention Pooling and Normal Coupling Patterns encoder final layer output features It contains high-level features of each sampling moment within the current fixed time window, but the importance of different sampling moments for anomaly detection varies. Average pooling can easily dilute short-duration but significantly impactful anomalous sampling moments with a large number of normal sampling moments, while max pooling is susceptible to the influence of single random noise peaks. This invention maps the normal coupling pattern prototype of the functional partition to which the spatial grid belongs to an attention query, enabling attention pooling to simultaneously combine current temporal features and the normal coupling structure of the corresponding functional partition; simultaneously, it applies normal attention target distribution constraints only to normal samples, ensuring that the attention results for normal samples conform to historical normal rhythms, without forcing anomalous samples to align with normal rhythms, such as... Figure 8 As shown, the specific steps are as follows: 1) For the first in the training batch The training sample, based on the first training sample Each training sample corresponds to a spatial grid. Functional tags Read the normal coupling mode prototype from the normal coupling mode prototype library .
[0130] Furthermore, the normal coupling mode prototype Input a trainable query mapping matrix , obtained the Attention query vectors of training samples ,Right now .
[0131] in, Indicates the first The attention query vector for each training sample, with dimension [ ]. ; Represents a trainable query mapping matrix with size . This is used to map the normal coupling mode prototype to a feature space consistent with the output features of the encoder's final layer. Indicates the first A prototype of the normal coupling mode of the functional partition to which each training sample belongs.
[0132] In one embodiment, for example, the maximum hysteresis order The normal coupling mode prototype has a length of 21, and the encoder's final layer output features have a feature channel count of 21. Then query the mapping matrix The 21-dimensional normal coupling pattern prototype is mapped to a 128-dimensional attention query vector.
[0133] 2) The first The encoder's final layer output features for the training samples are in the th... Feature vector at each sampling time Input a trainable key mapping matrix , obtained the The key vector corresponding to each sampling time ,Right now .
[0134] in, Indicates the first The training sample at the th ... The final layer feature vector of the encoder at each sampling time, with dimension [ ]. ; Represents a trainable key mapping matrix with size . ; Indicates the first The training sample at the th ... The key vector at each sampling time point has a dimension of .
[0135] It should be noted that the key mapping matrix This is used to convert the final layer features of the encoder at each sampling time into feature representations that can be matched with the attention query vector; the attention query vector provides normal coupling priors at the functional partition level, and the key vector provides the actual high-level features of the current fixed time window at the corresponding sampling time.
[0136] 3) Attention-based query vector and the key vector at each sampling time Calculate the scaled dot product attention score and perform Softmax normalization over time to obtain the attention weights. , is represented as: ; in, Indicates the first The training sample at the th ... The attention weights at each sampling time are given, and the attention weights at all sampling times are positive, and satisfy the following conditions: ; This represents the sampling time index during the Softmax normalization process; This represents the scaling factor, used to avoid excessively large absolute values of the dot product results when the feature dimensions are large.
[0137] It should be noted that, due to the attention query vector By the The normal coupling pattern prototype of the functional partition to which each training sample belongs is generated. Therefore, the attention weight depends not only on the encoder final layer features at the current sampling time, but also on the matching relationship between the encoder final layer features at the current sampling time and the normal coupling pattern of the corresponding functional partition.
[0138] 4) Use attention weights for the first The encoder's final layer output features from the training samples are weighted and summed along the time dimension to obtain the... Window representation vector of each training sample ,Right now .
[0139] in, Indicates the first A window representation vector of training samples, with dimension . The sampling time with higher attention weights affects the window representation vector. The sampling time with a higher attention weight contributes more to the window representation vector. Its contribution was relatively small.
[0140] It should be noted that attention-weighted pooling can highlight the sampling moments that are more valuable for judging the anomalies of the crowd-noise coupling while maintaining a fixed output dimension. This avoids the dilution of short-term anomaly responses by average pooling and reduces the risk that a single random peak will directly determine the classification result.
[0141] 5) Represent the window vector Input a linear classification layer and obtain the first... Anomaly probability of each training sample ,Right now .
[0142] in, The model will represent the first The probability of predicting a human flow-noise coupling anomaly for each training sample, with values ranging from [value range missing]. ; This represents the trainable classification projection weight vector of the linear classification layer, with dimension . ; This represents the trainable classification bias of a linear classification layer; This represents the Sigmoid function.
[0143] It should be noted that the probability of anomalies... The closer it is to 1, the better. The more training samples correspond to a fixed time window, the more likely there is an anomaly in the coupling of pedestrian flow and noise; the anomaly probability The closer it is to 0, the more likely it is to be in a normal state within the corresponding fixed time window.
[0144] 6) Based on the first The true anomaly labels of each training sample and abnormal probability Calculate the binary cross-entropy classification loss. True anomaly labels. The value can be 0 or 1, where, This indicates a normal sample. This indicates an abnormal sample.
[0145] It should be noted that the binary cross-entropy classification loss penalizes the deviation between the true abnormal label and the abnormal probability, thereby reducing the abnormal probability of normal samples and increasing the abnormal probability of abnormal samples, thus establishing a mapping relationship between the window representation vector and the abnormal category of the crowd-noise coupling.
[0146] 7) For normal samples with a true abnormal label of 0 in the training batch, read the normal attention target distribution from the normal attention target distribution set according to the functional label of the corresponding spatial grid, and calculate the KL divergence between the attention distribution generated by the model and the normal attention target distribution.
[0147] Specifically, the first The distribution of normal attention targets in the functional regions to which the training samples belong is in the th... The target weight at each sampling time is denoted as... The normal attention target distribution is derived from S202. In practical implementation, only when Attention weights are calculated. Weights of normal attention targets KL divergence between; when When training a model, the attention KL divergence of the training sample is not calculated. For example, a normal sample belongs to the "pharmacy" functional area, and its normal attention target distribution indicates that the weights are higher in the early part of the window (such as during peak dispensing periods). During model training, the attention weights of this sample are... If the KL divergence loss term is concentrated in the early part, it will be relatively small; if it is abnormally concentrated in the later part, this loss term will increase, thus penalizing the model and causing it to revert to a normal pattern.
[0148] It should be noted that by calculating the attention regularization loss only for normal samples, the attention distribution of normal samples can be made to conform to the historical normal time attention pattern of the corresponding functional area. At the same time, the attention distribution of abnormal samples is allowed to deviate from the normal time rhythm according to the actual location of the abnormality, thus avoiding forcibly adjusting abnormal samples to the normal attention pattern.
[0149] 8) Weight the binary cross-entropy classification loss of all training samples with the attention KL divergence of normal samples to obtain the total loss function. , is represented as: ; in, Represents the total loss function; This indicates the total number of training samples in the current training batch; This indicates the number of normal samples in the current training batch whose true outlier label is 0. This represents the attention regularization strength coefficient, used to control the impact of normal attention target distribution constraints on model training. It can be set from 0.01 to 1, for example, 0.1.
[0150] When organizing training batches, ensure that each training batch contains at least one normal sample to guarantee... Greater than 0. When the model attention distribution of normal samples is close to the normal attention target distribution of the corresponding functional partition, the attention KL divergence decreases; when the model attention distribution of normal samples deviates significantly from the normal attention target distribution of the corresponding functional partition, the attention KL divergence increases.
[0151] It should be noted that the first term of the total loss function is the binary cross-entropy classification loss, which is used to improve the classification ability between normal samples and abnormal samples; the second term of the total loss function is the normal sample attention regularization loss, which is used to make the model attention distribution of normal samples consistent with the normal attention target distribution of the corresponding functional partition.
[0152] It should also be noted that the normal attention target distribution constraint does not apply to anomalous samples with a true anomaly label of 1. Anomalous samples still participate in model training through binary cross-entropy classification loss, and their attention weights are allowed to be concentrated on sampling times that deviate from the normal coupling pattern, thus maintaining consistency with the design objective of improving anomaly separability by utilizing the normal coupling pattern.
[0153] 9) Using the total loss function To optimize the objective, the interaction-enhanced temporal convolutional encoder and attention pooling structure are trained end-to-end, updating all trainable parameters until the preset training termination condition is met.
[0154] After training, the model parameters, functional labels of each spatial grid, normal coupling mode prototype library, weekday-hour dual-period baseline statistical results, and parameters required to construct the extended and enhanced feature matrix are saved to form the trained pedestrian-noise coupling anomaly detection model.
[0155] It should be noted that this invention generates channel-wise modulation parameters by embedding functional labels, enabling different functional zones to share the main temporal convolutional structure while retaining their respective normal response ranges; it enhances the common variation information of pedestrian flow and environmental noise A-weighted sound pressure level at the same sampling time by element-wise multiplication of traffic semantic features and noise semantic features; it generates attention queries through normal coupling mode prototypes, so that attention weights are simultaneously affected by the current temporal features and the normal coupling structure of functional zones; and by constraining only the attention distribution of normal samples, it can retain the attention shift capability of abnormal samples while stabilizing the attention patterns of normal time.
[0156] It should also be noted that the specific structure of the interaction-enhanced temporal convolutional encoder is shown in Table 1. Table 1. Structure of the Interaction-Enhanced Temporal Convolutional Encoder It should also be noted that the specific structure of the functional prototype-guided attention pooling and classifier is shown in Table 2. Table 2. Structure of Functional Prototype-Guided Attention Pooling and Classifiers In a specific implementation, step S4, online detection of abnormal human-noise coupling in medical facilities, is as follows: The trained pedestrian-noise coupling anomaly detection model was deployed to the medical site monitoring system. Following the same spatial grid division method, monitoring channels, sampling intervals, and fixed time window length as in the training phase, pedestrian flow, A-weighted sound pressure level of ambient noise, temperature, relative humidity, and PM2.5 concentration were continuously collected from each spatial grid.
[0157] For any spatial grid to be detected, the current fixed time window is extracted from the online multivariate monitoring data stream to form the original multivariate time series matrix; the week-hour dual-period baseline of the corresponding spatial grid is called to calculate the standardized deviation vector of pedestrian flow and the standardized deviation vector of noise; the proportion of simultaneous exceedance of pedestrian flow and noise, the absolute value of correlation coefficient, the coupling anomaly tendency index, the spatial contrast deviation of pedestrian flow and the spatial contrast deviation of noise are further calculated to obtain the extended and enhanced feature matrix corresponding to the current fixed time window.
[0158] Furthermore, based on the functional labels of the spatial grid to be detected, the corresponding normal coupling pattern prototypes are read from the normal coupling pattern prototype library. The augmented feature matrix, functional labels, and normal coupling pattern prototypes are input into the trained pedestrian-noise coupling anomaly detection model, which is then sequentially passed through an interaction-enhanced temporal convolutional encoder, attention pooling, and a linear classification layer to obtain the anomaly probability corresponding to the current fixed time window.
[0159] Furthermore, the anomaly probability is compared with a preset anomaly detection threshold. If the anomaly probability is not less than the preset anomaly detection threshold, the detection result indicating an anomaly in the current spatial grid's pedestrian-noise coupling is output, and the corresponding spatial grid number, the start and end times of the fixed time window, and the anomaly probability are sent to the medical facility management terminal. If the anomaly probability is less than the preset anomaly detection threshold, the detection result indicating that the current spatial grid is in a normal state is output. The preset anomaly detection threshold can be determined based on the detection accuracy, recall, or F1 score on the validation set, for example, between 0.5 and 0.8.
[0160] It should be noted that the online detection phase uses the functional labels, model parameters, and normal coupling mode prototype determined during the training phase. The week-hour dual-period baseline can be updated using confirmed normal historical monitoring data according to a preset update cycle, but it does not recalculate the corresponding historical period mean and standard deviation using the data of the current fixed time window to be detected, thereby avoiding abnormal data from entering the normal period baseline and weakening the abnormal response. For example, the system uses a preset update cycle of 2:00 AM every Sunday, using confirmed normal historical monitoring data from the past 8 weeks (excluding this week) to recalculate the historical period mean and standard deviation of pedestrian traffic and noise for each spatial grid under various "week-hour" combinations to update the week-hour dual-period baseline. This update does not use any data containing the current detection date.
[0161] Although the specific embodiments of the invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the invention. Based on the technical solutions of the invention, various modifications or variations that can be made by those skilled in the art without creative effort are still within the scope of protection of the invention.
Claims
1. An anomaly detection method for spatiotemporal coupling patterns of pedestrian flow and noise in a medical setting, characterized in that, Includes the following steps: S1. Divide the medical site into spatial grids with unique numbers according to the actual building structure. Collect the flow of people, A-weighted sound pressure level of environmental noise, temperature, relative humidity and PM2.5 concentration in each spatial grid simultaneously. After being aligned with a unified timestamp, generate a multivariate monitoring data stream according to the preset sampling interval. Extract continuous data from the multivariate monitoring data stream according to a fixed time window and label it with anomaly tags to form a training sample set. S2. Data representation and functional semantic mining are performed on the prior of the coupling of people flow and noise in medical places. Personalized periodic baselines are established for each spatial grid and the coupling anomaly tendency index is calculated to generate an enhanced feature matrix. Further construct the spatial contrast deviation, and extract the normal coupling pattern prototype and normal attention target distribution of each functional area. Finally, output the expanded and enhanced feature matrix, functional labels, normal coupling pattern prototype library and normal attention target distribution set. S2 is as follows: S2.
1. Establish a week-hour dual-period baseline for each spatial grid, and combine the synchronous exceedance of pedestrian flow and environmental noise within the current fixed time window with the synchronous change intensity to generate a coupling anomaly tendency index and embed it into the feature system to obtain an enhanced feature matrix. S2.2 Calculate the spatial contrast deviation of the current spatial grid relative to its surrounding neighborhood, and fuse it with the enhanced feature matrix to obtain the expanded enhanced feature matrix; at the same time, perform functional clustering on the spatial grid based on long-term historical monitoring data to obtain the functional labels of each grid, and extract the normal coupling mode prototype and normal attention target distribution of the corresponding functional partition; S2.1 specifically refers to: Obtain all monitoring data of the current spatial grid within a fixed time window, and sort them according to the sampling time to obtain the original multivariate time series matrix; For each sampling time within the window, the monitoring data of the same week and the same hour in the same historical period of the spatial grid are extracted, and the historical periodic mean and standard deviation of the pedestrian flow and the A-weighted sound pressure level of the environment noise are calculated respectively. In this way, the standardized deviation of the two types of data relative to the historical normal level is obtained, forming the standardized deviation vector of pedestrian flow and the standardized deviation vector of noise. The percentage of sampling times in which both types of standardized deviation values simultaneously exceed a preset anomaly threshold within a fixed time window is statistically analyzed to obtain the proportion of simultaneous exceedances of pedestrian flow and noise; the correlation coefficient between the two types of standardized deviation vectors is calculated to characterize the intensity of their synchronous change. The ratio of simultaneous exceedance of pedestrian flow and noise and the intensity of synchronous change are nonlinearly fused to obtain the coupling anomaly tendency index; the original multivariate time series matrix, the two types of standardized deviation vectors and the coupling anomaly tendency index are concatenated along the feature dimension to obtain the enhanced feature matrix; The process of constructing and expanding the enhanced feature matrix based on spatial contrast deviation in S2.2 is as follows: Based on the spatial layout of the medical facility and the grid adjacency relationship, the first-order spatial neighborhood set of the current spatial grid is determined; the average standardized deviation of the pedestrian flow between the current grid and all grids in the neighborhood within a fixed time window is calculated, and the difference between the two is used as the spatial contrast deviation of pedestrian flow; the same calculation logic is used to obtain the spatial contrast deviation of noise; the two types of spatial contrast deviations are expanded into feature columns with the same length as the time dimension, and concatenated with the enhanced feature matrix along the feature dimension to obtain the expanded enhanced feature matrix; S3. Construct an interaction-enhanced temporal convolutional encoder to encode the augmented and enhanced feature matrix to obtain high-level temporal features; By combining the normal coupling mode prototype, attention pooling is performed on the high-level temporal features to output the anomaly probability. The total loss function is constructed based on the distribution of real anomaly labels and normal attention targets. The encoder and attention pooling structure are trained end-to-end, and the trained detection model and its parameters are saved. S4. Deploy the trained detection model to the medical site monitoring system to conduct online detection of abnormal human flow-noise coupling on the real-time monitoring data stream of each spatial grid.
2. The anomaly detection method for spatiotemporal coupling patterns of people flow and noise in a medical setting according to claim 1, characterized in that, The extraction process of functional clustering, normal coupling pattern prototypes, and normal attention target distribution in S2.2 is as follows: Based on the long-term historical statistical characteristics of all spatial grids, a grid functional feature vector is constructed. Functional partitions are divided using a clustering algorithm, and a corresponding functional label is assigned to each spatial grid. For each functional partition, all historical fixed-time windows marked as normal are collected, and the lag cross-correlation vectors of the two types of standardized deviation vectors in each window under different lag orders are calculated. The lag cross-correlation vectors of all windows are averaged to obtain the normal coupling mode prototype of the functional partition. The prototypes of all functional partitions together constitute the normal coupling mode prototype library. For each functional partition's historical normal window, the matching score between the local coupling features and the normal coupling pattern prototype at each sampling time is calculated, and the normal attention distribution of a single window is obtained after normalization. The average attention distribution of all normal windows within a partition is taken and normalized again to obtain the normal attention target distribution of that functional partition; the target distributions of all functional partitions together constitute the set of normal attention target distributions.
3. The anomaly detection method for the spatiotemporal coupling pattern of people flow and noise in a medical setting according to claim 1, characterized in that, The S3 interaction-enhanced temporal convolutional encoder includes multiple layers of residual blocks stacked sequentially. Each residual block contains dilated causal convolution branches, interactive convolution branches, functional modulation modules, and residual connections. Dilated causal convolution branches are used to extract temporal variation patterns at different time scales while preserving temporal causality; Interactive convolutional branches are used to extract the instantaneous multiplicative coupling relationship between the semantic features of pedestrian flow and the semantic features of noise; The functional modulation module is used to generate modulation parameters based on the functional labels of the spatial grid, and to perform channel-by-channel scaling and offset on the fused temporal features; Residual connections are used to preserve features from previous layers and improve network training stability.
4. The anomaly detection method for the spatiotemporal coupling pattern of people flow and noise in a medical setting according to claim 3. Its characteristic is that the generation process of high-level time series features in S3 is as follows: The augmented feature matrix corresponding to the spatial grid is used as the encoder input, and the corresponding functional label embedding vector is read according to the functional label of the spatial grid. In each residual block, the main temporal features are first extracted by dilated causal convolution, and then the semantic features of pedestrian flow and noise are projected to obtain the semantic features of noise respectively. After obtaining the instantaneous coupling features by element-wise multiplication, the interactive flow coupling features are obtained by interactive convolution. The main temporal features and the interaction flow coupling features are weighted and fused to obtain the fused temporal features; The channel-wise scaling factor and offset are generated by using the function label embedding vector. Functional modulation is then performed on the fused temporal features, and finally added to the channel-aligned output feature residual of the previous layer to obtain the output feature of the current residual block. After processing all residual blocks layer by layer, the high-level timing characteristics of the encoder's final output are obtained.
5. The anomaly detection method for the spatiotemporal coupling pattern of people flow and noise in a medical setting according to claim 4, characterized in that, The calculation process for the anomaly probability in S3 is as follows: Based on the functional labels of the current spatial grid, the corresponding normal coupling mode prototypes are read from the normal coupling mode prototype library and obtained through mapping transformation to obtain the attention query vector; the feature vectors of each time step of the high-level temporal features are mapped to key vectors respectively. Calculate the attention score by scaling the dot product of the attention query vector and the key vector at each time step, and then normalize it to obtain the attention weight at each sampling time step; The high-level temporal features are weighted and summed along the time dimension using attention weights to obtain a window representation vector. The window representation vector is then input into the classification layer, and the anomaly probability of the current fixed time window is output through the activation function.
6. The anomaly detection method for the spatiotemporal coupling pattern of pedestrian flow and noise in a medical setting according to claim 5, characterized in that the specific method of the total loss function and training optimization in S3 is as follows: The binary cross-entropy classification loss is calculated based on the true anomaly labels of the training samples and the anomaly probabilities output by the model. For all samples labeled as normal in the training samples, the difference between the attention distribution output by the model and the normal attention target distribution of the corresponding functional partition is calculated to obtain the attention regularization loss; abnormal samples are not included in the calculation of attention regularization loss. The classification loss and attention regularization loss are weighted and combined to obtain the total loss function. The goal is to minimize the total loss function. All trainable parameters of the encoder, attention pooling structure and classification layer are updated end-to-end until the preset training termination condition is met.
7. The anomaly detection method for spatiotemporal coupling patterns of people flow and noise in a medical setting according to claim 1, characterized in that, S1 is as follows: The medical facility is divided into multiple spatial grids according to the standard dimensions or functional area boundaries. Each grid is assigned a unique number. The functional areas include the registration and payment area, waiting area, consultation room corridor, rest area, and pharmacy. Multivariate monitoring data are collected synchronously within each spatial grid, including pedestrian flow data collected by a passenger flow counting device, ambient noise A-weighted sound pressure level data collected by a sound level meter, and temperature, relative humidity, and PM2.5 concentration data collected by an environmental sensor. All monitoring channels are aligned with a unified timestamp and form a multivariate monitoring data stream according to a preset sampling interval; continuous time-series data is extracted from the data stream according to a fixed time window length to form a monitoring sample; For each fixed time window, the monitoring samples are labeled with real anomaly labels to distinguish between normal states and abnormal states caused by the coupling of pedestrian flow and noise; finally, the training sample set is composed of all labeled monitoring samples.
Citation Information
Patent Citations
Line loss data anomaly monitoring method and system based on time sequence anomaly detection
CN120354327A
Abnormity detection method and system for multivariable time series data of Internet of Things
CN121705704A
