Emotional music generation method based on comprehensive facial attribute analysis and visual information analysis

By integrating facial attribute analysis and visual information analysis, the emotional music generation method solves the problem of ignoring visual information and facial attributes in the existing technology, achieves high-precision matching and personalized expression of music and video content, and improves music creation. efficiency and innovation.

CN118645079APending Publication Date: 2024-09-13NANJING UNIV +1
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410575922.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-10
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

It is difficult for existing music generation systems to accurately handle rich visual information and complex emotional content, especially the impact of facial attributes on emotional expression, resulting in the generated music not being able to fully reflect the details and personalization of the video content.

Method used

An emotional music generation method based on comprehensive facial attribute analysis and visual information analysis is adopted. Through the integration of visual information extraction, facial attribute analysis and advanced language models, music that matches the emotion of the video content is generated.

Benefits of technology

It improves the synchronization and emotional resonance of music and video content, enhances the personalization and cultural relevance of music, and improves the automation efficiency and innovation of music creation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118645079A
    Figure CN118645079A
Patent Text Reader

Abstract

The invention discloses an emotion music generation method based on comprehensive facial attribute analysis and visual information analysis, and relates to the field of music generation. The method comprises the following steps: extracting key scene information from an input video for building a visual information model; analyzing face key information for constructing a comprehensive face analysis model; integrating the scene information and the face emotion extracted by the natural language model to serve as music generation basic text input; emotional music generation: learning music text features according to the music-text pair for constructing a music generation model; in the prediction stage, a music generation model is used to generate emotional music conforming to a video scene. According to the method, vision, face and natural language models are combined, a multi-modal framework is used as basic text input, the models can correctly select corresponding music elements to generate music works expressing corresponding emotions, the efficiency and quality of music creation are improved, and the method is suitable for the fields of film and television music generation, personalized music generation and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of music generation, and in particular to an emotional music generation method based on comprehensive facial attribute analysis and visual information parsing. Background Art

[0002] The present invention relates to the field of music generation, and in particular to a method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing. With the continuous advancement of artificial intelligence technology, music generation technology has evolved from simple automated composition to advanced generation systems that can incorporate complex emotions and scene understanding. However, although the prior art has made certain progress in music creation, it still has obvious deficiencies, especially in the ability to process rich visual information and complex emotional content.

[0003] First, existing music generation systems mostly rely on audio information or simple text-based emotion labels. These systems usually lack the ability to comprehensively analyze non-verbal information in videos (such as character expressions, movements, and scene interactions). Therefore, although the generated music may be consistent with basic emotion labels, it often cannot accurately reflect the emotional complexity and details of the video content.

[0004] Second, existing music generation methods often ignore the important influence of facial attributes (such as age, race, and gender) on emotional expression when parsing visual elements. For example, the same expression may have different emotional meanings in people of different ages or cultural backgrounds. Failure to fully utilize this information will limit the emotional matching and personalization of music generation. Summary of the invention

[0005] The present invention aims at a method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing.

[0006] In order to solve the above technical problems, the present invention proposes a new emotional music generation method, which combines visual information extraction, facial attributes and data integration description text of advanced language models as music input instructions, and can more accurately capture the emotional changes and visual cues in video content, thereby generating more expressive and emotionally resonant music works.

[0007] The present invention provides the following technical solution: a method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing, comprising the following steps:

[0008] Step 1: Visual information extraction: extract multiple key visual elements and describe them as text based on the input video using a visual information model;

[0009] Step 2, comprehensive facial attribute analysis, based on the faces detected in the video, uses a comprehensive facial analysis model to analyze multiple facial information and describe it as text;

[0010] Step 3: Data integration: Based on the visual information and the comprehensive facial analysis model, the text described in each frame is called by the large language model to integrate it into a complete process of what happened;

[0011] Step 4, music element selection, based on the integrated text, selects music elements that match the determined emotions, such as melody, harmony, and rhythm;

[0012] Step 5, music generation, combines the selected music elements and music generation rules to generate music works that express corresponding emotions.

[0013] Furthermore, in step 1, the visual information extraction specifically includes:

[0014] Extract key frames from the input video;

[0015] Based on the extracted features, each frame of the image is subjected to scene understanding, object recognition, weather recognition, and color recognition;

[0016] Based on the recognition results, describe the scene description of the current image.

