A humor content generation method based on causal and non-causal feature extraction

By using causal and non-causal feature extraction methods, the problem of humor content generation not matching users' sense of humor in existing technologies is solved, and more accurate humor content generation is achieved.

CN120705551BActive Publication Date: 2026-07-17SUN YAT SEN UNIV +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SUN YAT SEN UNIV
Filing Date
2025-06-19
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

In existing technologies, when retrieving humorous content through keyword searches, it is difficult to accurately match the user's sense of humor, resulting in low accuracy in retrieving humorous content.

Method used

This paper adopts a method based on causal and non-causal feature extraction. By obtaining training samples of humorous content, a pre-trained humorous content generation model is used for feature extraction and compression. A multi-task loss function is constructed, and the model parameters are updated to generate humorous content that matches the user's sense of humor.

Benefits of technology

It improves the accuracy of humor content generation, ensuring that the generated content matches the user's sense of humor and the characteristics of the training samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705551B_ABST
    Figure CN120705551B_ABST
Patent Text Reader

Abstract

This application relates to a humor content generation method based on causal and non-causal feature extraction, comprising: acquiring humor content training samples; the humor content training samples including text samples, image samples, and humor content samples; inputting the text samples and image samples into a pre-trained humor content generation model for feature extraction and compression to obtain causal feature vectors and non-causal feature vectors; constructing a multi-task loss function based on the causal feature vectors, the non-causal feature vectors, and the humor content samples; updating the parameters of the pre-trained humor content generation model according to the multi-task loss function to obtain a target humor content generation model; and inputting target text and target image into the target humor content generation model to obtain target humor content. This application can generate target humor content that conforms to the features of the humor content training samples, improving the accuracy of humor content acquisition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of humor generation, and in particular to a method for generating humor content based on the extraction of causal and non-causal features. Background Technology

[0002] In existing technologies, people can retrieve humorous content by inputting keywords. However, this method often simply retrieves relevant humorous content from a database containing a large amount of humorous material, rather than generating new humorous content. Since the humor of content is influenced by the user's subjective perception, humorous content obtained directly from keyword searches may not align with the user's sense of humor. In other words, existing technologies struggle to obtain humorous content that matches the user's sense of humor, resulting in low accuracy in retrieving humorous content. Summary of the Invention

[0003] Therefore, the purpose of this application is to provide a humor content generation method based on causal and non-causal feature extraction, which can overcome the shortcomings of the prior art.

[0004] To achieve the above objectives, the technical solution adopted in this application is as follows:

[0005] A humor content generation method based on causal and non-causal feature extraction includes:

[0006] Obtain training samples of humorous content; the training samples of humorous content include text samples, image samples, and humorous content samples;

[0007] The text samples and image samples are input into a pre-trained humor content generation model for feature extraction and compression to obtain causal feature vectors and non-causal feature vectors.

[0008] A multi-task loss function is constructed based on the causal feature vector, the non-causal feature vector, and the humor content sample.

[0009] The parameters of the pre-trained humor content generation model are updated according to the multi-task loss function to obtain the target humor content generation model;

[0010] The target text and target image are input into the target humor content generation model to obtain the target humor content.

[0011] As one implementation method, the step of obtaining training samples of humorous content includes:

[0012] Collect humorous content samples, as well as the initial text and initial images corresponding to the humorous content samples;

[0013] Preprocess the initial text and the initial image;

[0014] The preprocessed initial text and initial image are subjected to format conversion processing to obtain the text sample and image sample.

[0015] As one implementation, the step of preprocessing the initial text and the initial image includes:

[0016] The initial text is cleaned; the cleaning process includes removing noise and special characters from the initial text.

[0017] The initial image is normalized; the normalization process includes adjusting the size of the initial image, removing irrelevant background from the initial image, and enhancing the contrast of the initial image.

[0018] As one implementation method, the step of inputting the text samples and the image samples into a pre-trained humor content generation model for feature extraction and compression to obtain causal feature vectors and non-causal feature vectors includes:

