Psychological counseling method and system based on AI generative dialogue

The AI-generated dialogue system addresses the limitations of existing chatbots by enhancing interactivity and security in psychological counseling through a generative model and robust encryption, enabling flexible emotional responses and secure data handling.

CN119252486APending Publication Date: 2025-01-03NEWLAND DIGITAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411349154.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Existing psychological counseling tools based on chatbots lack interactivity and security, as they rely on preset dialogue scripts and do not adequately respond to users' complex emotions or personalized needs, and they fail to protect user data privacy.

Method used

A psychological counseling method and system utilizing AI-generated dialogue, which involves constructing a generative dialogue model from psychological consultation history data, converting voice data to text and back, monitoring emotions, and encrypting and storing counseling data to enhance interactivity and security.

Benefits of technology

The system flexibly responds to users' complex emotions and personalized needs through voice dialogue interaction while ensuring data privacy by employing multiple encryption layers, thereby improving the effectiveness and security of psychological counseling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119252486A_ABST
    Figure CN119252486A_ABST
Patent Text Reader

Abstract

The invention provides a psychological counseling method and system based on AI generative dialogues in the technical field of psychological counseling. The method comprises the steps of S1, obtaining psychological counseling historical data to construct a data set; s2, training the generative dialogue model by using the data set; s3, acquiring input psychological consultation voice data, converting the psychological consultation voice data into psychological consultation text data, and inputting the psychological consultation text data into the generative dialogue model to obtain consultation feedback text data; s4, converting the consultation feedback text data into consultation feedback voice data and automatically playing the consultation feedback voice data so as to perform dialogue interaction; and step S5, in the dialogue interaction process, monitoring the emotion of the user in real time, and generating and displaying a psychological health report based on the emotion of the user and the psychological consultation text data. The psychological counseling system has the advantage that the interactivity and safety of psychological counseling are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of psychological counseling technology, and in particular to a psychological counseling method and system based on AI-generated dialogue. Background Art

[0002] With the acceleration of social pace and the increase of life pressure, mental health problems are becoming more and more common. When people have mental health problems, they need to seek help from psychologists; however, the number of psychologists is limited, and the cost of seeking help from psychologists is high and the time is inflexible, making it difficult for many people to obtain timely and effective psychological help.

[0003] Psychological counseling tools based on chatbots can overcome the above problems to a certain extent. However, most of these psychological counseling tools are based on preset dialogue scripts and cannot flexibly respond to users' complex emotions and personalized needs. In other words, they have poor interactivity, resulting in limited psychological counseling effects. In addition, no corresponding security measures are taken for the chat data generated, which poses certain security risks.

[0004] Therefore, how to provide a psychological counseling method and system based on AI-generated dialogue to improve the interactivity and safety of psychological counseling has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a psychological counseling method and system based on AI generative dialogue, so as to improve the interactivity and safety of psychological counseling.

[0006] In a first aspect, the present invention provides a psychological counseling method based on AI-generated dialogue, comprising the following steps:

[0007] Step S1, obtaining a large amount of psychological consultation history data, and constructing a data set after preprocessing each of the psychological consultation history data;

[0008] Step S2: creating a generative dialogue model based on the word embedding module and the LSTM module, and training the generative dialogue model using the data set;

[0009] Step S3, obtaining inputted psychological consultation voice data, converting the psychological consultation voice data into psychological consultation text data, inputting the psychological consultation text data into a generative dialogue model, and obtaining consultation feedback text data;

[0010] Step S4: converting the consultation feedback text data into consultation feedback voice data, and automatically playing the consultation feedback voice data to conduct a dialogue interaction;

[0011] Step S5: During the interactive dialogue, the user's emotions are monitored in real time, and a mental health report is generated and displayed based on the user's emotions and the psychological counseling text data;

[0012] Step S6: Pack the psychological counseling text data, counseling feedback text data, user emotions and mental health reports into psychological counseling privacy data, and encrypt and store the psychological counseling privacy data.

[0013] Furthermore, the step S1 is specifically as follows:

[0014] A large amount of psychological counseling historical data is obtained, and after pre-processing the data cleaning, each psychological counseling historical data is labeled with psychological problems, and a data set is constructed based on the labeled psychological counseling historical data.

[0015] Furthermore, the step S2 is specifically as follows:

[0016] Create a generative dialogue model based on the word embedding module and the LSTM module;

[0017] The word embedding module is constructed based on Word2Vec's CBOW and is used to associate the psychological counseling history data with annotations. The objective function is:

[0018]