[0017] Furthermore, in step 2, comprehensive facial attribute analysis information extraction specifically includes:

[0018] Use face detection algorithms to locate faces in images;

[0019] Locate the feature points of the detected face and identify the key points of the face, such as eyes, eyebrows, nose, mouth, etc.

[0020] Extract facial expression features based on feature points, such as the angle of eyebrows, the degree of eye opening and closing, the shape of the mouth, etc., to infer the basic emotions of the expression, such as happiness, sadness, surprise or anger. The shape of the mouth further enhances the judgment of emotional state, such as smiling or frowning can clearly express happy or unhappy emotions;

[0021] The distribution and characteristics of facial feature points, such as the depth and location of wrinkles, the degree of skin sagging, and changes in facial contours, can be used to estimate the age of an individual. This information helps to adjust the style and emotional depth of music generation to suit listeners of different ages;

[0022] Ethnicity can be identified by analyzing specific differences in facial structure, such as the features of the eyes, nose bridge, and face shape. Identifying ethnicity helps understand the impact of cultural background on emotional expression, thereby taking cultural diversity and complexity into account when generating music;

[0023] Gender can usually be identified by analyzing the configuration of facial feature points and differences in facial contours, such as the shape of the jaw line and the width of the face. Gender information helps to further refine sentiment analysis, as different genders may have different facial expressions when expressing the same emotion;

[0024] The extracted comprehensive facial attribute features are fed into the classification model to predict the emotion, age, race, gender, etc. expressed by the face;

[0025] Output the result of comprehensive facial attribute classification, obtain the comprehensive facial attribute information of face expression, and output it as text.

[0026] Further, in step 3, the data processing specifically includes:

[0027] Load the scene text description output in step 1;

[0028] Load the comprehensive facial attribute text description output in step 2;

[0029] Call the natural language model to integrate the scene text and comprehensive facial attribute text output for each frame;

[0030] Outputs a text description summarizing the entire video content.

[0031] Furthermore, in step 4, the music element selection specifically includes:

[0032] Loading the integrated text description generated in step 3, the text comprehensively reflects the scene information in the video content and the comprehensive facial attributes of the characters;

[0033] The system uses advanced sentiment analysis technology to analyze and integrate the emotional tendency and intensity in the text. According to the type of emotion (such as happiness, sadness, excitement, etc.) and intensity, the system selects corresponding musical elements, such as melody lines, harmony layout and rhythm patterns, to ensure that these elements can accurately match the emotional atmosphere of the video;

[0034] In addition, the system also takes into account information such as age, race and gender mentioned in the text to select musical styles and elements that are more in line with specific cultural and personalized needs, thereby improving the personalization and cultural relevance of musical works.

[0035] Furthermore, in step 5, music generation specifically includes:

[0036] The system constructs the basic structure of the music based on the selected musical elements, such as melody, harmony and rhythm. This step is the core of music creation, involving the arrangement of elements such as the length of the music, the speed of the rhythm, the height of the melody and the richness of the harmony;

[0037] After building the basic structure, the system further refines the musical expression of each part, such as through dynamic changes, timbre selection and volume control, to enhance the expressiveness and appeal of the music work;

[0038] Finally, the system combines all the music elements and uses music generation algorithms and synthesis technology to generate the final music work. This music work will fully express the emotions of the video content, deeply synchronize with the video images and scenes, and provide the audience with a comprehensive audio-visual experience. For the specific reasoning framework, please refer to Figure 2 .

[0039] Beneficial effects of the present invention:

[0040] Improve the accuracy of emotion recognition and expression: This invention can more accurately capture and understand the emotional level and complexity of video content by comprehensively analyzing the scene information and facial attributes of characters (including emotions, age, race and gender, etc.) in the video. This high-precision emotion recognition enables the generated music to better match the emotional changes in the video and improve the emotional expression ability of the music.

[0041] Enhanced synchronization between music and video: Through sophisticated emotion analysis and music element selection, the present invention ensures that the emotions of the music work and the video content are fully synchronized, enhancing the audience's immersion and emotional resonance. This synchronization is not only reflected in the rhythm and melody of the music, but also in the style and atmosphere of the music, making the music a strong support for the video narrative.

