A method and system for intelligent building safety monitoring based on machine learning
Through stacking integrated learning model and dual-dimensional attention mechanism neural network model, combined with building environment detection and abnormal access recognition, the problems of data diversity and complexity, weak feature capture capabilities, and limited coverage of a single means in intelligent building safety monitoring are solved. , achieving higher detection accuracy and security.
Patent Information
- Application Number
- CN202411526262.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-30
AI Technical Summary
In existing intelligent building safety monitoring, the diversity and complexity of the building environment data makes it difficult for a single model to fully capture data characteristics, and the model accuracy is low; the data dimensions of abnormal access recognition are high and complex interactive relationships, and traditional models are difficult to pay attention to time at the same time. and feature dimensions lead to weak feature capture capabilities; a single detection method can only cover some building safety issues and cannot provide comprehensive security guarantees.
The stacked integrated learning model is used for building environment detection, and the basic learner is enhanced through stacked random forests and extreme gradients to enhance the ability to capture complex features; the two-dimensional attention mechanism neural network model is used for abnormal access recognition, and the two-dimensional attention mechanism is used. Flexible adjustment of attention to different data dimensions; comprehensive analysis is carried out in combination with building environment detection and abnormal access recognition to reduce false alarms and missed reports caused by a single method.
It improves the accuracy and real-time nature of building environment detection, enhances the performance of abnormal access recognition, and establishes a multi-level building safety protection system to help managers formulate more effective safety management strategies and provide comprehensive security guarantees.
Smart Images