[0019] The text samples and image samples are input into the convolutional layer of the pre-trained humor content generation model for feature extraction to obtain semantic features and visual features;

[0020] Using a spatial attention mechanism, based on the first spatial attention heatmap of the convolutional layer of the pre-trained humor content generation model, the semantic features and the visual features are weighted to obtain causal features; the first spatial attention heatmap includes the correlation between each semantic feature and / or each visual feature and the humor content sample.

[0021] Using a spatial attention mechanism, the semantic features and the visual features are weighted based on the second spatial attention heatmap of the convolutional layer of the pre-trained humor content generation model to obtain non-causal features; the second spatial attention heatmap includes the irrelevance of each semantic feature and / or each visual feature to the humor content sample;

[0022] The causal features and the non-causal features are compressed to obtain the causal feature vector and the non-causal feature vector.

[0023] As one implementation method, the humor content sample includes multiple humor element targets;

[0024] The step of constructing a multi-task loss function based on the causal feature vector, the non-causal feature vector, and the humor content sample includes:

[0025] Based on the causal feature vector and the multiple humor element targets of the humor content sample, a first loss function is constructed;

[0026] A second loss function is constructed based on the non-causal feature vector and multiple humor element targets of the humor content sample;

[0027] The multi-task loss function is constructed based on the first loss function and the second loss function.

[0028] As one implementation, the step of constructing a first loss function based on the causal feature vector and multiple humor element targets of the humor content sample includes:

[0029] The first loss function is constructed using the following formula:

[0030] ;

[0031] in, This is the output of the first loss function. The length of the humorous content sample. The first of the humorous content samples A humorous element is the goal. To generate the first based on the causal feature vector The probability of a target with a humorous element.

[0032] As one implementation, the step of constructing a second loss function based on the non-causal feature vector and multiple humor element targets of the humor content sample includes:

[0033] The second loss function is constructed using the following formula:

[0034]

[0035] in, This is the output of the second loss function. The length of the humorous content sample. According to the corresponding number The non-causal feature vector of the humor element target is generated as follows: The probability of each word.

[0036] As one implementation, the step of constructing the multi-task loss function based on the first loss function and the second loss function includes:

[0037] The multi-task loss function is constructed using the following formula:

[0038]

[0039] in, The output of the multi-task loss function; This is the output of the first loss function. This is the output of the second loss function. As the first weighting coefficient, This is the second weighting coefficient. The third weighting coefficient, For joint features Humor generation loss.

[0040] As one implementation, the step of updating the parameters of the pre-trained humor content generation model according to the multi-task loss function to obtain the target humor content generation model includes:

[0041] Based on the LoRA fine-tuning technique, the fine-tuning output function of the linear layer of the pre-trained humor content generation model is obtained;

[0042] The parameters of the linear layer are updated based on the multi-task loss function and the fine-tuning output function to obtain the target humor content generation model.

[0043] As one implementation method, the step of obtaining the fine-tuned output function of the linear layer of the pre-trained humor content generation model according to the LoRA fine-tuning technique includes:

[0044] The fine-tuned output function is obtained using the following formula:

[0045]

[0046] in, The output of the fine-tuned output function is the output of the linear layer. Here is the weight matrix of the linear layer. This is the incremental weight matrix of the linear layer. For the input of the linear layer, and It is a trainable low-rank matrix.

[0047] Compared with traditional technologies, the beneficial effects of this application are:

[0048] This application extracts and compresses features from text and image samples of humorous content training samples into a pre-trained humorous content generation model to obtain causal and non-causal feature vectors. Then, a multi-task loss function is constructed based on the causal and non-causal feature vectors and the humorous content samples. The parameters of the pre-trained humorous content generation model are then updated based on the multi-task loss function to obtain a target humorous content generation model. This model generates target humorous content based on target text and target images, which is beneficial for generating target humorous content that conforms to the features of the humorous content training samples and improves the accuracy of humorous content acquisition.

