Scene recognition method based on homogeneous hidden Markov model

Through the scene recognition method based on the homogeneous hidden Markov model, combined with the neural network and state transition probability, the problems of low scene recognition accuracy and scene jump in the existing technology are solved, and more efficient indoor scene recognition is achieved.

CN118762273APending Publication Date: 2024-10-11ZHEJIANG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410878497.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

Existing indoor scene recognition solutions fail to effectively utilize the behavioral characteristics and spatial prior information of people's indoor activities, resulting in low scene recognition accuracy and prone to scene jumps.

Method used

The scene recognition method based on the homogeneous hidden Markov model is used to train the neural network model and establish the adjacency matrix through the offline stage, calculate the state transition probability and observation probability, and update the scene recognition results in real time to avoid scene jumps.

Benefits of technology

The accuracy of scene recognition is improved, the scene jump phenomenon is avoided, and efficient recognition performance is maintained during the recognition process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118762273A_ABST
    Figure CN118762273A_ABST
Patent Text Reader

Abstract

The invention provides a scene recognition method based on a homogeneous hidden Markov model, and belongs to the technical field of indoor scene recognition. The scene recognition method comprises an offline stage and an online stage; the offline stage comprises the following steps: S1, training a scene recognition model based on a neural network; s2, taking the probability of each scene output by the scene recognition model as an observation probability; the online stage comprises the following steps: S3, establishing an adjacent matrix; s4, calculating a state transition matrix based on the adjacent matrix, and then calculating a state transition probability; s5, after scene recognition is started, a first scene recognition result is calculated as an initial state, and then the probability of the current t + 1 moment is calculated in real time; and S6, after the probabilities of all the scenes are calculated, taking the scene with the maximum probability as the current estimation scene. By adopting the scene recognition method based on the homogeneous hidden Markov model, the scene recognition accuracy can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of indoor scene recognition, and in particular to a scene recognition method based on a homogeneous hidden Markov model. Background Art

[0002] As a current research hotspot, indoor scene recognition has a profound impact on people's daily lives. Indoor scene recognition helps to enhance the scene change perception ability of indoor positioning systems, provides a logical basis for implementing hybrid intelligent positioning strategies, selects positioning methods based on scene changes, and performs hybrid positioning to improve intelligent effects.

[0003] However, most of the current indoor scene recognition solutions only collect and train signal data from different spaces through machine learning algorithms, without taking into account the behavioral characteristics of people's indoor activities, and insufficiently utilizing spatial prior information. Therefore, the present invention proposes a scene recognition method based on a homogeneous hidden Markov model. Summary of the invention

[0004] The purpose of the present invention is to provide a scene recognition method based on a homogeneous hidden Markov model, which can effectively improve the scene recognition accuracy compared with the traditional scene recognition algorithm based on a neural network.

[0005] To achieve the above object, the present invention provides a scene recognition method based on a homogeneous hidden Markov model, the scene recognition method includes an offline stage and an online stage;

[0006] The offline phase includes the following sub-steps:

[0007] S1, scene recognition model based on neural network training;

[0008] S2, the probability of each scene output by the scene recognition model is used as the observation probability b(x|c i );

[0009] Among them, c i Indicates that the current scene is the state of scene i; x is the observed value;

[0010] The online phase consists of the following sub-steps:

[0011] S3, establish an adjacency matrix A;

[0012] S4, calculating the state transition probability based on the adjacency matrix A;

[0013] S5, after the scene recognition starts, the first scene recognition result is calculated as the initial state, and then the probability at the current time t+1 is calculated in real time;

[0014] S6. After calculating the probabilities of all scenarios, the scenario with the highest probability is used as the current estimated scenario.

[0015] Preferably, in step S1, the training sample for training the scene recognition model is X=[RSSI wifi 、RSSI ble 、RSSI uwb d wifi d uwb ];

[0016] Among them, RSSI wifi 、RSSI ble 、RSSI uwb d wifi d uwb They are the signal strength of Wi-Fi FTM, Bluetooth, and UWB, as well as the ranging results of Wi-Fi FTM and UWB.

[0017] Preferably, in step S1, one-hot encoding is used to represent the label, so that the scene recognition model outputs the probability of each scene, 1 indicates belonging to the scene, and 0 indicates not belonging to the scene.

[0018] Preferably, in step S1, the output layer of the scene recognition model uses a Softmax activation function to ensure that the number of output units is equal to the number of scenes.

[0019] Preferably, in step S3, the adjacency matrix A N×N =(a ij ), where N is the number of scenes, i and j are scene index numbers, i = 1, 2, ..., N, j = 1, 2, ..., N;

