Disclosure of Invention
In view of the above analysis, embodiments of the present invention are directed to a method and a system for fall detection based on a category imbalance signal, so as to solve the problem that it is difficult to accurately identify a fall event signal from a large amount of daily activities due to the imbalance of categories in the conventional fall detection.
In one aspect, an embodiment of the present invention provides a fall detection method based on a category unbalanced signal, including:
acquiring action test data of a user acquired by intelligent wearable equipment in real time; the motion test data comprises: acceleration data and angular velocity values;
inputting the motion test data into an optimal deep learning model, identifying motion types of the motion test data, and acquiring probability values of the motion types;
comparing the probability value of each action category with an optimal threshold value, and predicting the action category corresponding to the action test data;
and the optimal threshold is used for shifting the prediction result to the action type with low occurrence probability according to the unbalance rate of the sample data set used in the deep learning model training.
Further, the optimal deep learning model comprises:
the residual error connecting module is used for extracting the characteristics of the motion test data;
the fully-connected softmax layer is used for classifying the motion test data characteristics and outputting probability values of the motion test data corresponding to the motion categories;
and the threshold moving algorithm layer is used for adjusting the classification threshold, acquiring the optimal threshold, and judging the action type of the action test data according to the relation between the probability value of each action type and the optimal threshold.
Further, the adjusting the classification threshold to obtain the optimal threshold includes:
acquiring a sample data set, dividing data in the sample data set into daily activity sample data and fall sample data, and counting the number of the daily activity sample data and the number of the fall sample data;
calculating the sample unbalance rate according to the ratio of the number of the daily life sample data to the number of the falling sample data;
adjusting a classification threshold according to the sample unbalance rate, and determining the optimal threshold, wherein the optimal threshold is a falling action threshold lambda*。
Further, the optimum threshold λ*Expressed as:
λ*=k×e-ρ/a+b
wherein λ is*K is the default threshold of the classifier, ρ is the imbalance rate of the sample data set, a and b are constants, nmaxNumber of daily data, n, for sample data setminThe number of fall sample data in the sample data set.
Further, the action categories include fall actions and daily activity actions; judging the action type of the action test data according to the relation between the probability value of each action type and the optimal threshold, wherein the action type comprises the following steps:
when a fall probability value p and an optimal threshold lambda are output by certain action test data*Comparing if p is more than or equal to lambda*If so, the optimal deep learning model predicts that the motion test data is a falling motion;
when the daily activity probability value q of a certain action test data output and the optimal threshold lambda*Comparing if q is less than or equal to 1-lambda*And predicting the motion test data to be the falling motion by the optimal deep learning model.
Further, the residual connecting module includes:
the convolution layer is used for extracting characteristic information in the original data;
the batch normalization layer is used for carrying out normalization processing on the characteristic information and then carrying out nonlinear calculation on the activation function;
and the residual connection computing unit is used for linearly superposing the extracted characteristic information and the original data.
Further, the convolutional layer comprises: a first convolution layer and a second convolution layer;
the batch normalization layer includes: a first batch of normalization layers and a second batch of normalization layers;
the residual error connecting module comprises four first to fourth residual error connecting units which are sequentially connected, and the first to fourth residual error connecting units all comprise the following components in sequence: the first convolution layer, the first batch of normalization layers, the second convolution layer, the second batch of normalization layers and the residual error connection calculation subunit;
the first convolution layer and the second convolution layer in the first residual error connection unit respectively comprise 64 convolution kernels;
the first convolution layer and the second convolution layer in the second residual connecting unit respectively comprise 128 convolution kernels;
the first convolution layer and the second convolution layer in the third residual connecting unit respectively comprise 256 convolution kernels;
the first convolution layer and the second convolution layer in the fourth residual connection unit both comprise 512 convolution kernels;
all convolution kernels in the first to fourth residual connecting units are 1x3 convolution kernels.
Further, in the process of model training of the deep learning model, the error of the model training process is calculated through a cross entropy loss function, and when the error is stable, the deep learning model is the optimal deep learning model.
In another aspect, an embodiment of the present invention provides a fall detection system based on a category imbalance signal, including:
the data acquisition module is used for acquiring action test data of the user, which is acquired by the intelligent wearable equipment, in real time; the motion test data comprises: acceleration data and angular velocity values;
the probability calculation module is used for inputting the motion test data into an optimal deep learning model, performing motion category identification on the motion test data and acquiring probability values of all motion categories;
the prediction module is used for comparing the probability value of each action category with an optimal threshold value and predicting the action category corresponding to the action test data; and the optimal threshold is used for shifting the prediction result to the action type with low occurrence probability according to the unbalance rate of the sample data set used in the deep learning model training.
Further, the optimal deep learning model in the probability calculation module comprises:
the residual error connecting module is used for extracting the characteristics of the motion test data;
the fully-connected softmax layer is used for classifying the motion test data characteristics and outputting probability values of the motion test data corresponding to the motion categories;
and the threshold moving algorithm layer is used for adjusting the classification threshold, acquiring the optimal threshold, and judging the action type of the action test data according to the relation between the probability value of each action type and the optimal threshold.
Compared with the prior art, the invention can realize at least one of the following beneficial effects:
1. according to the invention, the unbalanced category condition of real life activities is optimized by an algorithm value moving method, so that the prediction result of the optimal deep learning model moves to a small number of falling data categories, the deviation of most daily activity categories is reduced, the model can be ensured to detect accidental falling event data with low occurrence probability from a large number of daily activity data, and the detection precision is high;
2. based on a deep learning network model, the deep learning method can automatically identify deep features from mass data and adjust the parameters of the model, compared with the traditional algorithm model, the method can more accurately detect and identify the falling event, the network model is trained and the parameters are adjusted through the category unbalance data collected in the real life, the trained model has good detection capability on the falling event with small probability, falling data signals can be identified from mass daily activity data, and the condition of missed detection is reduced;
3. according to the invention, the real life falling data set is established after certain preprocessing is carried out according to the data acquired by the accelerometer and the gyroscope in the intelligent wearable device, and the established type unbalanced falling detection model is trained and tested on the real life falling data set, so that the intelligent wearable device is more suitable for being applied to real life.
In the invention, the technical schemes can be combined with each other to realize more preferable combination schemes. Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.
Detailed Description
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate preferred embodiments of the invention and together with the description, serve to explain the principles of the invention and not to limit the scope of the invention.
As shown in fig. 1, an embodiment of the present invention discloses a fall detection method based on a category imbalance signal, which includes:
s10, acquiring action test data of the user acquired by the intelligent wearable equipment in real time; the motion test data comprises: acceleration data and angular velocity values; specifically, acceleration data and angular velocity values of various action categories of a user in daily life are collected according to an accelerometer and a gyroscope of the intelligent wearable device on the user. In particular, the accelerometer and gyroscope are integrated on the smart wearable device, the position of which relative to the wearable device is fixed, optionally, one wearable device comprising one accelerometer and one gyroscope, the wearable device being fixed on the waist of the user.
S20, inputting the motion test data into an optimal deep learning model, identifying motion types of the motion test data, and acquiring probability values of the motion types; in particular, the categories of actions include fall actions and daily activity actions; and inputting the acceleration data and the angular velocity value in the real-time collected data into an optimal deep learning model, and outputting a falling action probability value and a daily activity action probability value corresponding to the real-time collected data by the optimal deep learning model.
As shown in fig. 2, the optimal deep learning model includes:
a residual error connection module 10, configured to perform feature extraction on the motion test data;
the fully-connected softmax layer 20 is used for classifying the motion test data characteristics and outputting probability values of the motion test data corresponding to the motion categories;
and the threshold moving algorithm layer 30 is configured to adjust the classification threshold, obtain an optimal threshold, and determine the action category of the action test data according to a relationship between the probability value of each action category and the optimal threshold.
S30, comparing the probability value of each action type with an optimal threshold value, and predicting the action type corresponding to the action test data; and the optimal threshold is used for shifting the prediction result to the action type with low occurrence probability according to the unbalance rate of the sample data set used in the deep learning model training. Specifically, the falling action probability value and the daily activity action probability value are compared with an optimal threshold value to predict whether a falling action occurs. Specifically, the determining the action category of the action test data according to the relationship between the probability value of each action category and the optimal threshold includes:
when a fall probability value p and an optimal threshold lambda are output by certain action test data*Comparing if p is more than or equal to lambda*If so, the optimal deep learning model predicts that the motion test data is a falling motion;
when the daily activity probability value q of a certain action test data output and the optimal threshold lambda*Comparing if q is less than or equal to 1-lambda*And predicting the motion test data to be the falling motion by the optimal deep learning model.
After a deep learning model is built, the model is trained by using a training set and a verification set, parameters in the model are determined, in a life application scene, data of an accelerometer and a gyroscope are collected by user wearable equipment in real time, as shown in fig. 3, data within 3s before and after a peak value of the data are marked as falling actions, continuous time sequence data are intercepted into fragments by using a sliding window with the width of 1s, and after the real-time collection is preprocessed, the data are input into the trained model to predict whether a falling event occurs.
The method described above focuses on training the optimal deep learning model and determining the optimal threshold, and therefore, this embodiment provides a specific training method for the optimal deep learning model and a specific determining method for the optimal threshold, which are specifically as follows:
specifically, as shown in fig. 2, the deep learning model includes:
a residual error connection module 10, configured to perform feature extraction on the motion test data; specifically, the residual error connection module 10 includes: the convolution layer is used for extracting characteristic information in the original signal; the batch normalization layer is used for carrying out normalization processing on the characteristic information and then carrying out nonlinear calculation on the activation function; and the residual connection computing unit is used for linearly superposing the extracted characteristic information and the original data. Specifically, the residual error connection calculation unit may be introduced to skip one or more layers, and linearly superimpose the input original data and the feature information extracted from the original data through nonlinear change, so that on one hand, the residual error connection module 10 can better fit a classification function to obtain higher classification accuracy, and on the other hand, the residual error connection module 10 solves the problem of optimization training of the network when the number of layers is deepened.
Specifically, in the deep learning model training process, the training process of the residual error connection module is divided into two stages, specifically, the first stage is a stage in which data is propagated from a lower level to a higher level, i.e., a forward propagation stage, and the second stage is a process in which an error is propagated and trained from a higher level to a lower level when a result obtained by current forward propagation does not match an expected result, i.e., a backward propagation stage. Specifically, the training process of the residual error connection module 10 is as follows: 1. initializing a weight value by the network; 2. the input data is propagated forwards through the convolution layer and the like to obtain an output value; 3. calculating the error between the output value of the network and the target value; 4. when the error is larger than 0, the error is transmitted back to the network; 5. and updating the weight according to the obtained error, and then carrying out forward propagation calculation again.
Specifically, the residual connecting module 10 includes four first to fourth residual connecting units connected in sequence, and specifically, as shown in fig. 4, each residual connecting unit includes: a first convolution layer, a first Batch Normalization layer, a second convolution layer, a second Batch Normalization layer and a residual connection calculation subunit; the first convolution layer and the second convolution layer in the first residual connection unit respectively comprise 64 convolution kernels, the first convolution layer and the second convolution layer in the second residual connection unit respectively comprise 128 convolution kernels, the first convolution layer and the second convolution layer in the third residual connection unit respectively comprise 256 convolution kernels, and the first convolution layer and the second convolution layer in the fourth residual connection unit respectively comprise 512 convolution kernels; more specifically, all convolution kernels in the first to fourth residual connecting units are 1 × 3 convolution kernels; the stacking of four residual connecting units and the number of convolution kernels are increased so as to better extract the characteristics of the data deep level.
Specifically, time sequence data of an accelerometer and a gyroscope of a person in daily life are collected according to intelligent wearable equipment on a large number of users, and a sample data set of daily activities and falls of the person is formed; specifically, in the process of establishing the data set, daily life data and fall simulation data of a plurality of users are collected, a sample data set containing a large amount of data is established, and parameters of the algorithm model are adjusted before the sample data set is used, so that the error of model prediction is reduced.
Randomly dividing the sample data set into a training set and a verification set according to the proportion of 3: 1; preprocessing the data in the originally acquired sample data set, specifically, the preprocessing includes data segmentation and labeling: the data of each segment is marked, 0 represents daily activity action data, 1 represents falling event action data, and the original continuous data is cut into segments by using a sliding window.
Specifically, before the residual error connection module 10 is trained, the original parameters of the residual error connection module 10 are initialized, the weight parameters adopt an Xavier initialization mode, and the bias parameters adopt an all-0 initialization mode; and taking the training set as the input of the residual connecting module 10, training the residual connecting module 10 for multiple times, wherein after multiple parameter adjustment and training, the error is reduced along with the number of times of model back propagation calculation, and when the number of calculation times is large enough, the error of the model is rapidly reduced from the initial training and tends to be stable, so that the network model weight which is well represented in the test set is obtained. Optionally, in this embodiment, the function for calculating the error by the residual connecting module 10 uses a cross entropy loss function, and it is found through experiments that the error of the model is stable after 50 times of back propagation calculation, so the training calculation parameter of the model is set to be 50, and the model training is finished after 50 times of back propagation calculation.
In the embodiment of the fully-connected softmax layer, firstly, input data is converted into output with the same number as the number of classes through the weight matrix obtained by the residual error connection module 10, and then, the output probabilities of the classes are converted into probabilities within the range of 0 to 1 through a softmax activation function, and the sum of the probabilities of all the classes is ensured to be 1. And comparing the probability value of each action category corresponding to the action test data output by the fully-connected softmax layer 20 with the optimal threshold value, and predicting the action category corresponding to the action test data.
In the deep learning network, with the increase of the network depth, the features in the sample data set can be better extracted, the model performance is better, but with the increase of the network depth, the problems of gradient disappearance and the like are also brought. The residual connecting module 10 can well solve the problems of gradient disappearance and gradient explosion of the deep learning model.
Specifically, the adjusting the classification threshold to obtain the optimal threshold includes:
s100, acquiring a sample data set, dividing data in the sample data set into daily activity sample data and falling sample data, and counting the number of the daily activity sample data and the number of the falling sample data;
s200, calculating the sample unbalance rate according to the ratio of the number of the daily life sample data to the number of the falling sample data;
s300, adjusting a classification threshold according to the sample unbalance rate, and determining the optimal threshold, wherein the optimal threshold is a falling action threshold lambda*. The optimum threshold value lambda*Expressed as:
λ*=k×e-ρ/a+b
wherein λ is*K is the default threshold of the classifier, ρ is the imbalance rate of the sample data set, a and b are constants, nmaxNumber of daily data, n, for sample data setminThe number of fall sample data in the sample data set. Optionally, the default threshold k of the classifier is 0.5; a and b are determined through a threshold value moving function curve, and the threshold value moving function curve is obtained by fitting according to falling motion test threshold values corresponding to different unbalance rates in an experimental data set;
specifically, the obtaining of the threshold moving function curve obtained by fitting the experimental data specifically includes:
acquiring an experimental data set, dividing the experimental data set into a training set and a test set, performing feature extraction on the input training set by using a threshold value moving algorithm layer in a deep learning model, and outputting a falling action probability value p 'and a daily activity action probability value q' corresponding to the data, wherein p '+ q' is 1, and the falling action threshold value is set to be lambda ', and the daily activity action threshold value is 1-lambda';
when the probability value p 'of the falling action corresponding to the output data is more than or equal to lambda', classifying the prediction result as the falling action; when the probability value q 'of the daily activity actions is more than or equal to 1-lambda', classifying the prediction result as the daily activity actions; when the falling action threshold value meets the formula (1), the falling action threshold value is a falling action test threshold value corresponding to the unbalance rate of the experimental data set

