Portrayal prediction method, apparatus and device, and computer medium
By predicting user portraits at topic switching points, using BERT and vector search technology, the problem of insufficient computing resources and inheritance and follow-up capabilities in the existing technology is solved, and efficient user portrait update and adaptive prediction are achieved.
Patent Information
- Application Number
- CN202510137802.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-07
- Publication Date
- 2025-07-25
AI Technical Summary
The prior art wastes serious computing resources when predicting user portraits, and lacks the ability to inherit and follow conversation content and the ability to distinguish different user groups.
By determining whether the current question is a topic switching point, only the image prediction is performed at the topic switching point, the target topic switching recognition model and vector search technology represented by the BERT feature are used to recall portrait items with high similarity from the user profile database, and the image update is performed by updating the prediction model.
It reduces the number of portrait predictions, saves computing resources, improves the inheritance and follow-up ability of portrait prediction and adaptability to different user groups, and reduces the misjudgment rate.
Smart Images

Figure CN120373317A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of intelligent services, and particularly relates to an image prediction method, device, equipment, and computer medium. Background Art
[0002] With the rapid development of large model technology in recent years, the performance of dialogue systems has far exceeded expectations. They can not only achieve simple conversations, but also assist in querying knowledge and summarizing documents, greatly enhancing the role of dialogue systems in real life. Compared with traditional dialogue scenarios, the psychological counseling scenario requires not only that the counselor has relatively rich psychological knowledge, but also relatively rich communication skills. During the psychological counseling process, the counselor needs to gradually understand the actual experiences, psychological problems, and related demands of the client without hurting the client, and then adopt appropriate communication skills and give personalized solutions in combination with applicable school knowledge. With the development of large models, many tasks have applied large models to the psychological field to implement online psychological counseling assistants. However, in real life, due to the differences in user groups and psychological problems, the response strategies of counselors often vary greatly. In order to enable the online psychological counseling assistant to more effectively help clients relieve psychological problems, image prediction of users during the conversation is a commonly used method. Through image prediction of users, the psychological counseling assistant can better make strategic responses according to the user group and the corresponding psychological problems. When predicting the image of a user, existing methods often only use a single-round approach. During the interaction process, every time the user inputs a sentence, the psychological image of the user's conversation content is predicted. This type of method will result in relatively large resource waste in implementation because in many cases, the image of the client will not change significantly, and this method must continuously predict the window conversation as much as possible, consuming too many resources.
[0003] In summary, in the related technology, when predicting the image of a user, computing resources are relatively wasted. Summary of the Invention
[0004] The embodiments of this application provide an implementation solution different from the prior art to solve the technical problem of relatively wasting computing resources when predicting the image of a user in the related technology.
[0005] In a first aspect, this application provides an image prediction method, including: obtaining the conversation record of a target user, where the conversation record includes historical conversations and the current question; determining whether the current question is a topic switching point based on the current question and the historical conversations. If so, determining the predicted image item corresponding to the current question, where the predicted image item includes a predicted image and an image cause corresponding to the predicted image.
[0006] Second aspect, the present application provides an image prediction device, including: an acquisition unit configured to acquire a conversation record of a target user, where the conversation record includes a historical conversation and a current question; a determination unit configured to determine, based on the current question and the historical conversation, whether the current question is a topic switching point, and if so, determine a predicted image item corresponding to the current question, where the predicted image item includes a predicted image and an image cause corresponding to the predicted image.
[0007] Third aspect, the present application provides an electronic device, including: a processor; and a memory configured to store executable instructions of the processor; wherein, the processor is configured to execute any method in the first aspect or any possible implementation manner of the first aspect by executing the executable instructions.
[0008] Fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements any method in the first aspect or any possible implementation manner of the first aspect.
[0009] Fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements any of the methods described in the first aspect or any possible implementation manner of the first aspect.
[0010] The solution of the present application for acquiring a conversation record of a target user, where the conversation record includes a historical conversation and a current question; determining, based on the current question and the historical conversation, whether the current question is a topic switching point, and if so, determining a predicted image item corresponding to the current question, where the predicted image item includes a predicted image and an image cause corresponding to the predicted image, can perform image prediction on the user only when the current question is a topic switching point, reducing the number of image prediction times and saving computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. In the drawings: Figure 1a is a schematic structural diagram of a system provided by an embodiment of the present application; Figure 1b is a schematic flowchart of an image prediction method provided by an embodiment of the present application; Figure 2aSchematic flowchart of the image prediction method provided by an embodiment of the present application; Figure 2b Schematic diagram of the training process of the target topic switching recognition model provided by an embodiment of the present application; Figure 2c Schematic diagram of the data processing scenario for updating the prediction model provided by an embodiment of the present application; Figure 3 Schematic diagram of the structure of the image prediction device provided by an embodiment of the present application; Figure 4 Schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0012] The embodiments of the present application will be described in detail below. Examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to explain the present application, and should not be construed as a limitation to the present application.
[0013] Terms such as "first" and "second" in the description, claims, and drawings of the embodiments of the present application are used to distinguish similar users, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0014] First, some terms in the embodiments of the present application will be explained below to facilitate understanding by those skilled in the art.
[0015] User Persona or User Profile is a method for describing and understanding target users or user groups. It deeply analyzes and summarizes the characteristics, behaviors, needs, preferences, etc. of users in multiple dimensions to form one or more representative user images or prototypes. These user images can not only help designers of products, services, or content better understand their target audiences, but also guide them to make decisions that better meet user expectations and needs.
[0016] BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained language model that has achieved significant breakthroughs in the field of natural language processing (NLP). The features of BERT are mainly reflected in the following aspects: I. Bidirectional training mechanism The core feature of BERT is its bidirectional training mechanism. Traditional language models are usually unidirectional, that is, they can only capture context information from front to back or from back to front, while BERT is bidirectional and can capture the context information before and after words at the same time. This bidirectionality enables BERT to better understand the polysemy of words and capture the semantic information of text more accurately.
[0017] II. Transformer architecture BERT is based on the Transformer model, which is an architecture that relies on the self-attention mechanism. The Transformer architecture abandons traditional RNNs and CNNs and relies entirely on the self-attention mechanism to process sequential data. This architecture makes BERT more flexible and efficient in processing long sequential data and can capture long-distance dependencies between words.
[0018] BGE-zh-1.5 (or written as bge-large-zh-v1.5) is an important model in the field of vector retrieval. This model aims to provide high-quality semantic vector representations to support various downstream tasks such as search, recommendation, etc.
[0019] With the rapid development of large model technology in recent years, the performance of dialogue systems has far exceeded expectations. They can not only achieve simple dialogue exchanges, but also assist in querying knowledge and summarizing documents, greatly enhancing the role of dialogue systems in real life. Compared with traditional dialogue scenarios, the psychological counseling scenario requires not only that counselors have relatively rich psychological knowledge, but also possess relatively rich communication skills. In the process of psychological counseling, counselors need to gradually understand the actual experiences, psychological problems, and related demands of the clients without hurting them, and then adopt appropriate communication skills and provide personalized solutions in combination with applicable school of thought knowledge. With the development of large models, many tasks have applied large models to the psychological field to realize online psychological counseling assistants. However, in real life, due to the differences in user groups and psychological problems, the reply strategies of counselors often vary greatly. To enable online psychological counseling assistants to more effectively help clients relieve psychological problems, predicting the user portrait during the dialogue is a commonly used method. Through predicting the user portrait, the psychological counseling assistant can better reply strategically according to the user group and corresponding psychological problems. When predicting the user portrait, existing methods often only use a single-round approach. In the interaction process, every time the user inputs a sentence, the psychological portrait of the user's dialogue content is predicted. Not only is the inheritance and following ability of the prediction result insufficient, but there is also no effective distinction for different user groups. At this time, the effect of portrait prediction is not good; Judging the portrait of the client only based on the window content information will, on the one hand, have a greater impact on accuracy. For example, some content with a joking nature will easily lead to misjudgment due to insufficient information in the window. On the other hand, due to the lack of analysis of historical portrait information, this method is often weak in inheriting, following, and adjusting the portrait. At the same time, this type of method will cause a large waste of resources in implementation because, most of the time, the portrait of the client will not change significantly, and this method must continuously predict the window dialogue as much as possible, consuming too much resources. In summary, in the related technologies, a large amount of computing resources are wasted when predicting the user portrait.
[0020] The following will use specific embodiments to elaborate in detail on the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems. These specific embodiments below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0021] FIG. 1 is a schematic structural diagram of a system provided by an exemplary embodiment of the present application. The system includes a terminal 10 and a server 20. Among them, the terminal 10 is used to display a conversation window for the user to input the current question, and the server 20 can be used to execute the portrait prediction method of the present application.
[0022] This solution takes the topic as the core and uses a target topic switching recognition model based on Bert feature representation to determine whether the current question switches topics, that is, whether the current question is a topic switching point, and uses the current question as a topic switching point as the trigger condition for predicting the user's portrait; if a new topic is entered, the current question will be retrieved from the user's key profiling database through vector retrieval to recall some portrait items with a higher similarity to the current question, such as the target portrait item with the highest matching degree to the current question. Then, the user's historical profile, the user's conversation record, and the portrait items with a higher similarity to the current question are input into the updated prediction model to obtain the predicted portrait items, and at the same time, the user's historical profile and the user's key profiling database are updated. Finally, the entire process can better adaptively select the optional portrait range according to different user groups and determine the user's historical profile, and can complete better portrait prediction and following at a lower prediction frequency, which can effectively reduce excessive prediction overhead, and can adaptively update the portrait information according to the topic switch. It can achieve improving the portrait prediction inheritance and following ability of the model while minimizing misjudgment, and can effectively inherit similar historical portraits and update the portraits according to the degree of deepening on the basis of similar portraits.
[0023] The solution in this application is applicable to a variety of Q&A scenarios, such as psychological counseling, intelligent companionship and other scenarios.
[0024] Optionally, in this solution, users can first be divided into different user types according to the user's age and school stage, and different user types each correspond to at least one psychological portrait. Among them, when the user types are different, the basis for determining the psychological portrait is different.
[0025] Optionally, the user type, the psychological portrait corresponding to the user type, and the basis for determining the psychological portrait can be stored in the psychological portrait description library. At least one psychological portrait corresponding to different user types constitutes the optional portrait range corresponding to the user type, and the optional portrait range can be included in the user's historical profile.
[0026] Specifically, some of the content included in the psychological portrait description library can be seen in Table 1: Table 1 Common age and school stage - Psychological portrait differentiation description
[0027] In some embodiments, different user types can be determined according to the user's attributes. Specifically, the user types can also be determined according to more attributes. For example, age range, age and school stage, gender, length of marriage and childbearing, occupation, etc. Regarding this, this application does not make any limitations.
[0028] For further reference, see Figure 1bAs shown Figure 1b FIG. Figure 1b is another schematic flowchart of an image prediction method provided by the present application. After obtaining the basic information of the target user, the optional image range corresponding to the target user can be determined based on the psychological image description library; and then the historical profile corresponding to the target user can be determined according to the optional image range corresponding to the target user and the historical image information corresponding to the target user.
[0029] Further, it is also necessary to obtain the historical conversation of the target user during the psychological counseling interaction, and use the historical conversation and the current question as the conversation record.
[0030] Further, input the current question and the conversation record into the target topic switching recognition model to obtain topic switching information.
[0031] Further, when the topic switching information indicates that the current question is a topic switching point, determine the target image item with the highest matching degree with the current question from multiple image items included in the user key profile database of the target user; and determine the prediction image item corresponding to the current question based on the conversation record, the target image item, and the historical profile.
[0032] By introducing the historical profile, the ability of the model to inherit and follow image prediction can be effectively improved. On the one hand, from the perspective of generation, adding abduction is to introduce a thinking chain into the large model to ensure that the predicted image is more reasonable. On the other hand, from the perspective of input, introducing abduction can realize reasonable update and prediction by combining historical images; the image presented by the historical conversation is only that the peer relationship is poor, and the current visitor emphasizes the upgrade of the severity, so the current corresponding new image needs to be upgraded to the campus peer relationship pressure.
[0033] Further, in this solution, the historical image information and the user key profile database of the target user can be updated based on the prediction image item.
[0034] Optionally, updating the historical image information of the target user based on the prediction image item means: Taking the predicted image in the prediction image item as the new previous image, and taking the image abduction of the predicted image as the image abduction of the new previous image.
[0035] Optionally, updating the user key profile database based on the prediction image item means: adding the prediction image item to the user key profile database.
[0036] In the solution of the present application, the trained target topic switching recognition model and the update prediction model can be modularly encapsulated to fully automate the image prediction of the target user.
[0037] For the execution principles and interaction processes of the constituent units in the embodiments of the present system, reference can be made to the descriptions of the following method embodiments.
[0038] Figure 2a A flowchart of an image prediction method provided for an exemplary embodiment of the present application. The execution subject of this method can be any electronic device, and this method at least includes the following steps S201 - S202: S201. Obtain the conversation record of the target user, where the conversation record includes the historical conversation and the current question. The solution of the present application can be applied to scenarios such as intelligent companionship and intelligent psychological counseling.
[0039] The target user can input the current question in the conversation window.
[0040] The aforementioned historical conversation is the conversation content between the target user and the intelligent system within a preset historical time period before sending the current question. Among them, the intelligent system can refer to a psychological counseling system.
[0041] S202. Based on the current question and the historical conversation, determine whether the current question is a topic switching point. If so, determine the predicted portrait item corresponding to the current question, where the predicted portrait item includes the predicted portrait and the portrait cause corresponding to the predicted portrait. If not, do not process.
[0042] The current question being a topic switching point means that the topic has changed compared to the historical conversation.
[0043] Optionally, when the current question is a non-psychological topic, it can be not processed.
[0044] The current question not being a topic switching point means that the topic has not changed compared to the historical conversation.
[0045] In some optional embodiments of the present application, in S202, the determining whether the current question is a topic switching point based on the current question and the historical conversation includes the following steps S2021 - S2022: S2021. Input the current question and the historical conversation into the target topic switching recognition model to obtain topic switching information. Optionally, the topic switching information is any one of the following: having new portrait information, topic not switched, non-psychological rejection recognition.
[0046] Regarding the determination method of the aforementioned target topic switching recognition model, in some optional embodiments of the present application, the method further includes the following steps S01 - S02: S01. Obtain multiple groups of sample data. Each group of sample data includes: a sample historical conversation, a sample current question, and a sample historical profile. The sample historical profile includes a sample relevant historical profile related to the sample current question and a sample irrelevant historical profile unrelated to the sample current question. S02. Train an initial topic switching recognition model based on the multiple groups of sample data to obtain the target topic switching recognition model.
[0047] In some alternative embodiments of the present application, in S02, the training of the initial topic switching recognition model based on the multiple groups of sample data to obtain the target topic switching recognition model includes the following steps S021 - S025: S021. Take out a group of sample data to be processed from the multiple groups of sample data. The sample data to be processed includes: a sample historical conversation to be analyzed, a sample current question to be analyzed, and a sample historical profile to be analyzed. Optionally, taking out a group of sample data to be processed from the multiple groups of sample data means: taking out a group of sample data that has not been taken out as the sample data to be processed from the multiple groups of sample data.
[0048] Optionally, taking out a group of sample data to be processed from the multiple groups of sample data means: arbitrarily taking out a group of sample data from the multiple groups of sample data as the sample data to be processed.
[0049] S022. Process the sample data to be processed through the initial topic switching recognition model to obtain an encoded sample historical conversation, an encoded sample current question, an encoded sample historical profile, and topic change prediction information of the sample current question to be analyzed relative to the sample historical profile to be analyzed.
[0050] Optionally, in the aforementioned S022, processing the sample data to be processed through the initial topic switching recognition model to obtain an encoded sample historical conversation, an encoded sample current question, an encoded sample historical profile, and topic change prediction information of the sample current question to be analyzed relative to the sample historical profile to be analyzed includes the following steps S0221 - S0222: S0221. Perform encoding processing on the sample historical conversation to be analyzed, the sample current question to be analyzed, and the sample historical profile to be analyzed in the sample data to be processed through an initial encoding unit in the initial topic switching recognition model to obtain an encoded sample historical conversation, an encoded sample current question, and an encoded sample historical profile respectively. Optionally, the aforementioned initial encoding unit is a BERT model.
[0051] Optionally, bge - base - zh - 1.5 can be a pre - trained model of the initial topic switching recognition model.
[0052] S0222. Analyze the concatenation result of the encoded sample historical dialogue and the encoded sample current question through the initial classifier in the initial topic switching recognition model to obtain the topic change prediction information of the current question of the sample to be analyzed relative to the historical profile of the sample to be analyzed; The concatenation result of the encoded sample historical dialogue and the encoded sample current question is obtained by concatenating the encoded sample historical dialogue and the encoded sample current question.
[0053] The topic change prediction information is any one of the following: having new portrait information, topic not switched, non-psychological rejection recognition.
[0054] S023. Obtain the target topic change information of the current question of the sample to be analyzed relative to the historical profile of the sample to be analyzed; The target topic change information is any one of the following: having new portrait information, topic not switched, non-psychological rejection recognition.
[0055] S024. Determine the target loss information based on the target topic change information, the topic change prediction information, the encoded sample current question, the encoded sample historical dialogue, and the encoded sample historical profile; In some alternative embodiments of the present application, in the foregoing step S024, the determining the target loss information based on the target topic change information, the topic change prediction information, the encoded sample current question, the encoded sample historical dialogue, and the encoded sample historical profile includes the following steps S241 - S244: S241. Determine the topic classification loss information based on the target topic change information and the topic change prediction information; S242. Determine the contrast loss information based on the encoded sample current question and the encoded sample historical dialogue; S243. Determine the positive and negative example calculation contrast loss information based on the encoded sample current question and the encoded sample historical profile; S244. Determine the target loss information according to the topic classification loss information, the contrast loss information, and the positive and negative example calculation contrast loss information.
[0056] In some alternative embodiments of the present application, in S244, determining the target loss information according to the topic classification loss information, the contrast loss information, and the positive and negative example calculation contrast loss information may include: summing the topic classification loss information, the contrast loss information, and the positive and negative example calculation contrast loss information to obtain the target loss information.
[0057] S025. Train the initial topic switching recognition model based on the target loss information to obtain the target topic switching recognition model.
[0058] Optionally, in the foregoing S025, training the initial topic switching recognition model based on the target loss information to obtain the target topic switching recognition model includes: determining whether the target loss information or the number of iterations meets a preset condition; if not, adjusting the parameters of the initial topic switching recognition model based on the target loss information, and returning to execute taking out a set of to-be-processed sample data from the multiple sets of sample data; if so, taking the most recently determined initial topic switching recognition model as the target topic switching recognition model.
[0059] Optionally, when the target loss information is less than a preset threshold, it is regarded that the target loss information meets the preset condition.
[0060] Optionally, when the number of iterations reaches a preset number, it is regarded that the number of iterations meets the preset condition.
[0061] Specifically, the training process of the target topic switching recognition model can be seen in Figure 2b as shown.
[0062] S2022. Determine whether the current question is a topic switching point based on the topic switching information.
[0063] Optionally, the topic switching information is any one of the following: having new portrait information, topic not switched, non-psychological rejection recognition.
[0064] Optionally, when the topic switching information is having new portrait information, it is regarded that the current question is a topic switching point.
[0065] Optionally, when the topic switching information is topic not switched, it is regarded that the current question is not a topic switching point.
[0066] Optionally, when the topic switching information is non-psychological rejection recognition, do not process.
[0067] In some alternative embodiments of the present application, in the foregoing S202, determining the predicted portrait item corresponding to the current question includes the following steps S2021 - S2023: S2021. Determine the target portrait item with the highest matching degree with the current question from the multiple portrait items included in the user key profiling database of the target user, and each portrait item includes a historical portrait and the portrait origin of the historical portrait; In some alternative embodiments of the present application, determining the target portrait item with the highest matching degree with the current question from among the multiple portrait items included in the user key profile database of the target user may also be implemented based on the aforementioned target topic switching recognition model. In this regard, the present application does not make any limitations.
[0068] Specifically, in the process of inputting the current question and the historical conversation into the target topic switching recognition model to obtain topic switching information, the judgment and training stages of topic switching are the same, and there is no need to calculate the loss again; however, when determining the target portrait item with the highest matching degree with the current question from among the multiple portrait items included in the user key profile database of the target user, the embedding codes of each portrait item in the multiple portrait items included in the user key profile database will be directly combined with the current question for similarity calculation, and the topk relevant historical portrait profile contents will be recalled (in this case, Top1 is adopted).
[0069] S2022. Obtain the historical profile of the target user; Optionally, the historical profile of the target user includes: at least one historical portrait of the target user in a preset historical time period, the portrait items of the target user's previous portrait, and the portrait items of the previous portrait include the portrait and the portrait cause of the previous portrait, the optional portrait range of the target user, and the user type to which the target user belongs; Among them, the optional portrait range of the target user includes: at least one psychological portrait corresponding to the user type to which the target user belongs.
[0070] S2023. Determine the predicted portrait item corresponding to the current question based on the conversation record, the target portrait item, and the historical profile.
[0071] In some alternative embodiments of the present application, in S2023, determining the predicted portrait item corresponding to the current question based on the conversation record, the target portrait item, and the historical profile includes: Inputting the conversation record, the target portrait item, and the historical profile into an updated prediction model to obtain the predicted portrait item corresponding to the current question.
[0072] Among them, the predicted portrait item includes: the predicted portrait and the portrait cause of the predicted portrait.
[0073] Furthermore, the above method further includes: adding the predicted portrait item to the historical profile of the user to obtain the new historical profile of the target user; adding the predicted portrait item to the user key profile database to obtain the new user key profile database of the target user.
[0074] The foregoing new historical profile and new user key profile database are used for the next data processing.
[0075] Optionally, the pre-trained base for updating the prediction model may be an autoregressive model of the GPT architecture, such as the 1.3B Spark model.
[0076] Optionally, to ensure effective implementation of the update, there will be an additional portrait update determination on the output side of the autoregressive model of the GPT architecture.
[0077] In some alternative embodiments of the present application, the method further includes the following S1-S4: S1. Obtain the basic information of the target user; S2. Determine the optional portrait range corresponding to the target user based on the preset psychological portrait description library and the basic information; In some alternative embodiments of the present application, in S2, determining the optional portrait range corresponding to the target user based on the preset psychological portrait description library and the basic information includes: determining the user type in the psychological portrait description library that matches the basic information based on the basic information, and taking at least one psychological portrait corresponding to the user type as the optional portrait range.
[0078] Optionally, the user type that matches the basic information refers to the user type that is at least partially the same as the content in the basic information.
[0079] S3. Obtain the historical portrait information corresponding to the target user; In some alternative embodiments of the present application, the historical portrait information corresponding to the target user includes: The basic information of the target user, at least one historical portrait of the target user within a preset historical time period; the most recent historical portrait (i.e., the previous portrait) among the at least one historical portrait, and the portrait reason for the most recent historical portrait.
[0080] Optionally, the basic information of the target user may include any one or more of the following: name, gender, age, school stage, occupation.
[0081] S4. Determine the historical profile corresponding to the target user based on the optional portrait range and the historical portrait information.
[0082] Optionally, in the foregoing S4, determining the historical profile corresponding to the target user based on the optional portrait range and the historical portrait information includes: taking the optional portrait range and the historical portrait information as the historical profile corresponding to the target user.
[0083] In some alternative embodiments of the present application, the psychological portrait description library includes multiple psychological portraits and at least one user type corresponding to each psychological portrait. In the aforementioned step S2, determining the optional portrait range corresponding to the target user based on the preset psychological portrait description library and the basic information includes the following steps S21 - S22: S21. Select the target user type that matches the basic information from the psychological portrait description library; S22. Use at least one psychological portrait corresponding to the target user type as the optional portrait range corresponding to the target user.
[0084] Through reasonable user type classification, the portrait can be predicted more regularly and accurately, further ensuring that the categories between psychological portraits are sufficiently separable and effectively reducing the prediction difficulty.
[0085] In some alternative embodiments of the present application, the multiple psychological portraits include: family conflict, high learning pressure, immature love, poor peer relationship, anxiety about future prospects, employment pressure, exam pressure, heavy learning burden, anxiety about future prospects, divorced family, childhood left-behind, stressful life events, etc.
[0086] The user type can be distinguished according to any one or more of the following attributes: age range, age school stage, gender, marriage and childbearing duration. In contrast, the present application does not make any limitations. Optionally, the age school stage may include: junior high school, senior high school, university.
[0087] In some alternative embodiments of the present application, the basic information of the target user is: Name: Little A; Gender: Male; Age: 14; School stage: Junior high school; The optional portrait range of the target user includes: immature love, relatively poor peer relationship, high learning pressure, etc.
[0088] The portrait item of the previous portrait of the target user is: Previous portrait: Relatively poor peer relationship; Portrait reason for the previous portrait: The visitor was marginalized by other classmates because of good grades; The user type to which the target user belongs is school stage: junior high school, or: Gender: Male; Age: 14; School stage: Junior high school; At least one historical portrait of the target user in the preset historical time period may include relatively poor peer relationship.
[0089] Correspondingly, the historical profile of the target user includes: Gender: Male; Age: 14; School stage: junior high school; Optional portrait range: immature love, poor peer relationship, high learning pressure, etc.; Recent historical portrait records (i.e., at least one historical portrait in the preset historical time period): poor peer relationship; The previous portrait: poor peer relationship; Portrait causation (i.e., the portrait causation of the previous portrait): The visitor was marginalized by other students because of good grades.
[0090] The conversation record of the target user may include: Historical conversation: XXX; Current question: They have become even more excessive today and still tease and point at me together; The target portrait item is: Historical portrait: poor peer relationship; Portrait causation: The visitor was marginalized by other students because of good grades.
[0091] Inputting the conversation record, the target portrait item, and the historical profile into the updated prediction model, the predicted portrait item corresponding to the current question obtained may include: Predicted portrait: Campus peer relationship pressure; Portrait causation: The visitor was marginalized by other students because of good grades, and was recently teased and pointed at.
[0092] Inputting the conversation record, the target portrait item, and the historical profile into the updated prediction model, the data processing process of obtaining the predicted portrait item corresponding to the current question can be specifically referred to Figure 2c as shown.
[0093] The present application provides a method for obtaining the conversation record of a target user, where the conversation record includes a historical conversation and a current question; determining whether the current question is a topic switching point based on the current question and the historical conversation, and if so, determining the predicted portrait item corresponding to the current question, where the predicted portrait item includes a predicted portrait and the portrait causation corresponding to the predicted portrait. The solution can perform portrait prediction on the user only when the current question is a topic switching point, reducing the number of portrait prediction times and saving computing resources.
[0094] Figure 3 It is a schematic structural diagram of a portrait prediction device provided by an exemplary embodiment of the present application; wherein, the device includes: An acquisition unit 31, configured to acquire the conversation record of a target user, where the conversation record includes a historical conversation and a current question; A determination unit 32, configured to determine whether the current question is a topic switching point based on the current question and the historical conversation. If so, determine a predicted portrait item corresponding to the current question, where the predicted portrait item includes a predicted portrait and a portrait causation corresponding to the predicted portrait.
[0095] In some alternative embodiments of the present application, when the foregoing device is used to determine the predicted portrait item corresponding to the current question, it is specifically configured to: Determine a target portrait item with the highest matching degree with the current question from multiple portrait items included in the user key profiling database of the target user, where each portrait item includes a historical portrait and a portrait causation of the historical portrait; Obtain the historical profiling of the target user; Determine the predicted portrait item corresponding to the current question based on the conversation record, the target portrait item, and the historical profiling.
[0096] In some alternative embodiments of the present application, the foregoing device is further configured to: Obtain the basic information of the target user; Determine an optional portrait range corresponding to the target user based on a preset psychological portrait description library and the basic information; Obtain the historical portrait information corresponding to the target user; Determine the historical profiling corresponding to the target user based on the optional portrait range and the historical portrait information.
[0097] In some alternative embodiments of the present application, the psychological portrait description library includes multiple psychological portraits and at least one user type corresponding to each psychological portrait. When the foregoing device is used to determine the optional portrait range corresponding to the target user based on the preset psychological portrait description library and the basic information, it is specifically configured to: Select a target user type that matches the basic information from the psychological portrait description library; Use at least one psychological portrait corresponding to the target user type as the optional portrait range corresponding to the target user.
[0098] In some alternative embodiments of the present application, when the foregoing device is used to determine whether the current question is a topic switching point based on the current question and the historical conversation, it is specifically configured to: input the current question and the historical conversation into a target topic switching recognition model to obtain topic switching information; determine whether the current question is a topic switching point based on the topic switching information.
[0099] In some alternative embodiments of the present application, the foregoing device is further configured to: Obtain multiple groups of sample data, where each group of sample data includes: sample historical conversations, sample current questions, and sample historical profiles. The sample historical profiles include sample-related historical profiles related to the sample current questions and sample-unrelated historical profiles unrelated to the sample current questions; Train the initial topic switch recognition model based on the multiple groups of sample data to obtain the target topic switch recognition model.
[0100] In some optional embodiments of the present application, when the foregoing device is used to train the initial topic switch recognition model based on the multiple groups of sample data to obtain the target topic switch recognition model, it is specifically used for: Take out a group of sample data to be processed from the multiple groups of sample data; Through the initial encoding unit in the initial topic switch recognition model, perform encoding processing on the sample historical conversation to be analyzed, the sample current question to be analyzed, and the sample historical profile to be analyzed in the sample data to be processed, and obtain the encoded sample historical conversation, the encoded sample current question, and the encoded sample historical profile respectively; Analyze the concatenated result of the encoded sample historical conversation and the encoded sample current question through the initial classifier in the initial topic switch recognition model to obtain the topic change prediction information of the sample current question to be analyzed relative to the sample historical profile to be analyzed; Obtain the target topic change information of the sample current question to be analyzed relative to the sample historical profile to be analyzed; Determine the target loss information based on the target topic change information, the topic change prediction information, the encoded sample current question, the encoded sample historical conversation, and the encoded sample historical profile; Determine whether the target loss information or the number of iterations meets the preset conditions. If not, adjust the parameters of the initial topic switch recognition model based on the target loss information, and return to execute taking out a group of sample data to be processed from the multiple groups of sample data. If so, use the most recently determined initial topic switch recognition model as the target topic switch recognition model.
[0101] In some optional embodiments of the present application, when the foregoing device is used to determine the target loss information based on the target topic change information, the topic change prediction information, the encoded sample current question, the encoded sample historical conversation, and the encoded sample historical profile, it is specifically used for: Determine the topic classification loss information based on the target topic change information and the topic change prediction information; Determine the contrast loss information based on the encoded sample current question and the encoded sample historical conversation; Determine the positive and negative example calculation contrast loss information based on the currently asked question of the encoded sample and the historical profile of the encoded sample; Determine the target loss information according to the topic classification loss information, the contrast loss information, and the positive and negative example calculation contrast loss information.
[0102] It should be understood that the device embodiments and the method embodiments can correspond to each other, and similar descriptions can refer to the method embodiments. To avoid repetition, they are not elaborated here. Specifically, the device can execute the above method embodiments, and the foregoing and other operations and / or functions of each module in the device respectively correspond to the corresponding processes in each method in the above method embodiments. For the sake of brevity, they are not elaborated here.
[0103] The device of the embodiment of the present application has been described above from the perspective of functional modules. It should be understood that the functional module can be implemented in the form of hardware, or in the form of instructions of software, or in the form of a combination of hardware and software modules. Specifically, the steps of the method embodiments in the present application can be completed by the integrated logic circuit of the hardware in the processor and / or the instructions in the form of software. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by the combination of the hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps in the above method embodiments.
[0104] Figure 4 is a schematic block diagram of an electronic device provided by an embodiment of the present application. The electronic device may include: A memory 301 and a processor 302. The memory 301 is used to store a computer program and transmit the program code to the processor 302. In other words, the processor 302 can call and run the computer program from the memory 301 to implement the method in the embodiment of the present application.
[0105] For example, the processor 302 can be used to execute the above method embodiments according to the instructions in the computer program.
[0106] In some embodiments of the present application, the processor 302 may include but is not limited to: General-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like.
[0107] In some embodiments of the present application, the memory 301 includes, but is not limited to: Volatile memory and / or non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synch link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0108] In some embodiments of the present application, the computer program may be divided into one or more modules, and the one or more modules are stored in the memory 301 and executed by the processor 302 to complete the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.
[0109] As Figure 4 shown, the electronic device may further include: A transceiver 303, which can be connected to the processor 302 or the memory 301.
[0110] Among them, the processor 302 can control the transceiver 303 to communicate with other devices. Specifically, it can send information or data to other devices, or receive information or data sent by other devices. The transceiver 303 can include a transmitter and a receiver. The transceiver 303 can further include an antenna, and the number of antennas can be one or more.
[0111] It should be understood that the various components in the electronic device are connected through a bus system. Among them, the bus system includes, in addition to the data bus, a power bus, a control bus, and a status signal bus.
[0112] This application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computer, the computer can execute the methods in the above method embodiments. Or rather, the embodiments of this application also provide a computer program product containing instructions. When the instructions are executed by a computer, the computer executes the methods in the above method embodiments.
[0113] When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of this application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, a computer, a server, or a data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access, or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital video disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)), etc.
[0114] Those of ordinary skill in the art will realize that the modules and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A professional technician may use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0115] In several embodiments provided by this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or module can be in electrical, mechanical, or other forms.
[0116] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical modules, that is, they can be located in one place, or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, in each embodiment of this application, the functional modules can be integrated in a processing module, or each module can exist physically alone, or two or more modules can be integrated in one module.
[0117] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. An image prediction method, characterized in that, Including: Obtain the conversation record of the target user, where the conversation record includes historical conversations and the current question; Based on the current question and the historical conversations, determine whether the current question is a topic switching point. If so, determine the predicted portrait item corresponding to the current question, where the predicted portrait item includes a predicted portrait and the portrait causal analysis corresponding to the predicted portrait.
2. The method according to claim 1, wherein The determining the predicted portrait item corresponding to the current question includes: Determine the target portrait item with the highest matching degree with the current question from multiple portrait items included in the user key profiling database of the target user. Each portrait item includes a historical portrait and the portrait causal analysis of the historical portrait; Obtain the historical profiling of the target user; Based on the conversation record, the target portrait item, and the historical profiling, determine the predicted portrait item corresponding to the current question.
3. The method according to claim 2, characterized in that, The method further includes: Obtain the basic information of the target user; Based on a preset psychological portrait description library and the basic information, determine the optional portrait range corresponding to the target user; Obtain the historical portrait information corresponding to the target user; Based on the optional portrait range and the historical portrait information, determine the historical profiling corresponding to the target user.
4. The method according to claim 3, wherein The psychological portrait description library includes multiple psychological portraits and at least one user type corresponding to each psychological portrait. The determining the optional portrait range corresponding to the target user based on the preset psychological portrait description library and the basic information includes: Select the target user type that matches the basic information from the psychological portrait description library; Use at least one psychological portrait corresponding to the target user type as the optional portrait range corresponding to the target user.
5. The method according to claim 1, wherein The determining whether the current question is a topic switching point based on the current question and the historical conversations includes: Input the current question and the historical conversations into a target topic switching recognition model to obtain topic switching information; Based on the topic switching information, determine whether the current question is a topic switching point.
6. The method according to claim 5, wherein The method further includes: Obtain multiple groups of sample data. Each group of sample data includes: sample historical conversations, sample current questions, sample historical profiling, where the sample historical profiling includes sample relevant historical profiling related to the sample current question and sample irrelevant historical profiling not related to the sample current question; Train an initial topic switching recognition model based on the multiple groups of sample data to obtain the target topic switching recognition model.
7. The method according to claim 6, wherein The training the initial topic switching recognition model based on the multiple groups of sample data to obtain the target topic switching recognition model includes: Take out a group of sample data to be processed from the multiple groups of sample data. The sample data to be processed includes: sample historical conversations to be analyzed, sample current questions to be analyzed, sample historical profiling to be analyzed; Process the sample data to be processed through the initial topic switching recognition model to obtain encoded sample historical conversations, encoded sample current questions, encoded sample historical profiling, and topic change prediction information of the sample current question to be analyzed relative to the sample historical profiling to be analyzed; Obtain the target topic change information of the current question of the sample to be analyzed relative to the historical profile of the sample to be analyzed; Determine the target loss information based on the target topic change information, the topic change prediction information, the encoded current question of the sample, the encoded historical conversation of the sample, and the encoded historical profile of the sample; Train the initial topic switch recognition model based on the target loss information to obtain the target topic switch recognition model.
8. The method according to claim 7, wherein The determining the target loss information based on the target topic change information, the topic change prediction information, the encoded current question of the sample, the encoded historical conversation of the sample, and the encoded historical profile of the sample includes: Determine the topic classification loss information based on the target topic change information and the topic change prediction information; Determine the contrast loss information based on the encoded current question of the sample and the encoded historical conversation of the sample; Determine the positive and negative example calculation contrast loss information based on the encoded current question of the sample and the encoded historical profile of the sample; Determine the target loss information according to the topic classification loss information, the contrast loss information, and the positive and negative example calculation contrast loss information.
9. An image prediction device, characterized in that, including: An acquisition unit for acquiring the conversation record of the target user, where the conversation record includes a historical conversation and a current question; A determination unit for determining whether the current question is a topic switch point based on the current question and the historical conversation. If so, determine the predicted portrait item corresponding to the current question, and the predicted portrait item includes a predicted portrait and the portrait abduction corresponding to the predicted portrait.
10. An electronic device, characterized in that, including: A processor; and A memory for storing the executable instructions of the processor; Wherein, the processor is configured to execute the method according to any one of claims 1-8 by executing the executable instructions.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program realizes the method according to any one of claims 1-8 when executed by the processor.