[0019] Where T represents the total number of words in the psychological counseling history data; w t Indicates the central word in each word to predict the psychological problem; w t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the psychological counseling history data; represents the average vector representation of all context words;

[0020] The LSTM module is used to capture the long-term dependency of the context in the historical data of psychological counseling, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is:

[0021]

[0022] Among them, L represents the loss value of the loss function; N represents the number of samples of historical psychological counseling data; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i;

[0023] The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model;

[0024] The calculation formula of the prediction accuracy is:

[0025] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0026] Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

[0027] Furthermore, the step S3 is specifically as follows:

[0028] Acquire input psychological consultation voice data, wherein the psychological consultation voice data carries personal information including at least gender, age, and occupation, and emotional distress issues;

[0029] The psychological consultation voice data is converted into psychological consultation text data by using speech-to-text technology, and the psychological consultation text data is preprocessed by at least deleting special characters, invalid information, and duplicate information, and then input into a generative dialogue model to obtain consultation feedback text data;

[0030] The step S4 is specifically as follows:

[0031] The consultation feedback text data is converted into consultation feedback voice data in real time through text-to-speech technology, and the consultation feedback voice data is automatically played for dialogue interaction. During the dialogue interaction, the generative dialogue model is continuously optimized based on the psychological counseling text data and the consultation feedback text data.

[0032] Furthermore, the step S5 is specifically as follows:

[0033] During the interactive conversation, the heart rate information is collected through wearable devices such as smart bracelets or smart watches, and facial expressions are collected through cameras. The heart rate information and facial expressions are input into a pre-trained neural network model to monitor the user's emotions in real time, and a mental health report is generated and displayed based on the user's emotions and psychological counseling text data;

[0034] The step S6 is specifically as follows:

[0035] The psychological counseling text data, counseling feedback text data, user emotions and mental health reports are packaged as psychological counseling privacy data, the psychological counseling privacy data is encrypted into first-level encrypted data by RC6 algorithm, each character of the first-level encrypted data is shifted right by 9 bits to obtain second-level encrypted data, the second-level encrypted data is encrypted by 3DES algorithm to obtain third-level encrypted data, the third-level encrypted data is mapped based on a preset mapping rule to obtain fourth-level encrypted data, the number 8 and the letter B in the fourth-level encrypted data are swapped to obtain fifth-level encrypted data, the fifth-level encrypted data is encrypted by ChaCha20 algorithm to obtain encrypted privacy data, and the encrypted privacy data is stored and distributedly backed up.

[0036] In a second aspect, the present invention provides a psychological counseling system based on AI-generated dialogue, comprising the following modules:

[0037] A data set construction module is used to obtain a large amount of psychological counseling historical data, and construct a data set after preprocessing each of the psychological counseling historical data;

[0038] A generative dialogue model training module, used to create a generative dialogue model based on the word embedding module and the LSTM module, and train the generative dialogue model using the data set;

[0039] A psychological consultation voice data input module is used to obtain input psychological consultation voice data, convert the psychological consultation voice data into psychological consultation text data, input the psychological consultation text data into a generative dialogue model, and obtain consultation feedback text data;

[0040] A dialogue interaction module, used for converting the consultation feedback text data into consultation feedback voice data, and automatically playing the consultation feedback voice data to conduct dialogue interaction;

[0041] A mental health report generation module is used to monitor user emotions in real time during the dialogue interaction, and to generate and display a mental health report based on the user emotions and psychological counseling text data;

[0042] The privacy data encryption storage module is used to package the psychological counseling text data, counseling feedback text data, user emotions and mental health reports into psychological counseling privacy data, and encrypt and store the psychological counseling privacy data.

[0043] Furthermore, the data set construction module is specifically used for:

[0044] A large amount of psychological counseling historical data is obtained, and after pre-processing the data cleaning, each psychological counseling historical data is labeled with psychological problems, and a data set is constructed based on the labeled psychological counseling historical data.

[0045] Furthermore, the generative dialogue model training module is specifically used for:

[0046] Create a generative dialogue model based on the word embedding module and the LSTM module;

[0047] The word embedding module is constructed based on Word2Vec's CBOW and is used to associate the psychological counseling history data with annotations. The objective function is:

[0048]

[0049] Where T represents the total number of words in the psychological counseling history data; w t Indicates the central word in each word to predict the psychological problem; w t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the psychological counseling history data; represents the average vector representation of all context words;

[0050] The LSTM module is used to capture the long-term dependency of the context in the historical data of psychological counseling, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is:

[0051]