[0042] Taking into account cultural diversity and personalized needs: The invention takes into account the character's race, gender, age and other information in the selection and generation of music elements, so that the generated music can not only reflect the general emotional state, but also reflect the unique needs of specific cultural backgrounds and individual differences. This is particularly important for global content creation, which can attract a wider audience group.

[0043] Improved automation and efficiency of music creation: The automated music generation process of the present invention reduces the manual effort in traditional music creation, and can quickly and efficiently generate matching music works, especially when processing large amounts of video content. This efficiency improvement makes the present invention particularly suitable for use in movies, advertising, video games, and other multimedia fields.

[0044] Increase the innovation and uniqueness of music works: This invention allows music creators to explore new music expressions and creation techniques through comprehensive and innovative analysis methods, thereby producing highly innovative and personalized music works. This not only enriches the artistic expression of music, but also brings new development opportunities to the music industry.

[0045] In summary, the present invention provides a method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing. Through its advanced technical means and methods, it provides an efficient, accurate and widely applicable emotional music generation solution, which has a significant role in improving the artistic quality of multimedia content and audience experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is a flow chart of the scheme of the present invention;

[0047] Figure 2 Music generation model reasoning framework.

[0048] Figure 3 Emotional music generation model structure;

[0049] Figure 4 Audio processing and feature extraction framework diagram;

[0050] Figure 5 Clap framework;

[0051] Figure 6 Acoustic modeling framework; DETAILED DESCRIPTION

[0052] In the following description, a large number of specific details are provided to provide a more thorough understanding of the present invention. However, it is apparent to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present invention, some technical features well known in the art are not described.

[0053] Reference Figure 1 Model framework,This paper proposes a simple video multiframe captioning (SVFC) framework, which consists of two parts: an image encoder and a text decoder that are pre-trained using a pre-trained image encoder and a pre-trained image encoder using a generation task. The image encoder uses a model based on contrast pre-training, which is mainly responsible for compressing the input image into a connected two-dimensional feature map and flattening it into a feature list. Subsequently, these feature lists have a linear layer and a layer normalization process, and are then mapped to D dimensions as input data for the text decoder. The text decoding part generates text descriptions based on Transformer. The text decoder includes multiple Transformer units, each of which has a built-in self-attention mechanism layer and a feedforward layer. The text is divided into words and embedded in a D-dimensional space, and then the words are given position encoding and layer normalization.

[0054] After this processing, the image features and text embedding data are concatenated and combined as input to the Transformer module. The decoding process of the word text starts from the [BOS] (start tag) tag and proceeds in an autoregressive manner until the [EOS] (end tag) tag or the maximum length of the text is reached. In this process, the seq2seq attention mechanism is applied so that the word tag can only depend on the previous word tag and all image tags, and the image tags can pay attention to each other. The difference from the ordinary attention mechanism and the cross attention mechanism is that not every image tag can depend on all other image tags. And the text decoder is randomly initialized instead of the image encoder. This is based on the experimental results. Random initialization can achieve similar performance as BERT initialization. The main reason may be that BERT initialization cannot understand the image signal, but the image signal is very important for visual language tasks.

[0055] In this work, in order to better adapt to visual language tasks, we let all model parameters be updated. In the above, we connected the representation of images and text as the input of transformer. The decoder based on self-attention performed better on large-scale data, while the cross-attention mechanism performed better in small-scale datasets. With the addition of more pre-training data, although the parameters are well optimized, making the model larger is not suitable for subsequent downstream work of music generation. Using the cross-self-attention mechanism in a small-scale dataset, the independent mapping matrix is ​​less likely to cause the model to overfit, so in all our experiments, the architecture of the cross-attention mechanism is used.

[0056] The model is trained using MS COCO Caption (Microsoft Common Objects inContextCaption), a dataset containing 330,000 image-text pairs, with the main goal of scene understanding.

[0057] During training, for each image-text pair, let I be the image, yi;i∈{1,...,N} be the text token, y0 be the [BOS] token, and yN+1 be the [EOS] token. The language model (LM) loss is used to train the model. The formula is:

[0058]

[0059] Where: -l is the average of the loss function, -N is the number of samples, CE(yi,y^i) is the cross entropy loss of the i-th sample, where yi is the true label, and y^i=p(yi|I,{yj;j=0,...,i-1}) is the predicted probability of the i-th label given the image I and the previous label set {yj;j=0,...,i-1}.