[0049] To better understand and implement this application, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description

[0050] Figure 1 This is a flowchart illustrating the steps of a humor content generation method based on causal and non-causal feature extraction according to an embodiment of this application.

[0051] Figure 2 This is a data flow diagram illustrating a humor content generation method based on causal and non-causal feature extraction according to an embodiment of this application. Detailed Implementation

[0052] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0053] It should be understood that the described embodiments are merely some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of the embodiments of this application.

[0054] In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances. The singular forms "a," "the," and "the" used in this application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. The word "if" as used herein can be interpreted as "when," "when," or "in response to determination."

[0055] Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0056] Please see Figure 1 This is a flowchart of a humor content generation method based on causal and non-causal feature extraction according to the first embodiment of this application. The method includes:

[0057] S1: Obtain training samples of humorous content; the training samples of humorous content include text samples, image samples, and humorous content samples;

[0058] Among them, the training samples of humorous content are training samples provided by users that match the users' sense of humor or that the users consider humorous.

[0059] S2: Input the text samples and the image samples into a pre-trained humor content generation model for feature extraction and compression to obtain causal feature vectors and non-causal feature vectors;

[0060] Among them, the pre-trained humor content generation model is a large language model (such as GPT, BERT) trained with a large amount of humor content data.

[0061] S3: Construct a multi-task loss function based on the causal feature vector, the non-causal feature vector, and the humor content sample;

[0062] S4: Update the parameters of the pre-trained humor content generation model according to the multi-task loss function to obtain the target humor content generation model;

[0063] S5: Input the target text and target image into the target humor content generation model to obtain the target humor content.

[0064] like Figure 2 As shown, after inputting the text samples and the image samples into the pre-trained humor content generation model, causal feature vectors and non-causal feature vectors can be obtained based on the relationship between the causal feature vectors and the humor content samples, respectively, so as to construct a multi-task loss function.

[0065] In a feasible embodiment, step S1: obtaining training samples of humorous content includes:

[0066] S11: Collect humor content samples, as well as the initial text and initial image corresponding to the humor content samples;

[0067] S12: Preprocess the initial text and the initial image;

[0068] S13: Perform format conversion processing on the preprocessed initial text and the initial image to obtain the text sample and the image sample.

[0069] In a feasible embodiment, step S12, the preprocessing step of the initial text and the initial image, includes:

[0070] S121: Clean the initial text; the cleaning process includes removing noise and special characters from the initial text;

[0071] S122: Perform normalization processing on the initial image; the normalization processing includes adjusting the size of the initial image, removing irrelevant background from the initial image, and enhancing the contrast of the initial image.

[0072] Steps S121 and S122 are independent steps, and there is no restriction on their order.

[0073] In a feasible embodiment, step S2: inputting the text samples and the image samples into a pre-trained humor content generation model for feature extraction and compression to obtain causal feature vectors and non-causal feature vectors, includes:

[0074] S21: Input the text samples and the image samples into the convolutional layer of the pre-trained humor content generation model to extract features, and obtain semantic features and visual features;

[0075] S22: Using a spatial attention mechanism, based on the first spatial attention heatmap of the convolutional layer of the pre-trained humor content generation model, the semantic features and the visual features are weighted to obtain causal features; the first spatial attention heatmap includes the correlation between each semantic feature and / or each visual feature and the humor content sample.

[0076] For example, spatial attention heatmaps can be generated using convolutional layers through spatial attention mechanisms. This represents the relevance of each spatial location to the "humor point." Then, feature weighting is applied to the attention heatmap. With original features Element-by-element multiplication yields causal characteristics. .

[0077] S23: Using a spatial attention mechanism, based on the second spatial attention heatmap of the convolutional layer of the pre-trained humor content generation model, the semantic features and the visual features are weighted to obtain non-causal features; the second spatial attention heatmap includes the irrelevance of each semantic feature and / or each visual feature to the humor content sample;