[0052] Among them, L represents the loss value of the loss function; N represents the number of samples of historical psychological counseling data; C represents the number of categories of psychological problems; yi,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i;

[0053] The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model;

[0054] The calculation formula of the prediction accuracy is:

[0055] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0056] Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

[0057] Furthermore, the psychological consultation voice data input module is specifically used for:

[0058] Acquire input psychological consultation voice data, wherein the psychological consultation voice data carries personal information including at least gender, age, and occupation, and emotional distress issues;

[0059] The psychological consultation voice data is converted into psychological consultation text data by using speech-to-text technology, and the psychological consultation text data is preprocessed by at least deleting special characters, invalid information, and duplicate information, and then input into a generative dialogue model to obtain consultation feedback text data;

[0060] The dialogue interaction module is specifically used for:

[0061] The consultation feedback text data is converted into consultation feedback voice data in real time through text-to-speech technology, and the consultation feedback voice data is automatically played for dialogue interaction. During the dialogue interaction, the generative dialogue model is continuously optimized based on the psychological counseling text data and the consultation feedback text data.

[0062] Furthermore, the mental health report generation module is specifically used to:

[0063] During the interactive conversation, the heart rate information is collected through wearable devices such as smart bracelets or smart watches, and facial expressions are collected through cameras. The heart rate information and facial expressions are input into a pre-trained neural network model to monitor the user's emotions in real time, and a mental health report is generated and displayed based on the user's emotions and psychological counseling text data;

[0064] The privacy data encryption storage module is specifically used for:

[0065] The psychological counseling text data, counseling feedback text data, user emotions and mental health reports are packaged as psychological counseling privacy data, the psychological counseling privacy data is encrypted into first-level encrypted data by RC6 algorithm, each character of the first-level encrypted data is shifted right by 9 bits to obtain second-level encrypted data, the second-level encrypted data is encrypted by 3DES algorithm to obtain third-level encrypted data, the third-level encrypted data is mapped based on a preset mapping rule to obtain fourth-level encrypted data, the number 8 and the letter B in the fourth-level encrypted data are swapped to obtain fifth-level encrypted data, the fifth-level encrypted data is encrypted by ChaCha20 algorithm to obtain encrypted privacy data, and the encrypted privacy data is stored and distributedly backed up.

[0066] The advantages of the present invention are:

[0067] 1. Build a data set by acquiring a large amount of historical psychological counseling data and preprocessing it; then create a generative dialogue model based on the word embedding module and the LSTM module, and use the data set to train the generative dialogue model; then convert the acquired psychological counseling voice data into psychological counseling text data and input it into the generative dialogue model to obtain counseling feedback text data, convert the counseling feedback text data into counseling feedback voice data, and automatically play the counseling feedback voice data for dialogue interaction. During the dialogue interaction, monitor user emotions in real time, and generate and display a mental health report based on user emotions and psychological counseling text data; finally, the psychological counseling text data, counseling feedback text data, and user emotions are combined into a comprehensive psychological counseling report. The psychological health report is packaged as psychological counseling privacy data, and the psychological counseling privacy data is encrypted and stored; that is, the psychological counseling voice data is converted into psychological counseling text data and input into the pre-trained generative dialogue model, and the output counseling feedback text data is converted into counseling feedback voice data for playback to conduct voice dialogue interaction. Since the generative dialogue model is trained based on a large amount of psychological counseling historical data, it can flexibly respond to users' complex emotions and personalized needs, and the psychological counseling text data, counseling feedback text data, user emotions and psychological health reports generated by the psychological counseling process are encrypted and stored to avoid privacy leakage, which ultimately greatly improves the interactivity and security of psychological counseling.

[0068] 2. Encrypt the psychological counseling privacy data into first-level encrypted data through the RC6 algorithm, shift each character of the first-level encrypted data to the right by 9 bits to obtain second-level encrypted data, encrypt the second-level encrypted data through the 3DES algorithm to obtain third-level encrypted data, map the third-level encrypted data based on the mapping rule to obtain fourth-level encrypted data, swap the number 8 and the letter B in the fourth-level encrypted data to obtain fifth-level encrypted data, encrypt the fifth-level encrypted data through the ChaCha20 algorithm to obtain encrypted privacy data, store and distribute the encrypted privacy data. If the corresponding encryption algorithm or data transformation rule is not known, the encrypted privacy data cannot be cracked. At least 7 security measures are taken before and after (RC6 algorithm, character shift right by 9 bits, 3DES algorithm, mapping rule, swap the number 8 and the letter B, ChaCha20 algorithm, distributed backup), which greatly improves the security of the storage of psychological counseling privacy data. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.