[0060] Another method is the masked language model (MLM), which predicts about 15% of the input tokens in each iteration. In order to predict all tokens, the number of epochs required is the formula: epoch iteration. Compared with the language model LM predicting all tokens in each iteration, this strategy is more effective for processing pre-training data. Under the constraints of limited computing resources, the language model LM loss has better performance. Therefore, we adopt the language model LM loss method.

[0061] In the comprehensive facial attribute analysis method, we break the video into several frames and perform comprehensive facial attribute analysis on each frame, so as to accurately identify the emotional state of each frame. This method not only improves the accuracy of emotion recognition, but also can track the emotional fluctuations of the characters in the video in real time, and a small number of misjudgments with a large number of recognitions have little impact on the subsequent comprehensive emotion recognition. The comprehensive facial attribute analysis process covers four core steps: detection, alignment, feature extraction, and matching. Emotion recognition is divided into seven dimensions, including neutrality, happiness, anger, fear, disgust, sadness, and surprise. In this study, we adopted a lightweight comprehensive facial attribute analysis framework, which includes sentiment analysis, age, and gender model analysis. Age and gender are built based on the VGG-Face model. The VGG-Face image input size is 224x224x3 and has a 22-layer architecture. The output layer is specifically designed for different problems. First, the gender prediction model has two output points, representing males and females respectively. In addition, the output layer of the age prediction model contains 101 points, corresponding to ages from 0 to 100 years old. The emotion prediction model does not use the VGG-Face structure, but uses the FER-2013 dataset, which consists of 48x48 pixel grayscale images, in contrast to the high resolution and RGB channels of other datasets. The model has a 12-layer architecture, including five convolutional layers and three fully connected layers, and its output layer is designed with seven nodes, corresponding to neutral, happy, angry, fearful, disgusted, sad, and surprised.

[0062] The dataset used for training facial emotions is FER-2013, which contains approximately 30,000 facial RGB images with different expressions. The image resolution is limited to 48×48 pixels in grayscale. These images are divided into 7 main categories according to the expression, corresponding to neutral, happy, angry, fearful, disgusted, sad, and surprised.

[0063] Age prediction uses the softmax output of the classification task to calculate the weighted average of the expected age. Each output of the softmax layer (the probability score of each age) is multiplied by the corresponding age value, and then these products are summed to get an expected value, which is used as the predicted age. Pi is the softmax probability score of age i. Ai is the corresponding age value. N is the maximum value of the age category, which can be obtained by the following formula:

[0064]

[0065] Multiply each probability by the corresponding age value and then add up all these products to get the final predicted age.

[0066] Compared with the age prediction task, gender and emotion models are both classification models. Evaluating classification models requires some additional indicators, TP is true instance, TP is false positive, FN is false negative, and the formula for precision and recall is:

[0067]

[0068]

[0069] The LightFace facial recognition module calls the OpenCV face detection model. The comprehensive facial attribute detection model has a total of 12 layers, including five convolutional layers and three maximum pooling layers. It is a combination of convolutional layers and maximum pooling layers to extract image features. The convolutional layer uses different filters to capture local features in the image, while the maximum pooling layer is used to reduce the spatial dimension of the features, reduce the amount of calculation and extract more abstract features. The last layer is the Softmax layer, which converts the output of the fully connected layer into a probability distribution, and the output of each node represents the probability of the corresponding emotion category. The seven output points are neutral, happy, angry, fearful, disgusted, sad, and surprised. The facial attribute analysis framework can effectively predict emotions in facial images by using deep learning models and appropriate datasets. This framework is not only suitable for emotion prediction, but can also be extended to the prediction of age and gender, providing an effective data basis for subsequent emotional music generation.

