Disclosure of Invention
Therefore, an object of the present invention is to provide a driving fatigue detection method, so as to solve the problems that the brain leads are difficult to detect the fatigue state of the driver continuously in practical application, and the calculation method is too complex.
A driving fatigue detection method, comprising:
continuously acquiring two-lead electroencephalogram signals of a forehead of a driver for multiple times according to a preset sampling frequency to obtain an electroencephalogram signal sample in a fatigue state;
dividing the electroencephalogram signal samples according to a sampling period to form a sample vector set with the sampling period as the length;
calculating synchronicity of the two leads of each of the sample vector sets;
carrying out time period discretization on the calculated synchronism result to screen out singular samples and obtain target samples;
determining a fatigue threshold according to the target sample and the driving fatigue state change characteristics of the driver;
and acquiring electroencephalogram signals of the driver on line, calculating a synchronism result in real time, and comparing and analyzing the synchronism result calculated in real time with the fatigue threshold value to determine whether the driver is in a fatigue state at present.
The driving fatigue detection method provided by the invention at least has the following beneficial effects:
1) the invention adopts two forehead leads as a signal source, can avoid the problem of difficult acquisition caused by covering of an electroencephalogram signal during acquisition, and can realize the detection effect with high accuracy by a two-lead synchronism calculation method;
2) the invention uses the two-lead synchronism value as the output result, and outputs the continuous value as the detection basis through each sampling period, thereby realizing the real-time data output and continuously detecting the fatigue state of the driver in real time;
3) in the prior art, the real value output by using the forehead region leads is mainly output by using an entropy method, but the entropy output method needs to reconstruct a time domain periodic signal and has high time complexity.
In addition, the driving fatigue detection method according to the present invention may further include the following additional features:
further, the step of calculating the synchronicity of the two leads of each sample vector set adopts a phase synchronization calculation method, specifically:
the calculation method of the phase-locked value PLV between the two leads is as follows:
therein
Is a time series x
i(t) and x
j(t) calculating the phase change of the time domain signal using a hilbert transform, the hilbert transform being obtained for a continuous time sequence x (t) by the following equation:
where PV represents the cauchy principal value and the phase change is calculated by the following equation:
further, in the step of calculating the synchronicity of the two leads of each sample vector set, a time domain vector synchronization calculation method is adopted, specifically:
where t is the time component in the brain electrical signal sample, N is the length of one sampling period, xiAnd xjRespectively representing a sample time series of two electrodes.
Further, the step of dividing the electroencephalogram signal samples according to the sampling period to form a sample vector set with the sampling period as the length includes:
the data was truncated according to the sampling frequency, and for a signal of M minutes for one experiment, the samples were organized into a matrix of 2 x 60M x H, where 60M is the number of seconds sampled, H is the number of H data points collected in one second, and 2 is two leads.
Further, the time-segment discretization of the calculated synchronicity result is performed to screen out singular samples, and the step of obtaining the target sample includes:
selecting each row in the calculated matrix of the synchronism result, dividing the vectors in the matrix into M vectors according to the step length 60, and then reserving two bits behind a decimal point to obtain an L-60 matrix, wherein L is the number of samples;
calculating the distance between each row of the L-60 matrix to eliminate singular samples, wherein the calculation method comprises the following steps of firstly calculating the Fisher distance between row vectors, and the calculation formula is as follows:
where μ represents the mean of the vector, σ represents the standard deviation of the vector, Fi,jComputingThe result is a matrix of L and defines Fi,jA value of (d);
statistical samples, if there is a vector m, where FimOr FjmExceeding a defined Fi,jAnd if so, determining m as a singular sample, and removing the singular sample m.
Further, the step of determining a fatigue threshold according to the target sample and the driving fatigue state change characteristics of the driver comprises:
calculating a matrix of the target samples;
taking M/2 as a step length, averaging the matrix of the target sample according to rows, then averaging according to columns, and finally obtaining two numbers, namely a first half-segment numerical value and a second half-segment numerical value;
and determining the second half segment value as a fatigue threshold value.
Further, the step of collecting electroencephalogram signals of the driver on line, calculating a synchronicity result in real time, and comparing and analyzing the synchronicity result calculated in real time and the fatigue threshold value to determine whether the driver is in a fatigue state at present comprises:
acquiring electroencephalogram signals of a driver on line, calculating synchronism once every 1 second to obtain a numerical value, marking the fatigue state of the second as 1 if the numerical value exceeds the fatigue threshold value, otherwise marking the fatigue state of the second as 0, continuously calculating for 1 minute to obtain a marking vector, summing the marking vector, judging that the driver is in the fatigue state at present if the summation result exceeds a preset value, and outputting the fatigue value of the last second.
Another objective of the present invention is to provide a driving fatigue detection system to solve the problems that the whole brain region leads are difficult to detect the fatigue state of the driver continuously in practical application and the calculation method is too complex.
A driving fatigue detection system, the system comprising:
the acquisition module is used for continuously acquiring the two-lead electroencephalogram signals of the forehead of the driver for multiple times according to a preset sampling frequency so as to obtain an electroencephalogram signal sample in a fatigue state;
the dividing module is used for dividing the electroencephalogram signal samples according to the sampling period to form a sample vector set taking the sampling period as the length;
a calculation module for calculating the synchronicity of the two leads of each sample vector set;
the dispersion module is used for carrying out time period discretization on the calculated synchronism result so as to screen out singular samples and obtain target samples;
the threshold value determining module is used for determining a fatigue threshold value according to the target sample and the driving fatigue state change characteristics of the driver;
and the fatigue determining module is used for collecting electroencephalogram signals of the driver on line, calculating a synchronism result in real time, and comparing and analyzing the synchronism result calculated in real time and the fatigue threshold value to determine whether the driver is in a fatigue state at present.
The driving fatigue detection system provided by the invention at least has the following beneficial effects:
1) the invention adopts two forehead leads as a signal source, can avoid the problem of difficult acquisition caused by covering of an electroencephalogram signal during acquisition, and can realize the detection effect with high accuracy by a two-lead synchronism calculation method;
2) the invention uses the two-lead synchronism value as the output result, and outputs the continuous value as the detection basis through each sampling period, thereby realizing the real-time data output and continuously detecting the fatigue state of the driver in real time;
3) in the prior art, the real value output by using the forehead region leads is mainly output by using an entropy method, but the entropy output method needs to reconstruct a time domain periodic signal and has high time complexity.
In addition, the driving fatigue detection system according to the present invention may further have the following additional features:
further, the calculation module may calculate the synchronicity of the two leads of each sample vector set by using a phase synchronization calculation method, specifically:
the calculation method of the phase-locked value PLV between the two leads is as follows:
therein
Is a time series x
i(t) and x
j(t) calculating the phase change of the time domain signal using a hilbert transform, the hilbert transform being obtained for a continuous time sequence x (t) by the following equation:
where PV represents the cauchy principal value and the phase change is calculated by the following equation:
further, the calculating module may calculate the synchronicity of the two leads of each sample vector set by using a time domain vector synchronization calculating method, specifically:
where t is the time component in the brain electrical signal sample, N is the length of one sampling period, xiAnd xjRespectively representing a sample time series of two electrodes.
Further, the dividing module is specifically configured to:
the data was truncated according to the sampling frequency, and for a signal of M minutes for one experiment, the samples were organized into a matrix of 2 x 60M x H, where 60M is the number of seconds sampled, H is the number of H data points collected in one second, and 2 is two leads.
Further, the discrete module is specifically configured to:
selecting each row in the calculated matrix of the synchronism result, dividing the vectors in the matrix into M vectors according to the step length 60, and then reserving two bits behind a decimal point to obtain an L-60 matrix, wherein L is the number of samples;
calculating the distance between each row of the L-60 matrix to eliminate singular samples, wherein the calculation method comprises the following steps of firstly calculating the Fisher distance between row vectors, and the calculation formula is as follows:
where μ represents the mean of the vector, σ represents the standard deviation of the vector, Fi,jCalculating the result as a matrix of L x L and defining Fi,jA value of (d);
statistical samples, if there is a vector m, where FimOr FjmExceeding a defined Fi,jAnd if so, determining m as a singular sample, and removing the singular sample m.
Further, the threshold determination module is specifically configured to:
calculating a matrix of the target samples;
taking M/2 as a step length, averaging the matrix of the target sample according to rows, then averaging according to columns, and finally obtaining two numbers, namely a first half-segment numerical value and a second half-segment numerical value;
and determining the second half segment value as a fatigue threshold value.
Further, the fatigue determination module is specifically configured to:
acquiring electroencephalogram signals of a driver on line, calculating synchronism once every 1 second to obtain a numerical value, marking the fatigue state of the second as 1 if the numerical value exceeds the fatigue threshold value, otherwise marking the fatigue state of the second as 0, continuously calculating for 1 minute to obtain a marking vector, summing the marking vector, judging that the driver is in the fatigue state at present if the summation result exceeds a preset value, and outputting the fatigue value of the last second.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a driving fatigue detection method according to a first embodiment of the present invention includes steps S101 to S103:
s101, continuously collecting two-lead electroencephalogram signals of a forehead of a driver for multiple times according to a preset sampling frequency to obtain electroencephalogram signal samples in a fatigue state;
the method includes the steps that the existing portable electroencephalogram signal acquisition equipment (for example, neurosky forehead two-lead electroencephalogram signal acquisition equipment) can be used for acquiring forehead two-lead electroencephalogram signals of a driver, multiple continuous acquisition is conducted on the driver, the sampling frequency can be set to be 256Hz or 512Hz or 1000Hz or 1024Hz, and the like, the adopted frequency can be selected according to actual conditions, and the method is not limited.
In this embodiment, the sampling frequency is described by taking 1000Hz as an example, driver electroencephalograms are continuously collected for 40 minutes, each subject (i.e., driver) is collected for multiple times, after each collection is completed, a questionnaire is given to the subject to determine whether the subject is tired, when the questionnaire result of the subject is tired, the sample is stored, otherwise, the collection is performed, in this embodiment, the number of samples in a sample set of the subject is not less than 30, and then the collection experiment can be stopped.
S102, dividing the electroencephalogram signal samples according to a sampling period to form a sample vector set with the sampling period as the length;
in one embodiment, the data may be truncated according to the sampling frequency, and for a signal with M minutes in one experiment, the samples are grouped into a matrix of 2 × 60M × H, where 60M is the number of seconds of sampling, H is the number of data points acquired in one second, and 2 is two leads.
In this embodiment, the data is truncated according to the sampling frequency, and for a 40-minute signal from one experiment, the samples form a matrix of 2 x 2400 x 1000, where 2400 is the sampling time (seconds) of 40 minutes, 1000 is the data point collected in one second (corresponding to the sampling frequency of 1000Hz), and 2 represents two leads.
S103, calculating the synchronism of the two leads of each sample vector set;
the method for calculating the synchronicity of the two leads of each sample vector set can adopt various synchronous calculation methods such as phase synchronization or time domain vector synchronization.
The specific process of calculating the synchronism of the two leads by adopting a phase synchronization calculation method comprises the following steps:
the calculation method of the phase-locked value PLV between the two leads is as follows:
therein
Is a time series x
i(t) and x
j(t) calculating the phase change of the time domain signal using a hilbert transform, the hilbert transform being obtained for a continuous time sequence x (t) by the following equation:
where PV represents the cauchy principal value and the phase change is calculated by the following equation:
the following formula is specifically adopted for calculating the synchronism of the two leads by adopting a time domain vector synchronous calculation method:
where t is the time component in the brain electrical signal sample, N is the length of one sampling period, xiAnd xjRespectively representing a sample time series of two electrodes.
Specifically, in this embodiment, a time domain vector synchronization calculation method is adopted to calculate the synchronicity of the two leads. Where N is 1000, one sample period length, xiAnd xjThe time series of samples representing the two electrodes respectively, a 2400 vector can be calculated for each sample, each value of the vector represents the synchronicity value of the two-lead electroencephalogram signal at the second moment, and 30 samples can be constructed into a 30 × 2400 matrix, wherein 30 is the number of samples.
S104, performing time-period discretization on the calculated synchronism result to screen out singular samples and obtain target samples;
the method specifically comprises the following steps of screening out singular samples:
selecting each row in the calculated matrix of the synchronism result, dividing the vectors in the matrix into M vectors according to the step length 60, and then reserving two bits behind a decimal point to obtain an L-60 matrix, wherein L is the number of samples;
calculating the distance between each row of the L-60 matrix to eliminate singular samples, wherein the calculation method comprises the following steps of firstly calculating the Fisher distance between row vectors, and the calculation formula is as follows:
where μ represents the mean of the vector, σ represents the standard deviation of the vector, Fi,jCalculating the result as a matrix of L x L and defining Fi,jA value of (d);
statistical samples, if there is a vector m, where FimOr FjmExceeding a defined Fi,jAnd if so, determining m as a singular sample, and removing the singular sample m.
Specifically, in this embodiment, each row is selected, the vector of 2400 is divided into 40 vectors according to the step size 60 (i.e., 2400 seconds is divided into 40 minutes), and then two digits after the decimal point are reserved, so that a matrix of 30 × 60 is obtained, where L is 30;
calculating the distance between each row of the matrix of 30-60 to eliminate singular samples, wherein the calculation method comprises the following steps of firstly, calculating the Fisher distance between row vectors, and the calculation formula is as follows:
where μ represents the mean of the vector, σ represents the standard deviation of the vector, and F results in a 30 x 30 matrix. Then, the value of F is defined, in this embodiment, F is defined as 1.8, when F isi,jIf the distance between the i line and the j line is not more than 1.8, the tentative i line and the tentative j line are not singular vectors, and if the distance between the i line and the j line is not more than 1.8, the other vector m exists, wherein F isimOr FjmBeyond 1.8, then m can be determined to be a singular sample. In this example, 25 samples were finally screened out of 30 samples.
S105, determining a fatigue threshold according to the target sample and the driving fatigue state change characteristics of the driver;
since the occurrence of fatigue is a gradual process, in order to simplify the threshold determination process, the fatigue threshold may be determined by the following method:
calculating a matrix of the target samples, in this embodiment, (1) calculating a matrix of 25 × 40 obtained in step S104 (25 is the number of samples after deletion, and 40 is the vector calculated in step S104);
taking M/2 as a step length, averaging the matrix of the target sample according to rows, then averaging according to columns, and finally obtaining two numbers, namely a first half value and a second half value, in the embodiment, taking 20 as a step length, averaging the matrix of the target sample according to rows, and finally obtaining a 25 x 2 matrix, then averaging according to columns, and finally obtaining two numbers, in the embodiment, finally obtaining two numbers, namely a first half value and a second half value, specifically (0.64, 0.35);
since the occurrence of fatigue is a gradual process and usually from a non-fatigue state to a fatigue state, the second half value is determined as a fatigue threshold, i.e., the fatigue threshold is 0.35.
In addition, as a specific example, since each person may know whether or not they are in a fatigue state differently, when calculating the fatigue threshold, the driver may adjust the fatigue threshold within a certain range based on the calculated fatigue threshold, for example, the fatigue threshold may be adjusted to 0.4 when the driver has a strong fatigue resistance, whereas the fatigue threshold may be adjusted to 0.3 when the driver has a weak fatigue resistance, so as to more conform to the fatigue state of the person, and the adjusted fatigue threshold is the criterion for subsequent determination.
S106, collecting electroencephalogram signals of the driver on line, calculating a synchronism result in real time, and comparing and analyzing the synchronism result calculated in real time and the fatigue threshold value to determine whether the driver is in a fatigue state at present.
The method comprises the steps of collecting electroencephalogram signals of a driver on line, calculating synchronism every 1 second to obtain a numerical value, marking the fatigue state of the second as 1 if the numerical value exceeds a fatigue threshold value, otherwise marking the fatigue state of the second as 0, continuously calculating for 1 minute (namely 60 seconds) to obtain a marking vector, summing the marking vector, and judging that the driver is in the fatigue state currently (in the minute) if the summation result exceeds a preset value (the preset value can be adjusted, for example, 40 is adopted, and if the summation result exceeds 40 is adopted. In addition, in general, when it is determined that the vehicle is in a fatigue state, the fatigue value of the last second is usually the largest within 1 minute, and therefore the fatigue value of the last second can be output as the final detection result.
According to the driving fatigue detection method provided by the embodiment, at least the following beneficial effects are achieved:
1) the invention adopts two forehead leads as a signal source, can avoid the problem of difficult acquisition caused by covering of an electroencephalogram signal during acquisition, and can realize the detection effect with high accuracy by a two-lead synchronism calculation method;
2) the invention uses the two-lead synchronism value as the output result, and outputs the continuous value as the detection basis through each sampling period, thereby realizing the real-time data output and continuously detecting the fatigue state of the driver in real time;
3) in the prior art, the real value output by using the forehead region leads is mainly output by using an entropy method, but the entropy output method needs to reconstruct a time domain periodic signal and has high time complexity.
Referring to fig. 2, a driving fatigue detecting system according to a second embodiment of the present invention based on the same inventive concept includes:
the acquisition module 10 is used for continuously acquiring the two-lead electroencephalogram signals of the forehead of the driver for multiple times according to a preset sampling frequency so as to obtain an electroencephalogram signal sample in a fatigue state;
the dividing module 20 is configured to divide the electroencephalogram signal samples according to a sampling period to form a sample vector set with the sampling period as a length;
a calculation module 30 for calculating the synchronicity of the two leads of each of the sample vector sets;
the discretization module 40 is used for performing time-segment discretization on the calculated synchronicity result to screen out singular samples and obtain target samples;
a threshold determination module 50, configured to determine a fatigue threshold according to the target sample and the driving fatigue state change characteristic of the driver;
and the fatigue determining module 60 is configured to acquire electroencephalogram signals of the driver on line, calculate a synchronicity result in real time, and compare and analyze the synchronicity result calculated in real time with the fatigue threshold value to determine whether the driver is in a fatigue state at present.
The calculating module 30 may calculate the synchronicity of the two leads of each sample vector set by using a phase synchronization calculating method, specifically:
the calculation method of the phase-locked value PLV between the two leads is as follows:
therein
Is a time series x
i(t) and x
j(t) calculating the phase change of the time domain signal using a hilbert transform, the hilbert transform being obtained for a continuous time sequence x (t) by the following equation:
where PV represents the cauchy principal value and the phase change is calculated by the following equation:
the calculating module 30 may calculate the synchronicity of the two leads of each sample vector set by using a time domain vector synchronization calculating method, specifically:
where t is the time component in the brain electrical signal sample, N is the length of one sampling period, xiAnd xjRespectively representing a sample time series of two electrodes.
Wherein, the dividing module 20 is specifically configured to:
the data was truncated according to the sampling frequency, and for a signal of M minutes for one experiment, the samples were organized into a matrix of 2 x 60M x H, where 60M is the number of seconds sampled, H is the number of H data points collected in one second, and 2 is two leads.
Wherein the discrete module 40 is specifically configured to:
selecting each row in the calculated matrix of the synchronism result, dividing the vectors in the matrix into M vectors according to the step length 60, and then reserving two bits behind a decimal point to obtain an L-60 matrix, wherein L is the number of samples;
calculating the distance between each row of the L-60 matrix to eliminate singular samples, wherein the calculation method comprises the following steps of firstly calculating the Fisher distance between row vectors, and the calculation formula is as follows:
where μ represents the mean of the vector, σ represents the standard deviation of the vector, Fi,jCalculating the result as a matrix of L x L and defining Fi,jA value of (d);
statistical samples, if there is a vector m, where FimOr FjmExceeding a defined Fi,jAnd if so, determining m as a singular sample, and removing the singular sample m.
Wherein the threshold determination module 50 is specifically configured to:
calculating a matrix of the target samples;
taking M/2 as a step length, averaging the matrix of the target sample according to rows, then averaging according to columns, and finally obtaining two numbers, namely a first half-segment numerical value and a second half-segment numerical value;
and determining the second half segment value as a fatigue threshold value.
Wherein the fatigue determination module 60 is specifically configured to:
acquiring electroencephalogram signals of a driver on line, calculating synchronism once every 1 second to obtain a numerical value, marking the fatigue state of the second as 1 if the numerical value exceeds the fatigue threshold value, otherwise marking the fatigue state of the second as 0, continuously calculating for 1 minute to obtain a marking vector, summing the marking vector, judging that the driver is in the fatigue state at present if the summation result exceeds a preset value, and outputting the fatigue value of the last second.
The driving fatigue detection system provided by the embodiment has at least the following beneficial effects:
1) the invention adopts two forehead leads as a signal source, can avoid the problem of difficult acquisition caused by covering of an electroencephalogram signal during acquisition, and can realize the detection effect with high accuracy by a two-lead synchronism calculation method;
2) the invention uses the two-lead synchronism value as the output result, and outputs the continuous value as the detection basis through each sampling period, thereby realizing the real-time data output and continuously detecting the fatigue state of the driver in real time;
3) in the prior art, the real value output by using the forehead region leads is mainly output by using an entropy method, but the entropy output method needs to reconstruct a time domain periodic signal and has high time complexity.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit of a logic gate circuit specifically used for realizing a logic function for a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.