[0070] Figure 1 It is a flow chart of a psychological counseling method based on AI generative dialogue of the present invention.

[0071] Figure 2 It is a structural schematic diagram of a psychological counseling system based on AI generative dialogue in the present invention. DETAILED DESCRIPTION

[0072] The technical solution in the embodiments of the present application has the following overall idea: the psychological counseling voice data is converted into psychological counseling text data and input into a pre-trained generative dialogue model, and the output counseling feedback text data is converted into counseling feedback voice data for playback to conduct voice dialogue interaction. Since the generative dialogue model is trained based on a large amount of psychological counseling historical data, it can flexibly respond to the user's complex emotions and personalized needs, and the psychological counseling text data, counseling feedback text data, user emotions and mental health reports generated during the psychological counseling process are encrypted and stored to enhance the interactivity and security of psychological counseling.

[0073] Please refer to Figure 1 to Figure 2 As shown, a preferred embodiment of a psychological counseling method based on AI-generated dialogue of the present invention comprises the following steps:

[0074] Step S1, obtaining a large amount of psychological consultation history data, and constructing a data set after preprocessing each of the psychological consultation history data;

[0075] Step S2: creating a generative dialogue model based on the word embedding module and the LSTM module, and training the generative dialogue model using the data set;

[0076] Step S3, obtaining inputted psychological consultation voice data, converting the psychological consultation voice data into psychological consultation text data, inputting the psychological consultation text data into a generative dialogue model, and obtaining consultation feedback text data;

[0077] Step S4: converting the consultation feedback text data into consultation feedback voice data, and automatically playing the consultation feedback voice data for interactive dialogue; in specific implementation, whether further counseling is needed can be determined based on whether the user inputs new psychological consultation voice data (new questions);

[0078] Step S5: During the interactive dialogue, the user's emotions are monitored in real time, and a mental health report is generated and displayed based on the user's emotions and the psychological counseling text data;

[0079] Step S6: Pack the psychological counseling text data, counseling feedback text data, user emotions and mental health reports into psychological counseling privacy data, and encrypt and store the psychological counseling privacy data. By storing the psychological counseling privacy data, it is convenient to trace the counseling process later.

[0080] The step S1 is specifically as follows:

[0081] A large amount of psychological consultation history data is obtained, and after pre-processing the data cleaning, each psychological consultation history data is labeled with psychological problems, and a data set is constructed based on the labeled psychological consultation history data. The psychological problems include at least depression, anxiety and affective disorders.

[0082] The step S2 is specifically as follows:

[0083] Create a generative dialogue model based on the word embedding module and the LSTM module;

[0084] The word embedding module is built based on Word2Vec's CBOW (Continuous Bag of Words) and is used to associate the psychological counseling history data with annotations. The objective function is:

[0085]

[0086] Where T represents the total number of words in the psychological counseling history data; w t Indicates the central word in each word to predict the psychological problem; w t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the psychological counseling history data; represents the average vector representation of all context words;

[0087] The LSTM module is used to capture the long-term dependency of the context in the historical data of psychological counseling, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is:

[0088]

[0089] Among them, L represents the loss value of the loss function; N represents the number of samples of historical psychological counseling data; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i;

[0090] The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model;

[0091] The calculation formula of the prediction accuracy is:

[0092] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0093] Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

[0094] The step S3 is specifically as follows:

[0095] Acquire input psychological consultation voice data, wherein the psychological consultation voice data carries personal information including at least gender, age, and occupation, and emotional distress issues;

[0096] The psychological consultation voice data is converted into psychological consultation text data by using speech-to-text technology, and the psychological consultation text data is preprocessed by at least deleting special characters, invalid information, and duplicate information, and then input into a generative dialogue model to obtain consultation feedback text data;

[0097] The step S4 is specifically as follows:

[0098] The consultation feedback text data is converted into consultation feedback voice data in real time through text-to-speech technology, and the consultation feedback voice data is automatically played for dialogue interaction. During the dialogue interaction, the generative dialogue model is continuously optimized based on the psychological consultation text data and the consultation feedback text data to improve the psychological counseling effect. The present invention effectively improves the user experience through voice dialogue interaction.

[0099] The step S5 is specifically as follows:

[0100] During the interactive conversation, the heart rate information is collected through wearable devices such as smart bracelets or smart watches, and facial expressions are collected through cameras. The heart rate information and facial expressions are input into a pre-trained neural network model to monitor the user's emotions in real time, and a mental health report is generated and displayed based on the user's emotions and psychological counseling text data;