[0070] In text integration, we focus on exploring how to extract key information from video materials and integrate them to deepen the understanding of video content. In particular, this study takes a 10-second video as an example, aiming to extract scene descriptions and character emotions from each second of the video frame, and then build a coherent and comprehensive story. To achieve this goal, this study introduces two core models: the scene video frame classification (SVFC) model and the face comprehensive facial analysis model. The SVFC model is used to analyze scene elements in the video frame, such as the environment, objects, etc., while the face comprehensive facial analysis model focuses on capturing the emotional changes of the characters in the picture. The integration of these two models enables us to extract detailed and rich information from each frame of the video. The specific method is as follows: First, the video is split into seconds and the first frame of each second is extracted, resulting in a total of 10 frames. For each picture, the SVFC model first performs scene analysis. If a face is detected, the emotional state is further analyzed using comprehensive facial attribute analysis technology. Through this process, we obtained 10 scene descriptions and 10 emotional descriptions respectively. Next, we will integrate these 20 texts (one scene description and one emotion description for each frame of video). Considering the complexity of natural language processing technology and its training resource requirements, we choose to call external APIs to implement the subsequent steps. This decision allows us to use the most advanced natural language processing technology without worrying about the underlying technical details and resource configuration. The strategy we adopted is to pair the scene description and emotion description in each second as input data for the natural language processing model. This approach ensures that the extracted information is fully considered and effectively shows the connection between the scene and emotion. After the natural language processing model comprehensively processes these information pairs, it outputs a coherent story description that summarizes the main events of the entire 10-second video. This not only improves the comprehensibility of the information, but also prepares for the input of emotional music generation.

[0071] In the music model, we use three models to extract audio features, which are applied to the conditional autoregressive music generation process. We follow the AudioLM model framework, use SoundStream's self-supervised audio features as acoustic markers to achieve high-quality synthesis effects, and use w2v-BERT as semantic markers to support continuous coherence generation. In order to achieve accurate conditional modeling, we use CLAP to fuse audio and text features in the training phase, and use CLAP text embedding in the inference phase. These three models are independently pre-trained and fixed, providing discrete representations for sequence-to-sequence models of audio and text. This work is based on MusicLM: Generating Music From Tex released by Google Research, and makes some modifications to the model with reference to the work of Wu et al. We use CLAP instead of the MuLan model in Music. For details, please refer to Figure 3By integrating these models, the proposed framework can effectively compress and extract features of audio data while ensuring sound quality. In addition, the framework also introduces a hierarchical modeling method, which subdivides audio representation into two steps: semantic modeling and acoustic modeling, thereby further improving the efficiency and accuracy of audio processing. For details, please refer to Figure 4 .

[0072] SoundStream is a general-purpose neural audio codec that can compress all types of audio at low bitrates while ensuring high quality of the reconstructed audio. To achieve high-quality audio, SoundStream uses a residual vector quantization (RVQ) method that supports scaling to higher bitrates and sound quality without increasing computational cost. In general, RVQ adopts a hierarchical quantization strategy consisting of multiple vector quantizers in series, and reconstructs the target signal by summing the quantizer outputs. Thanks to this combination of quantizers, RVQ successfully avoids the problem of exponential growth of the codebook size as the target bitrate increases. In addition, each quantizer optimizes the residual of the previous coarse quantizer, which brings a hierarchical structure to the quantizer, where the coarser level of quantization is particularly critical for high-quality reconstruction. This feature is very beneficial for generation tasks because the past context can be defined only by the coarser level of tokens. Recently, SoundStream has successfully expanded to higher bitrates and stereo audio processing with reference to EnCodec's method. Soundstream and Encodec are both neural audio codecs that can encode any waveform into a series of sound tokens, which can then be decoded into a waveform similar to the original. These intermediate tokens can then be modeled as a SEQ2SEQ task. However, in this generation task, we use SoundStream as the audio segmentation tool because Soundstream can reconstruct 24kHz music with high quality at a bit rate of 6kbps.

[0073] The w2v-BERT model is an intermediate layer of the Masked Language Model (MLM) part with 600M parameters. After the model is pre-trained and its parameters are fixed, we select the embeddings extracted from the 7th layer and quantize them using the centroid learned by the k-means algorithm. With 1024 clusters and a sampling rate of 25Hz, 25 semantic tokens, or S, can be generated per second of audio.