[0020] Element a in the adjacency matrix A ij Indicates the connection relationship between scenes. When scene i and scene j are adjacent, a ij =1; when scene i and scene j are not adjacent, a ij =0 o'clock;

[0021] In the adjacency matrix A, a ii =1.

[0022] Preferably, in step S4, the calculation formula for the state transition probability is as follows:

[0023]

[0024] Among them, π ij is the state transition probability, indicating the probability of transitioning from scene i to scene j; k is the scene number.

[0025] Preferably, in step S5, the initial state p0(x|c i)=b(x|c i ).

[0026] Preferably, in step S5, the probability at the current time t+1 is calculated as follows:

[0027]

[0028] Where j is the index of scene j; c j Indicates that the current scene is the state of scene j; π ji represents the probability of transitioning from scene j to scene i; p t (x|c j ) is the probability of observing the observation value x in scene j at the previous time t.

[0029] Therefore, the present invention adopts the above-mentioned scene recognition method based on homogeneous hidden Markov model, and the technical effects are as follows:

[0030] (1) Compared with the scene recognition algorithm based on neural network, the present invention effectively improves the scene recognition accuracy;

[0031] (2) The method proposed in the present invention can avoid scene jump phenomenon. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a schematic diagram of the scene recognition model;

[0033] Figure 2 This is a floor plan diagram of the experimental site building. DETAILED DESCRIPTION

[0034] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.

[0035] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.

[0036] Embodiment 1

[0037] Hidden Markov Model (HMM) is a statistical model used to model sequential data with a sequence of states. It consists of two main parts: a visible observation sequence and an invisible state sequence. The basic idea of ​​HMM is that at each moment there is an invisible state that generates visible observations, and there are transition probabilities between states. HMM has 4 main components:

[0038] (1) State: The state in HMM is invisible and represents the state at different time points, represented here by the scene number c.

[0039] (2) Observations: Observations are visible data sequences that represent phenomena or information observed at each point in time.

[0040] (3) State transition probability: The state transition probability represents the probability of transitioning from one state to another, expressed as π ij express.

[0041] (4) Observation probability: The observation probability represents the probability of observing a specific observation value under a specific state, usually expressed as conditional probability b(x|c).

[0042] like Figure 1 , which is a schematic diagram of a scene recognition model of the present invention, a scene recognition method based on a homogeneous hidden Markov model proposed in the present invention includes an offline stage and an online stage;

[0043] The offline phase includes the following sub-steps:

[0044] S1, scene recognition model based on neural network training;

[0045] The training sample is X = [RSSI wifi 、RSSI ble 、RSSI uwb d wifi d uwb ];

[0046] Among them, RSSI wifi 、RSSI ble 、RSSI uwb d wifi d uwb They are the signal strength of Wi-Fi FTM, Bluetooth, and UWB, as well as the ranging results of Wi-Fi FTM and UWB.

[0047] In order to make the output of the neural network represent the probability distribution of each category, one-hot encoding is used to represent the label so that the scene recognition model outputs the probability of each category. One-hot encoding maps each category to a vector in which only one element is 1 and the rest are 0. Each element represents a category, 1 means it belongs to the category, and 0 means it does not belong to the category.

[0048] The output layer of the scene recognition model uses the Softmax activation function to ensure that the number of output units is equal to the number of categories.

[0049] S2, the probability of each scene output by the scene recognition model is used as the observation probability b(x|c i );

[0050] The online phase consists of the following sub-steps:

[0051] S3, establish an adjacency matrix A;

[0052] Adjacency Matrix A N×N =(a ij ), where N is the number of scenes, i and j are scene index numbers, i = 1, 2, ..., N, j = 1, 2, ..., N.

[0053] Element a in the adjacency matrix A ij Indicates the connection relationship between scenes. When scene i and scene j are adjacent, a ij =1; when scene i and scene j are not adjacent, a ij =0 o'clock;

[0054] In the adjacency matrix A, a ii =1.

[0055] S4. Calculate the state transition probability based on the adjacency matrix A. The calculation formula is as follows:

[0056]

[0057] Among them, π ij is the state transition probability, which means the probability of transitioning from scene i to scene j; N is the number of scenes; k is the scene number.

[0058] S5, after the scene recognition starts, the first scene recognition result is calculated as the initial state, and then the probability at the current time t+1 is calculated in real time;

[0059] Initial state p0(x|c i )=b(x|c i ). That is, the initial state observation probability value is equal to the scene recognition result based on the neural network;

[0060] The probability at the current time t+1 is calculated as follows:

[0061]

[0062] Where j is the index of scene k; π ji represents the probability of transitioning from scene j to scene i; p t (x|c j ) is the probability of observing the observation value x in scene j at the previous time t.

[0063] S6. After calculating the probabilities of all scenarios, the scenario with the highest probability is used as the current estimated scenario.

[0064] The present invention is described below by means of specific examples.

[0065] In this embodiment, the experimental field is located on the first, second and third floors of a building. Figure 2As shown, the experimental field is 37.38 meters long and 41.23 meters wide, with a first floor height of 5 meters and a second floor height of 4.5 meters. The middle part of the experimental field is an escalator, and the two sides of the escalator are laboratories. In order to test the positioning effect of the method proposed in the present invention, a total of 6 scenes were selected for testing, among which scenes one, three, four, six and the top of the escalator were equipped with UWB and Wi-Fi FTM devices to test the three-dimensional positioning effect, and the remaining scenes were adjacent to the aforementioned scenes as adjacent scenes to test the scene recognition accuracy.

[0066] UWB and Wi-Fi FTM are located in Figure 2 In the figure, they are represented by red and green squares respectively. Google pixel 6 smartphone is selected as the experimental equipment to collect Wi-Fi FTM, UWB, Bluetooth, and barometer data, and multi-source signal acquisition software is used to collect and process the experimental data.

[0067] Before inputting the training data and test data into the neural network training and real-time scene recognition, the data needs to be preprocessed to remove useless base station data. Useless base station data mainly refers to the noise data in the entire training set and test data set, which comes from the Bluetooth or Wi-Fi hotspots turned on by other users' mobile phones during the collection process. In addition, in view of the particularity of the signal strength data type, the 0 value data in the data set is replaced with -115, indicating that the user is far away or cannot receive valid signal strength data. After data preprocessing, the number of data set attributes is reduced from 310 to 283, indicating that 27 attribute data belong to the category of invalid data. The data is input into the neural network for training, and then 6 indoor scene recognition training and testing are carried out based on the homogeneous hidden Markov model.

[0068] First, we tested the classification probability model based on neural network. For comparison, we trained other machine learning methods such as decision tree, KNN, linear SVM, naive Bayes, etc. using the same data set, and counted the training time and scene recognition accuracy of each algorithm. The comparison of training time and scene recognition accuracy of each method is shown in Table 1 and Table 2.

[0069] Table 1 Comparison of scene recognition performance of various algorithms

[0070]

[0071]

[0072] Table 2 Recognition accuracy of different scenes for different classifiers

[0073] method Scene 1 Scene 2 Scene 3 Scene 4 Scene 5 Scene 6 Neural Networks 98.77% 98.0% 100% 97.3% 99.0% 100% Decision Tree 74.17% 64.13% 83.18% 91.33% 97.2% 88.65% KNN 86.6% 74.0% 93.6% 94.04% 95.2% 96.38% Linear SVM 98.57% 99.73% 100% 95.3% 99.9% 100% Naive Bayes 98.71% 98.3% 99.78% 97.53% 98.3% 98.73%

[0074] From Table 1 and Table 2, we can see that in terms of recognition accuracy, the decision tree and KNN have poor results in the overall scene recognition rate and single scene recognition rate, the neural network and linear SVM have high scene recognition accuracy, and the naive Bayes scene recognition rate is slightly lower than the neural network and linear SVM. The recognition accuracy in each sub-scene is also high, but its training time is the longest. In terms of training time, the neural network takes a little longer, but it does not need to adjust parameters, which can save a lot of time.

[0075] Table 3 Confusion matrix of neural network classifier scene recognition

[0076] Recognition rate Scene 1 Scene 2 Scene 3 Scene 4 Scene 5 Scene 6 Scene 1 98.77% 1.14% 0.09% 0.0 0.0 0.0 Scene 2 1.94% 98.0% 0.06% 0.0 0.0 0.0 Scene 3 0.0 0.0 100% 0.0 0.0 0.0 Scene 4 0.0 0.0 0.0 97.3% 2.7% 0.0 Scene 5 0.0 0.0 0.0 1.0% 99.0% 0.0 Scene 6 0.0 0.0 0.0 0.0 0.0 100%

[0077] Table 3 shows the scene recognition confusion matrix based on the neural network method. The columns represent the real categories of the scenes, and the rows represent the predicted categories of the scenes. It can be found from Table 3 that spatially adjacent scenes are more prone to recognition errors. For example, between scene 1 and scene 2, there are two adjacent rooms, which will cause recognition errors. In order to suppress this situation, the present invention proposes a scene recognition algorithm based on a homogeneous hidden Markov model on this basis. The confusion matrix based on the homogeneous hidden Markov model is shown in Table 4.