[0078] For example, spatial attention heatmaps can be generated using convolutional layers through spatial attention mechanisms. This represents the irrelevance of each spatial location to the "humor point." Then, feature weighting is applied to the attention heatmap. Reverse ( ), and with the original features Element-by-element multiplication yields non-causal characteristics.

[0079] Steps S22 and S23 are independent steps, and there is no restriction on their order.

[0080] S24: Compress the causal features and the non-causal features to obtain the causal feature vector and the non-causal feature vector.

[0081] In step S24, feature aggregation and global pooling can be used to compress the causal features and the non-causal features into one-dimensional vectors respectively, thereby obtaining the causal feature vector and the non-causal feature vector.

[0082] In one feasible embodiment, the humor content sample includes multiple humor element targets;

[0083] Step S3: The step of constructing a multi-task loss function based on the causal feature vector, the non-causal feature vector, and the humor content sample includes:

[0084] S31: Construct a first loss function based on the causal feature vector and the multiple humor element targets of the humor content sample;

[0085] S32: Construct a second loss function based on the non-causal feature vector and the multiple humor element targets of the humor content sample;

[0086] S33: Construct the multi-task loss function based on the first loss function and the second loss function.

[0087] Among them, the multi-task loss function is used to maximize the association between causal features and humorous content through mutual information, while minimizing the influence of non-causal features, so as to better generate humorous content based on causal features and reduce the interference of non-causal features.

[0088] In a feasible embodiment, step S31: constructing a first loss function based on the causal feature vector and multiple humor element targets of the humor content sample, includes:

[0089] Using cross-entropy loss to guide the mapping between causal feature vectors and humorous content samples ( Learning indirectly maximizes the mutual information between them. mutual information ,in Since mutual information is constant, maximizing mutual information is equivalent to minimizing conditional entropy. We use cross-entropy loss as... The variational upper bound is optimized to indirectly maximize mutual information, thereby constructing the first loss function:

[0090] ;

[0091] in, This is the output of the first loss function. The length of the humorous content sample. The first of the humorous content samples A humorous element is the goal. To generate the first based on the causal feature vector The probability of a target with a humorous element.

[0092] In a feasible embodiment, step S32: constructing a second loss function based on the non-causal feature vector and multiple humor element targets of the humor content sample, includes:

[0093] Force the mapping between non-causal feature vectors and humorous content samples using KL divergence. Following an approximately uniform distribution, the second loss function is constructed as follows:

[0094]

[0095] in, This is the output of the second loss function. The length of the humorous content sample. According to the corresponding number The non-causal feature vector of the humor element target is generated as follows: The probability of each word For vocabulary size, , where is the probability of a uniform distribution of the vocabulary.

[0096] The second loss function is the KL divergence loss function, which forces non-causal features. The output is nearly uniformly distributed, suppressing its correlation with the target humorous content and minimizing the influence of non-causal features on the generation process.

[0097] In a feasible embodiment, step S33: constructing the multi-task loss function based on the first loss function and the second loss function includes:

[0098] The multi-task loss function is constructed using the following formula:

[0099]

[0100] in, The output of the multi-task loss function; This is the output of the first loss function. This is the output of the second loss function. As the first weighting coefficient, This is the second weighting coefficient. The third weighting coefficient, For joint features Humor generation loss, It is By splicing these features together and feeding them into a decoder, the true sequence can be obtained. This involves calculating the loss function for generation to improve overall generation capabilities and feature synergy. By minimizing the multi-task loss function, the optimization objectives of causal and non-causal features can be balanced, while simultaneously optimizing the weights of causal and non-causal features to ensure the humor and originality of the generated content.

[0101] In a feasible embodiment, step S4: updating the parameters of the pre-trained humor content generation model according to the multi-task loss function to obtain the target humor content generation model includes:

[0102] S41: Obtain the fine-tuning output function of the linear layer of the pre-trained humor content generation model according to the LoRA fine-tuning technique;

[0103] The core idea of ​​LoRA fine-tuning technology is low-rank heavy parameterization, which can be trained using two low-rank matrices with dimensions much smaller than the incremental weight matrix of a linear layer, greatly reducing the number of training parameters and memory usage.

[0104] S42: Update the parameters of the linear layer according to the multi-task loss function and the fine-tuning output function to obtain the target humor content generation model.

[0105] Updating the parameters of the linear layers is a fine-tuning process that adapts the pre-trained humor content generation model to specific humor generation tasks, enabling it to generate more accurate and humorous responses given image and text inputs. The training process includes forward propagation, where images and text are input into the model to generate causal, non-causal, and joint features, and humorous content is generated based on the joint features.

[0106] In a feasible embodiment, the step of obtaining the fine-tuned output function of the linear layer of the pre-trained humor content generation model according to the LoRA fine-tuning technique includes:

[0107] The fine-tuned output function is obtained using the following formula:

[0108]

[0109] in, The output of the fine-tuned output function is the output of the linear layer. Here is the weight matrix of the linear layer. This is the incremental weight matrix of the linear layer. For the input of the linear layer, and It is a trainable low-rank matrix.

[0110] In one embodiment of the cross-functional approach, after step S5: inputting the target text and target image into the target humor content generation model to obtain the target humor content, the method further includes the step of: evaluating and optimizing the quality of the target humor content.

[0111] The evaluation process includes user feedback and evaluation criteria (such as creativity, humor, and receptiveness). User feedback refers to user responses to the target humorous content, assessing its creativity, humor, and other metrics. Evaluation criteria can use automated evaluation standards (such as BLEU scores, creativity scores, and humor scores) to quantitatively evaluate the target humorous content.

[0112] Optimization refers to improving the target humor content generation model. For example, adjusting the weights of causal and non-causal features based on user feedback and evaluation criteria to optimize the model parameters of the target humor content generation model, so that the humor content generated by the target humor content generation model is more in line with user feedback and evaluation criteria.

[0113] Compared with traditional technologies, the beneficial effects of this application are:

[0114] This application extracts and compresses features from text and image samples of humorous content training samples into a pre-trained humorous content generation model to obtain causal and non-causal feature vectors. Then, a multi-task loss function is constructed based on the causal and non-causal feature vectors and the humorous content samples. The parameters of the pre-trained humorous content generation model are then updated based on the multi-task loss function to obtain a target humorous content generation model. This model generates target humorous content based on target text and target images, which is beneficial for generating target humorous content that conforms to the features of the humorous content training samples and improves the accuracy of humorous content acquisition.

[0115] The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without any inventive effort.

[0116] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0117] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1One or more processes and / or boxes Figure 1 The function selected in one or more boxes.

[0118] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function selected in one or more boxes.

[0119] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0120] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0121] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0122] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0123] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for generating humorous content based on causal and non-causal feature extraction, characterized in that, include: Obtain training samples of humorous content; The training samples for humorous content include text samples, image samples, and humorous content samples; The text samples and image samples are input into a pre-trained humor content generation model for feature extraction and compression to obtain causal feature vectors and non-causal feature vectors. A multi-task loss function is constructed based on the causal feature vector, the non-causal feature vector, and the humor content sample. The parameters of the pre-trained humor content generation model are updated according to the multi-task loss function to obtain the target humor content generation model; The target text and target image are input into the target humor content generation model to obtain the target humor content; The step of inputting the text samples and image samples into a pre-trained humor content generation model for feature extraction and compression to obtain causal and non-causal feature vectors includes: The text samples and image samples are input into the convolutional layer of the pre-trained humor content generation model for feature extraction to obtain semantic features and visual features; Using a spatial attention mechanism, based on the first spatial attention heatmap of the convolutional layer of the pre-trained humor content generation model, the semantic features and the visual features are weighted to obtain causal features; the first spatial attention heatmap includes the correlation between each semantic feature and / or each visual feature and the humor content sample. Using a spatial attention mechanism, the semantic features and the visual features are weighted based on the second spatial attention heatmap of the convolutional layer of the pre-trained humor content generation model to obtain non-causal features; the second spatial attention heatmap includes the irrelevance of each semantic feature and / or each visual feature to the humor content sample; The causal features and the non-causal features are compressed to obtain the causal feature vector and the non-causal feature vector.