[0101] The step S6 is specifically as follows:

[0102] The psychological counseling text data, counseling feedback text data, user emotions and mental health reports are packaged as psychological counseling privacy data, the psychological counseling privacy data is encrypted into first-level encrypted data by RC6 algorithm, each character of the first-level encrypted data is shifted right by 9 bits to obtain second-level encrypted data, the second-level encrypted data is encrypted by 3DES algorithm to obtain third-level encrypted data, the third-level encrypted data is mapped based on a preset mapping rule to obtain fourth-level encrypted data, the number 8 and the letter B in the fourth-level encrypted data are swapped to obtain fifth-level encrypted data, the fifth-level encrypted data is encrypted by ChaCha20 algorithm to obtain encrypted privacy data, and the encrypted privacy data is stored and distributedly backed up.

[0103] The psychological counseling privacy data is encrypted into first-level encrypted data through the RC6 algorithm, and each character of the first-level encrypted data is shifted right by 9 bits to obtain second-level encrypted data. The second-level encrypted data is encrypted through the 3DES algorithm to obtain third-level encrypted data. The third-level encrypted data is mapped based on the mapping rule to obtain fourth-level encrypted data. The number 8 and the letter B in the fourth-level encrypted data are swapped to obtain fifth-level encrypted data. The fifth-level encrypted data is encrypted through the ChaCha20 algorithm to obtain encrypted privacy data. The encrypted privacy data is stored and distributedly backed up. If the corresponding encryption algorithm or data transformation rule is not known, the encrypted privacy data cannot be cracked. At least 7 security measures are taken before and after (RC6 algorithm, character shift right by 9 bits, 3DES algorithm, mapping rule, swap number 8 and letter B, ChaCha20 algorithm, distributed backup), which greatly improves the security of psychological counseling privacy data storage.

[0104] A preferred embodiment of a psychological counseling system based on AI-generated dialogue of the present invention includes the following modules:

[0105] A data set construction module is used to obtain a large amount of psychological counseling historical data, and construct a data set after preprocessing each of the psychological counseling historical data;

[0106] A generative dialogue model training module, used to create a generative dialogue model based on the word embedding module and the LSTM module, and train the generative dialogue model using the data set;

[0107] A psychological consultation voice data input module is used to obtain input psychological consultation voice data, convert the psychological consultation voice data into psychological consultation text data, input the psychological consultation text data into a generative dialogue model, and obtain consultation feedback text data;

[0108] A dialogue interaction module is used to convert the consultation feedback text data into consultation feedback voice data, and automatically play the consultation feedback voice data to conduct dialogue interaction; in specific implementation, whether further counseling is needed can be determined based on whether the user inputs new psychological consultation voice data (new questions);

[0109] A mental health report generation module is used to monitor user emotions in real time during the dialogue interaction, and to generate and display a mental health report based on the user emotions and psychological counseling text data;

[0110] The privacy data encryption storage module is used to package the psychological counseling text data, counseling feedback text data, user emotions and mental health reports into psychological counseling privacy data, and encrypt and store the psychological counseling privacy data. By storing the psychological counseling privacy data, it is convenient to trace the counseling process later.

[0111] The data set construction module is specifically used for:

[0112] A large amount of psychological consultation history data is obtained, and after pre-processing the data cleaning, each psychological consultation history data is labeled with psychological problems, and a data set is constructed based on the labeled psychological consultation history data. The psychological problems include at least depression, anxiety and affective disorders.

[0113] The generative dialogue model training module is specifically used for:

[0114] Create a generative dialogue model based on the word embedding module and the LSTM module;

[0115] The word embedding module is built based on Word2Vec's CBOW (Continuous Bag of Words) and is used to associate the psychological counseling history data with annotations. The objective function is:

[0116]

[0117] Where T represents the total number of words in the psychological counseling history data; w t Indicates the central word in each word to predict the psychological problem; w t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the psychological counseling history data; represents the average vector representation of all context words;

[0118] The LSTM module is used to capture the long-term dependency of the context in the historical data of psychological counseling, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is:

[0119]

[0120] Among them, L represents the loss value of the loss function; N represents the number of samples of historical psychological counseling data; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i;

[0121] The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model;

[0122] The calculation formula of the prediction accuracy is:

[0123] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0124] Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

[0125] The psychological consultation voice data input module is specifically used for:

[0126] Acquire input psychological consultation voice data, wherein the psychological consultation voice data carries personal information including at least gender, age, and occupation, and emotional distress issues;