[0074] Finally, CLAP is a model that combines audio and text features, and its training is based on the LAION-Audio-630KG dataset. Like the MuLan model, this model constructs two branches, audio and text, through which the respective content is mapped to a common 512-dimensional latent space. The MuLan model was trained on 50 million text-audio pairs. However, due to lack of computing resources and corresponding data, we were unable to train this model, so we used the CLAP model to try to get close to the effect of the MuLan model. CLAP's training data covers 2.6 million text-audio pairs, and the data sets come from LAION-630k (about 633k text-audio pairs) and AudioSet (2 million samples, and the description text is generated by the keyword-to-description model conversion). Although it is only a small amount of data compared to the amount used to train the MuLan model, a variety of music samples were generated using CLAP. If the latent space that the model can reach is not enough for the ability to generate music, we will consider increasing the data set for training or trying to use the MuLan model in the future. First, in audio processing, the framework we demonstrated uses 10 seconds of audio as an example. Audio shorter than 10 seconds will be repeated and padded to extend it to 10 seconds. If the audio length exceeds 10 seconds, it will be divided into multiple 10-second segments. After these segments are processed, they will be merged together. The audio data is converted to a Mel spectrum using the Mel filter bank coefficients, and then feature extraction is performed through a 2D convolution layer. If there are multiple segments, the outputs of these 2D convolutions are merged through another merged 2D convolution layer. Next, the features are further fused through the attention feature fusion module to capture important information in the audio data. These features are passed to other encoder layers to form a complete audio encoder.

[0075] In text data processing, text data is divided into text description and label, and label data is converted into text description form through keyword-to-description enhancement. The converted description data is fed into the text encoder and processed through a multi-layer perceptron to extract text features. The features output by the audio encoder and text encoder are fed into a common multi-layer perceptron for final feature fusion. This can be used for various tasks such as audio classification, speech recognition, or audio-text matching.

[0076] Figure 5 The overall architecture of the contrast language-audio encoder model. The model architecture is similar to the CLIP model. The encoder uses two, respectively processing the input of audio data Xa and text data Xt, where is one of the audio-text pairs labeled by index i. Audio embedding and text embedding The audio codec φ audio(·) and the text encoder φ text (·) is obtained, with the mapping layer, the formula is:

[0077]

[0078]

[0079] The mapping layer between audio and text is a multi-layer perceptron (MLP) consisting of these two layers, using the ReLU function as the activation mechanism. The main purpose is to map the encoded output to the same dimension D, that is,

[0080]

[0081] This model is trained using contrastive learning to generate audio and text embedding pairs, and uses the same loss function form as defined in , changing the way similarity is calculated:

[0082]

[0083] We introduce a regularization term:

[0084]

[0085] Where λ is a regularization coefficient that controls the strength of the regularization term. This regularization term encourages the model to learn smaller embedding vectors to prevent overfitting. represents an adjustable parameter in the learning process, mainly used to adjust the loss size. The two parts of the loss function reflect the mapping relationship from audio to text and from text to audio respectively. N represents the number of samples in the dataset, but during model training, N refers to the batch size. This is because in practice, it is impossible to perform full matrix calculations on the entire dataset. The model is updated by batch gradient descent. The Clap model architecture includes audio / text encoders, feature fusion, and keyword-to-text description enhancement. In this architecture, the audio encoder is responsible for processing audio waveforms and extracting useful features; the text encoder processes text data, such as tags or descriptions, and also extracts important features. The feature fusion part combines these two different types of features, usually using an attention mechanism to weight important features. In text data processing, keyword-to-description enhancement is used to expand the training dataset and improve the model's ability to understand language by generating richer text descriptions. Such an architecture is very suitable for tasks that need to process and understand multimodal data. For specific models, please refer to Figure 5 .

[0086] This paper combines discrete audio representations and the text-conditioned music generation method of AudioLM. It adopts a hierarchical sequence-to-sequence modeling task, and each stage is autoregressively modeled by an independent decoder-only Transformer. It consists of 24 layers, 16 multi-head attention mechanisms, an embedding dimension of 1024, a feed-forward layer with a dimension of 4096, a dropout rate of 0.1, and relative position embeddings, with 430M parameters in each stage. The first stage is the semantic modeling stage, which maps Clap audio tokens to semantic tokens through the model and captures the long-term structure. The second stage is the acoustic modeling stage, which predicts acoustic tokens based on Clap audio tokens and previous semantic tokens. To manage the complexity, in the semantic modeling stage, it is mainly responsible for learning the mapping of Clap from audio tokens to semantic tokens S, which is achieved by modeling the conditional distribution p(S_t|S_<t, C_A), where S_t represents the sequence semantic token at time step t, S_<t represents the semantic token at time step t, and C_A is the audio representation.