2. The humor content generation method based on causal and non-causal feature extraction according to claim 1, characterized in that, The step of obtaining training samples of humorous content includes: Collect humorous content samples, as well as the initial text and initial images corresponding to the humorous content samples; Preprocess the initial text and the initial image; The preprocessed initial text and initial image are subjected to format conversion processing to obtain the text sample and image sample.

3. The humor content generation method based on causal and non-causal feature extraction according to claim 2, characterized in that, The step of preprocessing the initial text and the initial image includes: The initial text is cleaned; the cleaning process includes removing noise and special characters from the initial text. The initial image is normalized; the normalization process includes adjusting the size of the initial image, removing irrelevant background from the initial image, and enhancing the contrast of the initial image.

4. The humor content generation method based on causal and non-causal feature extraction according to claim 1, characterized in that, The humor content sample includes multiple humor element targets; The step of constructing a multi-task loss function based on the causal feature vector, the non-causal feature vector, and the humor content sample includes: Based on the causal feature vector and the multiple humor element targets of the humor content sample, a first loss function is constructed; A second loss function is constructed based on the non-causal feature vector and multiple humor element targets of the humor content sample; The multi-task loss function is constructed based on the first loss function and the second loss function.

5. The humor content generation method based on causal and non-causal feature extraction according to claim 4, characterized in that, The step of constructing a first loss function based on the causal feature vector and multiple humor element targets of the humor content sample includes: The first loss function is constructed using the following formula: , in, This is the output of the first loss function. The length of the humorous content sample. The first of the humorous content samples A humorous element is the goal. To generate the first based on the causal feature vector The probability of a target with a humorous element.

6. The humor content generation method based on causal and non-causal feature extraction according to claim 4, characterized in that, The step of constructing a second loss function based on the non-causal feature vector and multiple humor element targets of the humor content sample includes: The second loss function is constructed using the following formula: , in, This is the output of the second loss function. The length of the humorous content sample. According to the corresponding number The non-causal feature vector of the humor element target is generated as follows: The probability of each word For vocabulary size, , where is the probability of a uniform distribution of the vocabulary.

7. The humor content generation method based on causal and non-causal feature extraction according to claim 4, characterized in that, The step of constructing the multi-task loss function based on the first loss function and the second loss function includes: The multi-task loss function is constructed using the following formula: , in, The output of the multi-task loss function; This is the output of the first loss function. This is the output of the second loss function. As the first weighting coefficient, This is the second weighting coefficient. The third weighting coefficient, For joint features The humor generation loss will combine features The sequence obtained by decoding is fed into the decoder. It is the loss function used to calculate this sequence.

8. The humor content generation method based on causal and non-causal feature extraction according to claim 1, characterized in that, The step of updating the parameters of the pre-trained humor content generation model according to the multi-task loss function to obtain the target humor content generation model includes: Based on the LoRA fine-tuning technique, the fine-tuning output function of the linear layer of the pre-trained humor content generation model is obtained; The parameters of the linear layer are updated based on the multi-task loss function and the fine-tuning output function to obtain the target humor content generation model.

9. The humor content generation method based on causal and non-causal feature extraction according to claim 8, characterized in that, The step of obtaining the fine-tuned output function of the linear layer of the pre-trained humor content generation model according to the LoRA fine-tuning technique includes: The fine-tuned output function is obtained using the following formula: , in, The output of the fine-tuned output function is the output of the linear layer. Here is the weight matrix of the linear layer. This is the incremental weight matrix of the linear layer. For the input of the linear layer, and It is a trainable low-rank matrix.