[0127] The psychological consultation voice data is converted into psychological consultation text data by using speech-to-text technology, and the psychological consultation text data is preprocessed by at least deleting special characters, invalid information, and duplicate information, and then input into a generative dialogue model to obtain consultation feedback text data;

[0128] The dialogue interaction module is specifically used for:

[0129] The consultation feedback text data is converted into consultation feedback voice data in real time through text-to-speech technology, and the consultation feedback voice data is automatically played for dialogue interaction. During the dialogue interaction, the generative dialogue model is continuously optimized based on the psychological consultation text data and the consultation feedback text data to improve the psychological counseling effect. The present invention effectively improves the user experience through voice dialogue interaction.

[0130] The mental health report generation module is specifically used for:

[0131] During the interactive conversation, the heart rate information is collected through wearable devices such as smart bracelets or smart watches, and facial expressions are collected through cameras. The heart rate information and facial expressions are input into a pre-trained neural network model to monitor the user's emotions in real time, and a mental health report is generated and displayed based on the user's emotions and psychological counseling text data;

[0132] The privacy data encryption storage module is specifically used for:

[0133] The psychological counseling text data, counseling feedback text data, user emotions and mental health reports are packaged as psychological counseling privacy data, the psychological counseling privacy data is encrypted into first-level encrypted data by RC6 algorithm, each character of the first-level encrypted data is shifted right by 9 bits to obtain second-level encrypted data, the second-level encrypted data is encrypted by 3DES algorithm to obtain third-level encrypted data, the third-level encrypted data is mapped based on a preset mapping rule to obtain fourth-level encrypted data, the number 8 and the letter B in the fourth-level encrypted data are swapped to obtain fifth-level encrypted data, the fifth-level encrypted data is encrypted by ChaCha20 algorithm to obtain encrypted privacy data, and the encrypted privacy data is stored and distributedly backed up.

[0134] The psychological counseling privacy data is encrypted into first-level encrypted data through the RC6 algorithm, and each character of the first-level encrypted data is shifted right by 9 bits to obtain second-level encrypted data. The second-level encrypted data is encrypted through the 3DES algorithm to obtain third-level encrypted data. The third-level encrypted data is mapped based on the mapping rule to obtain fourth-level encrypted data. The number 8 and the letter B in the fourth-level encrypted data are swapped to obtain fifth-level encrypted data. The fifth-level encrypted data is encrypted through the ChaCha20 algorithm to obtain encrypted privacy data. The encrypted privacy data is stored and distributedly backed up. If the corresponding encryption algorithm or data transformation rule is not known, the encrypted privacy data cannot be cracked. At least 7 security measures are taken before and after (RC6 algorithm, character shift right by 9 bits, 3DES algorithm, mapping rule, swap number 8 and letter B, ChaCha20 algorithm, distributed backup), which greatly improves the security of psychological counseling privacy data storage.

[0135] In summary, the advantages of the present invention are:

[0136] 1. Build a data set by acquiring a large amount of historical psychological counseling data and preprocessing it; then create a generative dialogue model based on the word embedding module and the LSTM module, and use the data set to train the generative dialogue model; then convert the acquired psychological counseling voice data into psychological counseling text data and input it into the generative dialogue model to obtain counseling feedback text data, convert the counseling feedback text data into counseling feedback voice data, and automatically play the counseling feedback voice data for dialogue interaction. During the dialogue interaction, monitor user emotions in real time, and generate and display a mental health report based on user emotions and psychological counseling text data; finally, the psychological counseling text data, counseling feedback text data, and user emotions are combined into a comprehensive psychological counseling report. The psychological health report is packaged as psychological counseling privacy data, and the psychological counseling privacy data is encrypted and stored; that is, the psychological counseling voice data is converted into psychological counseling text data and input into the pre-trained generative dialogue model, and the output counseling feedback text data is converted into counseling feedback voice data for playback to conduct voice dialogue interaction. Since the generative dialogue model is trained based on a large amount of psychological counseling historical data, it can flexibly respond to users' complex emotions and personalized needs, and the psychological counseling text data, counseling feedback text data, user emotions and psychological health reports generated by the psychological counseling process are encrypted and stored to avoid privacy leakage, which ultimately greatly improves the interactivity and security of psychological counseling.