[0078] Table 4 Confusion matrix of scene recognition based on homogeneous hidden Markov model

[0079] Recognition rate Scene 1 Scene 2 Scene 3 Scene 4 Scene 5 Scene 6 Scene 1 100% 0.0 0.0 0.0 0.3% 0.0 Scene 2 0.87% 99.13% 0.0 0.0 0.0 0.0 Scene 3 0.0 0.0 100% 0.0 0.0 0.0 Scene 4 0.0 0.0 0.0 99.74% 0.26% 0.0 Scene 5 0.0 0.0 0.0 0.88% 99.12% 0.0 Scene 6 0.0 0.0 0.0 0.0 0.0 100%

[0080] When the homogeneous hidden Markov model is used to constrain scene recognition, the overall recognition accuracy of the six scenes is 99.66%, which is 0.82% higher than the 98.84% recognition rate based on the neural network classifier alone. In addition to improving the scene recognition accuracy, the Markov model can limit scene recognition errors to adjacent scenes, avoiding the phenomenon of rapid scene jumps during real-time scene recognition.

[0081] It is worth noting that the contents not elaborated in detail above are well known to those skilled in the art.

[0082] Therefore, the present invention adopts the above-mentioned scene recognition method based on the homogeneous hidden Markov model. Compared with the traditional scene recognition algorithm based on the neural network, this method can effectively improve the scene recognition accuracy.

[0083] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A scene recognition method based on a homogeneous hidden Markov model, characterized in that: The scene recognition method includes an offline phase and an online phase; The offline phase includes the following sub-steps: S1, scene recognition model based on neural network training; S2, the probability of each scene output by the scene recognition model is used as the observation probability b(x|c i ); Among them, c i Indicates that the current scene is the state of scene i; x is the observed value; The online phase consists of the following sub-steps: S3, establish an adjacency matrix A; S4, calculating the state transition probability based on the adjacency matrix A; S5, after the scene recognition starts, the first scene recognition result is calculated as the initial state, and then the probability at the current time t+1 is calculated in real time; S6. After calculating the probabilities of all scenarios, the scenario with the highest probability is used as the current estimated scenario.

2. A scene recognition method based on a homogeneous hidden Markov model according to claim 1, characterized in that: In step S1, the training sample of the training scene recognition model is X=[RSSI wifi 、RSSI ble 、RSSI uwb d wifi d uwb ]; Among them, RSSI wifi 、RSSI ble 、RSSI uwb d wifi d uwb They are the signal strength of Wi-Fi FTM, Bluetooth, and UWB, as well as the ranging results of Wi-Fi FTM and UWB.

3. A scene recognition method based on a homogeneous hidden Markov model according to claim 2, characterized in that: In step S1, one-hot encoding is used to represent the label so that the scene recognition model outputs the probability of each scene, 1 indicates that it belongs to the scene, and 0 indicates that it does not belong to the scene.

4. A scene recognition method based on a homogeneous hidden Markov model according to claim 3, characterized in that: In step S1, the output layer of the scene recognition model uses the Softmax activation function to ensure that the number of output units is equal to the number of scenes.

5. A scene recognition method based on a homogeneous hidden Markov model according to claim 4, characterized in that: In step S3, the adjacency matrix A N×N =(a ij ), where N is the number of scenes, i and j are scene index numbers, i = 1, 2, ..., N, j = 1, 2, ..., N; Element a in the adjacency matrix A ij Indicates the connection relationship between scenes. When scene i and scene j are adjacent, a ij =1; When scene i and scene j are not adjacent, a ij =0 o'clock; In the adjacency matrix A, a ij =1.

6. A scene recognition method based on a homogeneous hidden Markov model according to claim 5, characterized in that: In step S4, the calculation formula of the state transition probability is as follows: Among them, π ij is the state transition probability, indicating the probability of transitioning from scene i to scene j; k is the scene number.

7. A scene recognition method based on a homogeneous hidden Markov model according to claim 6, characterized in that: In step S5, the initial state p0(x|c i )=b(x|c i ).

8. The scene recognition method based on homogeneous hidden Markov model according to claim 7, characterized in that: In step S5, the probability at the current time t+1 is calculated as follows: Where j is the index of scene j; c j Indicates that the current scene is the state of scene j; π ji represents the probability of transitioning from scene j to scene i; p t (x|c j ) is the probability of observing the observation value x in scene j at the previous time t.