Content generation method and apparatus, and computer device and storage medium
View Patent ↗A content generation method includes: obtaining target interaction text of a target object for a target media object; predicting a target emoji type matching the target interaction text according to the target interaction text and pieces of historical interaction content of the target object that include emoji images; obtaining a target text feature based on feature extraction of the target interaction text; obtaining a reference image feature based on feature extraction of at least one reference emoji image, wherein an emoji type of the at least one reference emoji image is the target emoji type; obtaining an encoding result by performing encoding based on the target text feature and the reference image feature; decoding the encoding result, to generate a target emoji image matching the target interaction text configured for insertion into the target interaction text to generate target interaction content of the target object for the target media object.
1 . A content generation method, performed by a computer device, comprising:
obtaining target interaction text of a target object for a target media object;
predicting a target emoji type matching the target interaction text according to the target interaction text and a plurality of pieces of historical interaction content of the target object that comprise a plurality of emoji images;
obtaining a target text feature based on performing feature extraction on the target interaction text, wherein the predicting the target emoji type and the plurality of pieces of the historical interaction content comprises:
determining first emoji type distribution information based on a distribution of a plurality of emoji types of the plurality of emoji images;
obtaining historical interaction text of the target media object;
splicing the historical interaction text and the target interaction text to generate a spliced interaction text; and
predicting the target emoji type matching the target interaction text based on the first emoji type distribution information and the spliced interaction text;
obtaining a reference image feature based on performing feature extraction on at least one reference emoji image, wherein an emoji type of the at least one reference emoji image is the target emoji type;
obtaining an encoding result by performing encoding based on the target text feature and the reference image feature; and
decoding the encoding result, to generate a target emoji image matching the target interaction text configured for insertion into the target interaction text to generate target interaction content of the target object for the target media object.
2 . The content generation method according to claim 1 , wherein the determining the first emoji type distribution information comprises:
obtaining the plurality of pieces of historical interaction content;
determining a plurality of quantities of emoji images respectively corresponding to the plurality of emoji types;
determining a total emoji image quantity of the plurality of emoji images;
determining a plurality of historical occurrence probabilities based on a plurality of ratios of the plurality of quantities of emoji images to the total emoji image quantity; and
obtaining the first emoji type distribution information based on the plurality of historical occurrence probabilities, wherein the first emoji type distribution information comprises the plurality of historical occurrence probabilities.
3 . The content generation method according to claim 1 , wherein the predicting the target emoji type comprises:
predicting second emoji type distribution information representing a plurality of matching degrees between the plurality of emoji types and the target interaction text based on the first emoji type distribution information and the target interaction text; and
selecting, based on the second emoji type distribution information, a first target emoji type matching the target interaction text from the plurality of emoji types as the target emoji type.
4 . The content generation method according to claim 3 , wherein the predicting the second emoji type distribution information comprises:
performing word vector transformation on the spliced interaction text to generate a spliced text feature;
obtaining a type distribution feature obtained by performing feature extraction on the first emoji type distribution information; and
predicting, based on the spliced text feature and the type distribution feature, predicted occurrence probabilities respectively corresponding to the plurality of emoji types, to obtain the second emoji type distribution information, wherein the second emoji type distribution information comprises the predicted occurrence probabilities respectively corresponding to the plurality of emoji types.
5 . The content generation method according to claim 1 , wherein a plurality of reference emoji images are provided, and
wherein the obtaining the reference image feature comprises:
performing image fusion on the plurality of reference emoji images to obtain a reference fused image; and
performing image feature extraction on the reference fused image to obtain the reference image feature.
6 . The content generation method according to claim 1 , wherein the obtaining the encoding result comprises:
performing feature extraction on the target emoji type to obtain a target type feature; and
performing encoding based on the target type feature, the target text feature, and the reference image feature.
7 . The content generation method according to claim 1 , wherein the obtaining the encoding result comprises:
performing feature transformation on the reference image feature based on a plurality of feature transformation matrices to obtain a plurality of transformed image features; and
performing encoding based on the target text feature and the plurality of transformed image features.
8 . The content generation method according to claim 1 , wherein the obtaining the encoding result and the decoding the encoding result comprise:
performing encoding based on the target text feature and the reference image feature, and decoding a result obtained by the encoding, to generate a first candidate emoji image;
determining a first emoji matching degree between the target emoji type and the first candidate emoji image;
updating the at least one reference emoji image based on the first emoji matching degree being less than a matching degree threshold;
performing feature extraction on the updated at least one reference emoji image until the first emoji matching degree is greater than or equal to the matching degree threshold; and
determining a second candidate emoji image with a second emoji matching degree greater than or equal to the matching degree threshold as the target emoji image matching the target interaction text.
9 . A content generation apparatus, comprising:
at least one memory configured to store computer program code; and
at least one processor configured to read the computer program code and operate as instructed by the computer program code, the computer program code comprising:
text obtaining code configured to cause at least one of the at least one processor to obtain target interaction text of a target object for a target media object;
type determining code configured to cause at least one of the at least one processor to predict a target emoji type matching the target interaction text according to the target interaction text and a plurality of pieces of historical interaction content of the target object that comprise a plurality of emoji images, wherein the type determining code comprises:
first determining code configured to cause at least one of the at least one processor to determine first emoji type distribution information based on a distribution of a plurality of emoji types of the plurality of emoji images, and
first prediction code configured to cause at least one of the at least one processor to:
obtain historical interaction text of the target media object,
splice the historical interaction text and the target interaction text to generate a spliced interaction text, and
predict the target emoji type matching the target interaction text based on the first emoji type distribution information and the spliced interaction text;
feature extraction code configured to cause at least one of the at least one processor to obtain a target text feature based on performing feature extraction on the target interaction text;
referencing code configured to cause at least one of the at least one processor to obtain a reference image feature based on performing feature extraction on at least one reference emoji image, wherein an emoji type of the at least one reference emoji image is the target emoji type; and
image generation code comprising encoding code and decoding code,
wherein the encoding code is configured to cause at least one of the at least one processor to obtain an encoding result by performing encoding based on the target text feature and the reference image feature, and
wherein the decoding code is configured to cause at least one of the at least one processor to decode the encoding result, to generate a target emoji image matching the target interaction text configured for insertion into the target interaction text to generate target interaction content of the target object for the target media object, the target emoji image being a dynamically generated new emoji image that is not a preset emoji image selected from a preset emoji library.
10 . The content generation apparatus according to claim 9 , wherein the first determining code is configured to cause at least one of the at least one processor to:
obtain the plurality of pieces of historical interaction content;
determine a plurality of quantities of emoji images respectively corresponding to the plurality of emoji types;
determine a total emoji image quantity of the plurality of emoji images;
determine a plurality of historical occurrence probabilities based on a plurality of ratios of the plurality of quantities of emoji images to the total emoji image quantity; and
obtain the first emoji type distribution information based on the plurality of historical occurrence probabilities, wherein the first emoji type distribution information comprises the plurality of historical occurrence probabilities.
11 . The content generation apparatus according to claim 9 , wherein the first prediction code comprises second prediction code and selection code,
wherein the second prediction code is configured to cause at least one of the at least one processor to predict second emoji type distribution information representing a plurality of matching degrees between the plurality of emoji types and the target interaction text based on the first emoji type distribution information and the target interaction text; and
wherein the selection code is configured to cause at least one of the at least one processor to select, based on the second emoji type distribution information, a first target emoji type matching the target interaction text from the plurality of emoji types as the target emoji type.
12 . The content generation apparatus according to claim 11 , wherein the second prediction code is configured to cause at least one of the at least one processor to:
perform word vector transformation on the spliced interaction text to generate a spliced text feature;
obtain a type distribution feature obtained by performing feature extraction on the first emoji type distribution information; and
predict, based on the spliced text feature and the type distribution feature, predicted occurrence probabilities respectively corresponding to the plurality of emoji types, to obtain the second emoji type distribution information, wherein the second emoji type distribution information comprises the predicted occurrence probabilities respectively corresponding to the plurality of emoji types.
13 . The content generation apparatus according to claim 9 , wherein a plurality of reference emoji images are provided, and
wherein the referencing code is configured to cause at least one of the at least one processor to:
perform image fusion on the plurality of reference emoji images to obtain a reference fused image; and
perform image feature extraction on the reference fused image to obtain the reference image feature.
14 . The content generation apparatus according to claim 9 , wherein the encoding code is configured to cause at least one of the at least one processor to:
perform feature extraction on the target emoji type to obtain a target type feature; and
perform encoding based on the target type feature, the target text feature, and the reference image feature.
15 . The content generation apparatus according to claim 9 , wherein the encoding code is configured to cause at least one of the at least one processor to:
perform feature transformation on the reference image feature based on a plurality of feature transformation matrices to obtain a plurality of transformed image features; and
perform encoding based on the target text feature and the plurality of transformed image features.
16 . A non-transitory computer-readable storage medium, storing computer code which, when executed by at least one processor, causes the at least one processor to at least:
obtain target interaction text of a target object for a target media object;
predict a target emoji type matching the target interaction text according to the target interaction text and a plurality of pieces of historical interaction content of the target object that comprise a plurality of emoji images, wherein predicting the target emoji type and the plurality of pieces of the historical interaction content comprises:
determining first emoji type distribution information based on a distribution of a plurality of emoji types of the plurality of emoji images,
obtaining historical interaction text of the target media object,
splicing the historical interaction text and the target interaction text to generate a spliced interaction text, and
predicting the target emoji type matching the target interaction text based on the first emoji type distribution information and the spliced interaction text;
obtain a target text feature based on performing feature extraction on the target interaction text;
obtain a reference image feature based on performing feature extraction on at least one reference emoji image, wherein an emoji type of the at least one reference emoji image is the target emoji type;
obtain an encoding result by performing encoding based on the target text feature and the reference image feature; and
decode the encoding result, to generate a target emoji image matching the target interaction text configured for insertion into the target interaction text to generate target interaction content of the target object for the target media object, the target emoji image being a dynamically generated new emoji image that is not a preset emoji image selected from a preset emoji library.