[0137] 2. Encrypt the psychological counseling privacy data into first-level encrypted data through the RC6 algorithm, shift each character of the first-level encrypted data to the right by 9 bits to obtain second-level encrypted data, encrypt the second-level encrypted data through the 3DES algorithm to obtain third-level encrypted data, map the third-level encrypted data based on the mapping rule to obtain fourth-level encrypted data, swap the number 8 and the letter B in the fourth-level encrypted data to obtain fifth-level encrypted data, encrypt the fifth-level encrypted data through the ChaCha20 algorithm to obtain encrypted privacy data, store and distribute the encrypted privacy data. If the corresponding encryption algorithm or data transformation rule is not known, the encrypted privacy data cannot be cracked. At least 7 security measures are taken before and after (RC6 algorithm, character shift right by 9 bits, 3DES algorithm, mapping rule, swap the number 8 and the letter B, ChaCha20 algorithm, distributed backup), which greatly improves the security of the storage of psychological counseling privacy data.

[0138] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.

Claims

1. A psychological counseling method based on AI-generated dialogue, characterized by: The steps include: Step S1, obtaining a large amount of psychological consultation history data, and constructing a data set after preprocessing each of the psychological consultation history data; Step S2: creating a generative dialogue model based on the word embedding module and the LSTM module, and training the generative dialogue model using the data set; Step S3, obtaining inputted psychological consultation voice data, converting the psychological consultation voice data into psychological consultation text data, inputting the psychological consultation text data into a generative dialogue model, and obtaining consultation feedback text data; Step S4: converting the consultation feedback text data into consultation feedback voice data, and automatically playing the consultation feedback voice data to conduct a dialogue interaction; Step S5: During the interactive dialogue, the user's emotions are monitored in real time, and a mental health report is generated and displayed based on the user's emotions and the psychological counseling text data; Step S6: Pack the psychological counseling text data, counseling feedback text data, user emotions and mental health reports into psychological counseling privacy data, and encrypt and store the psychological counseling privacy data.

2. A psychological counseling method based on AI-generated dialogue as claimed in claim 1, characterized in that: The step S1 is specifically as follows: A large amount of psychological counseling historical data is obtained, and after pre-processing the data cleaning, each psychological counseling historical data is labeled with psychological problems, and a data set is constructed based on the labeled psychological counseling historical data.

3. A psychological counseling method based on AI-generated dialogue as claimed in claim 1, characterized in that: The step S2 is specifically as follows: Create a generative dialogue model based on the word embedding module and the LSTM module; The word embedding module is constructed based on Word2Vec's CBOW and is used to associate the psychological counseling history data with annotations. The objective function is: Where T represents the total number of words in the psychological counseling history data; w t represents the central word in each word to predict the psychological problem; t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the psychological counseling history data; represents the average vector representation of all context words; The LSTM module is used to capture the long-term dependency of the context in the historical data of psychological counseling, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is: Among them, L represents the loss value of the loss function; N represents the number of samples of historical psychological counseling data; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i; The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model; The calculation formula of the prediction accuracy is: Accuracy=(TP+TN) / (TP+TN+FP+FN); Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

4. The psychological counseling method based on AI-generated dialogue according to claim 1, characterized in that: The step S3 is specifically as follows: Acquire input psychological consultation voice data, wherein the psychological consultation voice data carries personal information including at least gender, age, and occupation, and emotional distress issues; The psychological consultation voice data is converted into psychological consultation text data by using speech-to-text technology, and the psychological consultation text data is preprocessed by at least deleting special characters, invalid information, and duplicate information, and then input into a generative dialogue model to obtain consultation feedback text data; The step S4 is specifically as follows: The consultation feedback text data is converted into consultation feedback voice data in real time through text-to-speech technology, and the consultation feedback voice data is automatically played for dialogue interaction. During the dialogue interaction, the generative dialogue model is continuously optimized based on the psychological counseling text data and the consultation feedback text data.

5. The psychological counseling method based on AI-generated dialogue according to claim 1, characterized in that: The step S5 is specifically as follows: During the interactive conversation, the heart rate information is collected through wearable devices such as smart bracelets or smart watches, and facial expressions are collected through cameras. The heart rate information and facial expressions are input into a pre-trained neural network model to monitor the user's emotions in real time, and a mental health report is generated and displayed based on the user's emotions and psychological counseling text data; The step S6 is specifically as follows: The psychological counseling text data, counseling feedback text data, user emotions and mental health reports are packaged as psychological counseling privacy data, the psychological counseling privacy data is encrypted into first-level encrypted data by RC6 algorithm, each character of the first-level encrypted data is shifted right by 9 bits to obtain second-level encrypted data, the second-level encrypted data is encrypted by 3DES algorithm to obtain third-level encrypted data, the third-level encrypted data is mapped based on a preset mapping rule to obtain fourth-level encrypted data, the number 8 and the letter B in the fourth-level encrypted data are swapped to obtain fifth-level encrypted data, the fifth-level encrypted data is encrypted by ChaCha20 algorithm to obtain encrypted privacy data, and the encrypted privacy data is stored and distributedly backed up.

6. A psychological counseling system based on AI-generated dialogue, characterized by: Includes the following modules: A data set construction module is used to obtain a large amount of psychological counseling historical data, and construct a data set after preprocessing each of the psychological counseling historical data; A generative dialogue model training module, used to create a generative dialogue model based on the word embedding module and the LSTM module, and train the generative dialogue model using the data set; A psychological consultation voice data input module is used to obtain input psychological consultation voice data, convert the psychological consultation voice data into psychological consultation text data, input the psychological consultation text data into a generative dialogue model, and obtain consultation feedback text data; A dialogue interaction module, used for converting the consultation feedback text data into consultation feedback voice data, and automatically playing the consultation feedback voice data to conduct dialogue interaction; A mental health report generation module is used to monitor user emotions in real time during the dialogue interaction, and to generate and display a mental health report based on the user emotions and psychological counseling text data; The privacy data encryption storage module is used to package the psychological counseling text data, counseling feedback text data, user emotions and mental health reports into psychological counseling privacy data, and encrypt and store the psychological counseling privacy data.

7. A psychological counseling system based on AI-generated dialogue as claimed in claim 6, characterized in that: The data set construction module is specifically used for: A large amount of psychological counseling historical data is obtained, and after pre-processing the data cleaning, each psychological counseling historical data is labeled with psychological problems, and a data set is constructed based on the labeled psychological counseling historical data.

8. The psychological counseling system based on AI-generated dialogue according to claim 6, characterized in that: The generative dialogue model training module is specifically used for: Create a generative dialogue model based on the word embedding module and the LSTM module; The word embedding module is constructed based on Word2Vec's CBOW and is used to associate the psychological counseling history data with annotations. The objective function is: Where T represents the total number of words in the psychological counseling history data; w t represents the central word in each word to predict the psychological problem; t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the psychological counseling history data; represents the average vector representation of all context words; The LSTM module is used to capture the long-term dependency of the context in the historical data of psychological counseling, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is: Among them, L represents the loss value of the loss function; N represents the number of samples of historical psychological counseling data; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i; The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model; The calculation formula of the prediction accuracy is: Accuracy=(TP+TN) / (TP+TN+FP+FN); Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

9. The psychological counseling system based on AI-generated dialogue according to claim 6, characterized in that: The psychological consultation voice data input module is specifically used for: Acquire input psychological consultation voice data, wherein the psychological consultation voice data carries personal information including at least gender, age, and occupation, and emotional distress issues; The psychological consultation voice data is converted into psychological consultation text data by using speech-to-text technology, and the psychological consultation text data is preprocessed by at least deleting special characters, invalid information, and duplicate information, and then input into a generative dialogue model to obtain consultation feedback text data; The dialogue interaction module is specifically used for: The consultation feedback text data is converted into consultation feedback voice data in real time through text-to-speech technology, and the consultation feedback voice data is automatically played for dialogue interaction. During the dialogue interaction, the generative dialogue model is continuously optimized based on the psychological counseling text data and the consultation feedback text data.

10. The psychological counseling system based on AI-generated dialogue according to claim 6, characterized in that: The mental health report generation module is specifically used for: During the interactive conversation, the heart rate information is collected through wearable devices such as smart bracelets or smart watches, and facial expressions are collected through cameras. The heart rate information and facial expressions are input into a pre-trained neural network model to monitor the user's emotions in real time, and a mental health report is generated and displayed based on the user's emotions and psychological counseling text data; The privacy data encryption storage module is specifically used for: The psychological counseling text data, counseling feedback text data, user emotions and mental health reports are packaged as psychological counseling privacy data, the psychological counseling privacy data is encrypted into first-level encrypted data by RC6 algorithm, each character of the first-level encrypted data is shifted right by 9 bits to obtain second-level encrypted data, the second-level encrypted data is encrypted by 3DES algorithm to obtain third-level encrypted data, the third-level encrypted data is mapped based on a preset mapping rule to obtain fourth-level encrypted data, the number 8 and the letter B in the fourth-level encrypted data are swapped to obtain fifth-level encrypted data, the fifth-level encrypted data is encrypted by ChaCha20 algorithm to obtain encrypted privacy data, and the encrypted privacy data is stored and distributedly backed up.

Citation Information

Cited By

  • Psychological risk early warning intervention system and method based on multi-source heterogeneous portraits and agents

    CN122050816A