Figure CN119046816B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of intelligent building safety, and specifically refers to an intelligent building safety monitoring method and system based on machine learning. Background Art
[0002] Intelligent building safety monitoring uses machine learning technology to conduct real-time monitoring and analysis of safety conditions in buildings to achieve automated safety monitoring. It aims to detect potential safety hazards in buildings in advance, reduce the risk of accidents, help building managers take timely measures, and optimize safety management strategies, thereby improving building safety levels.
[0003] However, in the existing intelligent building security monitoring process, there is a technical problem that the building environment contains a large amount of diverse data, which is diverse and complex. A single model is difficult to fully capture the complex data features, and the model accuracy is low, thus affecting the effectiveness of building environment detection; there is a technical problem that the data dimension of abnormal access identification is high and has complex interactive relationships. It is difficult for traditional prediction models to pay attention to the time dimension and feature dimension at the same time, resulting in weak feature capture capabilities and affecting the model recognition performance; there is a technical problem that a single building environment detection or abnormal access identification can only cover some building safety issues and cannot provide comprehensive security guarantees. Summary of the invention
[0004] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a method and system for intelligent building safety monitoring based on machine learning. In view of the technical problem that in the existing intelligent building safety monitoring process, there is a large amount of diversified data in the building environment, which is diverse and complex, and a single model is difficult to fully capture the complex data features, and the model accuracy is low, thus affecting the effectiveness of building environment detection, this solution creatively adopts a stacked ensemble learning model for building environment detection. By stacking random forest base learners and extreme gradient boosting base learners, the advantages of different base learners are combined to enhance the ability to capture complex features, further improve the robustness and accuracy of the model, help improve the real-time and effectiveness of building environment detection, and assist management personnel to take timely measures to deal with environmental abnormalities; in the existing intelligent building safety monitoring process, there is abnormal access identification The data dimension is high and has complex interactive relationships, and traditional prediction models are difficult to capture at the same time Focusing on the time dimension and feature dimension leads to weak feature capture ability, which affects the model recognition performance. This solution creatively adopts a two-dimensional attention mechanism neural network model for abnormal access identification. Through the two-dimensional attention mechanism, the attention to different data dimensions can be flexibly adjusted, and the complex interactive relationship between different features can be effectively captured. It adapts to the real-time changes in building access patterns, improves model performance, and enhances the overall reliability of the method. In view of the technical problem that in the existing intelligent building safety monitoring process, a single building environment detection or abnormal access identification can only cover part of the building safety issues and cannot provide comprehensive security protection, this solution creatively combines building environment detection and abnormal access identification for intelligent building safety monitoring. By comprehensively analyzing building safety, it reduces false alarms and missed alarms caused by a single means, better adapts to the safety needs of intelligent buildings, and helps to establish a multi-level building safety protection system to help managers formulate more effective building safety management strategies.
[0005] The technical solution adopted by the present invention is as follows: The present invention provides a smart building safety monitoring method based on machine learning, the method comprising the following steps:
[0006] Step S1: data collection;
[0007] Step S2: data preprocessing;
[0008] Step S3: Building environment detection;
[0009] Step S4: abnormal access identification;
[0010] Step S5: Generate a building safety report.
[0011] Further, in step S1, the data collection is used to collect raw data required for intelligent building security monitoring, specifically by collecting environmental sensor data, historical environmental data, access control system data and motion sensor data to obtain building security raw data;
[0012] The environmental sensor data includes temperature, humidity, smoke concentration, carbon dioxide concentration and air pressure;
[0013] The access control system data includes user identifier, entry and exit time, access control location and entry and exit type.
[0014] Furthermore, in step S2, the data preprocessing is used to optimize the data quality, including the following steps:
[0015] Step S21: data cleaning, specifically, cleaning the original building safety data by filling missing values, deleting outliers, and filtering duplicate values to obtain building safety cleansed data;
[0016] Step S22: data standardization, specifically, obtaining building safety standard data by performing data standardization processing on the building safety cleaning data;
[0017] Step S23: data integration, specifically integrating the environmental sensor data and historical environmental data in the building safety standard data to obtain building environmental data, and integrating the access control system data and motion sensor data in the building safety standard data to obtain building access data.
[0018] Further, in step S3, the building environment detection is used to detect the environment in the smart building, specifically, based on the building environment data, a stacked ensemble learning model is used to perform building environment detection to obtain building environment detection information, including the following steps:
[0019] The stacked ensemble learning model includes a random forest base learner, an extreme gradient boosting base learner and a meta learner;
[0020] The random forest-based learner is used to process high-dimensional features and make predictions;
[0021] The extreme gradient boosting base learner is used to improve the prediction results of the random forest base learner;
[0022] The meta-learner is used to integrate the prediction results of different base learners to enhance the generalization ability of the model;
[0023] The building environment detection comprises the following steps:
[0024] Step S31: constructing a stacked ensemble learning model, specifically using the building environment data as the original input data to construct a stacked ensemble learning model, including the following steps:
[0025] Step S311: construct a random forest-based learner, which includes N decision trees. The random forest-based learner is used to calculate the original input data to obtain a random forest prediction result. The calculation formula is:
[0026] ;
[0027] Where Y RF is the random forest prediction result, N is the number of decision trees in the random forest base learner, i is the decision tree index in the random forest base learner, and y i is the prediction result of the i-th decision tree in the random forest base learner;
[0028] Step S312: construct an extreme gradient boosting base learner, the extreme gradient boosting base learner includes K decision trees, the original input data and the random forest prediction result are used as inputs of the extreme gradient boosting base learner, and the extreme gradient boosting prediction result is calculated by the extreme gradient boosting base learner. The calculation formula is:
[0029] ;
[0030] In the formula, is the input of the extreme gradient boosting base learner, concat(·) is the feature concatenation operation, X is the original input data, specifically the building environment data, and Y XGB is the prediction result of extreme gradient boosting, K is the number of decision trees in the extreme gradient boosting base learner, k is the decision tree index in the extreme gradient boosting base learner, and f k (·) is the prediction function of the kth decision tree in the extreme gradient boosting base learner;
[0031] Step S313: construct a meta-learner, specifically, use the logistic regression model as the meta-learner, and use the meta-learner to perform a weighted combination of the random forest prediction result and the extreme gradient boosting prediction result to obtain the final prediction result. The calculation formula is:
[0032] ;
[0033] In the formula, is the final prediction result, w one is the first weight of the meta-learner, w two is the second weight of the meta-learner, and b is the bias term of the meta-learner;
[0034] Step S32: constructing a building environment detection model, specifically by training the stacked ensemble learning model to obtain the building environment detection model;
[0035] Step S33: generating a detection result, specifically, performing building environment detection through a building environment detection model to obtain building environment detection information.
[0036] Further, in step S4, the abnormal access identification is used to identify abnormal access in the intelligent building, specifically, based on the building access data, a two-dimensional attention mechanism neural network model is used to perform abnormal access identification to obtain abnormal access identification information;
[0037] The two-dimensional attention mechanism neural network model includes an input layer, a two-dimensional attention module, an attention synthesis layer, a fully connected layer and an output layer;
[0038] The dual-dimensional attention module is used to enhance the attention to important information in the time and feature dimensions, thereby improving the model's ability to capture complex temporal dependencies and feature interactions;
[0039] The attention synthesis layer is used to generate a building access context vector by integrating important information in time and feature dimensions;
[0040] The abnormal access identification includes the following steps:
[0041] Step S41: constructing a two-dimensional attention mechanism neural network model, including the following steps:
[0042] Step S411: constructing an input layer for receiving model input, specifically receiving building access data as model input through the input layer;
[0043] Step S412: constructing a two-dimensional attention module, specifically setting a parallel time dimension recurrent network layer and a feature dimension attention layer in the two-dimensional attention module, and calculating through the two-dimensional attention module to obtain the time attention weight and the feature attention weight, including the following steps:
[0044] Step S4121: construct a time dimension recurrent network layer, specifically, set a recurrent neural network layer and a time dimension attention layer in the time dimension recurrent network layer, calculate the model input through the recurrent neural network layer, generate the hidden state of each time step, calculate the attention weight of the hidden state at each time step through the time dimension attention layer, and obtain the time attention weight. The calculation formula is:
[0045] ;
[0046] In the formula, h tis the hidden state at the tth time step, t is the time step index, RNN(·) is the recurrent neural network function, and x t is the model input at time step t, h t-1 is the hidden state at the t-1th time step, wt t is the temporal attention weight at the t-th time step, softmax(·) is the softmax function, and score dot (·) is the dot product attention function, T is the total time step, and is used to represent the last time step. T is the hidden state at the Tth time step;
[0047] Step S4122: construct a feature dimension attention layer, calculate the attention weight of the model input at each time step through the feature dimension attention layer, and obtain the feature attention weight. The calculation formula is:
[0048] ;
[0049] In the formula, wf t is the feature attention weight at the tth time step, tanh(·) is the hyperbolic tangent function, and W 1 is the first weight of attention calculation, W 2 It is the second weight of attention calculation;
[0050] Step S413: construct an attention synthesis layer, and calculate the building access context vector based on the time attention weight and feature attention weight. The calculation formula is:
[0051] ;
[0052] In the formula, c t is the building access context vector at the tth time step;
[0053] Step S414: construct a fully connected layer for further processing the building access context vector, specifically, calculating the building access context vector through the fully connected layer to obtain a high-dimensional access feature vector;
[0054] Step S415: constructing an output layer for outputting the model prediction result, specifically calculating the high-dimensional access feature vector through the output layer to obtain the model prediction result;
[0055] Step S42: constructing an abnormal access recognition model, specifically, obtaining an abnormal access recognition model by training a two-dimensional attention mechanism neural network model;
[0056] Step S43: generating an identification result, specifically performing abnormal access identification through an abnormal access identification model to obtain abnormal access identification information.
[0057] Furthermore, in step S5, the building safety report is generated by integrating the building environment detection information and the abnormal access identification information to generate a building safety report, and an alarm is issued when there is an abnormality in the building environment or an abnormality in the access.
[0058] The present invention provides an intelligent building safety monitoring system based on machine learning, comprising: a data acquisition module, a data preprocessing module, a building environment detection module, an abnormal access identification module and a building safety report generation module;
[0059] The data acquisition module is used for data acquisition, obtains the original building safety data through data acquisition, and sends the original building safety data to the data preprocessing module;
[0060] The data preprocessing module is used for data preprocessing, and obtains building environment data and building access data through data preprocessing, and sends the building environment data to the building environment detection module, and sends the building access data to the abnormal access identification module;
[0061] The building environment detection module is used for building environment detection, obtains building environment detection information through building environment detection, and sends the building environment detection information to the building safety report generation module;
[0062] The abnormal access identification module is used for abnormal access identification, obtains abnormal access identification information through abnormal access identification, and sends the abnormal access identification information to the building safety report generation module;
[0063] The building safety report generation module is used to generate a building safety report, and integrates the building environment detection information and the abnormal access identification information to generate a building safety report.
[0064] The beneficial effects achieved by the present invention using the above scheme are as follows:
[0065] (1) In view of the technical problem that in the existing intelligent building safety monitoring process, there is a large amount of diverse data in the building environment, which is diverse and complex, and a single model is difficult to fully capture the complex data features, and the model accuracy is low, thus affecting the effectiveness of building environment detection. This solution creatively adopts a stacked ensemble learning model for building environment detection. By stacking random forest base learners and extreme gradient boosting base learners, the advantages of different base learners are combined to enhance the ability to capture complex features, further improve the robustness and accuracy of the model, and help improve the real-time and effectiveness of building environment detection, and assist management personnel to take timely measures to deal with environmental abnormalities;
[0066] (2) In the existing intelligent building security monitoring process, the data dimension of abnormal access identification is high and has complex interactive relationships. The traditional prediction model is difficult to pay attention to the time dimension and feature dimension at the same time, resulting in weak feature capture ability and affecting the model recognition performance. This solution creatively adopts a two-dimensional attention mechanism neural network model for abnormal access identification. Through the two-dimensional attention mechanism, the attention to different data dimensions can be flexibly adjusted, and the complex interactive relationships between different features can be effectively captured. It adapts to the real-time changes in building access patterns, improves model performance, and enhances the overall reliability of the method.
[0067] (3) In view of the technical problem that in the existing intelligent building security monitoring process, a single building environment detection or abnormal access identification can only cover part of the building safety issues and cannot provide comprehensive security protection, this solution creatively combines building environment detection and abnormal access identification for intelligent building security monitoring. By comprehensively analyzing building security, it reduces false alarms and missed alarms caused by a single means, better adapts to the security needs of intelligent buildings, helps to establish a multi-level building security protection system, and helps managers formulate more effective building security management strategies. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 A schematic diagram of a process flow of a smart building safety monitoring method based on machine learning provided by the present invention;
[0069] Figure 2 A schematic diagram of an intelligent building safety monitoring system based on machine learning provided by the present invention;
[0070] Figure 3 is a schematic flow chart of step S2;
[0071] Figure 4 is a schematic flow chart of step S3;
[0072] Figure 5 It is a schematic diagram of the process of step S4.
[0073] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION
[0074] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0075] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.
[0076] Example 1, see Figure 1 The present invention provides a method for intelligent building safety monitoring based on machine learning, the method comprising the following steps:
[0077] Step S1: data collection;
[0078] Step S2: data preprocessing;
[0079] Step S3: Building environment detection;
[0080] Step S4: abnormal access identification;
[0081] Step S5: Generating a building safety report;
[0082] By performing the above operations, in order to address the technical problem that in the existing intelligent building security monitoring process, a single building environment detection or abnormal access identification can only cover some building safety issues and cannot provide comprehensive security protection, this solution creatively combines building environment detection and abnormal access identification for intelligent building security monitoring. By comprehensively analyzing building security, it reduces false alarms and missed alarms caused by a single means, better adapts to the security needs of intelligent buildings, helps to establish a multi-level building security protection system, and helps managers formulate more effective building security management strategies.
[0083] Example 2, see Figure 1 ,This embodiment is based on the above embodiment. In step S1, the data collection is used to collect the original data required for intelligent building security monitoring, specifically, by collecting environmental sensor data, historical environmental data, access control system data and motion sensor data to obtain building security original data;
[0084] The environmental sensor data includes temperature, humidity, smoke concentration, carbon dioxide concentration and air pressure;
[0085] The access control system data includes user identifier, entry and exit time, access control location and entry and exit type.
[0086] Example 3, see Figure 1 and Figure 3This embodiment is based on the above embodiment. In step S2, the data preprocessing is used to optimize the data quality, including the following steps:
[0087] Step S21: data cleaning, specifically, cleaning the original building safety data by filling missing values, deleting outliers, and filtering duplicate values to obtain building safety cleansed data;
[0088] Step S22: data standardization, specifically, obtaining building safety standard data by performing data standardization processing on the building safety cleaning data;
[0089] Step S23: data integration, specifically integrating the environmental sensor data and historical environmental data in the building safety standard data to obtain building environmental data, and integrating the access control system data and motion sensor data in the building safety standard data to obtain building access data.
[0090] Example 4, see Figure 1 and Figure 4 This embodiment is based on the above embodiment. In step S3, the building environment detection is used to detect the environment in the intelligent building. Specifically, based on the building environment data, a stacked ensemble learning model is used to perform building environment detection to obtain building environment detection information, including the following steps:
[0091] The stacked ensemble learning model includes a random forest base learner, an extreme gradient boosting base learner and a meta learner;
[0092] The random forest-based learner is used to process high-dimensional features and make predictions;
[0093] The extreme gradient boosting base learner is used to improve the prediction results of the random forest base learner;
[0094] The meta-learner is used to integrate the prediction results of different base learners to enhance the generalization ability of the model;
[0095] The building environment detection comprises the following steps:
[0096] Step S31: constructing a stacked ensemble learning model, specifically using the building environment data as the original input data to construct a stacked ensemble learning model, including the following steps:
[0097] Step S311: construct a random forest-based learner, which includes N decision trees. The random forest-based learner is used to calculate the original input data to obtain a random forest prediction result. The calculation formula is:
[0098] ;
[0099] Where YRF is the random forest prediction result, N is the number of decision trees in the random forest base learner, i is the decision tree index in the random forest base learner, and y i is the prediction result of the i-th decision tree in the random forest base learner;
[0100] Step S312: construct an extreme gradient boosting base learner, the extreme gradient boosting base learner includes K decision trees, the original input data and the random forest prediction result are used as inputs of the extreme gradient boosting base learner, and the extreme gradient boosting prediction result is calculated by the extreme gradient boosting base learner. The calculation formula is:
[0101] ;
[0102] In the formula, is the input of the extreme gradient boosting base learner, concat(·) is the feature concatenation operation, X is the original input data, specifically the building environment data, and Y XGB is the prediction result of extreme gradient boosting, K is the number of decision trees in the extreme gradient boosting base learner, k is the decision tree index in the extreme gradient boosting base learner, and f k (·) is the prediction function of the kth decision tree in the extreme gradient boosting base learner;
[0103] Step S313: construct a meta-learner, specifically, use the logistic regression model as the meta-learner, and use the meta-learner to perform a weighted combination of the random forest prediction result and the extreme gradient boosting prediction result to obtain the final prediction result. The calculation formula is:
[0104] ;
[0105] In the formula, is the final prediction result, w one is the first weight of the meta-learner, w two is the second weight of the meta-learner, and b is the bias term of the meta-learner;
[0106] Step S32: constructing a building environment detection model, specifically by training the stacked ensemble learning model to obtain the building environment detection model;
[0107] Step S33: generating a detection result, specifically, performing building environment detection through a building environment detection model to obtain building environment detection information;
[0108] By performing the above operations, in order to address the technical problem that in the existing intelligent building safety monitoring process, there is a large amount of diverse data in the building environment, which is diverse and complex, and a single model is difficult to fully capture the complex data features, and the model accuracy is low, thus affecting the effectiveness of building environment detection, this solution creatively adopts a stacked ensemble learning model for building environment detection. By stacking random forest base learners and extreme gradient boosting base learners, the advantages of different base learners are combined to enhance the ability to capture complex features, further improve the robustness and accuracy of the model, help improve the real-time and effectiveness of building environment detection, and assist managers to take timely measures to deal with environmental abnormalities.
[0109] Example 5, see Figure 1 and Figure 5 , This embodiment is based on the above embodiment. In step S4, the abnormal access identification is used to identify abnormal access in the intelligent building. Specifically, based on the building access data, a two-dimensional attention mechanism neural network model is used to perform abnormal access identification to obtain abnormal access identification information;
[0110] The two-dimensional attention mechanism neural network model includes an input layer, a two-dimensional attention module, an attention synthesis layer, a fully connected layer and an output layer;
[0111] The dual-dimensional attention module is used to enhance the attention to important information in the time and feature dimensions, thereby improving the model's ability to capture complex temporal dependencies and feature interactions;
[0112] The attention synthesis layer is used to generate a building access context vector by integrating important information in time and feature dimensions;
[0113] The abnormal access identification includes the following steps:
[0114] Step S41: constructing a two-dimensional attention mechanism neural network model, including the following steps:
[0115] Step S411: constructing an input layer for receiving model input, specifically receiving building access data as model input through the input layer;
[0116] Step S412: constructing a two-dimensional attention module, specifically setting a parallel time dimension recurrent network layer and a feature dimension attention layer in the two-dimensional attention module, and calculating through the two-dimensional attention module to obtain the time attention weight and the feature attention weight, including the following steps:
[0117] Step S4121: construct a time dimension recurrent network layer, specifically, set a recurrent neural network layer and a time dimension attention layer in the time dimension recurrent network layer, calculate the model input through the recurrent neural network layer, generate the hidden state of each time step, calculate the attention weight of the hidden state at each time step through the time dimension attention layer, and obtain the time attention weight. The calculation formula is:
[0118] ;
[0119] In the formula, h t is the hidden state at the tth time step, t is the time step index, RNN(·) is the recurrent neural network function, and x t is the model input at time step t, h t-1 is the hidden state at the t-1th time step, wt t is the temporal attention weight at the t-th time step, softmax(·) is the softmax function, and score dot (·) is the dot product attention function, T is the total time step, and is used to represent the last time step. T is the hidden state at the Tth time step;
[0120] Step S4122: construct a feature dimension attention layer, calculate the attention weight of the model input at each time step through the feature dimension attention layer, and obtain the feature attention weight. The calculation formula is:
[0121] ;
[0122] In the formula, wf t is the feature attention weight at the tth time step, tanh(·) is the hyperbolic tangent function, and W 1 is the first weight of attention calculation, W 2 It is the second weight of attention calculation;
[0123] Step S413: construct an attention synthesis layer, and calculate the building access context vector based on the time attention weight and feature attention weight. The calculation formula is:
[0124] ;
[0125] In the formula, c t is the building access context vector at the tth time step;
[0126] Step S414: construct a fully connected layer for further processing the building access context vector, specifically, calculating the building access context vector through the fully connected layer to obtain a high-dimensional access feature vector;
[0127] Step S415: constructing an output layer for outputting the model prediction result, specifically calculating the high-dimensional access feature vector through the output layer to obtain the model prediction result;
[0128] Step S42: constructing an abnormal access recognition model, specifically, obtaining an abnormal access recognition model by training a two-dimensional attention mechanism neural network model;
[0129] Step S43: generating an identification result, specifically, performing abnormal access identification through an abnormal access identification model to obtain abnormal access identification information;
[0130] By performing the above operations, in order to solve the technical problem that in the existing intelligent building security monitoring process, the data dimension of abnormal access identification is high and has complex interactive relationships, and the traditional prediction model is difficult to pay attention to the time dimension and feature dimension at the same time, resulting in weak feature capture ability and affecting the model recognition performance, this solution creatively adopts a two-dimensional attention mechanism neural network model for abnormal access identification. Through the two-dimensional attention mechanism, the attention to different data dimensions can be flexibly adjusted, the complex interactive relationships between different features can be effectively captured, and the real-time changes of building access patterns can be adapted. The model performance is improved, thereby enhancing the overall reliability of the method.
[0131] Example 6, see Figure 1 This embodiment is based on the above embodiment. In step S5, the building safety report is generated, specifically by integrating the building environment detection information and abnormal access identification information to generate a building safety report. When there is an abnormal building environment or access, an alarm is issued.
[0132] Embodiment 7, see Figure 2 ,This embodiment is based on the above embodiment. The present invention provides an intelligent building safety monitoring system based on machine learning, including: a data acquisition module, a data preprocessing module, a building environment detection module, an abnormal access identification module and a building safety report generation module;
[0133] The data acquisition module is used for data acquisition, obtains the original building safety data through data acquisition, and sends the original building safety data to the data preprocessing module;
[0134] The data preprocessing module is used for data preprocessing, and obtains building environment data and building access data through data preprocessing, and sends the building environment data to the building environment detection module, and sends the building access data to the abnormal access identification module;
[0135] The building environment detection module is used for building environment detection, obtains building environment detection information through building environment detection, and sends the building environment detection information to the building safety report generation module;
[0136] The abnormal access identification module is used for abnormal access identification, obtains abnormal access identification information through abnormal access identification, and sends the abnormal access identification information to the building safety report generation module;
[0137] The building safety report generation module is used to generate a building safety report, and integrates the building environment detection information and the abnormal access identification information to generate a building safety report.
[0138] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0139] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.
[0140] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.
Claims
1. A smart building safety monitoring method based on machine learning, characterized in that: The method comprises the following steps: Step S1: data collection; Step S2: data preprocessing; Step S3: Building environment detection, specifically, based on the building environment data, using a stacked ensemble learning model to perform building environment detection to obtain building environment detection information; The stacked ensemble learning model includes a random forest base learner, an extreme gradient boosting base learner and a meta learner; The random forest-based learner is used to process high-dimensional features and make predictions; The extreme gradient boosting base learner is used to improve the prediction results of the random forest base learner; The meta-learner is used to integrate the prediction results of different base learners to enhance the generalization ability of the model; The building environment detection is used to detect the environment conditions in the intelligent building, and includes the following steps: Step S31: constructing a stacked ensemble learning model, specifically using the building environment data as the original input data to construct a stacked ensemble learning model, including the following steps: Step S311: construct a random forest-based learner, which includes N decision trees. The random forest-based learner is used to calculate the original input data to obtain a random forest prediction result. The calculation formula is: ; Where Y RF is the random forest prediction result, N is the number of decision trees in the random forest base learner, i is the decision tree index in the random forest base learner, and y i is the prediction result of the i-th decision tree in the random forest base learner; Step S312: construct an extreme gradient boosting base learner, the extreme gradient boosting base learner includes K decision trees, the original input data and the random forest prediction result are used as inputs of the extreme gradient boosting base learner, and the extreme gradient boosting prediction result is calculated by the extreme gradient boosting base learner. The calculation formula is: ; In the formula, is the input of the extreme gradient boosting base learner, concat(·) is the feature concatenation operation, X is the original input data, specifically the building environment data, and Y XGB is the prediction result of extreme gradient boosting, K is the number of decision trees in the extreme gradient boosting base learner, k is the decision tree index in the extreme gradient boosting base learner, and f k (·) is the prediction function of the kth decision tree in the extreme gradient boosting base learner; Step S313: construct a meta-learner, specifically, use the logistic regression model as the meta-learner, and use the meta-learner to perform a weighted combination of the random forest prediction result and the extreme gradient boosting prediction result to obtain the final prediction result. The calculation formula is: ; In the formula, is the final prediction result, w one is the first weight of the meta-learner, w two is the second weight of the meta-learner, and b is the bias term of the meta-learner; Step S32: constructing a building environment detection model, specifically by training the stacked ensemble learning model to obtain the building environment detection model; Step S33: generating a detection result, specifically, performing building environment detection through a building environment detection model to obtain building environment detection information; Step S4: abnormal access identification, specifically, based on the building access data, using a two-dimensional attention mechanism neural network model to perform abnormal access identification to obtain abnormal access identification information; The two-dimensional attention mechanism neural network model includes an input layer, a two-dimensional attention module, an attention synthesis layer, a fully connected layer and an output layer; The dual-dimensional attention module is used to enhance the attention to important information in the time and feature dimensions, thereby improving the model's ability to capture complex temporal dependencies and feature interactions; The attention synthesis layer is used to generate a building access context vector by integrating important information in time and feature dimensions; The abnormal access identification is used to identify abnormal access in a smart building, and includes the following steps: Step S41: constructing a two-dimensional attention mechanism neural network model, including the following steps: Step S411: constructing an input layer for receiving model input, specifically receiving building access data as model input through the input layer; Step S412: constructing a two-dimensional attention module, specifically setting a parallel time dimension recurrent network layer and a feature dimension attention layer in the two-dimensional attention module, and calculating through the two-dimensional attention module to obtain the time attention weight and the feature attention weight, including the following steps: Step S4121: construct a time dimension recurrent network layer, specifically, set a recurrent neural network layer and a time dimension attention layer in the time dimension recurrent network layer, calculate the model input through the recurrent neural network layer, generate the hidden state of each time step, calculate the attention weight of the hidden state at each time step through the time dimension attention layer, and obtain the time attention weight. The calculation formula is: ; In the formula, h t is the hidden state at the tth time step, t is the time step index, RNN(·) is the recurrent neural network function, and x t is the model input at time step t, h t-1 is the hidden state at the t-1th time step, wt t is the temporal attention weight at the t-th time step, softmax(·) is the softmax function, and score dot (·) is the dot product attention function, T is the total time step, and is used to represent the last time step. T is the hidden state at the Tth time step; Step S4122: construct a feature dimension attention layer, calculate the attention weight of the model input at each time step through the feature dimension attention layer, and obtain the feature attention weight. The calculation formula is: ; Where wf t is the feature attention weight at the tth time step, tanh(·) is the hyperbolic tangent function, W1 is the first weight for attention calculation, and W2 is the second weight for attention calculation; Step S413: construct an attention synthesis layer, and calculate the building access context vector based on the time attention weight and feature attention weight. The calculation formula is: ; In the formula, c t is the building access context vector at the tth time step; Step S414: construct a fully connected layer for further processing the building access context vector, specifically, calculating the building access context vector through the fully connected layer to obtain a high-dimensional access feature vector; Step S415: constructing an output layer for outputting the model prediction result, specifically calculating the high-dimensional access feature vector through the output layer to obtain the model prediction result; Step S42: constructing an abnormal access recognition model, specifically, obtaining an abnormal access recognition model by training a two-dimensional attention mechanism neural network model; Step S43: generating an identification result, specifically, performing abnormal access identification through an abnormal access identification model to obtain abnormal access identification information; Step S5: Generate a building safety report.
2. The intelligent building safety monitoring method based on machine learning according to claim 1, characterized in that: In step S5, the building safety report is generated by integrating the building environment detection information and the abnormal access identification information to generate a building safety report. When there is an abnormality in the building environment or an abnormality in the access, an alarm is issued.
3. The intelligent building safety monitoring method based on machine learning according to claim 2 is characterized in that: In step S2, the data preprocessing is used to optimize the data quality, including the following steps: Step S21: data cleaning, specifically, cleaning the original building safety data by filling missing values, deleting outliers, and filtering duplicate values to obtain building safety cleansed data; Step S22: data standardization, specifically, obtaining building safety standard data by performing data standardization processing on the building safety cleaning data; Step S23: data integration, specifically integrating the environmental sensor data and historical environmental data in the building safety standard data to obtain building environmental data, and integrating the access control system data and motion sensor data in the building safety standard data to obtain building access data.
4. The intelligent building safety monitoring method based on machine learning according to claim 3 is characterized in that: In step S1, the data collection is used to collect the original data required for intelligent building security monitoring, specifically by collecting environmental sensor data, historical environmental data, access control system data and motion sensor data to obtain building security original data; The environmental sensor data includes temperature, humidity, smoke concentration, carbon dioxide concentration and air pressure; The access control system data includes user identifier, entry and exit time, access control location and entry and exit type.
5. A machine learning-based intelligent building safety monitoring system, used to implement a machine learning-based intelligent building safety monitoring method as described in any one of claims 1 to 4, characterized in that: It includes a data acquisition module, a data preprocessing module, a building environment detection module, an abnormal access identification module and a building safety report generation module.
6. The intelligent building safety monitoring system based on machine learning according to claim 5, characterized in that: The data acquisition module is used for data acquisition, obtains the original building safety data through data acquisition, and sends the original building safety data to the data preprocessing module; The data preprocessing module is used for data preprocessing, and obtains building environment data and building access data through data preprocessing, and sends the building environment data to the building environment detection module, and sends the building access data to the abnormal access identification module; The building environment detection module is used for building environment detection, obtains building environment detection information through building environment detection, and sends the building environment detection information to the building safety report generation module; The abnormal access identification module is used for abnormal access identification, obtains abnormal access identification information through abnormal access identification, and sends the abnormal access identification information to the building safety report generation module; The building safety report generation module is used to generate a building safety report, and integrates the building environment detection information and the abnormal access identification information to generate a building safety report.
Citation Information
Patent Citations
Flow data automatic detection method and device based on deep learning technology
CN112468509A
Building load prediction model training method, building load prediction method and device
CN116975665A