[0087] In the acoustic modeling stage, the model predicts the acoustic token A_q based on the audio and semantic tokens of Clap, and the modeled distribution is p(A_t|A_<t, S, C_A). Where A_t is the acoustic token and A_<t is all the acoustic tokens before this acoustic token. Additionally, to avoid long sequence tokens in the acoustic modeling stage, the acoustic modeling stage is divided into a rough acoustic modeling and a detailed acoustic modeling stage. There are a total of 12 quantizers. In the rough acoustic modeling stage, SoundStream RVQ outputs four levels for modeling, while the detailed modeling stage models the remaining eight levels. This can reduce the complexity of audio data and the complexity of sequence length, making the model more efficient. For details, please refer to Figure 6 。

[0088] In the music generation stage, we introduce in detail the architecture and training process of a music generation system based on the Clap model. This system utilizes the LAION-Audio-630k dataset and realizes music generation by learning the joint embedding space of audio and text. In the inference stage, we replace C_A with C_T and use the joint embedding space learned by the Clap model between audio and text to generate music with specific semantic content. In addition, we also adopt a temperature sampling strategy to balance the diversity and temporal consistency of the generated music. In this section, we will introduce the specific process of the inference stage in detail. For the specific architecture, please refer to Figure 2 。

[0089] In the inference phase, we replaced CA with CT to use the joint embedding space between audio and text learned by Clap. Subsequently, post-CT was performed according to the above process to obtain A. In the autoregressive sampling operation of all stages, we used a temperature sampling strategy, with the temperature of the semantic modeling stage set to 1.0, and the temperatures of the coarse acoustic modeling and fine acoustic modeling stages set to 0.95 and 0.4 respectively. The setting of these temperature values ​​was determined based on subjective evaluation of the balance between the diversity and temporal consistency of the generated music.

Claims

1. A method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing, characterized in that: The following steps are involved: Step 1: Visual information extraction: extract multiple key visual elements and describe them as text based on the input video using a visual information model; Step 2, comprehensive facial attribute analysis, based on the faces detected in the video, uses a comprehensive facial analysis model to analyze multiple facial information and describe it as text; Step 3: Data integration: Based on the visual information and the comprehensive facial analysis model, the text described in each frame is called by the large language model to integrate it into a complete process of what happened; Step 4, music element selection, based on the integrated text, select the music elements that match the determined emotions, including at least melody, harmony and rhythm; Step 5, music generation, combines the selected music elements and music generation rules to generate music works that express corresponding emotions.

2. The method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing according to claim 1, characterized in that: In step 1, the visual information extraction specifically uses image processing technology to identify scenes, objects, colors, and weather visual elements in the video, and outputs descriptive text as visual instructions for subsequent music generation.

3. The method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing according to claim 1, characterized in that: In step 2, the comprehensive facial analysis model is based on deep learning to identify emotions, age, race, and gender to analyze the information contained in the face, and outputs a description text as a portrait information instruction for subsequent music generation.

4. The method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing according to claim 1, characterized in that: In step 3, the language model API is called to integrate the text output by the visual information model and the comprehensive facial analysis model described in steps 1 and 2 into a complete account of what happened.

5. The method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing according to claim 1, characterized in that: In step 4, the visual and facial information text integrated in step 3 is input as instructions to the music generation model, and the model determines the tonality, rhythm speed and music style of the music according to the scene and type.

6. The method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing according to claim 1, characterized in that: In step 5, the music generation rules are combination rules based on music theory, which are used to guide the combination and arrangement of music elements.

7. The method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing according to claim 1, characterized in that: It further includes a music post-processing step to adjust and optimize the generated music work to meet specific sound quality and expression requirements.

8. The method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing according to claim 1, characterized in that: The method is applicable to the fields of film and television soundtracks and personalized music generation.

9. The method for generating emotional music based on comprehensive facial attribute analysis and visual information parsing according to claim 1, characterized in that: The method can generate adaptive music in real time according to the user's personalized preferences and emotional state to provide a personalized auditory experience.

Citation Information

Cited By

  • Multi-modal input music score generation method and device based on music and / or graph

    CN119007696A

  • Music emotion adjusting system and method based on content generated by artificial intelligence

    CN119498851A

  • Audio electronic picture book intelligent generation method, system and device and storage medium

    CN122530386A