Disclosure of Invention
The invention aims to solve the defects of the prior art and provides a new neural network framework, wherein a convolutional neural network and a bidirectional long-short term memory neural network are used for respectively distinguishing static posture characteristics and dynamic action characteristics of personnel, so that the calculation complexity is reduced; and in addition, a unidirectional long-term and short-term memory neural network is embedded into a uniform feature space, so that dynamic and static features are effectively fused. And finally, outputting a final suicide tendency classification result through a softmax function.
The purpose of the invention is realized by at least one of the following technical solutions.
A suicide risk assessment method based on a body language comprises the following steps:
s1, capturing the limb behavior data of the video acquisition personnel by using kinect as input data;
s2, dividing the input data into static postures and dynamic actions, and respectively extracting the characteristics of the static postures and the characteristics of the dynamic actions by using a convolutional neural network and a bidirectional long-short term memory neural network;
s3, a long-short term memory neural network is used for effectively fusing the characteristics of static postures and the characteristics of dynamic actions to be unified to the same characteristic space;
and S4, outputting whether the person has suicide tendency or not through the softmax layer.
Further, in step S2, the static gesture recognition is specifically as follows:
inputting frames in a video into a Convolutional Neural Network (CNN) for training and testing, inputting the frames into video frames, and outputting the video frames into static posture categories corresponding to people in the video frames, wherein the static posture categories comprise right arm uplift, right shoulder uplift, head right inclination, body right inclination, left arm uplift, left shoulder uplift, head left inclination, body straightness and two-hand crossing; CNN uses partial filters to compute convolution, i.e. inner product operation using local submatrices of the entries and local filters.
Further, the Convolutional Neural Network (CNN) includes an input layer, 2 convolutional layers, 2 pooling layers, and a full-link layer, where each pooling layer is a next layer of each convolutional layer;
the input of the input layer is represented as
x
mnRepresents the mth row and the nth column in the input matrix;
the formula for the convolutional layer is as follows:
wherein l represents the l-th convolutionLayer, i represents the ith component of the convolution output matrix; j represents the jth output matrix; j is in the range of 0, N]Where N represents the number of convolution output matrices;
a value representing the ith component of the jth output matrix of the ith convolutional layer;
representing the value of the ith component of the kth input matrix of the l convolutional layer, b
jDenotes the offset of the jth output matrix, m denotes the number of convolution kernels, a denotes the a-th convolution kernel,
representing the weight of the kth matrix of the a-th convolution kernel; f is a non-linear sigmoid-type function;
in pooling layers, mean pooling is used, with the input to each mean pooling layer coming from the immediately preceding convolutional layer and the output as the input to the next convolutional layer, and the calculation formula is as follows:
wherein ,
represents the local output after the pooling process of the pooling layer under the first convolutional layer is finished,
is the ith component of the jth output matrix of the convolutional layer;
the calculation formula of the full connection layer is as follows:
wherein ,f
rOutput, ω, representing the r-th component of the fully-connected layer
rRepresenting the r-th matrixThe weight value of the weight is calculated,
representing the ith component of the 2 nd pooling layer's ith output matrix.
Further, in step S2, the dynamic motion recognition specifically includes the following steps:
executing human body positioning and tracking through an application program interface built in the Kinect; when a human body enters a working space of the robot, the human body is detected through the characteristics of the 3D data, and a human body skeleton is calculated through an API (application programming interface) to obtain skeleton points;
numbering 15 skeleton points from top to bottom and from left to right; coordinates of the 15 skeleton joint points are coordinates of Kinect; detecting human body skeleton point data in real time by using the Kinect, and calculating the behavior characteristics of the human body by using the skeleton point data;
preprocessing the skeleton point data: the acquisition process limits the matrix size to 15 × 3, where 15 denotes the number of skeleton points and 3 denotes the three-dimensional coordinates of each skeleton point, i.e., p ═ p (p ═ p)x,py,pz) Representing the coordinates of the skeleton points in the x, y and z axes, respectively; extracting the motion sequence characteristics of a skeleton point through a Recurrent Neural Network (RNN), and encoding the skeleton point sequence corresponding to continuous actions, namely N set actions into a vector defined as { h }NProcessing { h } by using two-way long-short term memory neural network with conditional random fieldN}。
Further, the recurrent neural network includes an input layer, a hidden layer, and an output layer, specifically as follows:
the input of the input layer is denoted as h0={p1,p2,...pT}, wherein ptDenotes the T-th coordinate, and T represents the total number of coordinates.
The calculation formula of the hidden layer is as follows:
st=f(Wxhh0+Whhst-1); (11)
wherein ,stW being the state of the hidden layer at time txhAs a weight matrix from the input layer to the hidden layer, WhhFrom a hidden layer to a hidden layerHiding a weight matrix of the layer, wherein f is an activation function;
the calculation formula of the output layer is as follows:
ht=g(V·st); (12)
wherein ,htFor output at time t, g is the activation function and V is the weight matrix.
Finally, for the Nth time, the output h is output0To hNSequentially constructing a sequence to obtain
{hN}={h0,h1,...,hN}。
Further, given an input sequence hN}={h0,h1,...,hNThe output calculation formula of the hidden layer of the bidirectional long and short term memory neural network is as follows:
lt=σh(Wxhht+Whhlt-1+bh); (13)
wherein ,ltFor the output of the hidden layer at time t, WxhAs a weight matrix from the input layer to the hidden layer, WhhAs a weight matrix from hidden layer to hidden layer, bhFor concealing the bias of the layer, σhRepresenting an activation function; the bidirectional long-short term memory neural network hidden layer (Bi-LSTM) is used for strengthening bilateral relation, and the first layer is forward LSTM, and the second layer is backward LSTM.
Further, in step S3, the long-short term memory neural network is used to effectively embed into the unified feature space, which is as follows:
using x
sm and x
dmTo represent the extracted static gesture features and dynamic motion features separately and directly connect them as x
c=(x
sm,x
dm),x
cIs a persistent feature vector; then x is put
cEmbedded as x via an LSTM
eThe LSTM uses the forward LSTM of Bi-LSTM extracted dynamic motion features in step S2; after the embedding process is finished, for x
c and x
ePerforming element-by-element multiplication to obtain the cross effect of two vectors; after multiplication, cross effect characteristics are measuredAnd x
eConnect again to add the original information back; x needs a normalized self-organizing map to
The normalized x size is N × 1.
Further, in step S4, the final result is classified by using the softmax function, and the calculation formula is as follows:
wherein ,WeA weight matrix of the e-th emotional tendency is adopted, and b represents the bias of the weight matrix; the emotional tendency categories are suicidal emotional tendency and no suicidal emotional tendency, respectively.
Compared with the prior art, the invention has the following beneficial effects:
(1) the invention uses the kinect with the infrared camera to collect data, and can effectively prevent the image from being influenced by illumination.
(2) The invention simultaneously uses the static posture characteristic and the dynamic action characteristic of people, and can effectively improve the accuracy of emotion recognition.
(3) The invention embeds the dynamic and static characteristics of people into a uniform characteristic space, and ensures that the characteristics can be used more effectively and coordinately.
Example (b):
a suicide risk assessment method based on body language, as shown in fig. 1, includes the following steps:
s1, in the embodiment, a kinect placed in a range of 5 meters is used for capturing the body behavior data of the person staying in the room, and the body behavior data is used as input data;
s2, as shown in fig. 2, dividing the input data into static posture and dynamic action, and extracting the features of the static posture and the features of the dynamic action by using a convolutional neural network and a bidirectional long-short term memory neural network, respectively;
the static gesture recognition is specifically as follows:
inputting frames in a video into a Convolutional Neural Network (CNN) for training and testing, inputting the frames into video frames, and outputting the video frames into static posture categories corresponding to people in the video frames, wherein the static posture categories comprise right arm uplift, right shoulder uplift, head right inclination, body right inclination, left arm uplift, left shoulder uplift, head left inclination, body straightness and two-hand crossing; CNN uses partial filters to compute convolution, i.e. inner product operation using local submatrices of the entries and local filters.
The Convolutional Neural Network (CNN) comprises an input layer, 2 convolutional layers, 2 pooling layers and a full-connection layer, wherein each pooling layer is the next layer of each convolutional layer;
the input of the input layer is represented as
x
mnRepresents the mth row and the nth column in the input matrix;
the formula for the convolutional layer is as follows:
wherein l represents the l convolutional layer, and i represents the i component of the convolutional output matrix; j represents the jth output matrix; j is in the range of 0, N]Where N represents the number of convolution output matrices;
to representThe value of the ith component of the jth output matrix of the jth convolutional layer;
representing the value of the ith component of the kth input matrix of the l convolutional layer, b
jDenotes the offset of the jth output matrix, m denotes the number of convolution kernels, a denotes the a-th convolution kernel,
representing the weight of the kth matrix of the a-th convolution kernel; f is a non-linear sigmoid-type function;
in pooling layers, mean pooling is used, with the input to each mean pooling layer coming from the immediately preceding convolutional layer and the output as the input to the next convolutional layer, and the calculation formula is as follows:
wherein ,
represents the local output after the pooling process of the pooling layer under the first convolutional layer is finished,
is the ith component of the jth output matrix of the convolutional layer;
the calculation formula of the full connection layer is as follows:
wherein ,f
rOutput, ω, representing the r-th component of the fully-connected layer
rThe weight values of the r-th matrix are represented,
representing the ith component of the 2 nd pooling layer's ith output matrix.
The dynamic action recognition is specifically as follows:
executing human body positioning and tracking through an application program interface built in the Kinect; when a human body enters a working space of the robot, the human body is detected through the characteristics of the 3D data, and a human body skeleton is calculated through an API (application programming interface) to obtain skeleton points;
numbering 15 skeleton points from top to bottom and from left to right; coordinates of the 15 skeleton joint points are coordinates of Kinect; detecting human body skeleton point data in real time by using the Kinect, and calculating the behavior characteristics of the human body by using the skeleton point data;
preprocessing the skeleton point data: the acquisition process limits the matrix size to 15 × 3, where 15 denotes the number of skeleton points and 3 denotes the three-dimensional coordinates of each skeleton point, i.e., p ═ p (p ═ p)x,py,pz) Representing the coordinates of the skeleton points in the x, y and z axes, respectively; extracting the motion sequence characteristics of a skeleton point through a Recurrent Neural Network (RNN), and encoding the skeleton point sequence corresponding to continuous actions, namely N set actions into a vector defined as { h }N}; the recurrent neural network comprises an input layer, a hidden layer and an output layer, and specifically comprises the following steps:
the input of the input layer is denoted as h0={p1,p2,...pT}, wherein ptDenotes the T-th coordinate, and T represents the total number of coordinates.
The calculation formula of the hidden layer is as follows:
st=f(Wxhh0+Whhst-1); (18)
wherein ,stW being the state of the hidden layer at time txhAs a weight matrix from the input layer to the hidden layer, WhhF is a weight matrix from the hidden layer to the hidden layer, and is an activation function;
the calculation formula of the output layer is as follows:
ht=g(V·st); (19)
wherein ,htFor output at time t, g is the activation function and V is the weight matrix.
Finally, for the Nth time, the output h is output0To hNBuild into order in orderIs listed to obtain
{hN}={h0,h1,...,hN}。
Processing of h Using a two-way Long-short term memory neural network with conditional random fieldsNGiven an input sequence hN}={h0,h1,...,hNThe output calculation formula of the hidden layer of the bidirectional long and short term memory neural network is as follows:
lt=σh(Wxhht+Whhlt-1+bh); (20)
wherein ,ltFor the output of the hidden layer at time t, WxhAs a weight matrix from the input layer to the hidden layer, WhhAs a weight matrix from hidden layer to hidden layer, bhFor concealing the bias of the layer, σhRepresenting an activation function; the bidirectional long-short term memory neural network hidden layer (Bi-LSTM) is used for strengthening bilateral relation, and the first layer is forward LSTM, and the second layer is backward LSTM.
S3, a long-short term memory neural network is used for effectively fusing the characteristics of static postures and the characteristics of dynamic actions, and the characteristics are unified to the same characteristic space, and the details are as follows:
using x
sm and x
dmTo represent the extracted static gesture features and dynamic motion features separately and directly connect them as x
c=(x
sm,x
dm),x
cIs a persistent feature vector; then x is put
cEmbedded as x via an LSTM
eThe LSTM uses the forward LSTM of Bi-LSTM extracted dynamic motion features in step S2; after the embedding process is finished, for x
c and x
ePerforming element-by-element multiplication to obtain the cross effect of two vectors; after multiplication, the cross-effect characteristic is summed with x
eConnect again to add the original information back; x needs a normalized self-organizing map to
The normalized x size is N × 1.
S4, outputting whether the person has suicide tendency through a softmax layer, wherein the calculation formula is as follows:
wherein ,WeA weight matrix of the e-th emotional tendency is adopted, and b represents the bias of the weight matrix; the emotional tendency categories are suicidal emotional tendency and no suicidal emotional tendency, respectively.
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 person skilled in the art can substitute or change the technical solution of the present invention and the inventive concept within the scope of the present invention disclosed by the present invention.