Electrocardiogram-based method for unlocking electronic equipment
Technical Field
The invention relates to the field of electrocardiographic locks, in particular to a method for unlocking electronic equipment based on an electrocardiogram.
Background
The electrocardio is derived from the heart and is not easy to imitate, and compared with other common and mature identification modes at present, the electrocardio identification has higher safety. If the face recognition only needs a photo in the face input process, the face recognition is easy to imitate, and the face recognition can be recognized by the human fake face features in the recognition process. Such as fingerprint recognition, the fingerprint is easily left on the fingerprint recognizer after fingerprint recognition, and these fingerprint traces are easily copy-forged.
Differences between each individual's electrocardiographic waveforms are not only differences in characteristics within a single heart beat or between several consecutive heart beats, but also include differences in heart beat implications characteristics across a period of time, such as tens of minutes, hours, or days. When the method is used for extracting training features, a large amount of electrocardiographic waveform data of different times of users are adopted, so that the extracted features are richer. Can be identified when the heart is normal or diseased. Compared with other identification modes, the electrocardio identification has higher stability. For example, face recognition is affected not only by factors such as a cover and illumination, but also by age, face-lifting, fatness, thinness, and the like. Such as a finger print that does not clean the finger during the recognition process or a finger that is wet.
The electrocardio is derived from the heart, and everyone has universality, unlike fingerprint identification, the electrocardio cannot be normally used under the influence of partial individuals (especially, the physical laborers with more calluses on hands, shallower fingerprints, no fingerprints, broken fingerprints and the like).
The invention comprises the following steps:
in view of the above-mentioned shortcomings of the prior art, the present invention aims to provide a method and a system for unlocking an electronic device based on an electrocardiogram, which aims to solve the problems of easy cracking, inconvenient memorization or fuzzy fingerprint in the existing unlocking mode, and the invention is completed by the following technical scheme: a method for unlocking an electronic device based on an electrocardiogram, comprising the steps of:
A. collecting data, establishing an algorithm model, and training the algorithm model;
B. implanting the trained data model into an unlocking module of a mobile phone end or into a specific application app of the mobile phone;
C. judging that the verification is matched, unlocking, and if the verification is not matched, turning into fingerprint or password unlocking;
the step A is as follows:
A1. and acquiring n1 parts of original electrocardiogram waveform data with the length of c at different time periods in one day of each person and electrocardiogram waveform additional information. Extracting initial point information representing the PQRST waveform position from the original electrocardiogram waveform data;
A2. according to the position information of PQRST in the additional electrocardiograph information, calculating the interference degree from P wave to T wave in each cardiac cycle of the original electrocardiograph waveform data, removing the cardiac cycle with larger interference, and dividing the rest original electrocardiograph waveform data into n2 parts of original electrocardiograph waveform data with cardiac cycle of b;
A3. and counting the number of the electrocardiographic waveform data reserved by each person, and removing all electrocardiographic waveform data of people with fewer data numbers. Arranging the obtained representative PQRST waveform data and the electrocardiographic waveform additional information into one-dimensional training data t;
A4. and training the neural network of the deep learning algorithm according to the training data t.
As preferable: the step B comprises the following steps:
B1. reading a piece of original electrocardiogram waveform data tb of a device end user 1 And corresponding additional information of electrocardiogram, for data tb 1 Obtaining n3 original electrocardiographic waveform data tb with less interference through the step A2 2;
B2. Data tb 2 And corresponding additional information of electrocardiogram waveform are combined into one-dimensional data, the one-dimensional data is input into a trained algorithm model, and a representative electrocardiogram waveform data tb is directly calculated 2 Is a 32-dimensional feature vector s;
b3.n3 parts of data are circulated through the step B2, n3 parts of 32-dimensional feature vectors sn are extracted, and Euclidean distances between each part of feature vectors and other (n 3-1) parts of feature vectors are calculated
,
Wherein x is nk Is the kth point of the nth feature vector. Statistics L n The median value is smaller than the number of d1, and the feature vector with the maximum number is extracted to be used as a first template feature vector c1 of the user;
B4. sequentially extracting vectors with Euclidean distance larger than d2 from the rest (n 3-1) feature vectors, sorting according to the distance, and adding the vector c2 with the smallest distance into the template vector;
B5. sequentially extracting vectors with large Euclidean distances from the template vectors c1 and c2 to d3 from the rest (n 3-2) part of feature vectors, calculating the sum of Euclidean distances from the template to c1 and c2, sequencing all (n 3-2) part of vectors according to the sum of the distances, and adding the smallest feature vector c3 into the template vector;
B6. and (3) continuing to take out the remaining n template feature vectors according to the logic of the steps B4 and B5 until the feature vector which does not meet the condition in the step B5 or n is less than or equal to 10. If initially the condition is not met in step B5, the user has only one template vector.
As preferable: and C, obtaining feature vectors of the electrocardiographic waveform data to be verified in the step B1 and the step B2, calculating Euclidean distance between the feature vectors to be verified and the template feature vectors, judging that the Euclidean distance is less than the number p, if the Euclidean distance is greater than the number Q, unlocking the electrocardiographic waveform data, and if the Euclidean distance is less than the number Q, not the same person, converting the electrocardiographic waveform data into a fingerprint or password unlocking program.
As preferable: the method for calculating the interference degree in the step A2 comprises the following steps: extracting data T1 of heart beat moving forward for 0.01s from the P wave starting point to the T wave ending point for 0.02s, and performing polynomial fitting on the data T1 for n times to obtain data T2 equal to T1 in length; extracting data t3 and t4 between the data t1 and t2 moving backward from the starting point for 0.03s and the data t3 moving forward from the end point for 0.01, and calculating the fluctuation energy mean value of the data t3 relative to the data t4
As interference to the piece of data.
As preferable: the training is that firstly, 100 pieces of electrocardio data which are generated in the step A3 and contain the same person and different persons are read, 100 32-dimensional feature vectors s are output after calculation of a convolution layer, an RLD layer and a full link layer, and then angles among the vectors are calculated
Then calculating by L formula
And then performing SoftMax calculation error. This results in smaller angles between the feature vectors of the same person and larger angles between the feature vectors of different persons.
As preferable: the deep learning method specifically designs an RLD layer which receives the characteristic data extracted by the convolution of the previous different m layers, converts the characteristic data into one-dimensional characteristic data with the length of r, and equally divides the characteristic data into 2,3,5 and … n
The parts (n is smaller than r), an average value is calculated for each part of data, and the average values are spliced into a characteristic vector with the length of v= [2+3+5+ … +n ]. Converting the original training data with different lengths into feature vectors with fixed lengths; the deep learning method introduces electrocardiogram feature extraction, recodes electrocardiogram waveform data, and maps an electrocardiogram waveform to a smaller k-dimensional space. The electrocardiograph vector distances of the same person are as close as possible, and the electrocardiograph vector distances of different persons are as far as possible, so that a better recognition effect is achieved;
as preferable: the equipment end is a mobile phone shell capable of acquiring electrocardiographic data or a mobile phone end with the same function.
Compared with other electrocardiographic locking algorithms, the electrocardiographic waveform data training algorithm model has the advantages that the electrocardiographic waveform data training algorithm model is richer and deeper, the model identification algorithm is more stable, electrocardiographic waveform data is applied to unlocking of electronic equipment, compared with fingerprints and faces, electrocardiographs have higher reliability and higher convenience, electrocardiographs can be traced only by penetrating through the human heart or between the skins of any part of the electrodes covering the heart conduction path, people have more safety, and electrocardiograph waveform data is not easy to simulate or steal.
Drawings
FIG. 1 is a flow chart of the training steps of the present invention.
Fig. 2 is a flowchart of the electrocardiographic recording step of the present invention.
FIG. 3 is a flow chart of the judging and verifying steps of the present invention
Detailed Description
The invention will be described in detail below with reference to the attached drawings: fig. 1 shows a method for unlocking an electronic device based on an electrocardiogram, which comprises the following steps:
A. collecting data, establishing an algorithm model, and training the algorithm model;
B. implanting the trained data model into an unlocking module of a mobile phone end or into a specific application app of the mobile phone;
C. judging that the verification is matched, unlocking, and if the verification is not matched, turning into fingerprint or password unlocking;
the step A is as follows:
A1. and acquiring n1 parts of original electrocardiogram waveform data with the length of c at different time periods in one day of each person and electrocardiogram waveform additional information. Extracting initial point information representing the PQRST waveform position from the original electrocardiogram waveform data;
A2. according to the position information of PQRST in the additional electrocardiograph information, calculating the interference degree from P wave to T wave in each cardiac cycle of the original electrocardiograph waveform data, removing the cardiac cycle with larger interference, and dividing the rest original electrocardiograph waveform data into n2 parts of original electrocardiograph waveform data with cardiac cycle of b;
A3. and counting the number of the electrocardiographic waveform data reserved by each person, and removing all electrocardiographic waveform data of people with fewer data numbers. Arranging the obtained representative PQRST waveform data and the electrocardiographic waveform additional information into one-dimensional training data t;
A4. and training the neural network of the deep learning algorithm according to the training data t.
As shown in fig. 2: the step B comprises the following steps:
B1. reading a piece of original electrocardiogram waveform data tb of a device end user 1 And corresponding additional information of electrocardiogram, for data tb 1 Obtaining n3 original electrocardiographic waveform data tb with less interference through the step A2 2;
B2. Data tb 2 And corresponding additional information of electrocardiogram waveform are combined into one-dimensional data, the one-dimensional data is input into a trained algorithm model, and a representative electrocardiogram waveform data tb is directly calculated 2 Is a 32-dimensional feature vector s;
b3.n3 parts of data are circulated through the step B2, n3 parts of 32-dimensional feature vectors sn are extracted, and Euclidean distances between each part of feature vectors and other (n 3-1) parts of feature vectors are calculated
,
Wherein x is nk Is the kth point of the nth feature vector. Statistics L n The median value is smaller than the number of d1, and the feature vector with the maximum number is extracted to be used as a first template feature vector c1 of the user;
B4. sequentially extracting vectors with Euclidean distance larger than d2 from the rest (n 3-1) feature vectors, sorting according to the distance, and adding the vector c2 with the smallest distance into the template vector;
B5. sequentially extracting vectors with large Euclidean distances from the template vectors c1 and c2 to d3 from the rest (n 3-2) part of feature vectors, calculating the sum of Euclidean distances from the template to c1 and c2, sequencing all (n 3-2) part of vectors according to the sum of the distances, and adding the smallest feature vector c3 into the template vector;
B6. and (3) continuing to take out the remaining n template feature vectors according to the logic of the steps B4 and B5 until the feature vector which does not meet the condition in the step B5 or n is less than or equal to 10. If initially the condition is not met in step B5, the user has only one template vector.
As shown in fig. 3: and C, obtaining feature vectors of the electrocardiographic waveform data to be verified in the step B1 and the step B2, calculating Euclidean distance between the feature vectors to be verified and the template feature vectors, judging that the Euclidean distance is less than the number p, if the Euclidean distance is greater than the number Q, unlocking the electrocardiographic waveform data, and if the Euclidean distance is less than the number Q, not the same person, converting the electrocardiographic waveform data into a fingerprint or password unlocking program.
As preferable: the method for calculating the interference degree in the step A2 comprises the following steps: extracting data T1 of heart beat moving forward for 0.01s from the P wave starting point to the T wave ending point for 0.02s, and performing polynomial fitting on the data T1 for n times to obtain data T2 equal to T1 in length; extracting data t3 and t4 between the data t1 and t2 moving backward from the starting point for 0.03s and the data t3 moving forward from the end point for 0.01, and calculating the fluctuation energy mean value of the data t3 relative to the data t4
As interference to the piece of data.
The training is that firstly, 100 pieces of electrocardio data which are generated in the step A3 and contain the same person and different persons are read, 100 32-dimensional feature vectors s are output after calculation of a convolution layer, an RLD layer and a full link layer, and then angles among the vectors are calculated
Then calculating by L formula
And then performing SoftMax calculation error. Therefore, the angles between the feature vectors of the same person are smaller, the angles between the feature vectors of different persons are larger, and the electrocardio features extracted in the way have larger inter-class differences and smaller intra-class differences, so that the whole deep neural network is better in effect.
As preferable: the deep learning method specifically designs an RLD layer, the layer receives the characteristic data extracted by the previous different m layers of convolution, converts the characteristic data into one-dimensional characteristic data with the length of r, equally divides the characteristic data into 2,3,5 and … n parts (n is smaller than r), calculates an average value for each part of data, and re-splices the average values into a characteristic vector with the length of v= [2+3+5+ … +n ]. Converting the original training data with different lengths into feature vectors with fixed lengths; the deep learning method introduces electrocardiogram feature extraction, recodes electrocardiogram waveform data, and maps an electrocardiogram waveform to a smaller k-dimensional space. The electrocardiograph vector distances of the same person are as close as possible, and the electrocardiograph vector distances of different persons are as far as possible, so that a better recognition effect is achieved;
the equipment end of the invention is a mobile phone shell capable of collecting electrocardio data or a mobile phone end with the same function.
It will be appreciated by persons skilled in the art that the above embodiments are provided for illustration only and not for limitation of the invention, and that variations and modifications of the above described embodiments will fall within the scope of the claims of the invention as long as they fall within the true spirit of the invention.