Smart home control method, device, equipment and medium based on EEG decoding
Through transfer learning and reinforcement learning technology, the EEG decoding model is optimized to solve the problem of difficulty in distinguishing EEG patterns and integrated control of multiple devices in smart homes, improving the accuracy and efficiency of control, and realizing high-dimensional intelligent decision-making.
Patent Information
- Application Number
- CN202410886242.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-07-03
AI Technical Summary
Existing EEG decoding technology faces difficulties in distinguishing complex EEG patterns, noise interference and environmental factors in smart home control. It lacks high-dimensional integrated control capabilities for a variety of home appliances, and the dynamics of equipment failure prediction and maintenance planning. Inadequate performance and robustness.
The transfer learning strategy is used to pre-train the coding model on the general EEG data set, and the reinforcement learning technology and heuristic evaluation function are combined to optimize the home appliance control strategy through the Markov decision process, build distributed device control instructions, and improve the generalization of the coding system. flexibility and adaptability to achieve high-dimensional intelligent decision-making.
It has significantly improved the generalization and adaptability of the EEG coding system, improved the accuracy and efficiency of smart home control, can effectively handle multiple constraints and individual differences, and realize high-dimensional intelligent decision-making for integrated control of home appliances.
Smart Images

Figure 00000000_0000
Abstract
Description
Technical Field
[0001] The present application relates to the field of brain-computer interface technology, and in particular to a smart home control method, device, equipment and medium based on electroencephalogram decoding. Background Art
[0002] In recent years, brain-computer interface (BCI) technology has made great progress, and the application prospects of using EEG signals to decode human intentions and control external devices are broad. Introducing BCI technology into smart home control can automatically control home appliances by detecting and predicting the user's EEG activity pattern. This can not only greatly improve the convenience of control, but also provide a new barrier-free control method for special groups such as the disabled, which has great theoretical significance and application value.
[0003] However, existing EEG decoding technology still faces many challenges when applied to smart home control. First, the activity patterns of the human brain are highly complex and have individual differences. The EEG patterns corresponding to different home appliance control intentions often overlap and have similarities, which makes it difficult to accurately distinguish the encoding of different intentions. Secondly, the EEG acquisition conditions in the home environment are relatively complex, with noise interference and environmental factors, and it is necessary to improve the robustness processing capabilities of EEG signals. Furthermore, smart homes involve a variety of home appliances, and how to perform high-dimensional integrated control of home appliances based on user intentions is also a major challenge. Summary of the invention
[0004] The embodiments of the present application provide a smart home control method, device, equipment and medium based on EEG decoding, which can solve the problem that most of the current maintenance decision optimization methods are aimed at single equipment or independent production lines, lacking overall consideration of the overall operation of park equipment and resource scheduling. In addition, they do not take into account the equipment degradation mechanism and uncertainty when predicting faults and planning maintenance, and the dynamics and robustness of optimization need to be strengthened. The provided method can achieve the coordinated optimization of equipment life cycle management and park production operations.
[0005] In a first aspect, an embodiment of the present application provides a smart home control method based on EEG decoding, the method comprising:
[0006] Acquire an EEG database of a target user, and determine a plurality of reference EEG patterns in the EEG database;
[0007] Obtaining a neuron activation response corresponding to each sub-region network of a preset brain region according to a reference EEG pattern, obtaining a disturbance influencing factor corresponding to the sub-region network according to the neuron activation response, and obtaining a ranking score result corresponding to each sub-region network according to multiple disturbance influencing factors;
[0008] Determine a target sub-region network according to multiple ranking and scoring results, optimize multiple reference EEG patterns in the target sub-region network, and determine some reference EEG patterns as encoding benchmarks;
[0009] Determine the EEG pattern to be encoded in the reference EEG pattern as the encoding benchmark according to the EEG response difference of the target user when controlling the home appliance, obtain the difference EEG signal between the EEG pattern to be encoded and the reference EEG patterns of the remaining encoding benchmarks, and obtain the target EEG fingerprint of the difference EEG signal;
[0010] Obtain the EEG data of the target user when operating the home appliance, and obtain the response of the home appliance control intention corresponding to the EEG data;
[0011] Construct the EEG coding model to be trained, complete the migration training of the EEG coding model according to the target EEG fingerprint, and output the potential feature vector;
[0012] The target manipulation intention category corresponding to the potential feature vector is obtained, the home appliance control code corresponding to the target manipulation intention category is obtained, and the control of the home appliance corresponding to the home appliance control code is completed.
[0013] In a second aspect, the present application also provides a smart home control device, comprising:
[0014] A data acquisition module, used to acquire an EEG database of a target user and determine a plurality of reference EEG patterns from the EEG database;
[0015] A response acquisition module, used to acquire a neuron activation response corresponding to each sub-region network of a preset brain region according to the reference EEG pattern, acquire a disturbance influencing factor corresponding to the sub-region network according to the neuron activation response, and acquire a ranking score result corresponding to each sub-region network according to a plurality of the disturbance influencing factors;
[0016] A target determination module, used to determine a target sub-region network according to the plurality of ranking and scoring results, and optimize the plurality of reference EEG patterns in the target sub-region network to determine some of the reference EEG patterns as encoding benchmarks;
[0017] A fingerprint acquisition module, used to determine the EEG pattern to be encoded in the reference EEG pattern as the encoding benchmark according to the EEG response difference of the target user in controlling the home appliance, obtain the difference EEG signal between the EEG pattern to be encoded and the remaining reference EEG patterns of the encoding benchmark, and obtain the target EEG fingerprint of the difference EEG signal;
[0018] An operation acquisition module, used to acquire EEG data of the target user when operating the home appliance, and acquire the response of the home appliance control intention corresponding to the EEG data;
[0019] A model training module, used to construct an EEG coding model to be trained, complete the migration training of the EEG coding model according to the target EEG fingerprint, and output a potential feature vector;
[0020] The home appliance control module is used to obtain the target manipulation intention category corresponding to the potential feature vector, obtain the home appliance control code corresponding to the target manipulation intention category, and complete the control of the home appliance corresponding to the home appliance control code.
[0021] In a third aspect, the present application also provides a computer device, comprising a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the smart home control method based on EEG decoding as described in the first aspect is implemented.
[0022] In a fourth aspect, the present application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the smart home control method based on EEG decoding as described in the first aspect.
[0023] Compared with the prior art, this application has at least the following beneficial effects:
[0024] 1. The present invention adopts a transfer learning strategy. First, the coding model is pre-trained on a general large-scale EEG data set to enable it to learn the general feature representation ability of EEG signals, and then it is quickly fine-tuned on the data of individual users to obtain a personalized coding model with good generalization performance. This global-to-local, coarse-to-fine iterative optimization strategy can not only make full use of the prior knowledge in general data, but also effectively capture the unique patterns of individual users, thereby better solving the problem of individual EEG differences and significantly improving the generalization and adaptability of the coding system.
[0025] 2. There are many household appliances in smart homes, and their working states have complex mutual constraints and coupling relationships. Generating distributed device control instructions directly based on the decoded control intention feature vector is a typical high-dimensional sequence decision problem with a huge search space and it is difficult to obtain the optimal solution.
[0026] 3. The present invention introduces reinforcement learning technology into the optimization process of home appliance control strategy. Specifically, the home environment is modeled as a Markov decision process, the controllable response of home appliances is used as an immediate reward signal, and the optimal control strategy sequence is solved on the model through a strategy search algorithm, so that the comprehensive controllable response of all home appliances is maximized.
[0027] 4. In the search process, this scheme also designs a heuristic evaluation function and a human-computer interaction feedback mechanism to further improve the search efficiency and the reliability of the strategy. By introducing the reinforcement learning framework, it can not only fully consider the multiple constraints of home appliances, but also autonomously explore the optimal combination of control strategies, realize high-dimensional intelligent decision-making for home appliance integrated control, and significantly improve the accuracy and efficiency of home control.
[0028] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of a flow chart of a smart home control method based on EEG decoding according to an embodiment of the present application;
[0030] Figure 2 This is a schematic diagram of the structure of a smart home control device according to an embodiment of the present application;
[0031] Figure 3 A schematic diagram of the structure of a computer device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0033] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0034] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0035] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0036] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0037] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0038] The technical solution of the embodiment of the present application is introduced below.
[0039] With the rapid development of artificial intelligence and Internet of Things technologies, smart homes have gradually entered people's lives. Traditional smart home control mainly relies on manual operation or simple voice / gesture recognition, but these methods often lack convenience and intelligence. Therefore, how to achieve more natural and imperceptible smart home control has always been an important topic in this field.
[0040] In recent years, brain-computer interface (BCI) technology has made great progress, and the application prospects of using EEG signals to decode human intentions and control external devices are broad. Introducing BCI technology into smart home control can automatically control home appliances by detecting and predicting the user's EEG activity pattern. This can not only greatly improve the convenience of control, but also provide a new barrier-free control method for special groups such as the disabled, which has great theoretical significance and application value.
[0041] However, existing EEG decoding technology still faces many challenges when applied to smart home control. First, the activity patterns of the human brain are highly complex and have individual differences. The EEG patterns corresponding to different home appliance control intentions often overlap and have similarities, which makes it difficult to accurately distinguish the encoding of different intentions. Secondly, the EEG acquisition conditions in the home environment are relatively complex, with noise interference and environmental factors, and it is necessary to improve the robustness of EEG signal processing capabilities. Furthermore, smart homes involve a variety of home appliances, and how to perform high-dimensional integrated control of home appliances based on user intentions is also a major challenge. Please refer to Figure 1 , Figure 1 The flowchart of a smart home control method based on EEG decoding provided in the embodiment of the present application is shown in FIG. The smart home control method based on EEG decoding in the embodiment of the present application can be applied to computer devices, including but not limited to smart phones, laptops, tablet computers, desktop computers, physical servers, cloud servers and other devices. Figure 1 As shown, the smart home control method based on EEG decoding of this embodiment includes steps S101 to S106, which are described in detail as follows:
[0042] Step S101, obtaining an EEG database of a target user, and determining a plurality of reference EEG patterns in the EEG database.
[0043] Specifically, it is necessary to first obtain the EEG database of the target user, which records the EEG activity signals of the target user in different scenarios. The acquisition of EEG signals usually uses the electrode positions defined in the international 10-20 system, such as Fp1, Fp2, etc. in the frontal area, Pz, etc. in the parietal area, and other related brain areas, and uses an appropriate sampling rate (usually 256Hz or higher) to continuously record EEG activity. The acquired EEG raw data needs to be preprocessed, including eliminating baseline drift, removing frequency band interference, etc., to extract a pure EEG time series spectrum X(t). For each data sample X(t), t=1,2,...,T represents the index of the time series, and T is the data length. At this time, X(t) can be represented as a T×N matrix, where N is the number of electrode channels.
[0044] In some embodiments, determining multiple reference EEG patterns in the EEG database includes: extracting multiple EEG time series spectra from the EEG database; determining brain activity patterns corresponding to the EEG time series spectra; and determining multiple reference EEG patterns among the multiple brain activity patterns.
[0045] After obtaining the EEG time series spectrum X(t), it needs to be segmented to extract the brain activity pattern. The commonly used segmentation window length is 1-5 seconds. Assuming the window length is L time points, sliding segmentation of X(t) can obtain M=T-L+1 segmented samples X1, X2,..., Xm,..., XM, where Xm=[x(m), x(m+1),..., x(m+L-1)] represents the mth segmented sample. By performing time-frequency analysis such as wavelet transform or Fourier transform on each segmented sample, its energy distribution characteristics in the time and frequency domain can be obtained as a representation of the brain activity pattern. Taking wavelet transform as an example, multi-scale wavelet decomposition is performed on Xm, and the energy at the jth scale is Ej,m=∑i|Wj,i|^2, where Wj,i is the wavelet coefficient of the jth scale. By connecting the energy features of all scales, we can form the brain activity pattern vector fm=[E1,m,E2,m,...,EJ,m] corresponding to segment Xm, where J is the maximum number of scales.
[0046] For the entire EEG database, M brain activity pattern vectors F=[f1,f2,...,fm,...,fM] can be obtained. Next, these pattern vectors need to be clustered and divided into different pattern categories. The present invention adopts a hierarchical clustering algorithm to divide them into different clusters according to the similarity between samples, and constructs a hierarchical tree structure. Commonly used similarity metrics include Euclidean distance, Pearson correlation coefficient, etc., and hierarchical clustering aggregation methods include single link (SLINK), complete link (CLINK), mean link (UPGMA), etc. Taking UPGMA as an example, for any two clusters Ci and Cj, their distance is defined as d(Ci,Cj)=∑x∈Ci,y∈Cj||xy|| / (ninj), where ni and nj are the number of samples in the two clusters respectively. In each step, the two clusters with the closest distance are merged, and the distance to other clusters is recalculated until all samples are aggregated into one cluster. In this way, a hierarchical tree can be obtained, where the root represents all samples, the leaves represent single samples, and the intermediate nodes correspond to cluster categories at different levels.
[0047] After constructing the hierarchical clustering tree, it is necessary to evaluate the importance of nodes (cluster categories) at different levels in the tree to determine the clusters used as reference EEG patterns. The present invention adopts the Analytic Hierarchy Process (AHP), which is a systematic and hierarchical analysis method that combines qualitative and quantitative methods. For each node cluster Ck at each level, its importance weight wk is calculated according to the following steps: 1) Construct a judgment matrix A, whose element value aij represents the importance of cluster Ci relative to cluster Cj. The 1-9 Scale can be used to formulate the standard, for example, aij=9 means that Ci is more important than Cj; aij=1 / 9 means that Ci is less important than Cj; 2) Perform a consistency check on the judgment matrix A, and if it passes, calculate the eigenvalue and eigenvector of A, where the component of the eigenvector corresponding to the maximum eigenvalue is the weight wk of each cluster; 3) Perform a weighted synthesis on the weights of each level to obtain a global weight, which represents the overall importance of each cluster. In the AHP analysis, it is necessary to introduce appropriate evaluation indicators as judgment criteria, such as the number of samples in the cluster, energy intensity, time duration, etc.
[0048] After obtaining the global weight of each cluster category according to the above analytic hierarchy process, the weights can be sorted from large to small, and the top K clusters with the highest global weights can be selected as reference EEG patterns. Let the sample set corresponding to these K clusters be R={r1,r2,...,rK}, where rk=[fk1,fk2,...,fkn] is the n samples in the kth reference pattern cluster. These reference EEG patterns will be used in the subsequent steps to classify, identify and encode the user's EEG activities.
[0049] Step S102, obtaining the neuron activation response corresponding to each sub-region network of the preset brain region according to the reference EEG pattern, obtaining the disturbance influencing factor corresponding to the sub-region network according to the neuron activation response, and obtaining the ranking score result corresponding to each sub-region network according to the multiple disturbance influencing factors.
[0050] Specifically, by dividing the brain area into sub-region grids, the neuronal activation responses of different grids are evaluated according to the reference pattern, the spatial perturbation effects of environmental factors on the pattern are obtained, and the grids are ranked and scored according to the perturbation effects.
[0051] In some embodiments, before obtaining the neuron activation response corresponding to each sub-region network of a preset brain region according to the reference EEG pattern, it also includes: obtaining functional semantic information corresponding to each reference EEG pattern; querying relevant brain region information corresponding to the reference EEG pattern in a preset brain region function knowledge base according to the functional semantic information; marking each reference EEG pattern in the topological structure of the brain region according to the relevant brain region information, so as to obtain the neuron activation response corresponding to each sub-region network of the brain region according to the reference EEG pattern.
[0052] First, the reference pattern needs to be marked in the topological structure of the brain region. Taking visual information processing as an example, the relevant brain regions include the visual area of the occipital lobe, the interparietal lobule of the parietal lobe, and the caudate nucleus of the temporal lobe. Each reference pattern rk may be associated with the functions of multiple brain regions. Therefore, it is necessary to first query the relevant brain region set Bk={bk1,bk2,...,bkm} in the brain region function knowledge base according to the functional semantics Sk of rk, where bki represents the i-th brain region related to Sk, such as the premotor area.
[0053] The initial position of rk in each bki area is indicated as the basis for its marking in the brain topology. It should be noted that due to the overlap of brain function integration, different patterns may share some of the same functionally related brain areas. Next, it is necessary to further evaluate the activation response of the reference pattern in different brain areas to obtain the spatial perturbation effect of environmental factors on the pattern. Here, the brain area is divided into M×N×L three-dimensional grid areas, and each small area is regarded as a basic neuronal unit. Taking the cube grid as an example, assuming the side length is 2cm, then M×N×L=90×108×72=699,840 grid units.
[0054] Assume that the average activation response of the reference pattern rk in the (i, j, l)th grid unit is Ak(i, j, l), which is expressed as the average discharge frequency or current intensity of neurons in the grid, which can be obtained by functional magnetic resonance imaging (fMRI) and other technologies. Since the brain is a highly interconnected network system, the neuronal activity in a single grid is not only affected by rk itself, but also by the disturbance of the surrounding environment. This application defines this disturbance from the environment as a spatial disturbance factor Dk(i, j, l). In order to obtain Dk(i, j, l), the feature extraction capability of the deep convolutional neural network CNN can be used to treat the three-dimensional grid of the brain as image-like input data.
[0055] First, we use 3D CNN to perform unsupervised pre-training on the existing brain functional partitioning dataset to learn the spatial correlation and contextual information between grid regions. Let the trained 3D CNN network be f(·), then for a certain reference pattern rk, input its activation response matrix in all grid regions:
[0056] Ak=[Ak(1,1,1),...,Ak(i,j,l),...,Ak(M,N,L)]; its output feature map Fk=f(Ak) can be obtained. Since CNN has the characteristic of local receptive field, each element Fk(i,j,l) in Fk corresponds to the spatial perturbation factor Dk(i,j,l) of Ak(i,j,l) in its neighborhood.
[0057] Specifically, the receptive field size of CNN can be set to an s×s×s grid, then Fk(i,j,l) captures the spatial features of Ak in the s×s×s cubic neighborhood centered at (i,j,l), reflecting the perturbation effect of the neighborhood on the neuronal activity at (i,j,l). By adjusting the size of s, the receptive range of spatial perturbations can be controlled. After obtaining Dk(i,j,l) corresponding to all reference patterns rk, the weighted average perturbation effect of the pattern in the entire brain area can be calculated:
[0058] Wk = ∑i,j,l[Ak(i,j,l)×Dk(i,j,l)] / ∑i,j,lAk(i,j,l);
[0059] Where Wk represents the average spatial perturbation degree of the reference pattern rk in the entire brain area, Ak(i,j,l) is used as the weight, and the perturbation effect Dk(i,j,l) is weighted summed and normalized. The reference patterns R are sorted in order from small to large according to Wk to obtain the sorting result.
[0060] Step S103, determining a target sub-region network according to the multiple ranking and scoring results, optimizing the multiple reference EEG patterns in the target sub-region network, and determining some reference EEG patterns as encoding benchmarks.
[0061] Specifically, the scoring results are sorted through the above steps, and a preset number of high-scoring sub-region grids are obtained for marking; among these marked high-response grids, some reference EEG patterns are selected as encoding benchmarks, and the selected patterns are corrected by error analysis.
[0062] First, set a disturbance threshold T, arrange all patterns in order from small to large according to Wk, select the first Q patterns that satisfy Wk≤T, and record them as the optimization pattern set P={p1,p2,...,pQ}. For each optimization pattern pq∈P, perform the following processing in the brain grid area:
[0063] 1) Find the maximum activation response area Rq_max of pq in all grids, that is, Rq_max={rq1,rq2,...,rqn}, where rqi is the i-th maximum response grid, satisfying Apq(rqi)≥Apq(j) for any grid j. Here Apq(i) represents the average activation response intensity of pq in the i-th grid.
[0064] 2) Set a spatial mark for pq in Rq_max, that is, assign the mark of pq to each grid rqi in Rq_max, indicating that the grid is a high response area of pq. Vector encoding can be used, such as [rqi]=[1,0,...,0,pq,0,...,0]^T.
[0065] 3) Calculate the neighborhood disturbance effect of Rq_max Nq = ∑(i,j,l)∈Neighbor(Rq_max) Dpq(i,j,l). Where Neighbor(Rq_max) represents the set of all neighborhood grid coordinates of Rq_max, and Dpq(i,j,l) is the spatial disturbance factor value of pq at (i,j,l).
[0066] 4) Determine the perturbation score of the grid pq in Rq_max according to the size of Nq. The specific method is: first sort the grids in Rq_max from large to small according to Apq(rqi) to obtain the sorted grid sequence {rqi'}. Then weight {rqi'}, and the weight of the kth grid rqi' is:
[0067] wk = Apq(rqi') / ∑j Apq(rqj') * exp(-γ*Nq);
[0068] Where γ is the attenuation coefficient, which controls the influence of Nq on the weight. Multiply the spatial label code of the grid rqi' by wk, that is, [rqi']_new = wk*[rqi']. In this way, the {[rqi']_new} sequence can be obtained, where the grid with smaller disturbance influence has a larger coding weight.
[0069] 5) Through the above steps, the high-response, low-disturbance coding in the brain region can be determined for each optimized pattern pq, recorded as Spq. According to the coding strength of the coding Spq from large to small, a preset number (such as Top-K) of grid sub-regions are selected for marking as the reference area for subsequent coding.
[0070] In these marked high-response low-disturbance grid sub-regions, select some patterns from the optimized pattern set P as the coding reference pattern set R'. Since R' comes from P, they have been optimized for the influence of spatial disturbance, but there may still be some errors. Therefore, it is necessary to perform error analysis and correction on each pattern rk' in R', as follows:
[0071] 1) Manually annotate the exact functional semantics sk corresponding to rk', and mark the relevant dominant area Bk of sk in the known brain functional area template.
[0072] 2) Calculate the weighted average activation response of rk' in the Bk region Qk=∑i∈Bk Wk(i)*Ak(i) / ∑i∈BkWk(i). Where Wk(i) is the activation response weight of rk' in the i-th grid, reflecting the importance of the grid to sk.
[0073] 3) Compare Qk with the expected ideal response score Q0 of sk in the Bk region. If |Qk-Q0|>ε (ε is the threshold), it is necessary to modify and optimize rk' to reduce the error.
[0074] 4) The correction method is: expand a certain distance in the Rk_max neighborhood of rk' to obtain the extended area Rk_exp, and find the mode pk in Rk_exp that is related to sk and has the suboptimal response intensity;
[0075] 5) Perform weighted fusion of pk and rk': rk_new' = α*rk'+(1-α)*pk, where α is a weight between 0 and 1. Determine the optimal value of α by grid search and other methods, so that the response Qk_new of the corrected rk_new' is as close to Q0 as possible.
[0076] 6) Repeat the above steps 4)-5) until |Qk_new-Q0|≤ε, and output the corrected rk_new' as the final coding reference mode.
[0077] Through the above steps, factors such as the activation response intensity, spatial perturbation impact and functional semantic consistency of the pattern are comprehensively considered to obtain a set of optimized and error-corrected encoding benchmark pattern sets R'={r1',r2',...,rK'}, in which each rk' is accurately marked in the high-response and low-disturbance grid in a specific area of the brain.
[0078] Step S104, determining the EEG pattern to be encoded in the reference EEG pattern serving as the encoding benchmark according to the EEG response difference of the target user when controlling the home appliance, obtaining the difference EEG signal between the EEG pattern to be encoded and the reference EEG patterns of the remaining encoding benchmarks, and obtaining the target EEG fingerprint of the difference EEG signal.
[0079] Specifically, according to the differences in EEG responses when the user switches different household appliances and based on the reference patterns selected in the above steps, determine the EEG patterns to be encoded; extract the differences in EEG signals between the EEG patterns to be encoded and the reference patterns, and obtain the target EEG fingerprints corresponding to the differential EEG signals for subsequent training of the model.
[0080] In some embodiments, obtaining the differential EEG signals of the EEG patterns to be encoded and the reference EEG patterns of the remaining encoding benchmarks, and obtaining the target EEG fingerprints of the differential EEG signals includes: calculating the similarity scores between the EEG patterns to be encoded and the reference EEG patterns of the remaining encoding benchmarks respectively; determining the matching EEG patterns in the reference EEG patterns according to the similarity scores; calculating the differential EEG signals after aligning the EEG patterns to be encoded and the matching EEG patterns; and normalizing the differential EEG signals to obtain the target EEG fingerprints.
[0081] In the above steps, this application has obtained a set of optimized and error-corrected encoding benchmark pattern sets R' = {r1', r2',..., rK'}, where each rk' is accurately marked in the high-response and low-disturbance grid of a specific area of the brain. Next, it is necessary to determine the EEG patterns to be encoded according to the EEG responses of the user during actual operation of household appliances, compare them with the benchmark patterns in R', and extract the differential features as the target EEG fingerprints to prepare for subsequent encoding mapping. The specific process is as follows:
[0082] First, it is necessary to collect the EEG data of the user when operating different household appliances. Let the EEG data corresponding to a certain household appliance operation be X, where X(t) is the EEG signal value at time t, and t = 1, 2,..., T, and T is the data length. Preprocess X(t), including baseline correction, removal of band interference, etc., to obtain a clean EEG time series signal, denoted as Y(t). Then, it is necessary to segment Y(t), divide it into multiple time windows, and each window corresponds to an EEG pattern segment. The commonly used segmentation method is the sliding window. Let the window length be L time points and the step size be S time points (S < L), then M = T - L + S segmentation samples {Y1, Y2,..., Ym,..., YM} can be obtained, where Ym = [y(m), y(m + 1),..., y(m + L - 1)] is the mth segmentation sample.
[0083] Perform wavelet transform (WT) or short-time Fourier transform (STFT) on each segmentation sample Ym to obtain its energy distribution characteristics in the time and frequency domains as the EEG pattern representation of this segmentation. Taking wavelet transform as an example, perform J-level wavelet decomposition on Ym:
[0084] Ym = ∑j=1~J ∑k djkψjk + ∑k cJkφJk;
[0085] Where djk and cJk are the wavelet coefficients and scale coefficients of the j-th scale, ψjk and φJk are the wavelet basis functions and scale basis functions, respectively. Let Wm(j)=|djk|^2 be the wavelet energy of the j-th scale, then the EEG pattern feature of Ym can be expressed as Fm=[Wm(1),Wm(2),...,Wm(J)]. The feature sequences {F1,F2,...,FM} of all segmented samples are concatenated to obtain the EEG pattern feature matrix F corresponding to the entire EEG data X.
[0086] Next, it is necessary to compare each row of feature vectors in F (corresponding to an EEG pattern) with the encoding reference pattern set R' obtained in the above step to find the most similar reference pattern rk'. The similarity score can be calculated using methods such as cosine similarity and Euclidean distance. Suppose the similarity between the mth row feature vector Fm and rk' is Sm,k, then for each row of feature vectors, select the reference pattern with the highest score as its matching pattern:
[0087] rm' = argmax(k) Sm,k;
[0088] Among them, rm' is the reference pattern that is most similar to Fm in the mth row. Since rm' comes from the R' set, it has been accurately located in a specific high-response, low-disturbance grid area of the brain. This location information can be used as a constraint to assist the subsequent pattern analysis and encoding process.
[0089] After obtaining the matching reference pattern rm' corresponding to each EEG pattern Fm, it is necessary to further extract the difference features between Fm and rm' as the target EEG fingerprint of Fm. The specific method is: first align the two to ensure the same scale, record them as F'm and r'm, and then calculate the difference vector:
[0090] Dm = F'm - r'm;
[0091] Since Dm reflects the difference between Fm and the reference pattern rm', it can be used as the fingerprint feature of Fm. In practical applications, Dm can be normalized to obtain the standardized target EEG fingerprint vector dm:
[0092] dm = (Dm - μ(Dm)) / σ(Dm);
[0093] Where μ(Dm) and σ(Dm) are the mean and standard deviation of Dm respectively. This can eliminate the scale effect and improve the robustness of fingerprint features.
[0094] Finally, for the entire EEG data X, a series of target EEG fingerprints {d1, d2, ..., dM} can be obtained, each dm corresponds to an EEG pattern Fm, reflecting the difference between the pattern and its most similar reference pattern rm'. These fingerprint features will be used as inputs for subsequent encoding models to learn the mapping relationship between EEG patterns and home appliance control intentions.
[0095] It should be noted that the above method is suitable for extracting the EEG fingerprint sequence corresponding to a single home appliance operation. In practical applications, different home appliances usually stimulate different cognitive processing processes in the user's brain, resulting in differences in the corresponding EEG patterns. Therefore, the EEG data of users operating different home appliances can be collected separately, and the above steps can be repeated for each type of operation to obtain a set of fingerprint sequences for multiple home appliance operations, thereby providing sufficient differentiated samples for the training of the encoding model and improving the accuracy and generalization ability of the encoding.
[0096] Step S105, obtaining the EEG data of the target user when operating the home appliance, and obtaining the response of the home appliance control intention corresponding to the EEG data.
[0097] Specifically, the EEG pattern response of the home appliance control intention is obtained through the EEG signal of the target user; the response pattern is denoised, reconstructed and wavelet transformed to extract the time-frequency-power three-dimensional features and energy, and the EEG pattern that meets the standard is retained as the input pattern to be encoded in the above steps according to the confidence level.
[0098] In some embodiments, obtaining the response of the home appliance control intention corresponding to the EEG data includes: performing EEG data denoising and reconstruction, wavelet transform, three-dimensional feature extraction and energy extraction on the EEG data to obtain a three-dimensional feature matrix and energy matrix corresponding to the EEG data; inputting the three-dimensional feature matrix into a preset three-dimensional convolutional neural network, and outputting a control intention category label and a confidence score; correcting the confidence score according to the energy matrix; and generating the response of the home appliance control intention according to the corrected confidence score and the control intention category label.
[0099] In the above steps, the present application has obtained the target EEG fingerprint sequence {d1, d2, ..., dM} extracted based on the coding reference pattern set R', and each dm reflects the difference characteristics between the corresponding EEG pattern Fm and its most similar reference pattern rm'. Next, it is necessary to further identify and extract the EEG pattern response when the user operates different home appliances, and retain the pattern with high confidence according to the confidence level as the input of the pattern to be encoded in the above steps. The specific process is as follows:
[0100] First, it is necessary to collect the EEG data of the target user when operating various home appliances. Let the EEG data corresponding to the nth home appliance operation be Xn, where Xn(t) is the EEG signal value at time t, t=1,2,...,Tn, Tn is the data length. Xn(t) is preprocessed in the same way as the above steps, including baseline correction, band interference removal, etc., to obtain a clean EEG time series signal Yn(t). Then Yn(t) needs to be segmented, using the same sliding window method as the above steps, assuming the window length is L and the step size is S, then Mn=Tn-L+S segmented samples {Yn1,Yn2,...,Ynm,...,YnMn} can be obtained, where Ynm=[yn(m),yn(m+1),...,yn(m+L-1)] is the mth segmented sample.
[0101] Perform wavelet transform on each segmented sample Ynm to obtain its time-frequency characteristics. Different from the above steps that directly use wavelet energy as features, it is necessary to further extract information in three dimensions: time, frequency, and power to capture more fine-grained pattern differences. The specific method is:
[0102] 1. Perform J-level wavelet decomposition on Ynm to obtain the wavelet coefficients djk and scale coefficients cJk of each scale;
[0103] 2. Calculate the wavelet energy Wnm(j)=Σk|djk|^2 of the jth scale as the power feature of the scale;
[0104] 3. Perform short-time Fourier transform (STFT) on djk to obtain its time-frequency coefficient Cjk(t,f);
[0105] 4. Calculate the amplitude of Cjk(t,f) as the time-frequency response intensity Pnm(t,f,j) at time t and frequency f;
[0106] 5. Concatenate Pnm(t,f,j) of all scales to obtain the three-dimensional time-frequency-power characteristics of Ynm: Tnm(t,f)=[Pnm(t,f,1),Pnm(t,f,2),...,Pnm(t,f,J)];
[0107] 6. At the same time, calculate the short-time energy of Ynm En(m)=Σt|yn(m+t)|^2.
[0108] Through the above steps, the three-dimensional time-frequency power features {Tn1, Tn2, ..., TnMn} and energy sequences {En(1), En(2), ..., En(Mn)} of all segmented samples corresponding to the nth home appliance operation can be obtained. By splicing these features, the three-dimensional feature matrix Tn and energy matrix En corresponding to the entire home appliance operation Xn can be obtained.
[0109] Next, it is necessary to perform pattern recognition and response evaluation on Xn based on Tn and En. This application can use a deep learning-based method to construct a three-dimensional convolutional neural network (3D CNN), take Tn as input, and train the network to learn the mapping relationship between time-frequency power features and home appliance control intentions. Suppose the trained 3D CNN model is f(·), then for any input feature Tnm, its corresponding control intention category label lnm and confidence score snm can be obtained:
[0110] [lnm, snm] = f(Tnm);
[0111] Where lnm is the predicted control intention category (such as turning on the TV, raising the air-conditioning temperature, etc.), and snm is the confidence score of the prediction, which reflects the model's confidence in the prediction.
[0112] In order to improve the accuracy and robustness of pattern recognition, this application also needs to combine energy information En for comprehensive judgment. The specific method is: first, set an energy threshold εn according to the value of En(m). Only when En(m)>εn, the corresponding response pattern Tnm is sent as a valid input to the 3D CNN model f(·) for prediction; secondly, for the valid input Tnm, in addition to obtaining its predicted label lnm and confidence snm, it is also necessary to evaluate its deviation from the expected energy En_exp:
[0113] δnm = |En(m) - En_exp(lnm)| / En_exp(lnm);
[0114] Where En_exp(lnm) is the expected energy mean corresponding to the intent category lnm in the training data. If δnm is too large, it means that the energy distribution of the response mode deviates greatly from the expectation, and its confidence snm needs to be penalized to obtain the corrected confidence score s'nm.
[0115] Finally, the present application can set an overall confidence threshold smin, and for the nth home appliance operation, only those response patterns {Tnm'} and their corresponding labels {lnm'} with s'nm≥smin are retained as the input of the pattern to be encoded in the above step. In other words, this step outputs a series of high-confidence EEG response patterns that pass the time-frequency power feature and energy test, corresponding to the user's intention category to operate different home appliances, providing a reliable pattern input for subsequent encoding mapping.
[0116] Step S106, constructing an EEG coding model to be trained, completing migration training of the EEG coding model according to the target EEG fingerprint, and outputting a potential feature vector.
[0117] Specifically, an EEG encoding model is constructed based on a deep learning method; the target EEG fingerprint obtained in the above steps is used as the model input, and after transfer training, a potential feature vector is obtained to determine the home appliances that need to be controlled. The network architecture of the encoding model can adopt a hybrid structure of a convolutional neural network (CNN) and a long short-term memory network (LSTM). CNN is used to automatically extract local pattern features in the target EEG fingerprint sequence, while LSTM can learn long-term dependencies in sequence data. The design of this hybrid architecture is inspired by the behavior recognition task in the field of computer vision. The EEG fingerprint sequence in the time dimension is analogous to a video sequence. CNN captures the local features of each frame (each time point), and LSTM integrates the contextual information in the time dimension.
[0118] Suppose the hybrid network is f(·), its input is the target EEG fingerprint sequence X={d1, d2, ..., dM}, and its output is the corresponding home appliance control intention code y. The feedforward calculation process of the network can be expressed as:
[0119] h = CNN(X) # CNN extracts local featuresz = LSTM(h) # LSTM captures temporal dependenciesy = fc(z)# Fully connected layer outputs intent encoding;
[0120] Where h is the feature sequence extracted by CNN, z is the sequence feature after LSTM encoding, and fc(·) is the fully connected layer that maps z to the intent encoding space. During the network training phase, it is necessary to minimize the loss function L(y, y_true), where y_true is the true intent encoding label of the sample. Commonly used loss functions include cross entropy loss (for classification tasks) or mean square error loss (for regression tasks). By performing end-to-end optimization training on the network parameters through the back propagation algorithm, a model f(·) that can accurately map EEG fingerprints to manipulation intention encoding can be obtained.
[0121] It is worth noting that, since the EEG patterns of each target user may have individual differences, directly training the encoding model on the limited data of a single user may lead to overfitting and reduce the generalization ability of the model. In order to solve this problem, this application can adopt a transfer learning strategy, use the existing general EEG dataset to pre-train the encoding model, learn the general EEG pattern feature representation ability, and then fine-tune it on the target user's data to obtain a personalized encoding model with better generalization performance.
[0122] Assume that the initial encoding model is f_0(·), which is fully pre-trained on the general EEG dataset D_source={X_source, Y_source} (where X_source is the EEG fingerprint sequence set, and Y_source is the corresponding control intention encoding label set) to obtain the parameter θ_source. For the target user's EEG fingerprint data X_target and label Y_target, the encoding model first uses θ_source as the initialization parameter and performs the following migration training process:
[0123] 1. Freeze some parameters of the underlying convolutional layers and only fine-tune the high-level LSTM and fully connected layers to retain the general underlying feature extraction capabilities;
[0124] 2. Train on X_target to minimize the loss function L(f(X_target; θ), Y_target);
[0125] 3. According to the performance of the validation set, select the appropriate regularization strength (such as L1 / L2 regularization, dropout ratio, etc.) to prevent overfitting;
[0126] 4. Adopt appropriate optimization strategies, such as alternate optimization of CNN / LSTM layers, cyclic learning rate scheduling, etc.;
[0127] 5. After training converges, output f_target(·) as the personalized encoding model of the target user.
[0128] Through the above transfer training strategy, f_target(·) can not only learn the individual characteristics of the target user, but also retain the general knowledge in the pre-trained model, thereby obtaining better generalization performance. In the inference stage, the new EEG fingerprint sequence X_new of the target user is input into f_target(·), and its corresponding control intention code y_new can be obtained:
[0129] y_new = f_target(X_new)
[0130] It should be noted that the output y_new of the above encoding model can be a discrete category label (classification task) or a continuous real number vector (regression task), depending on the representation of the control intention. If it is a regression task, y_new can be directly output as a potential control intention feature vector; if it is a classification task, y_new needs to be further mapped to a continuous feature space to obtain its corresponding potential feature vector z_new.
[0131] Common feature vector mapping methods include:
[0132] 1. Based on Word Embedding: Treat each discrete category y_new as a "word" and learn its Embedding representation z_new in the continuous vector space;
[0133] 2. Based on category prototype: For each category y_new, calculate the average feature of its samples in the training set as the prototype feature z_new of the category;
[0134] 3. Based on Generative Adversarial Network (GAN): Take the output y_new of the encoding model as the conditional input of GAN, and train the GAN generator to learn to generate the corresponding potential feature vector z_new;
[0135] Through one of the above methods, the discrete control intention code y_new can be mapped to the continuous feature vector space z_new. These feature vectors can better characterize the semantic relationship between different control intentions and provide effective feature representation for subsequent control strategy planning.
[0136] For example: Assume that the EEG fingerprint sequence of the target user when watching TV is X_tv. After inputting into the encoding model f_target(·), the output code is y_tv=2 (i.e., the second type of manipulation intention). If it is a classification task, it can be mapped to the feature vector z_tv=[0.8, -0.3, 0.2, ...] through WordEmbedding. This feature vector can better characterize the semantic difference between the intention of "watching TV" and other intentions (such as "turn on the air conditioner", "turn off the light", etc.), thereby providing effective feature support for subsequent control decisions. Similarly, for the EEG fingerprint input of other manipulation intentions, such as X_ac (turn on the air conditioner), X_light (turn off the light), etc., the corresponding feature vectors z_ac, z_light,... can also be obtained. After constructing a complete manipulation intention feature space, the encoding model can map any new manipulation EEG fingerprint sequence X_new of the target user to the feature space to generate the corresponding manipulation intention feature vector z_new. This feature vector not only contains the category information of the control intention, but also can well describe the semantic relationship between different intentions, providing key feature support for subsequent home appliance control strategy planning.
[0137] The next key question is how to use the obtained control intention feature vector z_new to achieve accurate home appliance control. Here, the application can use a reinforcement learning-based method to model the home appliance control process as a Markov decision process (MDP) and solve the optimal control strategy through a strategy search algorithm.
[0138] Specifically, MDP can be defined as a five-tuple (S, A, P, R, γ), where:
[0139] • S is the state space of the home appliance environment, and each state s∈S describes the current working state of all home appliances (such as temperature, brightness, power switch, etc.);
[0140] • A is the control action space that can be executed by the control agent, and each action a∈A corresponds to a home appliance control operation (such as raising the air conditioner temperature, turning on the TV, etc.);
[0141] • P(s'|s,a) is the state transition probability, which means the probability of transitioning to state s' after executing action a in state s;
[0142] • R(s,a) is the immediate reward function, which reflects the reward value obtained by performing action a in state s;
[0143] • γ∈[0,1] is the discount factor, which controls the impact of immediate rewards on long-term cumulative rewards.
[0144] In this MDP framework, the goal of the control agent is to find a strategy π:S→A that maximizes the expected cumulative reward of the state sequence when following the strategy:
[0145] J(π) = E[∑_t γ^t R(s_t, π(s_t))];
[0146] This is a standard reinforcement learning problem that can be solved by a variety of strategy search algorithms, such as deep Q network (DQN), policy gradient (PG), proximal policy optimization (PPO), etc.
[0147] In order to integrate the manipulation intention feature vector z_new into the reinforcement learning framework, the present application can use it as an additional state feature to construct an extended state vector s'=[s, z_new] containing z_new. In this way, the control strategy π(s') not only depends on the working state s of the home appliance, but can also use the manipulation intention feature z_new to guide the control decision, thereby achieving more accurate and personalized home appliance control.
[0148] In the process of strategy search, the present application can design a reasonable reward function R(s',a) to reflect the user's control intention. For example, for the control intention of "turning on the TV", the action of turning on the TV can be given a positive reward, while other actions (such as turning up the air conditioner temperature) can be given a negative reward or 0 reward. By continuously trying various control actions and updating the parameters of the policy network according to the reward values obtained, the control agent can eventually learn a nearly optimal control strategy π*(s').
[0149] Through the above steps, the present application can combine the control intention feature vector z_new obtained based on EEG decoding with the reinforcement learning framework to achieve accurate and personalized smart home control. This method can not only automatically perceive the user's control intention, but also formulate the optimal home appliance control strategy according to the dynamic changes of the home environment. Compared with traditional manually set rules, this method has stronger intelligence and adaptability.
[0150] Exemplarily, before obtaining the EEG fingerprint sequence corresponding to the potential coding vector, it also includes: updating the ranking score result and the target sub-area network according to the network weight; and completing the optimization of the EEG coding model according to the updated target sub-area network.
[0151] Due to individual differences and environmental changes, the user's EEG pattern may drift slowly over time, causing the performance of the original encoding model to gradually decline. In order to make the encoding model continuously adaptable and robust, it is necessary to dynamically update and optimize the model based on the user's latest EEG data.
[0152] In the above steps, this application will obtain a new EEG database with a small amount of position drift as the input data source for encoding model optimization. The new database records the EEG activities of the target user at different time points and in different environments, and has a certain distribution offset compared to the original database. This application refers to the original database as the source domain and the new database as the target domain. The distribution offset between the source domain and the target domain constitutes a typical domain adaptation problem. By performing migration training between the two domains, the encoding model can learn the inherent laws of data distribution drift, thereby improving its adaptability to new data.
[0153] Specifically, let the original source domain data be D_source={X_source, Y_source}, and the new target domain data be D_target={X_target, Y_target}, where X is the set of EEG fingerprint sequences and Y is the corresponding set of manipulation intention coding labels. The goal of this application is to use the knowledge of the trained coding model f_target(·) on D_source to migrate and optimize its performance on D_target, and obtain a more accurate and more generalized new coding model f_new(·).
[0154] First, the initial parameters of f_target(·) need to be properly initialized so that it can make use of the source domain knowledge as much as possible. Common parameter initialization methods include:
[0155] 1. Directly load the source domain parameters: θ_new = θ_target;
[0156] 2. Make a small perturbation to the source domain parameters: θ_new = θ_target + N(0, σ^2);
[0157] 3. Warm-start based on sample data: perform a small number of iterative updates on D_target;
[0158] Secondly, it is necessary to design a suitable pattern mapping function g(·) to map the source domain feature space to the target domain space, thereby alleviating the distribution shift between the two domains. Commonly used mapping functions include:
[0159] 1. Linear mapping: g(x) = Wx + b;
[0160] 2. Kernel trick mapping: g(x) = φ(x), mapping x to the reproducing kernel Hilbert space (RKHS);
[0161] 3. Deep neural network mapping: g(x) = f_map(x; θ_map), end-to-end learning of nonlinear mapping;
[0162] For EEG encoding tasks, since the distribution offset between the source domain and the target domain is relatively complex, this application can use a deep neural network as the mapping function g(·), where θ_map is a network parameter. In each training iteration, the source domain sample X_source is mapped to the target domain feature space through g(·), paired with the real target domain sample X_target, and a sample pair such as (g(X_source), X_target) is constructed. Then, using these sample pairs as input, based on the objective function of minimizing the classification error, the parameters θ_new and θ_map of the encoding model f_new(·) and the mapping network g(·) are jointly optimized, so that the performance of the model in the target domain is continuously improved.
[0163] Assume the loss function is L(f_new(g(X_source)), Y_target), then the update rule of the model parameters is:
[0164] θ_new ← θ_new - η * ∂L / ∂θ_new ;
[0165] θ_map ← θ_map - η * ∂L / ∂θ_map;
[0166] Where η is the learning rate. This strategy is called reverse gradient training, which has been widely used in the field of deep transfer learning.
[0167] Through the above-mentioned migration training strategy, the present application can finally obtain an encoding model f_new(·) with excellent performance on the new target domain data D_target and its updated network weights θ_new.
[0168] The network weights θ_new can better adapt to the EEG pattern distribution of the target user, but there may still be some pattern omission or underfitting problems. In order to further optimize the encoding model and improve its performance in the target domain, the above steps are aimed at building a high-quality optimized training set based on θ_new, and fine-tuning the model to output the final encoder f_final(·).
[0169] Specifically, this application first inputs all EEG fingerprint sequences X_target in the target domain data D_target={X_target, Y_target} into the updated coding model f_new(·;θ_new) to obtain the predicted manipulation intention coding output Y_pred:
[0170] Y_pred = f_new(X_target; θ_new);
[0171] Where Y_pred is an N×C matrix, N is the number of samples in the target domain, and C is the number of manipulation intent categories. For the nth sample x_n, its prediction code is y_pred_n, that is, the nth row of Y_pred. This application compares y_pred_n with the true label y_n of x_n, and calculates the similarity score s_n between them as the confidence score of the sample. Commonly used similarity calculation methods include:
[0172] 1. Log-Likelihood Score: s_n = log P(y_n|x_n; θ_new) = log y_pred_n[y_n];
[0173] 2. Cosine Similarity: s_n = (y_pred_n · y_n) / (||y_pred_n|| * ||y_n||);
[0174] 3. Distance Score: s_n = -||y_pred_n - y_n||^2;
[0175] Where ||·|| represents the L2 norm. The appropriate similarity function can be selected according to the specific situation. The larger the score s_n, the higher the prediction confidence of the encoding model for the sample.
[0176] Next, this application sorts all samples from high to low according to the confidence score s_n, selects the first K samples with the highest confidence, and records them as the optimized sample set D_opt={X_opt, Y_opt}. Among them, X_opt and Y_opt are the EEG fingerprint sequence set and the control intention encoding label set of the optimized samples respectively. These samples with the highest confidence can be regarded as "support vectors" in the target domain data, which have the most critical impact on the performance of the encoding model. By focusing on optimizing these key samples, the generalization ability of the model in the entire target domain can be effectively improved.
[0177] The setting of K requires a balance between model complexity and training efficiency. Generally speaking, the larger the K is, the richer the information contained in the optimized sample set D_opt is, and the stronger the model's expressiveness is, but it will also increase the difficulty of training and the risk of overfitting; conversely, the smaller the K is, the lower the complexity of the model is, but some valid pattern information may be lost. The common K value setting range is 10%~50% of the sample size, and the optimal value can be determined by methods such as cross-validation.
[0178] With the optimized sample set D_opt, this application can use it as training data to further fine-tune the encoding model f_new(·). Specifically, the optimization goal is set to minimize the cross entropy loss function on D_opt:
[0179] L = -∑_n [y_n · log f_new(x_n; θ)];
[0180] Where θ is the parameter of the encoding model, n is the sample index in D_opt, y_n and x_n are the true label of the nth sample and the input EEG fingerprint sequence respectively. During the training process, this application can use optimization algorithms such as stochastic gradient descent (SGD) to continuously update the model parameter θ according to the gradient information of the loss function:
[0181] θ ← θ - η * ∂L / ∂θ;
[0182] Here η is the learning rate hyperparameter. At the same time, this application can also introduce regularization strategies (such as L1 / L2 regularization terms, dropout, etc.), data enhancement (such as Gaussian noise, deconvolution, etc.), attention mechanisms and other technologies to further improve the generalization ability and robustness of the model.
[0183] The training process can use a mini-batch strategy to speed up convergence, and set reasonable stopping conditions (such as the maximum number of iterations, the slowing down of the loss function, etc.) to prevent overfitting. After each training epoch, this application can also evaluate the model performance on the validation set of the target domain, and select the optimal model parameters based on the evaluation indicators (such as classification accuracy, F1 score, etc.) and save them.
[0184] After the above optimization training, this application can obtain the encoding model f_final(·) and its parameters θ_final with the best performance in the target domain D_target, and use it as the final encoder output of the smart home control system.
[0185] Step S107, obtaining the target manipulation intention category corresponding to the potential feature vector, obtaining the home appliance control code corresponding to the target manipulation intention category, and completing the control of the home appliance corresponding to the home appliance control code.
[0186] Specifically, the potential feature vector obtained in the above step is imported into the coding model in the above step for classification prediction; according to the probability distribution of the control intention and the code output by the feature vector, the code with the highest probability is obtained as the home appliance control code corresponding to the intention. And according to the control intention code obtained in the above step, the home appliance control application area corresponding to the code is determined; in the application area, the controllable response of each home appliance is calculated, and a preset number of high-response devices are selected to form a control device set. According to the control device set, iterative search is performed, and the control strategy corresponding to the maximum controllable response is obtained in each round of iteration, and the final home appliance control instruction is output for execution.
[0187] When the target user has an intention to control a home appliance, the present application first collects the EEG signals emitted by the user's brain and extracts the corresponding EEG fingerprint sequence X_new. X_new is input into the encoder f_encode(·) to obtain its potential feature vector z_new=f_encode(X_new) mapped to the semantic space. Since this feature vector can better characterize the semantic relationship between different control intentions, the present application can regard it as an implicit representation of the control intention and import it into f_final(·;θ_final) for classification prediction.
[0188] Let f_final(·;θ_final) be a K-class classifier whose input is the feature vector z and output is the K-dimensional control intention category probability vector p:
[0189] p = f_final(z; θ_final) = [p_1, p_2, ..., p_K];
[0190] Where p_k represents the probability score of the input feature vector z corresponding to the kth type of control intention, satisfying Σ_k p_k = 1. This application can select the category with the highest probability as the final intention prediction result:
[0191] y_pred = argmax_k(p_k);
[0192] That is, the category index y_pred with the largest probability p_y_pred is regarded as the manipulation intention category corresponding to the feature vector z.
[0193] It should be noted that, since f_final(·;θ_final) is obtained through optimization training in the above steps, its classification performance is relatively good and it can give relatively accurate discrimination results for different control intentions. At the same time, since both f_encode(·) and f_final(·;θ_final) have undergone transfer learning and feature space alignment, the expression of the semantic feature vector z is also relatively consistent and robust, which further ensures the discrimination accuracy of the entire system.
[0194] After determining the control intention category y_pred, the application also needs to obtain the corresponding home appliance control code as the final output result. Here, a code mapping table M can be defined in advance to correspond each control intention category to a specific home appliance control code, such as:
[0195] M = { "Turn on TV": 0x01, "Turn off air conditioner": 0x02, ...};
[0196] For the predicted y_pred, the application can directly query in M to obtain its corresponding home appliance control code c_y:
[0197] c_y = M[y_pred];
[0198] The code c_y can be used for subsequent home appliance control strategy planning and command execution. Of course, in some cases, the control intention is not a simple switch operation, but the adjustment of certain continuous parameters, such as "increase the air conditioning temperature by 2 degrees Celsius". In this case, the present application can regard c_y as a parameterized control code, corresponding to an adjustable parameter value range. Specifically, the present application can model the intention classification problem as a regression task, so that the output of f_final(·;θ_final) is the continuous value of the parameter, such as:
[0199] c_y = f_final(z; θ_final);
[0200] Where c_y is a floating point number, indicating the size of the adjustment parameter. By passing this value to the home appliance control strategy module, the fine-tuning control of the continuous parameters can be achieved.
[0201] In addition to outputting a single control code c_y, the present application can also obtain the confidence score of the control intention based on the probability vector p as auxiliary information of the control strategy. A common confidence measure is predictive entropy:
[0202] H(p) = -Σ_k p_k * log(p_k);
[0203] The smaller the value of entropy H(p), the more concentrated the probability distribution p is, and the more confident the model is about the prediction result. This application can set a confidence threshold η. When H(p)≤η, the prediction result c_y is output and the corresponding home appliance control is executed; otherwise, it can be considered that there is a large uncertainty in the judgment of the model, and additional measures need to be taken (such as requesting user confirmation, prompting re-entry, etc.). Through the above steps, this application can accurately decode the control intention generated in the target user's brain into the corresponding home appliance control code.
[0204] Home appliances in smart homes can be divided into different functional areas, such as living room entertainment area, bedroom rest area, kitchen cooking area, etc. Each control intention code corresponds to a specific application scenario, so this application can pre-establish a mapping table between codes and application areas. For example, code 0x01 corresponds to the intention of "turn on the TV", and its corresponding application area is the living room entertainment area; code 0x02 corresponds to the intention of "increase the air conditioner temperature", and its corresponding application area is the bedroom rest area. By querying the mapping table, the home appliance control application area corresponding to the current control intention code can be determined.
[0205] After determining the application area, this application needs to calculate the controllable response degree of each household appliance in the area to the current control intention code. The controllable response reflects the responsiveness of the household appliance to a specific control intention. The higher the controllable response, the more suitable the device is to be controlled to execute the intention. The calculation of the controllable response can be comprehensively evaluated based on multiple factors such as the functional attributes of the device, the current working status, and the degree of semantic association with the intention.
[0206] Assume that the current control intention is coded as c, and there are N household appliances {d_1, d_2, ..., d_N} in the application area. This application defines the controllable response of the i-th device d_i to the code c as R_i(c). The controllable response R_i(c) can be a comprehensive score or a multidimensional vector, reflecting the device's response capability to the intention in different aspects (such as functional matching, state controllability, etc.).
[0207] Specifically, the calculation of the controllable response R_i(c) can involve the following aspects:
[0208] 1. Functional matching degree F_i(c). It reflects the semantic relevance between the functional attributes of device d_i and the control intention c. For example, for the intention of "turning on the TV", the functional matching degree of the TV is obviously higher than that of the air conditioner; for the intention of "turning up the temperature of the air conditioner", the functional matching degree of the air conditioner is even higher. Based on the pre-built semantic knowledge base, the semantic similarity between the functional descriptions of c and d_i can be calculated as an estimate of F_i(c).
[0209] 2. State controllability S_i(c). It reflects the controllability of device d_i over intent c in the current state. For example, if the air conditioner is already on, the state controllability is low for the intent of "turning on the air conditioner", while it is high for the intent of "increasing the temperature of the air conditioner". S_i(c) can be estimated based on the current working state of the device, the semantics of the intent, and some empirical rules.
[0210] 3. Environmental influence factor E_i(c). It reflects the influence of the current home environment on the device d_i controlled by the intention c. For example, if the curtains in the living room are all open and the sun is shining directly, then for the intention of "turning on the TV", the controllable response of the TV will be affected to a certain extent due to light interference. The size of E_i(c) can be estimated based on the multimodal perception data of the home environment (such as light, temperature, noise, etc.).
[0211] 4. Other factors O_i(c). Other factors that affect the controllable response can be introduced according to specific needs, such as the energy consumption level of the equipment, usage habits, etc.
[0212] Taking all the above factors into consideration, the calculation formula of the controllable response R_i(c) can be designed as:
[0213] R_i(c) = w_F * F_i(c) + w_S * S_i(c) + w_E * E_i(c) + w_O * O_i(c);
[0214] Among them, w_F, w_S, w_E, w_O are the weight coefficients of each factor, which can be determined by machine learning methods or manual settings.
[0215] After calculating the controllable responses R_i(c) of all home appliances, the present application can set a threshold value θ to filter out the first K devices whose controllable responses are greater than θ, forming a control device set D_c = {d_c1, d_c2, ..., d_cK}. These K devices are regarded as the home appliances with the strongest response capability to the current control intention c and will be the key control objects.
[0216] The setting of K needs to balance the control complexity and response coverage. A smaller K value can reduce the computational overhead of the control strategy search, but may cause some effective devices to be ignored; a larger K value can improve the response coverage, but it will also increase the difficulty of the search. A reasonable K value can be determined according to the specific application scenario through methods such as cross-validation.
[0217] Next, this application needs to search for the optimal control strategy in the control device set D_c so that the comprehensive controllable response of these K devices is maximized. Since the working states of household appliances affect each other, the control strategy search process needs to consider the linkage relationship between devices, which is a typical combinatorial optimization problem.
[0218] This application can use heuristic search algorithms, such as simulated annealing, genetic algorithm, etc., to iteratively search for the best in the search space of the control strategy. Set an evaluation function J(D_c, Π) to evaluate the comprehensive controllable response of the control device set D_c under the current control strategy Π. The evaluation function J(D_c, Π) can be a weighted sum form:
[0219] J(D_c, Π) = Σ_i w_i * R_i(c, Π);
[0220] Where R_i(c, Π) is the controllable response of the ith device to the intent c under the strategy Π, and w_i is the weight coefficient of the device. The weight coefficient w_i can be set according to factors such as the importance of the device and the energy consumption level.
[0221] In each round of iteration, the present application can make a small perturbation to the current control strategy Π to obtain a new strategy Π'. Calculate the difference ΔJ between J(D_c, Π') and J(D_c, Π). If ΔJ>0, accept the new strategy Π' and use it as the initial solution for the next round of iteration; otherwise, temporarily accept Π' with a certain probability (this is to prevent the algorithm from falling into a local optimum). Through multiple rounds of iterations, the control strategy is continuously updated, and finally a strategy Π* that is close to the global optimal can be obtained, so that J(D_c, Π*) reaches the maximum value, that is, under this strategy, the comprehensive controllable response of the control device set D_c to the current control intention code c is maximized.
[0222] For example, for the control intention code of "turn on the TV", Π* may simultaneously control the TV to turn on, adjust the living room lights to the appropriate brightness, switch the audio mode, etc., to form a coordinated home appliance configuration and create the best viewing experience for users.
[0223] For the continuous control intention of "raising the air-conditioning temperature by 2 degrees Celsius", Π* will plan a smooth temperature adjustment path to avoid large jitters and improve the control experience.
[0224] When executing Π, the system will issue corresponding control instructions to each device in D_c, so that it can adjust its status as required, thereby maximizing the comprehensive response capability of the entire set and achieving precise control of home appliances.
[0225] In order to execute the smart home control method based on EEG decoding corresponding to the above method embodiment, so as to achieve the corresponding functions and technical effects. Figure 2 , Figure 2 The structure block diagram of a smart home control device 200 provided in an embodiment of the present application is shown. For the convenience of description, only the parts related to the present embodiment are shown. The smart home control device 200 provided in an embodiment of the present application includes:
[0226] The data acquisition module 201 is used to acquire an EEG database of a target user and determine a plurality of reference EEG patterns from the EEG database;
[0227] A response acquisition module 202 is used to acquire a neuron activation response corresponding to each sub-region network of a preset brain region according to the reference EEG pattern, acquire a disturbance influencing factor corresponding to the sub-region network according to the neuron activation response, and acquire a ranking score result corresponding to each sub-region network according to the plurality of disturbance influencing factors;
[0228] A target determination module 203 is used to determine a target sub-region network according to the plurality of ranking and scoring results, and optimize the plurality of reference EEG patterns in the target sub-region network to determine some of the reference EEG patterns as encoding benchmarks;
[0229] The fingerprint acquisition module 204 is used to determine the EEG pattern to be encoded in the reference EEG pattern as the encoding benchmark according to the EEG response difference of the target user when controlling the home appliance, obtain the difference EEG signal between the EEG pattern to be encoded and the remaining reference EEG patterns of the encoding benchmark, and obtain the target EEG fingerprint of the difference EEG signal;
[0230] The operation acquisition module 205 is used to acquire the EEG data of the target user when operating the home appliance, and acquire the response of the home appliance control intention corresponding to the EEG data;
[0231] The model training module 206 is used to construct an EEG coding model to be trained, complete the migration training of the EEG coding model according to the target EEG fingerprint, and output a potential feature vector;
[0232] The home appliance control module 207 is used to obtain the target manipulation intention category corresponding to the potential feature vector, obtain the home appliance control code corresponding to the target manipulation intention category, and complete the control of the home appliance corresponding to the home appliance control code.
[0233] The above-mentioned smart home control device 200 can implement the smart home control method based on EEG decoding of the above-mentioned method embodiment. The optional items in the above-mentioned method embodiment are also applicable to this embodiment and will not be described in detail here. The rest of the contents of the embodiment of this application can refer to the contents of the above-mentioned method embodiment, and will not be repeated in this embodiment.
[0234] Figure 3 This is a schematic diagram of the structure of a computer device provided in one embodiment of the present application. Figure 3 As shown, the computer device 3 of this embodiment includes: at least one processor 30 ( Figure 3 Only one is shown in the figure), a memory 31 and a computer program 32 stored in the memory 31 and executable on the at least one processor 30, wherein the processor 30 implements the steps of any of the above method embodiments when executing the computer program 32.
[0235] The computer device 3 may be a computing device such as a smart phone, a tablet computer, a desktop computer, a cloud server, etc. The computer device may include but is not limited to a processor 30 and a memory 31. Those skilled in the art will understand that Figure 3 It is only an example of computer device 3 and does not constitute a limitation on computer device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0236] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0237] In some embodiments, the memory 31 may be an internal storage unit of the computer device 3, such as a hard disk or memory of the computer device 3. In other embodiments, the memory 31 may also be an external storage device of the computer device 3, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 3. Further, the memory 31 may also include both an internal storage unit and an external storage device of the computer device 3. The memory 31 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 31 may also be used to temporarily store data that has been output or is to be output.
[0238] In addition, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0239] An embodiment of the present application provides a computer program product. When the computer program product is run on a computer device, the computer device implements the steps in the above-mentioned method embodiments when executing the computer device.
[0240] In several embodiments provided in the present application, it is understood that each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved.
[0241] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0242] The specific embodiments described above further describe the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the scope of protection of the present application. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of protection of the present application.
Claims
1. A smart home control method based on EEG decoding, characterized in that: include: Acquire an EEG database of a target user, and determine a plurality of reference EEG patterns in the EEG database; Obtaining a neuron activation response corresponding to each sub-region network of a preset brain region according to the reference EEG pattern, obtaining a disturbance influencing factor corresponding to the sub-region network according to the neuron activation response, and obtaining a ranking score result corresponding to each sub-region network according to the plurality of disturbance influencing factors; Determine a target sub-region network according to the plurality of ranking and scoring results, and optimize the plurality of reference EEG patterns in the target sub-region network to determine some of the reference EEG patterns as encoding benchmarks; Determine an EEG pattern to be encoded in the reference EEG pattern serving as the encoding benchmark according to the EEG response difference of the target user when controlling the home appliance, obtain a difference EEG signal between the EEG pattern to be encoded and the remaining reference EEG patterns of the encoding benchmark, and obtain a target EEG fingerprint of the difference EEG signal; Acquire the EEG data of the target user when operating the home appliance, and acquire the response of the home appliance control intention corresponding to the EEG data; Constructing an EEG coding model to be trained, completing migration training of the EEG coding model according to the target EEG fingerprint, and outputting a potential feature vector; The target manipulation intention category corresponding to the potential feature vector is obtained, the home appliance control code corresponding to the target manipulation intention category is obtained, and the control of the home appliance corresponding to the home appliance control code is completed.
2. The method according to claim 1, characterized in that Determining a plurality of reference EEG patterns in the EEG database comprises: Extracting multiple EEG time series spectra from the EEG database; Determining a brain activity pattern corresponding to the EEG time series spectrum; A plurality of the reference EEG patterns are determined from the plurality of the brain activity patterns.
3. The method according to claim 1, characterized in that Before acquiring the neuron activation response corresponding to each sub-region network of the preset brain region according to the reference EEG pattern, the method further includes: Acquiring functional semantic information corresponding to each reference EEG pattern; According to the functional semantic information, querying the relevant brain region information corresponding to the reference EEG pattern in a preset brain region function knowledge base; Each of the reference EEG patterns is marked in the topological structure of the brain region according to the relevant brain region information, so as to obtain the neuron activation response corresponding to each sub-region network of the brain region according to the reference EEG pattern.
4. The method according to claim 1, characterized in that: The step of obtaining a difference electroencephalogram signal between the electroencephalogram pattern to be encoded and the reference electroencephalogram patterns of the remaining encoding benchmarks, and obtaining a target electroencephalogram fingerprint of the difference electroencephalogram signal comprises: Calculating similarity scores between the EEG pattern to be encoded and the remaining reference EEG patterns of the encoding benchmarks respectively; Determining a matching EEG pattern in the reference EEG pattern according to the similarity score; Calculate the difference EEG signal after aligning the EEG pattern to be encoded and the matching EEG pattern; The difference EEG signal is normalized to obtain the target EEG fingerprint.
5. The method according to claim 1, characterized in that: The obtaining of the response of the home appliance control intention corresponding to the EEG data includes: Performing EEG data denoising and reconstruction, wavelet transform, three-dimensional feature extraction and energy extraction on the EEG data to obtain a three-dimensional feature matrix and an energy matrix corresponding to the EEG data; Inputting the three-dimensional feature matrix into a preset three-dimensional convolutional neural network, and outputting a manipulation intention category label and a confidence score; modifying the confidence score according to the energy matrix; A response status of the home appliance control intention is generated according to the revised confidence score and the control intention category label.
6. The method according to claim 1, characterized in that The step of obtaining the target manipulation intention category corresponding to the potential feature vector further includes: Acquire the updated EEG data of the target user; Using the EEG data before updating as a source domain and the EEG data after updating as a target domain, so as to update the network weights of the EEG encoding model after the EEG data is updated; The EEG fingerprint sequence corresponding to the potential feature vector is obtained, and the EEG fingerprint sequence is input into the EEG coding model to obtain the target manipulation intention category.
7. The method according to claim 6, characterized in that Before obtaining the EEG fingerprint sequence corresponding to the potential feature vector, the method further includes: Update the ranking score result and the target sub-region network according to the network weight; The EEG encoding model is optimized according to the updated target sub-region network.
8. A smart home control device, characterized in that: include: A data acquisition module, used to acquire an EEG database of a target user and determine a plurality of reference EEG patterns from the EEG database; A response acquisition module, used to acquire a neuron activation response corresponding to each sub-region network of a preset brain region according to the reference EEG pattern, acquire a disturbance influencing factor corresponding to the sub-region network according to the neuron activation response, and acquire a ranking score result corresponding to each sub-region network according to a plurality of the disturbance influencing factors; A target determination module, used to determine a target sub-region network according to the plurality of ranking and scoring results, and optimize the plurality of reference EEG patterns in the target sub-region network to determine some of the reference EEG patterns as encoding benchmarks; A fingerprint acquisition module, used to determine the EEG pattern to be encoded in the reference EEG pattern as the encoding benchmark according to the EEG response difference of the target user in controlling the home appliance, obtain the difference EEG signal between the EEG pattern to be encoded and the remaining reference EEG patterns of the encoding benchmark, and obtain the target EEG fingerprint of the difference EEG signal; An operation acquisition module, used to acquire EEG data of the target user when operating the home appliance, and acquire the response of the home appliance control intention corresponding to the EEG data; A model training module, used to construct an EEG coding model to be trained, complete the migration training of the EEG coding model according to the target EEG fingerprint, and output a potential feature vector; The home appliance control module is used to obtain the target manipulation intention category corresponding to the potential feature vector, obtain the home appliance control code corresponding to the target manipulation intention category, and complete the control of the home appliance corresponding to the home appliance control code.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the steps of the smart home control method based on EEG decoding as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the steps of the smart home control method based on EEG decoding as described in any one of claims 1 to 7.