As shown in fig. 5, a threshold movement function curve is obtained by fitting different imbalance rates and fall action test thresholds, where a in the graph is a fall action test threshold point corresponding to different imbalance rates, and the curve is a threshold movement function curve obtained by fitting according to the fall action test thresholds and the imbalance rates. Corresponding falling action test threshold values under different unbalance rates
Expressed as:
wherein f represents a small numberProbability of occurrence of several types of data (i.e. fall maneuver data) in the training set, fλ′Which represents the probability that the minority of classes of data predicted at the threshold lambda', i.e. fall motion data, is in the test set.
The higher the imbalance rate of the raw data collected, the more the threshold of the classifier shifts to a few classes. The optimal threshold determined by the optimal threshold determination formula can improve the classification precision of the deep learning model on the category unbalanced data, and reduce the missing detection of a few categories.
Compared with the prior art, in the fall detection method based on the category unbalanced signal, the category unbalanced condition of real life activities is optimized by an algorithm value moving method, so that the prediction result of the optimal deep learning model moves to a small number of fall data categories, the deviation of most daily activity categories is reduced, the model can detect accidental fall incident data with low occurrence probability from a large amount of daily activity data, and the detection precision is high; based on a deep learning network model, the deep learning method can automatically identify deep features from mass data and adjust the parameters of the model, compared with the traditional algorithm model, the method can more accurately detect and identify the falling event, the network model is trained and the parameters are adjusted through the category unbalance data collected in the real life, the trained model has good detection capability on the falling event with small probability, falling data signals can be identified from mass daily activity data, and the condition of missed detection is reduced; finally, according to data collected by an accelerometer and a gyroscope in the intelligent wearable device, the real life falling data set is established after certain preprocessing, and the established type unbalanced falling detection model is used for training and testing the real life falling data set, so that the intelligent wearable device is more suitable for being applied to real life.
As shown in fig. 6, an embodiment of the present invention discloses a fall detection system based on a category imbalance signal, including:
the data acquisition module 10 is used for acquiring action test data of a user, which is acquired by the intelligent wearable device, in real time; the motion test data comprises: acceleration data and angular velocity values;
the probability calculation module 20 is configured to input the motion test data into an optimal deep learning model, perform motion category identification on the motion test data, and obtain probability values of the motion categories;
a prediction module 30, configured to compare the probability values of the motion categories with an optimal threshold, and predict motion categories corresponding to the motion test data; and the optimal threshold is used for shifting the prediction result to the action type with low occurrence probability according to the unbalance rate of the sample data set used in the deep learning model training.
Specifically, the optimal deep learning model in the probability calculation module includes:
the residual error connecting module is used for extracting the characteristics of the motion test data;
the fully-connected softmax layer is used for classifying the motion test data characteristics and outputting probability values of the motion test data corresponding to the motion categories;
and the threshold moving algorithm layer is used for adjusting the classification threshold, acquiring the optimal threshold, and judging the action type of the action test data according to the relation between the probability value of each action type and the optimal threshold. Specifically, the threshold moving algorithm layer includes:
the system comprises a sample data acquisition unit, a data processing unit and a data processing unit, wherein the sample data acquisition unit is used for acquiring a sample data set, dividing data in the sample data set into daily activity sample data and falling sample data, and counting the number of the daily activity sample data and the number of the falling sample data;
the unbalance rate obtaining unit is used for calculating the sample unbalance rate according to the ratio of the number of the daily life sample data to the number of the falling sample data;
an optimal threshold confirming unit, configured to adjust a classification threshold according to the sample imbalance rate, and determine the optimal threshold, where the optimal threshold is a fall motion threshold λ*(ii) a The optimum threshold value lambda*Expressed as:
λ*=k×e-ρ/a+b
wherein λ is*K is the default threshold of the classifier, ρ is the imbalance rate of the sample data set, a and b are constants, nmaxNumber of daily data, n, for sample data setminThe number of fall sample data in the sample data set.
Those skilled in the art will appreciate that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program, which is stored in a computer readable storage medium, to instruct related hardware. The computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention.