Audio and video matching model training method and device, equipment and storage medium

By training the audio and video matching model, using the same tag set to pre-train the video and audio feature extractors, and combining the video and audio modal features, the problem of low matching caused by hot audio recommendations is solved, and the hit rate and accuracy of background music recommendations are improved. Adaptability.

CN118673178APending Publication Date: 2024-09-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310305177.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-20
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

In the existing technology, when background music is recommended based on audio popularity, the recommended music may not match the video content, resulting in a low recommendation hit rate.

Method used

By training the audio and video matching model, the same label set is used to pre-train the video feature extractor and audio feature extractor, and the video and audio modal features are combined to determine the matching relationship between video and audio to improve the accuracy of recommendations.

Benefits of technology

It improves the hit rate of background music recommendations, ensures that the recommended music is more suitable for video content, and improves the ability to match audio and video.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673178A
    Figure CN118673178A
Patent Text Reader

Abstract

The invention discloses an audio and video matching model training method and device, equipment and a storage medium, and relates to the technical field of artificial intelligence. The method comprises the following steps: for each audio sample in an audio sample set, determining at least one video sample using the audio sample as background music; determining a label of an audio sample according to the label of the at least one video sample; pre-training a video feature extractor according to the video sample and the label of the video sample; according to the audio sample and the label of the audio sample, pre-training the audio feature extractor; after the video feature extractor and the audio feature extractor are pre-trained, an audio and video matching model is trained, and the audio and video matching model is used for determining the matching relation between the video sample and the audio sample. The trained model is used for carrying out audio and video recommendation, the recommended audio is more consistent with the content of the video, and the hit rate is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a training method, apparatus, device and storage medium for an audio and video matching model. Background Art

[0002] With the popularity of video software such as short videos, user accounts can edit and publish videos by themselves. Generally speaking, when a user account publishes a video, it will also add BGM (Background Music) to the video.

[0003] In the related art, BGM is recommended to the videos of the user account based on the popularity of the BGM (number of times used / number of times played). For example, BGM is recommended to the user account based on the number of times the audio is played from large to small.

[0004] In the related art, recommending BGM to users based on popularity is likely to cause the BGM recommended to users to be incompatible with the content of the video to be released by the users, resulting in a low hit rate of the recommended BGM (the ratio of the number of videos whose released BGM comes from the recommended BGM to the number of videos released with BGM). Summary of the invention

[0005] The embodiment of the present application provides a training method, apparatus, device and storage medium for an audio and video matching model. The technical solution is as follows:

[0006] According to one aspect of an embodiment of the present application, a method for training an audio and video matching model is provided, the method comprising:

[0007] For each audio sample in the audio sample set, determining at least one video sample using the audio sample as background music;

[0008] Determine the label of the audio sample according to the label of the at least one video sample; wherein the video sample and the audio sample share the same label set, and the label refers to the classification label of the video sample or the audio sample;

[0009] Pre-training the video feature extractor according to the video sample and the label of the video sample; and pre-training the audio feature extractor according to the audio sample and the label of the audio sample;

[0010] After the pre-training of the video feature extractor and the audio feature extractor is completed, the audio-video matching model is trained, and the audio-video matching model is used to determine the matching relationship between the video sample and the audio sample.

[0011] According to one aspect of an embodiment of the present application, there is provided an audio and video matching method based on an audio and video matching model, the method comprising:

[0012] Obtaining a first video to be matched;

[0013] Extracting feature information corresponding to the first video by the video feature extractor;

[0014] Determine the matching degree between the first video and each of the audios according to the feature information corresponding to the first video and the feature information corresponding to the n audios; wherein the feature information corresponding to the audios is obtained by the audio feature extractor, the video feature extractor and the audio feature extractor share the same label set in a pre-training stage, and n is an integer greater than 1;

[0015] At least one matching audio that matches the first video is determined from the n audios according to the matching degree between the first video and each of the audios.

[0016] According to one aspect of an embodiment of the present application, a training device for an audio-video matching model is provided, the device comprising:

[0017] A sample determination module, configured to determine, for each audio sample in the audio sample set, at least one video sample that uses the audio sample as background music;

[0018] A label determination module, configured to determine a label of the audio sample according to a label of the at least one video sample; wherein the video sample and the audio sample share the same label set, and the label refers to a classification label of the video sample or the audio sample;

[0019] A pre-training module, configured to pre-train the video feature extractor according to the video sample and the label of the video sample; and to pre-train the audio feature extractor according to the audio sample and the label of the audio sample;

[0020] A model training module is used to train the audio-video matching model after pre-training the video feature extractor and the audio feature extractor. The audio-video matching model is used to determine the matching relationship between the video sample and the audio sample.

[0021] According to one aspect of an embodiment of the present application, there is provided an audio and video matching method based on an audio and video matching model, wherein the audio and video matching model includes a video feature extractor and an audio feature extractor, and the device includes:

[0022] A video acquisition module, used to acquire a first video to be matched;

[0023] A feature extraction module, used to extract feature information corresponding to the first video through the video feature extractor;

[0024] A matching degree determination module, used to determine the matching degree between the first video and each of the audios according to the feature information corresponding to the first video and the feature information corresponding to the n audios; wherein the feature information corresponding to the audios is obtained by the audio feature extractor, the video feature extractor and the audio feature extractor share the same label set in the pre-training stage, and n is an integer greater than 1;

[0025] The audio determination module is used to determine at least one matching audio that matches the first video from the n audios according to the matching degree between the first video and each of the audios.

[0026] According to one aspect of an embodiment of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above method.

[0027] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above method.

[0028] According to one aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above method.

[0029] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0030] The video feature extractor and the audio feature extractor are pre-trained respectively by using the same label set, and an audio-video matching model is further constructed based on the pre-trained video feature extractor and the pre-trained audio feature extractor, and the audio-video matching model is continued to be trained. Since the video feature extractor and the audio feature extractor in the audio-video matching model are pre-trained using the same label set, and the audio-video matching model combines the features of the video modality and the audio modality, the ability of the audio-video matching model to be used for audio-video matching can be improved. Furthermore, based on the audio-video matching model, downstream audio-video matching tasks are carried out to determine the audio recommended for the video to be matched, which can improve the BGM hit rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;

[0032] Figure 2 is a schematic diagram of an audio and video matching method based on an audio and video matching model provided by an embodiment of the present application;

[0033] Figure 3 is a flow chart of a method for training an audio and video matching model provided by an embodiment of the present application;

[0034] Figure 4 is a flowchart of a method for training an audio and video matching model provided by another embodiment of the present application;

[0035] Figure 5 is a flowchart of a method for training an audio and video matching model provided by another embodiment of the present application;

[0036] Figure 6 is a flowchart of a method for training an audio and video matching model provided by another embodiment of the present application;

[0037] Figure 7 This is an architecture diagram of an audio and video matching model provided by an embodiment of the present application;

[0038] Figure 8 is a schematic diagram of a training method for an audio and video matching model provided by an embodiment of the present application;

[0039] Fig. 9 is a flow chart of an audio and video matching method based on an audio and video matching model provided by an embodiment of the present application;

[0040] Fig.10 is a flowchart of an audio and video matching method based on an audio and video matching model provided by another embodiment of the present application;

[0041] Fig.11 is a block diagram of a training device for an audio and video matching model provided by an embodiment of the present application;

[0042] Fig.12 is a block diagram of a training device for an audio and video matching model provided by another embodiment of the present application;

[0043] Fig.13 is a block diagram of an audio and video matching device based on an audio and video matching model provided by an embodiment of the present application;

[0044] Fig.14 It is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0045] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0046] Before introducing the technical solution of this application, some background technical knowledge involved in this application is first introduced and explained. The following related technologies can be combined arbitrarily with the technical solution of the embodiment of this application as optional solutions, and they all belong to the protection scope of the embodiment of this application. The embodiment of this application includes at least part of the following contents.

[0047] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0048] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes natural language processing technology, machine learning / deep learning and other major directions.

[0049] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize related knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.

[0050] Deep Learning (DL) is a new research direction in the field of Machine Learning (ML). It is introduced into machine learning to make it closer to its original goal - artificial intelligence. Deep learning is the internal laws and representation levels of learning sample data. The information obtained in the learning process is of great help in the interpretation of data such as text, images and sounds. Its ultimate goal is to enable machines to have analytical learning capabilities like humans and to recognize data such as text, images and sounds. Deep learning is a complex machine learning algorithm that has achieved results in speech and image recognition that far exceed previous related technologies. Deep learning has achieved many results in search technology, data mining, machine learning, machine translation, natural language processing, multimedia learning, speech, recommendation and personalization technology, and other related fields. Deep learning enables machines to imitate human activities such as seeing, hearing and thinking, solves many complex pattern recognition problems, and makes great progress in artificial intelligence related technologies.

[0051] Computer Vision (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to using cameras and computers to replace human eyes to identify and measure targets, and further perform image processing so that the computer processes the images into images that are more suitable for human observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain "information" from images or multidimensional data. The information here refers to information defined by Shannon that can be used to help make a "decision". Because perception can be seen as extracting information from sensory signals, computer vision can also be seen as a science that studies how to make artificial systems "perceive" from images or multidimensional data.

[0052] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.

[0053] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless cars, autonomous driving, drones, robots, smart medical care, smart customer service, virtual reality (VR), augmented reality (AR), games, virtual humans, digital humans, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0054] The solutions provided in the embodiments of the present application involve technologies such as artificial intelligence machine learning, computer vision, and natural language processing, which are specifically illustrated by the following embodiments.

[0055] It should be noted that this application can display a prompt interface, pop-up window or output voice prompt information before collecting relevant user data and during the process of collecting relevant user data. The prompt interface, pop-up window or voice prompt information is used to prompt the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining user-related data after obtaining the user's confirmation operation on the prompt interface or pop-up window. Otherwise (that is, when the user's confirmation operation on the prompt interface or pop-up window is not obtained), the relevant steps of obtaining user-related data are terminated, that is, the user's relevant data is not obtained. In other words, all user data collected by this application (including video sample data and audio sample data obtained by the publisher) are processed strictly in accordance with the requirements of relevant national laws and regulations, and the informed consent or separate consent of the subject of personal information is obtained, and subsequent data use and processing behaviors are carried out within the scope of authorization of laws and regulations and the subject of personal information.

[0056] Before introducing the technical solution of the present application, some terms involved in the present application are explained. The following related explanations can be combined arbitrarily with the technical solution of the embodiment of the present application as optional solutions, and they all belong to the protection scope of the embodiment of the present application. The embodiment of the present application includes at least part of the following contents.

[0057] Contrastive learning: It is a kind of self-supervised learning, that is, it does not rely on labeled data, but learns knowledge from unlabeled images. At present, contrastive learning seems to be in a state of "no clear definition, but with guiding principles". Its guiding principle is: through this model, similar instances are closer in the projected space, while dissimilar instances are farther away in the projected space. The triplet loss in the embodiment of the present application is obtained by contrastive learning.

[0058] Recommended BGM (background music) hit rate: the ratio of the number of videos with recommended BGM to the number of videos with BGM.

[0059] Proportion of videos released with music: the ratio of the number of videos released with BGM to the number of videos released.

[0060] TF-IDF (Term Frequency–Inverse Document Frequency): A commonly used weighting technique for information retrieval and data mining. TF stands for term frequency and IDF stands for inverse document frequency.

[0061] MLP (Multi-Layer Perception): also called Artificial Neural Network (ANN), in addition to the input and output layers, it can have multiple hidden layers in the middle.

[0062] CMVMR (Cross-modal Video-music Retrieval): an audio recommendation method.

[0063] UT-CMVMR (Unified Pretraining Target based Cross-modal Video-musicRetrieval): an audio recommendation method.

[0064] CMVAE (Cross-modal Variational Autoencoder): an encoder.

[0065] MV (Music Video): A music album with an accompanying video specially produced by musicians.

[0066] Conformer: Convolution-augmented Transformer.

[0067] bin: literally translated as box or bucket, it can represent an interval within a certain range of values. For example, the closed interval [0,5] on the real axis can be divided into 5 bins, each with a length of 1, namely [0,1), [1,2), [2,3), [3,4), [4,5].

[0068] beat: music beat.

[0069] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include a model training device 10 and a model using device 20.

[0070] The model training device 10 may be an electronic device such as a personal computer, a computer, a tablet computer, a server, an intelligent robot, or other electronic devices with strong computing capabilities. The model training device 10 is used to jointly train the video feature extractor 31 and the audio feature extractor 32.

[0071] Optionally, the video feature extractor 31 and the audio feature extractor 32 are jointly trained using an audio-video matching model 30. Optionally, the video feature extractor 31 and the audio feature extractor 32 are pre-trained before the joint training. Optionally, the model training device 10 uses the same label set to pre-train the video feature extractor 31 and the audio feature extractor 32. Optionally, how to determine the same label set and how to use the same label set to pre-train the video feature extractor 31 and the audio feature extractor 32 is described in the following embodiments, which will not be repeated here.

[0072] In an embodiment of the present application, the audio and video matching model 30 is a machine learning model for jointly training a video feature extractor 31 and an audio feature extractor 32. Optionally, the model training device 10 can train the audio and video matching model 30 in a machine learning manner so that it has better performance. Exemplarily, the video feature extractor 31 (which can be considered as a module or sub-model in the audio and video matching model 30) in the trained audio and video matching model 30 can perform feature extraction on the input video, and the audio feature extractor 32 (which can be considered as a module or sub-model in the audio and video matching model 30) in the trained audio and video matching model 30 can perform feature extraction on the input audio.

[0073] The trained video feature extractor 31 and audio feature extractor 32 can be deployed in the model using device 20 for video or audio feature extraction, thereby achieving audio and video matching. The model using device 20 can be a terminal device such as a mobile phone, a computer, a smart TV, a multimedia playback device, a wearable device, a medical device, or a server, and this application does not limit this.

[0074] Optionally, the collected video samples and audio samples (including matched audio and video samples and unmatched audio and video samples, for specific explanations of unmatched audio and video samples, see the following embodiments) are divided into positive sample pairs and negative sample pairs. Optionally, the positive sample pairs include anchor samples and positive samples, and the negative sample pairs include anchor samples and negative samples. For the specific method of dividing the positive sample pairs and negative sample pairs, refer to the following embodiments, which will not be repeated here. In some embodiments, the video samples in the positive sample pairs and the negative sample pairs are input into the video feature extractor 31 to obtain video features, and the audio samples in the positive sample pairs and the negative sample pairs are input into the audio feature extractor 32 to obtain audio features. Optionally, according to the video features and audio features corresponding to the positive sample pairs and the negative sample pairs, respectively, the triplet loss function value is determined, and the parameters of the video feature extractor 31 and the audio feature extractor 32 are adjusted with the goal of minimizing the triplet loss function value to obtain the trained audio and video matching model 30.

[0075] The execution subject of each step of the method provided in the embodiment of the present application may be a computer device, which refers to an electronic device with data calculation, processing and storage capabilities. The computer device may be a terminal such as a PC (Personal Computer), a tablet computer, a smart phone, a wearable device, an intelligent robot, etc.; it may also be a server. Among them, the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The computer device may be Figure 1 The model training device 10 may also be a model using device 20.

[0076] Please refer to Figure 2 , which shows a schematic diagram of an audio and video matching method based on an audio and video matching model provided by an embodiment of the present application.

[0077] Figure 2210 is a schematic diagram of training the audio and video matching model. Before training the audio and video matching model, the video feature extractor and the audio feature extractor in the audio and video matching model are pre-trained. Optionally, the audio that matches the video is determined based on the corresponding BGM in the released video. Optionally, for the same audio, background music can be provided for multiple videos. That is, one audio corresponds to multiple matching videos. Optionally, the label of the video is determined based on a pre-trained video labeling model. Optionally, the label of the audio is determined based on the TF-IDF algorithm. In some embodiments, the video feature extractor is pre-trained using multiple video samples and labels corresponding to the multiple video samples, and the audio feature extractor is pre-trained using multiple audio samples and labels corresponding to the multiple audio samples. At this time, since the labels corresponding to the audio samples are mapped from the labels corresponding to the video samples, the video samples and the audio samples correspond to the same label set.

[0078] After the pre-training of the video feature extractor and the audio feature extractor is completed, an audio-video matching model is constructed. Optionally, the audio-video matching model 200 includes at least an audio feature extractor, a video feature extractor, an audio rhythm feature extractor and a video rhythm feature extractor. Of course, the audio-video matching model may also include other modules, specifically referring to the following embodiments, which will not be repeated here. Optionally, the input of the audio-video matching model is at least one positive sample pair and at least one negative sample pair, wherein the positive sample pair is constructed by an audio sample and a video sample having a matching relationship, and the negative sample pair is constructed by an audio sample and a video sample that do not have a matching relationship (the specific construction method of the positive sample pair and the negative sample pair is referred to the following embodiments, which will not be repeated here). Optionally, the video features of the video sample are extracted by the video feature extractor, the video rhythm features of the video sample are extracted by the video rhythm feature extractor, the audio features of the audio sample are extracted by the audio feature extractor, and the audio rhythm features of the audio sample are extracted by the audio rhythm feature extractor. Optionally, based on the video features, video rhythm features, audio features, and audio rhythm features, the value of the triplet loss function is determined, and based on the value of the triplet loss function, the parameters in the audio-video matching model 200 are adjusted. Optionally, the video features and the video rhythm features are summed and passed through the audio-video matching module to obtain the hidden layer embedding features corresponding to the video sample, and the audio features and the audio rhythm are summed and passed through the audio-video matching module to obtain the hidden layer embedding features corresponding to the audio sample, and further based on the hidden layer embedding features corresponding to the video sample and the hidden layer embedding features corresponding to the audio sample, the value of the triplet loss function is determined. Specifically, how to determine the hidden layer embedding features corresponding to the video sample and the hidden layer embedding features corresponding to the audio sample, and how to determine the value of the triplet loss function based on the hidden layer embedding features corresponding to the video sample and the hidden layer embedding features corresponding to the audio sample, refer to the following embodiments, which will not be repeated here.

[0079] Figure 2 220 is a schematic diagram of a method for performing audio and video matching using an audio and video matching model after the audio and video matching model training is completed. Optionally, a video feature extractor is used to obtain video features based on the video to be matched, and an audio feature extractor is used to obtain audio features corresponding to multiple audios based on multiple audios in a music library. Optionally, based on the similarity between the video feature and the audio feature, one or more audios that are only a short distance from the video feature are determined to generate an audio recommendation list. The position of the audio in the audio recommendation list determines the degree of matching between the audio and the video.

[0080] In the related art, the music recommendation system started to develop from mining the meta information of the music end, which belongs to a subfield of MIR (Music Information Retrieval), involving multiple disciplines such as information retrieval, musicology, audio engineering, digital signal processing, psychology, etc., and makes music recommendations by extracting the meta information of music, including title, lyrics, genre, instrument, singer, album name, comments, etc., as well as the user's historical behavior data. The work of using vision as one of the information modalities to assist music recommendation originated at the beginning of this century. Optionally, a Gaussian mixture model is used to model music and album covers, hoping to map the embedded vectors obtained from music and album covers to a unified space for matching. Optionally, music recommendations are made for digital albums by associating digital album tags and music tag semantics. Among them, the more typical music recommendation based on video-music content is the CBVMR (Content-based Video-music Retrieval) model, that is, a content-based video-music recommendation model. The model uses a visual pre-training model based on image classification to extract video-level average features, and uses an audio pre-training model based on music tags to extract music-level average features. After obtaining the video-music two-way average features, the video-music two-way model is trained based on the triplet loss within the modality (a single video modality or a single music modality) and the triplet loss between modalities (between video and music modalities). In the test phase, the video and the candidate music set are input, the distance between the video and each piece of music is calculated, and a ranked list of recommended music is obtained. Optionally, the work based on audio and video content matching also includes selecting MV as training input, using the SVM (Support Vector Machine) model to perform sentiment classification on the video and music of the MV respectively, obtaining the hidden layer representation of the middle layer, and finally combining the hidden layer representations of the video and music, and using the SVM model to perform binary classification to determine whether the video and music match. Optionally, in addition to using the video and music modalities, the text modality is also used, specifically extracting text information from the metadata of the music and fusing it with the video modality, and finally matching it with the music modality.

[0081] In the related art, in the above-mentioned work of music recommendation based on video-music content, different targets are used to pre-train the feature extractors of video and music, which will cause matching difficulties when doing downstream matching. The present application adopts a unified pre-training target set, that is, the video tag information is obtained from the video end, and then mapped to the paired music through the TF-IDF method, so that the video and music have the same pre-training target set. Another major disadvantage of the related art is that rhythm information such as timing is not considered. Different rhythms will greatly affect the emotions that the music wants to express. For example, sports and fitness scenes are suitable for fast-paced and dynamic songs, while for leisure scenes such as cafes, slow-paced and soothing songs are suitable. Most of the related technologies are based on video-level / music-level average features, that is, the average is taken after obtaining frame-by-frame features. Rhythm belongs to timing information, and the average feature cannot reflect rhythm information. The present application uses the optical flow method to extract the optical flow information of the video end as the rhythm information representation of the video end, and uses related technologies related to beat extraction to extract the beat position and number of the audio end as the rhythm information of the audio end, thereby assisting video and music matching. For the cross-modal recommendation task of video soundtracks, most of the related technologies are based on matching video and music dual-channel networks. The feature extractors of video and music, that is, pre-trained networks, generally have different training objectives. Most video feature extractors are based on image classification, action recognition, etc. as pre-training objectives, and most music feature extractors are based on music tags, music emotions, etc. as pre-training objectives. Different pre-training objectives will cause the obtained video and music embedded features to encounter matching difficulties when doing downstream matching.

[0082] Therefore, the embodiment of the present application uses a unified pre-training target to pre-train the video and music feature extractors. In addition, the present application also uses optical flow information as the rhythm information of the video end and beat features as the rhythm information of the audio end to assist in video and music matching, which is a good supplement to the matching method based on a single video and music embedding vector in the related art. The embodiment of the present application provides a new video soundtrack framework based on content matching.

[0083] Please refer to Figure 3 , which shows a flow chart of a method for training an audio and video matching model provided by an embodiment of the present application. The execution subject of each step of the method can be the model training device introduced above. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as a "computer device". The method can include at least one of the following steps (310-340):

[0084] Step 310: for each audio sample in the audio sample set, determine at least one video sample that uses the audio sample as background music.

[0085] Video samples: Video samples are obtained from videos posted in the user account history. The embodiments of the present application are all authorized by the user when obtaining audio and video samples. For example, user A posted a video C on platform B. Video C includes video screen content, video and audio content corresponding to the video screen content (or there may not be any), and background music D of video C. At this time, the video screen content can be used as a video sample, and the background music D of video C can be considered as an audio sample that has a matching relationship with the video sample. Optionally, when user A posts video C, he selects audio for the video (that is, background music D of video C). Of course, when the user posts video C, he may not directly select background music D. He may also have auditioned many other audios, but did not select them as background music for video C. Optionally, the audio that these users auditioned but did not select as background music is regarded as an audio sample that does not have a matching relationship with the above-mentioned video sample.

[0086] Audio sample: Get the audio corresponding to the video from the historically released videos (the audio in this case refers to the background music of the video, not the music of the video content itself), that is, the audio of the BGM of the video sample.

[0087] In some embodiments, one audio sample can be used as BGM by multiple video samples. Optionally, audio sample a has a matching relationship with video sample b1, video sample b2, and video sample b3, that is, video sample b1, video sample b2, and video sample b3 all use audio sample a as background music.

[0088] Step 320, determining a label of an audio sample according to a label of at least one video sample; wherein the video sample and the audio sample share the same label set, and the label refers to a classification annotation of the video sample or the audio sample.

[0089] In some embodiments, the label of the video sample is determined. Optionally, the label of the video sample is manually annotated, or it can be obtained through a video labeling model. Optionally, the video labeling model is a trained model for labeling videos. The embodiment of the present application does not limit the architecture of the specific video labeling model, and optionally, the model is a machine learning model. In some embodiments, the video labeling model includes a feature extractor and a classifier. Optionally, the features of the input video sample are extracted by feature extraction, and the confidence of each label is output according to the features of the video sample by the classifier. Optionally, the label corresponding to the first Q of the confidence is determined as the label of the video sample, where Q is a positive integer. Optionally, when Q is 1, the label with the highest confidence is used as the label of the video sample. Optionally, when Q is greater than 1, multiple labels with higher confidence are used as the label of the video sample. The embodiment of the present application does not limit the number of labels of the video sample.

[0090] In other embodiments, since one audio sample corresponds to a plurality of matching video samples, the label of the audio sample is determined according to the label of the video sample. Optionally, the label with the most occurrences among the labels corresponding to the plurality of video samples is determined as the label of the audio sample. In the embodiment of the present application, there is no limitation on the specific method of determining the label of the audio sample according to the label of the video sample. Optionally, the label of the video sample is mapped to the audio sample using the TF-IDF algorithm, that is, the audio sample and the video sample share the same label set (see the following embodiment for details). Sharing the same label set here does not necessarily mean that the label set of the video sample (the label set of the video sample includes the label of each video sample) is equal to the label set of the audio sample (the label set of the audio sample includes the label of each audio sample), but the label set of the audio sample may belong to the label set of the video sample, or the label set of the video sample may belong to the label set of the audio sample.

[0091] In some embodiments, the label of the video sample is a classification annotation of the video sample. Optionally, different label results correspond to different classification methods. Optionally, the classification method is based on the category to which the video belongs, and the labels that can be obtained include but are not limited to cute pets, animation, food, etc.

[0092] Step 330: pre-train a video feature extractor based on the video samples and labels of the video samples; and pre-train an audio feature extractor based on the audio samples and labels of the audio samples.

[0093] In the embodiments of the present application, there is no limitation on the pre-training method. Optionally, the video feature extractor and the audio feature extractor are pre-trained by machine learning. In some embodiments, a video feature classifier is connected after the video feature extractor, and the video features of the video sample are extracted by the video feature extractor, and the video features are input into the video feature classifier to obtain a classification result. Optionally, the value of the loss function is determined according to the difference between the classification result and the label of the video sample, and the parameters of the video feature extractor and the video feature classifier are adjusted according to the value of the loss function. In some embodiments, an audio feature classifier is connected after the audio feature extractor, and the audio features of the audio sample are extracted by the audio feature extractor, and the audio features are input into the audio feature classifier to obtain a classification result. Optionally, the value of the loss function is determined according to the difference between the classification result and the label of the audio sample, and the parameters of the audio feature extractor and the audio feature classifier are adjusted according to the value of the loss function. In some embodiments, a comprehensive feature classifier is connected after the video feature extractor and the audio feature extractor. Optionally, the video feature extractor is used to extract the video features of the video sample, and the video features are input into the comprehensive feature classifier to obtain the video classification result. Optionally, the audio feature extractor is used to extract the audio features of the audio sample, and the audio features are input into the comprehensive feature classifier to obtain the audio classification result. Optionally, the value of the loss function is determined based on the difference between the video classification result and the label of the video sample, and the difference between the audio classification result and the label of the audio sample, and the parameters of the video feature extractor, the audio feature extractor and the comprehensive feature classifier are adjusted according to the value of the loss function. Optionally, when the value of the loss function is less than a threshold value, the pre-training of the video feature extractor and the audio feature extractor is stopped.

[0094] In some embodiments, the video feature extractor and the audio feature extractor may be pre-trained separately, or the video feature extractor and the audio feature extractor may be pre-trained together, which is not limited in the present application.

[0095] Step 340: After the pre-training of the video feature extractor and the audio feature extractor is completed, the audio-video matching model is trained. The audio-video matching model is used to determine the matching relationship between the video sample and the audio sample.

[0096] In the embodiments of the present application, there is no limitation on the training method of the audio and video matching model. Optionally, the video matching model is trained using machine learning. In some embodiments, the audio and video matching model includes a pre-trained video feature extractor and an audio feature extractor. Of course, the audio and video matching model may also include other modules, which can be found in the following embodiments, and will not be described here. The specific training method of the audio and video matching model is also detailed in the following embodiments. Optionally, the audio and video matching model is UT-CMVMR.

[0097] The technical solution provided by the embodiment of the present application uses the same label set to pre-train the video feature extractor and the audio feature extractor respectively, and further constructs an audio and video matching model based on the pre-trained video feature extractor and the pre-trained audio feature extractor, and continues to train the audio and video matching model. Since the video feature extractor and the audio feature extractor in the audio and video matching model are pre-trained using the same label set, and the audio and video matching model combines the features of the video modality and the audio modality, the ability of the audio and video matching model to be used for audio and video matching can be improved. Furthermore, based on the audio and video matching model, downstream audio and video matching tasks are carried out to determine the audio recommended to the video to be matched, which can improve the BGM hit rate.

[0098] Please refer to Figure 4 , which shows a flow chart of a method for training an audio and video matching model provided by another embodiment of the present application. The execution subject of each step of the method can be the model training device introduced above. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as a "computer device". The method may include at least one of the following steps (310-340):

[0099] Step 310: for each audio sample in the audio sample set, determine at least one video sample that uses the audio sample as background music.

[0100] Step 321: Obtain a tag set that has not been deduplicated based on the tags corresponding to the respective video samples in at least one video sample. The tag set includes M tags, where M is a positive integer.

[0101] In some embodiments, the label corresponding to the video sample is determined by the video labeling model in the above embodiment. Optionally, the label with a confidence greater than a threshold is used as the label of the video sample. Optionally, the label with a confidence level before Q is used as the label of the video sample. Optionally, the number of labels corresponding to the video sample is one or more. Optionally, the number of labels of a video sample is q1 as an example for explanation, where q1 is a positive integer greater than 1. Optionally, the number of labels corresponding to each video sample in the video sample set may be the same or different. Assume that the number of labels corresponding to each video sample in the video sample set is q1.

[0102] In some embodiments, the number of video samples using audio samples as background music is determined to be q2, where q2 is a positive integer. Then, each video sample in the q2 video samples corresponds to q1 tags, and the total number M of the tag set that has not been deduplicated is q1*q2. Optionally, there are repeated tags in the M tags.

[0103] In some embodiments, the tag set includes K non-repeating tags, where K is a positive integer less than or equal to M. Optionally, the M tags in the tag set include K non-repeating tags.

[0104] Step 322: Select at least one tag from the tag set as a tag of the audio sample.

[0105] In the embodiment of the present application, there is no limitation on the specific method of selecting at least one tag from the tag set as the tag of the audio sample. Optionally, the number of the K non-repeating tags in the M tags is sorted, and at least one tag is selected according to the number. For example, the M tags include 10 games, 3 cute pets, 2 animations, and 1 food, among which games, cute pets, animations, and food are all tags, and the K non-repeating tags are games, cute pets, animations, and food. The number of times the tag "game" appears in the M tags is 10, the number of times the tag "cute pets" appears in the M tags is 3, the number of times the tag "animation" appears in the M tags is 2, and the number of times the tag "food" appears in the M tags is 1. Optionally, the tag "game" with the most occurrences is used as the tag corresponding to the audio sample. Of course, multiple tags can also be selected, for example, the top 2 tags are used as the tags corresponding to the audio sample, that is, the tags of the audio sample are games and cute pets.

[0106] In some embodiments, step 322 also includes at least one of steps 322 - a to 322 - d (not shown in the figure).

[0107] Step 322-a: For the jth tag among K tags, determine the frequency value of the jth tag according to the total number of tags M included in the tag set and the number of times the jth tag appears in the tag set, where j is a positive integer less than or equal to K.

[0108] In the video music scenario, a song can be paired with multiple videos. Because different users may use the same song as the background music of a video, the TF-IDF method can be used to map video tags to music. Specifically, for each piece of music, a set of unrepeated video tags can be obtained based on its video-music pairing information (each video has multiple tags, and different videos may have overlapping tags). Therefore, for a specific piece of music (considered as an audio sample), a i , you can calculate it in the tag set tagcol i The TF-IDF value of the j-th tag in .

[0109] In some embodiments, the frequency value of the jth tag is: Among them, (It can be considered as the tag set including M tags without deduplication) represents music a i The corresponding undeduplicated video tag set tagcol i The total number of all labels in , Indicates the jth tag in the tag set tagcol i The number of times it appears in .

[0110] Step 322 - b: Determine the prevalence value of the jth label according to the number of audio samples with the jth label in the audio sample set and the total number of audio samples in the audio sample set.

[0111] In some embodiments, the prevalence value of the jth tag is: Where N represents the total number of music, N is a positive integer, Indicates that it contains the tag set tagcol i The number of music with the jth label in .

[0112] Step 322 - c: Determine the weight value corresponding to the jth tag according to the frequency value of the jth tag and the prevalence value of the jth tag.

[0113] In some embodiments, the weight value (TF-IDF value) corresponding to the jth tag is determined based on the frequency value of the jth tag and the prevalence value of the jth tag. Optionally, the product of the frequency value of the jth tag and the prevalence value of the jth tag is used as the weight value corresponding to the jth tag.

[0114] Step 322 - d: Select at least one label from the K labels as the label of the audio sample according to the weight values ​​corresponding to the K labels respectively.

[0115] In some embodiments, the label with the largest weight value is used as the label of the audio sample. Optionally, the label with a weight value greater than a threshold value is used as the label of the audio sample, and the number of labels of the audio sample can be multiple. In some embodiments, the weight values ​​are sorted in descending order, and the labels corresponding to the first k1 weight values ​​are taken as the labels of the audio sample. Optionally, k1 is a positive integer not greater than K.

[0116] In some embodiments, a total of 578 different video tags are used as the same tag set as mentioned above as pre-training targets for the video feature extractor and the music feature extractor.

[0117] Step 330: pre-train a video feature extractor based on the video samples and labels of the video samples; and pre-train an audio feature extractor based on the audio samples and labels of the audio samples.

[0118] In some embodiments, the video feature extractor and the audio feature extractor use the Conformer model. Inside the Conformer model is a stacked Conformer encoder module. Considering that the number of videos is much larger than the number of audios, a standard 6-layer Conformer encoder stacking structure is adopted for the video feature extractor, and a 1-layer Conformer encoder structure is adopted for the music feature extractor. The input of the video feature extractor is a video sample (video clip), and the classification target is 578 video labels. The input of the audio feature extractor is an audio sample (audio clip), and the classification target is also 578 video labels. After the pre-training is completed, the video feature extractor can be used to obtain a 512-dimensional video feature vector based on the input video, and the audio feature extractor can be used to obtain a 512-dimensional audio feature vector based on the input audio. When the input is an audio clip or a video clip, a clip-level feature vector is obtained.

[0119] Step 340: After the pre-training of the video feature extractor and the audio feature extractor is completed, the audio-video matching model is trained. The audio-video matching model is used to determine the matching relationship between the video sample and the audio sample.

[0120] The technical solution provided in the embodiment of the present application maps the labels of video samples to audio samples through the TF-IDF algorithm, so that the audio samples and video samples share the same label set. The labels of audio samples determined according to the TF-IDF algorithm are more accurate and more in line with the actual scenarios in which the audio is used. Therefore, since the pre-training of the video feature extractor and the audio feature extraction uses a unified and relatively accurate label set, the pre-training effect of the video feature extractor and the audio feature extraction is better, and it can also provide better support for the subsequent training of the audio and video matching model, which is relatively beneficial to improving the training efficiency and training accuracy of the audio and video matching model.

[0121] Please refer to Figure 5 , which shows a flow chart of a method for training an audio and video matching model provided by another embodiment of the present application. The execution subject of each step of the method can be the model training device introduced above. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as a "computer device". The method may include at least one of the following steps (510-570):

[0122] Step 510: for each audio sample in the audio sample set, determine at least one video sample that uses the audio sample as background music.

[0123] Step 520, determining a label of an audio sample according to a label of at least one video sample; wherein the video sample and the audio sample share the same label set, and the label refers to a classification annotation of the video sample or the audio sample.

[0124] Step 530: pre-train a video feature extractor based on the video samples and labels of the video samples; and pre-train an audio feature extractor based on the audio samples and labels of the audio samples.

[0125] Step 540, construct a set of sample pairs based on at least one video sample and at least one audio sample, the set of sample pairs including at least one positive sample pair and at least one negative sample pair, the positive sample pair including a video sample and an audio sample having a matching relationship, and the negative sample pair including a video sample and an audio sample not having a matching relationship.

[0126] Positive sample pair: considered to be two samples with a similar or matching relationship. Optionally, when the positive sample pair is two samples with a similar relationship, the two samples in the positive sample pair can be considered to be samples of the same type (for example, both are video samples). Optionally, when the positive sample pair is two samples with a matching relationship, the two samples in the positive sample pair can be considered to be a video sample and an audio sample, and the video sample and the audio sample are considered to belong to the same published video. Optionally, the positive sample pair includes anchor samples and positive samples.

[0127] Negative sample pair: considered to be two samples that do not have a similar or matching relationship. Optionally, when the negative sample pair is two samples that do not have a similar relationship, the two samples in the negative sample pair can be considered to be samples of the same type (for example, both are video samples). Optionally, when the negative sample pair is two samples that do not have a matching relationship, the two samples in the negative sample pair can be considered to be a video sample and an audio sample, and it is considered that the user of the published video corresponding to the video sample chose to audition when publishing the video but ultimately did not adopt the audio. Optionally, the negative sample pair includes anchor samples and negative samples.

[0128] In some embodiments, the video samples and audio samples are preprocessed. The video is framed at 1 second intervals and converted into a 224×224 grayscale image, while the music is resampled to 16kHz. The length of the video-music pairs is uniformly trimmed to no more than 28 seconds, and divided into segments of 4 seconds in length. Video-music segments shorter than 4 seconds are padded to 4 seconds, where the video is padded with the tail frame and the music is padded with silence. For a video segment, it is tiled in time sequence to obtain an 896×224 matrix. For a music segment, its filter group features are calculated. The number of Mel-spectrogram bins is set to 80, and a 398×80 matrix is ​​obtained. The feature information of the video sample is then extracted using a video feature extractor, and the feature information of the audio sample is extracted using an audio feature extractor. This application does not limit the specific preprocessing method.

[0129] Step 550: For the video sample and the audio sample in the same sample pair, feature information corresponding to the video sample is extracted by a video feature extractor, and feature information corresponding to the audio sample is extracted by an audio feature extractor.

[0130] In some embodiments, the video feature extractor is a pre-trained machine learning model. In some embodiments, the video feature extractor includes at least one feature extraction module. Optionally, the video feature extractor includes a linear transformation module in addition to the feature extraction module. The embodiments of the present application do not limit the specific model architecture of the video feature extractor.

[0131] In some embodiments, the audio feature extractor is a pre-trained machine learning model. In some embodiments, the audio feature extractor includes at least one feature extraction module. Optionally, the audio feature extractor includes a linear transformation module in addition to the feature extraction module. The embodiments of the present application do not limit the specific model architecture of the audio feature extractor.

[0132] In some embodiments, the video feature extractor and the audio feature extractor are jointly trained together.

[0133] In some embodiments, a video sample is segmented to obtain multiple video segments. In some embodiments, for a video segment, a video frame sequence is obtained by sampling and extracting frames, and then the feature information corresponding to the video segment is extracted by a video feature extractor. Optionally, the sampling frequency is not limited. In some embodiments, taking the video as a 1-minute video as an example, the 1-minute video is framed at a frequency of sampling P frames per minute to obtain a P frame image. Optionally, according to the pixels of each frame image, the pixel matrix corresponding to the frame image is determined. Optionally, the matrix dimension corresponding to the P frame image is a matrix of 3*a*b*P, where 3 represents the value of the RGB three channels, a and b represent the number of pixels of the image in the horizontal and vertical directions respectively, P represents the number of images extracted, and P, a and b are positive integers. Optionally, the matrix of dimension 3*a*b*P (or considered as a video frame sequence) is used as the input of the video feature extractor to obtain the corresponding feature information.

[0134] In some embodiments, an audio sample is segmented to obtain multiple audio segments. Optionally, the video segments correspond to the audio segments one by one. In some embodiments, for a segment of audio, a method of sampling and framing is used to obtain an audio framing sequence, and then the feature information corresponding to the segment of video is extracted by a video feature extractor. Optionally, the sampling frequency is not limited. In some embodiments, taking the audio as a 1-minute video as an example, the 1-minute audio file (optionally, the audio file is in wav format) is framed at a frequency of sampling P frames per minute to obtain P frame-drawing results. Optionally, according to the size of the beat (beat information of the audio) corresponding to each frame-drawing result, the element size corresponding to the frame is determined. Optionally, the matrix dimension corresponding to the P frame-drawing results is a matrix of 1*P. Optionally, the matrix of 1*P dimension is used as the input of the audio feature extractor to obtain the corresponding feature information. In some embodiments, the feature information is a feature vector. The embodiments of the present application do not limit the dimension of the feature vector output by the video feature extractor or the audio feature extractor, and do not limit the specific model architecture in the video feature extractor. The video feature extractor includes but is not limited to a convolution module, a pooling module, etc.; the embodiments of the present application do not limit the specific model architecture in the audio feature extractor. The audio feature extractor includes but is not limited to a convolution module, a pooling module, etc.

[0135] Step 560, determining the value of the triplet loss function according to the feature information corresponding to the video sample and the feature information corresponding to the audio sample in the same sample pair; wherein the triplet loss function is used to characterize the matching degree of the sample pair.

[0136] Triplet loss function: a function used to characterize the matching degree of sample pairs. Optionally, the value of the triplet loss function can reflect the matching degree of the positive sample pair and the matching degree of the negative sample pair. Optionally, by performing a gradient descent update on the value of the triplet loss function, the matching degree of the positive sample pair can be improved and the matching degree of the negative sample pair can be reduced.

[0137] Step 570, adjusting the parameters of the audio and video matching model according to the value of the triplet loss function to obtain a trained audio and video matching model.

[0138] In some embodiments, with the goal of minimizing the value of the triplet loss function, the parameters of the video feature extractor and the audio feature extractor are adjusted to obtain a trained video feature extractor and a trained audio feature extractor.

[0139] Of course, the present application does not limit the method of adjusting the model parameters according to the value of the triplet loss function.

[0140] The technical solution provided by the embodiment of the present application is to jointly train the video feature extractor and the audio feature extractor by using contrastive learning. Since the video feature extractor and the audio feature extractor can learn the features of the video modality and the audio modality during the joint training, and the contrastive learning method is used for training, the video feature extractor's ability to extract video features and the audio feature extractor's ability to extract audio features can be improved. Therefore, the audio recommended to the video to be matched is determined based on the matching degree between the video features extracted by the video feature extractor and the video features extracted by the audio feature extractor, which can improve the BGM hit rate.

[0141] Please refer to Figure 6 , which shows a flow chart of a method for training an audio and video matching model provided by another embodiment of the present application. The execution subject of each step of the method can be the model training device introduced above. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as a "computer device". The method may include at least one of the following steps (510-570):

[0142] Step 510: for each audio sample in the audio sample set, determine at least one video sample that uses the audio sample as background music.

[0143] Step 520, determining a label of an audio sample according to a label of at least one video sample; wherein the video sample and the audio sample share the same label set, and the label refers to a classification annotation of the video sample or the audio sample.

[0144] Step 530: pre-train a video feature extractor based on the video samples and labels of the video samples; and pre-train an audio feature extractor based on the audio samples and labels of the audio samples.

[0145] Step 540, construct a set of sample pairs based on at least one video sample and at least one audio sample, the set of sample pairs including at least one positive sample pair and at least one negative sample pair, the positive sample pair including a video sample and an audio sample having a matching relationship, and the negative sample pair including a video sample and an audio sample not having a matching relationship.

[0146] Step 550: For the video sample and the audio sample in the same sample pair, feature information corresponding to the video sample is extracted by a video feature extractor, and feature information corresponding to the audio sample is extracted by an audio feature extractor.

[0147] In some embodiments, the audio-video matching model further includes a video rhythm feature extractor and an audio rhythm feature extractor.

[0148] In the embodiment of the present application, the specific architecture of the video rhythm feature extractor and the audio rhythm feature extractor is not limited, and the specific modules included therein are not limited. Whether the video rhythm feature extractor and the audio rhythm feature extractor are pre-trained in advance is not limited. Optionally, the video rhythm feature extractor and the audio rhythm feature extractor are jointly trained in advance. Of course, the video rhythm feature extractor and the audio rhythm feature extractor may also be not pre-trained.

[0149] Step 551: extracting rhythm information corresponding to the video sample by a video rhythm feature extractor; and extracting rhythm information corresponding to the audio sample by an audio rhythm feature extractor.

[0150] In some embodiments, in step 551, "extracting rhythm information corresponding to the video sample by a video rhythm feature extractor" includes at least one step from step 551-1 to step 551-4 (not shown in the figure).

[0151] Step 551-1, the video rhythm feature extractor determines the displacement information corresponding to each video clip according to the optical flow information corresponding to each video clip in the video sample, the optical flow information is used to reflect the displacement relationship of pixels between frames in the video clip, and the displacement information is used to reflect the average displacement value of pixels between frames in the video clip.

[0152] In some embodiments, optical flow is a method for describing the movement of pixels between images over time. As time passes, the same pixel will move in the image, and it is desired to know its movement process.

[0153] In some embodiments, for a video sample, optical flow information of a video clip is extracted Where H and W represent the height and width of the video frame, respectively. x represents the displacement of the pixel in the x direction, and y represents the displacement of the pixel in the y direction, which represents the displacement relationship between the previous and next frames in a video clip. The average displacement of each pixel is defined as Then the average displacement of pixels in a video clip is That is, all pixels of an image can be understood as a matrix with height H and width W, so the offsets in the x and y directions will correspond to two offset matrices. The absolute value of the displacement of each pixel in the x and y directions is calculated first, then the absolute values ​​of all pixels are added together and divided by HW to calculate the average displacement of each pixel in the x and y directions, and finally the average displacement of a pixel on the plane is calculated according to the Pythagorean theorem.

[0154] In some embodiments, the displacement information in step 551-1 refers to the average displacement d of the pixels in the video segment. t Optionally, the position information is specifically represented by a numerical value.

[0155] Step 551-2, according to the displacement information corresponding to each video clip, determine the upper and lower displacement limits corresponding to the video sample, the upper displacement limit is the maximum value of the displacement information corresponding to each video clip, and the lower displacement limit is the minimum value of the displacement information corresponding to each video clip.

[0156] In some embodiments, each video segment of a video sample corresponds to a displacement information value. Optionally, the maximum value of the displacement information corresponding to each video segment is determined as the upper displacement limit. Optionally, the minimum value of the displacement information corresponding to each video segment is determined as the lower displacement limit.

[0157] Step 551 - 3 , for each video segment in the video sample, determine the rhythm feature corresponding to the video segment according to the position of the displacement information corresponding to the video segment in the interval formed by the displacement upper limit and the displacement lower limit.

[0158] In some embodiments, the interval formed by the upper limit of displacement and the lower limit of displacement is divided, and optionally, the interval is divided into multiple intervals. Optionally, the interval is evenly or unevenly divided into n2 bins. In some embodiments, the value of n2 is 64. Optionally, since the value of the calculated displacement information is a continuous value, it needs to be discretized. Optionally, 64 bins are taken to divide the average displacement of the video clip, and the bin number is used to replace the continuous value in each bin, and then the nn.Embedding module in PyTorch is used to convert these discrete values ​​into continuous 512-dimensional feature vectors as rhythm features of the video clip. For example, assuming that the upper limit of displacement is 640 and the lower limit of displacement is 1, the interval determined by the upper limit of displacement and the lower limit of displacement is [1, 640], and the value of the displacement information of each specific video clip falls at any position in [1, 640]. Optionally, the interval [1, 640] is divided into 64 bins, and the length of each bin is 10, then the 64 bins are [1, 64], [65, 128], etc. Optionally, for the target video segment in the video sample, determine in which bin the value of its displacement information falls, and each bin corresponds to identification information (which can also be understood as a label), then determine the identification corresponding to the target video segment. Optionally, assuming that the target video segment falls in the first bin, a one-hot encoding method is used, then the encoding feature corresponding to the target video segment is [1, 0, 0, 0...]. Optionally, the length of the encoding feature is 64. Optionally, the encoding feature is converted into a rhythm feature. Optionally, the encoding feature is multiplied by a linear transformation matrix to obtain a transformed 512-dimensional feature, and the transformed 512-dimensional feature is determined as a rhythm feature. Optionally, the parameter matrix in the nn.Embedding module in the linear transformation matrix PyTorch is continuously adjusted as the model is trained. Optionally, the video rhythm feature extractor includes a nn.Embedding module.

[0159] Step 551 - 4 , determining rhythm information corresponding to the video sample according to the rhythm features corresponding to each video clip.

[0160] In some embodiments, the rhythm features corresponding to the respective video clips are combined into the rhythm information corresponding to the video sample in a certain order. Optionally, the video sample corresponds to T video clips, each video clip corresponds to a 512-dimensional rhythm feature, and the dimension of the rhythm information of the video sample is T*512, where T is a positive integer.

[0161] In some embodiments, the feature information is a feature vector.

[0162] In some embodiments, in step 551, "extracting rhythm information corresponding to the audio sample by an audio rhythm feature extractor" also includes at least one step from step 551-5 to step 551-11 (not shown in the figure).

[0163] Step 551-5, the audio rhythm feature extractor determines the beat intensity information, beat distance information and beat number information corresponding to each audio segment according to the beat information corresponding to each audio segment in the audio sample, and the beat information is used to reflect the rhythm of the audio in the audio segment.

[0164] In some embodiments, the beat-related functions of the librosa toolbox are used to extract the beat of the audio clip. The function returns beat information such as the beat position and beat strength in the audio clip. In some embodiments, the beat strength information is used to reflect the beat strength S in the audio clip. beat In some embodiments, the beat intensity information is used to reflect the average distance between adjacent beats in the audio segment. (The sum of the distances between every two beats in all the beats is divided by the number of intervals between the beats to obtain the average distance between the beats.) In some embodiments, the beat number information is used to reflect the number of beats N in the audio segment. beat In some embodiments, the number of beats N in the audio segment is used. beat , beat average intensity S beat and the average distance between adjacent beats To measure the rhythm information of the audio. Because the audio itself has a fixed beat pattern, such as 4 / 4, which means there are 4 beats in a measure, there is a definite upper limit on the number of beats for audio with a certain time signature, and the number of beats itself is a discrete value, which can be directly converted into a continuous feature vector using nn.Embedding. Beat average strength S beat and the average distance between adjacent beats is a continuous value and can be discretized by bin division according to the processing method of video clips. Optionally, 128 bins and 64 bins are used to divide S beat and Get the discrete label of the bin, and then use nn.Embedding to convert it into a continuous feature vector. Optionally, use nn.Embedding to convert N beat , S beat and They are converted into 256-, 128-, and 128-dimensional continuous feature vectors respectively, and then spliced ​​together into a 512-dimensional vector using a splicing function as the rhythm feature of the audio clip. The specific calculation method here can refer to the explanation of bin in the above video clip, which will not be repeated here. The embodiment of the present application does not limit the specific method for obtaining beat information.

[0165] Step 551-6, according to the beat strength information corresponding to each audio clip, determine the upper and lower limits of the beat strength corresponding to the audio sample, the upper limit of the beat strength is the maximum value of the beat strength information corresponding to each audio clip, and the lower limit of the beat strength is the minimum value of the beat strength information corresponding to each audio clip.

[0166] Step 551 - 7 , for each audio segment in the audio sample, determine the beat intensity feature corresponding to the audio segment according to the position of the beat intensity information corresponding to the audio segment in the interval formed by the beat intensity upper limit and the beat intensity lower limit.

[0167] Step 551-8, according to the beat distance information corresponding to each audio clip, determine the upper and lower limits of the beat distance corresponding to the audio sample, the upper limit of the beat distance is the maximum value of the beat distance information corresponding to each audio clip, and the lower limit of the beat distance is the minimum value of the beat distance information corresponding to each audio clip.

[0168] Step 551 - 9 , for each audio segment in the audio sample, determine the beat distance feature corresponding to the audio segment according to the position of the beat distance information corresponding to the audio segment in the interval formed by the beat distance upper limit and the beat distance lower limit.

[0169] In some embodiments, since the beat distance information and the beat intensity information are both non-discrete values, it is necessary to determine the interval based on the upper limit and the lower limit, and further divide the bin, and determine the identification information of the bin to which the audio segment belongs, so as to perform one-hot encoding to obtain the coding features corresponding to the beat distance information and the coding features corresponding to the beat intensity information. Optionally, the coding features corresponding to the beat distance information are further processed through nn.Embedding to obtain the beat distance features corresponding to the audio segment. Optionally, the coding features corresponding to the beat intensity information are further processed through nn.Embedding to obtain the beat intensity features corresponding to the audio segment. Optionally, the dimensions of the beat distance feature and the intensity feature are both 128.

[0170] Regarding steps 551 - 6 to 551 - 9 , please refer to the explanation of the video clips in the above embodiment and will not be repeated here.

[0171] Step 551 - 10 : for each audio segment in the audio sample, determine the beat number feature corresponding to the audio segment according to the beat number information corresponding to the audio segment and the beat number information corresponding to each audio segment.

[0172] In some embodiments, since the beat number information itself is a discrete value, it can be directly one-hot encoded to obtain the encoding feature corresponding to the beat number, and optionally, through nn.Embedding, the beat number feature corresponding to the audio clip is obtained. Optionally, the dimension of the beat number feature is 256.

[0173] Step 551 - 11 , determining the rhythm information corresponding to the audio sample according to the beat intensity feature, beat distance feature and beat number feature corresponding to each audio segment.

[0174] In some embodiments, the dimensions of the beat intensity feature, beat distance feature and beat number feature corresponding to each audio clip are 128, 128 and 256 respectively. The beat intensity feature, beat distance feature and beat number feature corresponding to the audio clip are respectively connected through a concatenation function to obtain the rhythm feature corresponding to the audio sample. The dimension of the rhythm feature corresponding to the audio clip is 512.

[0175] Optionally, the rhythm information corresponding to the audio sample is determined according to the rhythm feature corresponding to the audio segment. Optionally, the audio sample corresponds to T audio segments, each audio segment corresponds to a 512-dimensional rhythm feature, and the dimension of the rhythm information of the audio sample is T*512, where T is a positive integer.

[0176] Step 561, determining the value of the triplet loss function according to the rhythm information corresponding to the video sample, the rhythm information corresponding to the audio sample, the feature information corresponding to the video sample, and the feature information corresponding to the audio sample.

[0177] In some embodiments, the audio-video matching model further includes a video feature encoder, an audio feature encoder, and an audio-video matching module.

[0178] The specific architecture of the audio and video matching module is not limited in the embodiments of the present application, and reference may also be made to the introduction of the audio and video matching module in the following embodiments. In some embodiments, the video feature encoder is a Transformer encoder. Optionally, the audio feature encoder is a Transformer encoder.

[0179] In some embodiments, step 561 includes at least one of steps 561 - 1 to 561 - 6 (not shown in the figure).

[0180] Step 561 - 1 , obtaining a first hidden layer embedding feature corresponding to the video sample according to feature information corresponding to the video sample and rhythm information corresponding to the video sample through a video feature encoder.

[0181] In some embodiments, the feature information corresponding to the video sample may also be referred to as a video embedding feature. In some embodiments, the video feature encoder adds the feature information corresponding to the video sample and the rhythm information corresponding to the video sample to obtain the rhythm feature corresponding to the video sample and integrates it into the embedding feature.

[0182] In some embodiments, the video feature encoder integrates the rhythm feature corresponding to the video sample into the embedded feature to obtain the first hidden layer embedded feature corresponding to the video sample. Among them, ξ v is the first hidden layer embedding feature corresponding to the video sample, V e is the video feature encoder, The rhythm features corresponding to T video clips in the video sample are integrated into the embedded features.

[0183] Step 561 - 2 , obtaining a first hidden layer embedding feature corresponding to the audio sample according to feature information corresponding to the audio sample and rhythm information corresponding to the audio sample through an audio feature encoder.

[0184] In some embodiments, the feature information corresponding to the audio sample may also be referred to as an audio embedding feature. In some embodiments, the audio feature encoder adds the feature information corresponding to the audio sample and the rhythm information corresponding to the audio sample to obtain the rhythm feature corresponding to the audio sample and integrates it into the embedding feature.

[0185] In some embodiments, the audio feature encoder integrates the rhythm feature corresponding to the audio sample into the embedded feature to obtain the first hidden layer embedded feature corresponding to the audio sample. Among them, ξ m is the first hidden layer embedding feature corresponding to the audio sample, M e is the audio feature encoder, The rhythm features corresponding to the T audio clips in the audio sample are integrated into the embedded features.

[0186] Step 561-3, obtaining the second hidden layer embedding features corresponding to the video sample and the second hidden layer embedding features corresponding to the audio sample based on the first hidden layer embedding features corresponding to the video sample and the first hidden layer embedding features corresponding to the audio sample through the audio and video matching module.

[0187] In some embodiments, the audio-video matching module includes an attention submodule, a video feature mapping submodule, and an audio feature mapping submodule.

[0188] The embodiment of the present application does not limit the specific structural types of the attention submodule, the video feature mapping submodule and the audio feature mapping submodule. Optionally, the video feature mapping submodule is a mapping layer MLP of the video, and the audio feature mapping submodule is a mapping layer MLP of the audio.

[0189] In some embodiments, step 561 - 3 includes at least one of steps S1 to S3 (not shown in the figure).

[0190] Step S1, obtaining attention information corresponding to the video sample and attention information corresponding to the audio sample according to the first hidden layer embedding features corresponding to the video sample and the first hidden layer embedding features corresponding to the audio sample through the attention submodule.

[0191] In some embodiments, the attention information corresponding to the video sample is att v , the attention information corresponding to the audio sample is att m In some embodiments, att v =softmax(ξ v *ξ m T ). In some embodiments, att m =softmax(ξ m *ξ v T ).

[0192] Step S2, obtaining a second hidden layer embedding feature corresponding to the video sample according to the first hidden layer embedding feature corresponding to the video sample and the attention information corresponding to the video sample through the video feature mapping submodule.

[0193] In some embodiments, the second hidden layer embedding feature corresponding to the video sample is θ v θ v =V p (ξ v +att v ), where V p Represents the video feature mapping submodule.

[0194] Step S3, obtaining a second hidden layer embedding feature corresponding to the audio sample according to the first hidden layer embedding feature corresponding to the audio sample and the attention information corresponding to the audio sample through the audio feature mapping submodule.

[0195] In some embodiments, the second hidden layer embedding feature corresponding to the audio sample is θ m θ m =M p (ξ m +att m ), where M pRepresents the audio feature mapping submodule.

[0196] Step 561-4, determine the value of the first triplet loss function based on the similarity between the second hidden layer embedding features corresponding to the video sample in the positive sample pair and the second hidden layer embedding features corresponding to the audio sample, and the similarity between the second hidden layer embedding features corresponding to the video sample in the negative sample pair and the second hidden layer embedding features corresponding to the audio sample, and the video sample in the positive sample pair is the same as the video sample in the negative sample pair.

[0197] The audio and video matching model in the technical solution provided in the embodiment of the present application, namely the UT-CMVMR model, is mainly trained by triplet loss. The basic definition of triplet loss is: + ,y + ,y - )=max(d(x + ,y + )-d(x + ,y - )+λ,0), where x + ,y + and - denote anchor samples, positive samples and negative samples respectively, d(·,·) denotes the Euclidean distance, and λ is a set threshold. Optionally, a positive sample pair includes an anchor sample and a positive sample, and a negative sample pair includes an anchor sample and a negative sample.

[0198] In some embodiments, the second hidden layer embedding features corresponding to the video samples are used as anchor samples, the second hidden layer embedding features corresponding to the audio samples that have a matching relationship with the video samples are used as positive samples, and the second hidden layer embedding features corresponding to the audio samples that do not have a matching relationship with the video samples are used as negative samples. Optionally, the first triplet loss function is

[0199] In some embodiments, the similarity is characterized using cosine distance.

[0200] Step 561-5, determine the value of the second triplet loss function based on the similarity between the second hidden layer embedding features corresponding to the audio sample in the positive sample pair and the second hidden layer embedding features corresponding to the video sample, and the similarity between the second hidden layer embedding features corresponding to the audio sample in the negative sample pair and the second hidden layer embedding features corresponding to the video sample, and the audio sample in the positive sample pair is the same as the audio sample in the negative sample pair.

[0201] In some embodiments, the second hidden layer embedding feature corresponding to the audio sample in the positive sample pair is used as the anchor sample, the second hidden layer embedding feature corresponding to the video sample in the positive sample pair is used as the positive sample, and the second hidden layer embedding feature corresponding to the video sample in the negative sample pair is used as the negative sample. Optionally, the second triplet loss function is

[0202] Step 561 - 6 , determining the value of the triple loss function according to the value of the first triple loss function and the value of the second triple loss function.

[0203] In some embodiments, the value of the first triple loss function corresponds to a first weight value, the value of the second triple loss function corresponds to a second weight value, and the first weight value and the second weight value may be the same or different. Optionally, the sum of the product of the value of the first triple loss function and the first weight value and the sum of the product of the value of the second triple loss function and the second weight value is determined as the value of the triple loss function.

[0204] In some embodiments, the audio-video matching model further includes a video feature reconstruction module, an audio feature reconstruction module, a video feature decoder, and an audio feature decoder.

[0205] In some embodiments, the video feature reconstruction module, the audio feature reconstruction module, the video feature decoder and the audio feature decoder may be included in the audio and video matching module to be implemented as a video feature reconstruction submodule, an audio feature reconstruction submodule, a video feature decoder and an audio feature decoder, or may not be included in the audio and video matching module and be implemented as a video feature reconstruction module, an audio feature reconstruction module, a video feature decoder and an audio feature decoder separately.

[0206] In some embodiments, the video feature reconstruction module is a video reconstruction layer MLP, and the video feature decoder is a video feature decoder MLP. The audio feature reconstruction module is an audio reconstruction layer MLP, and the audio feature decoder is an audio feature decoder MLP.

[0207] In some embodiments, a video feature reconstruction module obtains video reconstruction features corresponding to the video samples based on second hidden layer embedding features corresponding to the video samples.

[0208] Optionally, the video feature reconstruction module is used to embed the second hidden layer feature θ corresponding to the video sample. v , get the video reconstruction features corresponding to the video sample

[0209] In some embodiments, the audio feature reconstruction module obtains the audio reconstruction feature corresponding to the audio sample based on the second hidden layer embedding feature corresponding to the audio sample.

[0210] Optionally, the audio feature reconstruction module is used to embed the second hidden layer feature θ corresponding to the audio sample. m , get the audio reconstruction features corresponding to the audio sample

[0211] In some embodiments, a video feature decoder obtains a video decoding feature corresponding to the video sample based on the second hidden layer embedding feature corresponding to the video sample.

[0212] Optionally, the video feature decoder is used to embed the feature θ of the second hidden layer corresponding to the video sample. v , get the video decoding features corresponding to the video sample

[0213] In some embodiments, an audio feature decoder obtains an audio decoding feature corresponding to the audio sample based on the second hidden layer embedding feature corresponding to the audio sample.

[0214] Optionally, the audio feature decoder is used to embed the second hidden layer feature θ corresponding to the audio sample m , get the audio decoding features corresponding to the audio sample

[0215] In some embodiments, the value of a first regularized loss function is determined based on the video reconstruction features and the first hidden layer embedding features corresponding to the video sample, and the audio reconstruction features and the first hidden layer embedding features corresponding to the audio sample. The first regularized loss function is the loss for feature reconstruction of the video sample and the audio sample in the sample pair.

[0216] In some embodiments,

[0217] In some embodiments, the value of the classification loss function is determined based on the video decoding features corresponding to the video sample and the audio decoding features corresponding to the audio sample, where the classification loss function is the loss for classifying whether the video sample and the audio sample in the sample pair match. The value of the first regularized loss function and the value of the classification loss function are used to adjust the parameters of the audio-video matching model in combination with the value of the triplet loss function.

[0218] In some embodiments, there are labels for matching or not for positive sample pairs and negative sample pairs, respectively. Optionally, the label for matching or not for the positive sample pair is 1, and the label for matching or not for the negative sample pair is 0, where 1 indicates matching and 0 indicates non-matching.

[0219] Optionally, a classification result is obtained by a classifier according to the video decoding features corresponding to the video sample and the audio decoding features corresponding to the audio sample. Optionally, a classification result is obtained by a classifier according to the video decoding features corresponding to the video sample and the audio decoding features corresponding to the audio sample, and each has a corresponding confidence level. For example, if the confidence level of 1 is 0.6 and the confidence level of 0 is 0.4, 1 is used as the classification result.

[0220] Optionally, a standard binary cross entropy loss is used to calculate the matching loss (classification loss) for video-music pairings:

[0221] In some embodiments, the audio and video matching model also includes a text module, which includes a label feature extractor, a label feature mapping submodule, and a label feature decoder.

[0222] In some embodiments, the tag feature extractor is a sentence level Transformer (SentenceTransformer). The tag feature mapping submodule is a mapping layer MLP. The tag feature decoder is a decoder MLP.

[0223] In some embodiments, a label feature extractor is used to obtain a label embedding feature corresponding to the label based on the label of a positive sample pair in the same sample pair, wherein the label of the positive sample is the label corresponding to the video sample in the positive sample pair.

[0224] In some embodiments, a content label of a video-music pair is determined. Since a negative sample pair is considered to be an unmatched audio-video sample pair, the negative sample pair has no content label. Optionally, the label corresponding to the video sample in the positive sample pair is determined as the content label of the positive sample pair (referred to as the label, which is different from the label used to distinguish whether the audio sample and the video sample in the sample pair match).

[0225] In some embodiments, a label feature extractor is used to obtain a label embedding feature ξ corresponding to the label according to the label of the positive sample pair in the same sample pair. tag .

[0226] In some embodiments, the label hidden layer features of the labels are obtained according to the label embedding features corresponding to the labels through the label feature mapping submodule.

[0227] In some embodiments, the label feature mapping submodule embeds the label feature ξ corresponding to the label tag , get the label hidden layer feature θ of the label tag .

[0228] In some embodiments, a label feature decoder obtains a label decoding feature corresponding to the label based on the label hidden layer feature corresponding to the label.

[0229] In some embodiments, the label feature decoder is used to decode the label hidden layer feature θ corresponding to the label. tag , get the label decoding feature corresponding to the label

[0230] In some embodiments, the value of the second regularized loss function is determined based on the video decoding features corresponding to the video sample, the label decoding features corresponding to the label, the audio decoding features corresponding to the audio, and the label hidden layer features corresponding to the label.

[0231] In some embodiments,

[0232] In some embodiments, the value of the third regularized loss function is determined based on the second hidden layer embedding features corresponding to the video sample, the second hidden layer embedding features corresponding to the audio sample, and the label hidden layer features of the label. The value of the second regularized loss function and the value of the third regularized loss function are used to adjust the parameters of the audio-video matching model in combination with the value of the triplet loss function.

[0233] In some embodiments, the third regularized loss function = d(θ v ,θ tag )+d(θ m ,θ tag ).

[0234] In some embodiments, the value of the first regularized loss function, the value of the second regularized loss function, and the value of the third regularized loss function constitute a regularized loss function.

[0235] Optionally, the value of the first regularized loss function, the value of the second regularized loss function, and the value of the third regularized loss function are added together to obtain the regularized loss Optionally, the values ​​of the first regularized loss function, the second regularized loss function, and the third regularized loss function correspond to different weights, which are multiplied by the weights and then added together to obtain the regularized loss

[0236] In some embodiments, the value of the third triplet loss function is determined based on the similarity between the second hidden layer embedding features corresponding to the video sample in the positive sample pair and the label hidden layer features corresponding to the label of the positive sample pair, as well as the similarity between the second hidden layer embedding features corresponding to the video sample in the positive sample pair and the second hidden layer embedding features corresponding to the video samples in other sample pairs, where the labels of the other sample pairs are different from the labels of the positive sample pair.

[0237] In some embodiments, the second hidden layer embedding features corresponding to the video samples in the positive sample pairs are used as anchor samples, the label hidden layer features corresponding to the labels of the positive sample pairs are used as positive samples, and the second hidden layer embedding features corresponding to the video samples in other sample pairs are used as negative samples. Optionally, the third triplet loss function is

[0238] In some embodiments, the value of the fourth triplet loss function is determined based on the similarity between the second hidden layer embedding features corresponding to the audio samples in the positive sample pair and the label hidden layer features corresponding to the labels of the positive sample pair, as well as the similarity between the second hidden layer embedding features corresponding to the audio samples in the positive sample pair and the second hidden layer embedding features corresponding to the audio samples in other sample pairs.

[0239] In some embodiments, the second hidden layer embedding features corresponding to the audio samples in the positive sample pairs are used as anchor samples, the label hidden layer features corresponding to the labels of the positive sample pairs are used as positive samples, and the second hidden layer embedding features corresponding to the audio samples in other sample pairs are used as negative samples. Optionally, the fourth triplet loss function is

[0240] In some embodiments, the value of the fifth triplet loss function is determined based on the similarity between the video decoding features corresponding to the video sample in the positive sample pair and the label decoding features corresponding to the label of the positive sample pair, as well as the similarity between the video decoding features corresponding to the video sample in the positive sample pair and the video decoding features corresponding to the video samples in other sample pairs.

[0241] In some embodiments, the video decoding features corresponding to the video samples in the positive sample pairs are used as anchor samples, the label decoding features corresponding to the labels of the positive sample pairs are used as positive samples, and the video decoding features corresponding to the video samples in other sample pairs are used as negative samples. Optionally, the fifth triplet loss function is

[0242] In some embodiments, the value of the sixth triplet loss function is determined based on the similarity between the audio decoding features corresponding to the audio samples in the positive sample pair and the label decoding features corresponding to the labels of the positive sample pair, as well as the similarity between the audio decoding features corresponding to the audio samples in the positive sample pair and the audio decoding features corresponding to the audio samples in other sample pairs; wherein the value of the third triplet loss function, the value of the fourth triplet loss function, the value of the fifth triplet loss function, and the value of the sixth triplet loss function are used to adjust the parameters of the audio and video matching model in combination with the values ​​of the triplet loss functions.

[0243] In some embodiments, the audio decoding features corresponding to the audio samples in the positive sample pairs are used as anchor samples, the label decoding features corresponding to the labels of the positive sample pairs are used as positive samples, and the audio decoding features corresponding to the audio samples in other sample pairs are used as negative samples. Optionally, the sixth triplet loss function is

[0244] In some embodiments, the value of the third triple loss function corresponds to a third weight value, the value of the fourth triple loss function corresponds to a fourth weight value, the value of the fifth triple loss function corresponds to a fifth weight value, and the value of the sixth triple loss function corresponds to a sixth weight value. The third weight value, the fourth weight value, the fifth weight value, and the sixth weight value may be the same or different. Optionally, the product of the value of the third triple loss function and the third weight value, the product of the value of the fourth triple loss function and the fourth weight value, the product of the value of the fifth triple loss function and the fifth weight value, the product of the value of the sixth triple loss function and the sixth weight value, the product of the value of the first triple loss function and the first weight value, and the product of the value of the second triple loss function and the second weight value are determined as the value of the triple loss function. Optionally,

[0245] In some embodiments, the final loss function It can be expressed as:

[0246] In other embodiments, as well as Different weights may also be corresponded, and this application does not limit this.

[0247] In some embodiments, Figure 7 As shown, the internal architecture of the audio and video matching model 700 is shown. Optionally, the audio and video matching model 700 includes at least a feature extraction module 710, an audio and video matching module 720 and a text module 730. Optionally, the feature extraction module 710 includes a video feature extractor, a video rhythm feature extractor, an audio feature extractor, an audio rhythm feature extractor, a video feature encoder, and an audio feature encoder. Optionally, the audio and video matching module 720 includes an attention submodule, a video feature mapping submodule, and an audio feature mapping submodule. Optionally, the text module 730 includes a label feature extractor, a label feature mapping submodule, and a label feature decoder. Optionally, in addition to the feature extraction module 710, the audio and video matching module 720 and the text module 730, a video feature reconstruction module, a video feature decoder, an audio feature reconstruction module, an audio feature decoder, and a classifier are also included. Optionally, the video feature reconstruction module, the video feature decoder, the audio feature reconstruction module, the audio feature decoder, and the classifier may also be included in the audio and video matching module 720, and this application does not limit this.

[0248] In some embodiments, Figure 8 As shown, a schematic diagram of a training method of an audio-video matching model 800 is shown. The specific steps are explained in the above embodiment and will not be repeated here.

[0249] Step 570, adjusting the parameters of the audio and video matching model according to the value of the triplet loss function to obtain a trained audio and video matching model.

[0250] In some embodiments, the parameters of the audio and video matching model are adjusted with the goal of minimizing the value of the final loss function to obtain a trained audio and video matching model.

[0251] In some embodiments, the video / music pre-training model (i.e., the pre-trained video feature extractor and the audio feature extractor) all use the Adam optimizer with a learning rate of 0.0001, and each is trained for 150 epochs. When doing downstream video-music matching training (training the audio-video matching model), first, the embedded features obtained by the pre-training model for all video-music clips from the same video-music pair are combined in time sequence, and filled according to the maximum number of clips that appear (the longest is 28 seconds, so the maximum number of clips is 7, and the last clip is used for filling). The downstream matching model also uses the Adam optimizer with a learning rate of 0.0003, and the triplet loss threshold is set to 0.1. In some embodiments, the recall rate recall@k of the recommended music is used as an evaluation indicator, which indicates the ratio of the original paired tracks in the top k recommended tracks after sorting.

[0252] This application uses recall@k as the evaluation indicator of the model, and the results are shown in Table 1.

[0253] Table 1 Video-music retrieval performance evaluation

[0254]

[0255] This application compares two SOTA (state-of-the-art, currently the most advanced) methods, namely CBVMR corresponding to system 1, and CMVAE corresponding to system 2. The difference between the method CMVMR corresponding to system 3 and the present application is that no unified pre-training label set is used to pre-train video / music, but the feature extractor of system 1 / 2 is used (video pre-training is based on image classification, and music pre-training is based on music tags). The downstream video-music matching model is the same as system 4, and system 4 completely adopts the video-music cross-modal recommendation method based on unified pre-training objectives proposed in this application. It can be seen that the first two SOTA methods have equivalent performance when K=1 or K=25, and when K=5 and K=10, system 2 is significantly better than system 1. In contrast, system 3 performs better than system 1 / 2 when K takes all values, but the performance is not obvious enough, indicating that the downstream video-music matching model adopted in this application can improve certain video-music retrieval performance. For system 4, it can be seen that all indicators of this system are significantly better than the first three systems, which illustrates the effectiveness and advancement of this application.

[0256] The technical solution provided by the embodiment of the present application not only extracts the content features of audio and video, but also extracts the rhythm features of audio and video. When extracting the video rhythm features, it relies on optical flow information to calculate the average displacement information, and adopts the method of dividing bins to convert continuous numerical values ​​into discrete features that can be used for encoding, so as to determine the video rhythm features. When extracting the audio rhythm features, information of at least three dimensions is extracted for the beat, including the number of beats, the beat distance and the beat intensity. The corresponding features are determined for the continuous beat distance and the beat intensity by dividing bins, and for the discrete number of beats, it is converted into features that can be learned by the model by the method of unique hot encoding. Therefore, the determination of the audio and video rhythm features is more accurate, and because the audio rhythm features are determined from multiple dimensions, the audio rhythm features can represent richer rhythm information, that is, the audio rhythm features are more comprehensive in representing the audio rhythm, which is conducive to the implementation of downstream tasks.

[0257] In addition, in addition to mainly using triplet loss to train the model in this application, regularization loss, classification loss, etc. are also introduced to train the model. Therefore, the training effect of the model is good and the training efficiency is high. Specifically, when training the model, the embodiment of the present application introduces six types of triplet losses and three types of regularization losses. The six types of triplet losses are not only determined by the features corresponding to the anchor samples, positive samples and negative samples composed of audio and video samples, but also by the features corresponding to the anchor samples, positive samples and negative samples composed of audio and video samples and labels, that is, the way to determine the triplet is more diverse. Since triples are constructed from different dimensions and triplet loss, classification loss and regularization loss are calculated, the types of loss functions determined are relatively rich, which is conducive to accelerating the convergence speed of the loss function of the model and improving the fault tolerance of the model when used for downstream tasks.

[0258] Please refer to Fig. 9 , which shows a flowchart of an audio and video matching method based on an audio and video matching model provided by an embodiment of the present application. The execution subject of each step of the method can be the model using device introduced above. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as a "computer device". The method can include at least one of the following steps (910-940):

[0259] Step 910: Obtain a first video to be matched.

[0260] In some embodiments, the video to be matched is a video whose audio has not yet been determined to be matched. The application does not limit the type of the first video, and the first video can be an original video shot by the user account, or a video recorded from other videos, etc.

[0261] Step 920: extract feature information corresponding to the first video by a video feature extractor.

[0262] Optionally, the trained video feature extractor in the above embodiment is used to extract feature information corresponding to the first video. The specific training of the audio and video matching model is shown in the above embodiment and will not be described in detail here.

[0263] In some embodiments, the first video is frame extracted to obtain a video frame sequence, and a pixel value matrix corresponding to the video frame sequence is determined. Optionally, the pixel value matrix is ​​input into a video feature extractor to obtain feature information corresponding to the first video.

[0264] In some embodiments, the feature information is a feature vector. Optionally, the dimension of the feature information is not limited.

[0265] Step 930, determining the degree of match between the first video and each audio according to the feature information corresponding to the first video and the feature information corresponding to the n audios; wherein the feature information corresponding to the audio is obtained by an audio feature extractor, and the video feature extractor and the audio feature extractor share the same label set in the pre-training stage, and n is an integer greater than 1.

[0266] In some embodiments, the n audios are all the audios in the music library, and no screening is performed. Optionally, the first video is matched with all the audios in the music library.

[0267] In some other embodiments, the n audios are audios in a music library that match the first video. Optionally, the first video is matched with the audios in a music library that match the first video.

[0268] Optionally, feature information corresponding to the n audios is extracted by an audio feature extractor. Optionally, the trained audio feature extractor in the above embodiment is used to extract feature information corresponding to the n audios.

[0269] In some embodiments, the audio is frame extracted to obtain an audio frame sequence, and a beat value matrix corresponding to the audio frame sequence is determined. Optionally, the beat value matrix is ​​input into an audio feature extractor to obtain feature information corresponding to the audio.

[0270] Step 940: Determine at least one matching audio that matches the first video from the n audios based on the matching degree between the first video and each audio.

[0271] In some embodiments, at least one matching audio that matches the first video is determined from the n audios based on the similarity between the feature information of the first video and the feature information corresponding to each audio. Optionally, the similarity between the feature information of the first video and the feature information corresponding to each audio is determined based on the cosine distance between the feature information corresponding to the video and the feature information corresponding to the audio.

[0272] In some embodiments, at least one matching audio is sorted according to the degree of matching to obtain a recommended audio list, wherein the audio located at the front of the recommended audio list has a higher degree of matching with the first video, and the audio located at the back of the recommended audio list has a lower degree of matching with the first video.

[0273] The technical solution provided by the embodiment of the present application uses the video feature extractor and the audio feature extractor in the audio and video matching model to extract audio and video features when determining the audio that matches the video to be matched. Since the video feature extractor and the audio feature extractor are pre-trained using the same label set, the video feature extractor and the audio feature extractor can both learn the features of the video modality and the audio modality, and by training using triple learning, the video feature extractor's ability to extract features from the video and the audio feature extractor's ability to extract features from the audio can be improved. Therefore, the audio recommended to the video to be matched can be determined based on the matching degree between the audio and video features, which can improve the BGM hit rate.

[0274] Please refer to Fig.10 , which shows a flowchart of an audio and video matching method based on an audio and video matching model provided by another embodiment of the present application. The execution subject of each step of the method can be the model using device introduced above. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as a "computer device". The method can include at least one of the following steps (910-940):

[0275] Step 910: Obtain a first video to be matched.

[0276] Step 920: extract feature information corresponding to the first video by a video feature extractor.

[0277] Step 921: extract rhythm information corresponding to the first video through a video rhythm feature extractor.

[0278] Step 922: extract feature information corresponding to the n audios respectively through an audio feature extractor.

[0279] Step 923: extract the rhythm information corresponding to the n audios respectively through an audio rhythm feature extractor.

[0280] Step 924: Obtain a first hidden layer embedding feature corresponding to the first video according to the feature information corresponding to the first video and the rhythm information corresponding to the first video through a video feature encoder.

[0281] Step 925: Obtain first hidden layer embedding features corresponding to the n audios respectively according to feature information corresponding to the n audios and rhythm information corresponding to the n audios respectively through an audio feature encoder.

[0282] Optionally, steps 921 to 925 refer to the explanation of the above embodiment and are not repeated here.

[0283] Step 931, determining the matching degree between the first video and each audio according to the first latent layer embedding feature corresponding to the first video and the first latent layer embedding features corresponding to the n audios respectively.

[0284] In some embodiments, the first hidden layer embedding features corresponding to the n audios can be predetermined before matching is performed to reduce device processing overhead during the matching task.

[0285] Step 940: Determine at least one matching audio that matches the first video from the n audios based on the matching degree between the first video and each audio.

[0286] The technical solution provided by the embodiment of the present application not only introduces content features but also introduces rhythm features for subsequent feature similarity calculation when matching audio and video. Therefore, the determined audio recommended to the video to be matched is more accurate.

[0287] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0288] Please refer to Fig.11 , which shows a block diagram of a training device for an audio-video matching model provided by an embodiment of the present application. The device 1100 may include: a sample determination module 1110 , a label determination module 1120 , a pre-training module 1130 and a model training module 1140 .

[0289] The sample determination module 1110 is used to determine, for each audio sample in the audio sample set, at least one video sample that uses the audio sample as background music.

[0290] The label determination module 1120 is used to determine the label of the audio sample according to the label of the at least one video sample; wherein the video sample and the audio sample share the same label set, and the label refers to the classification label of the video sample or the audio sample.

[0291] The pre-training module 1130 is used to pre-train the video feature extractor according to the video samples and the labels of the video samples; and to pre-train the audio feature extractor according to the audio samples and the labels of the audio samples.

[0292] The model training module 1140 is used to train the audio-video matching model after pre-training the video feature extractor and the audio feature extractor. The audio-video matching model is used to determine the matching relationship between the video sample and the audio sample.

[0293] In some embodiments, Fig.12 As shown, the label determination module 1120 includes a set determination unit 1121 and a label determination unit 1122 .

[0294] The set determination unit 1121 is configured to obtain a tag set without deduplication according to the tags corresponding to the respective video samples in the at least one video sample, wherein the tag set includes M tags, where M is a positive integer.

[0295] The label determination unit 1122 is configured to select at least one label from the label set as a label of the audio sample.

[0296] In some embodiments, the tag set includes K non-repetitive tags, where K is a positive integer less than or equal to M.

[0297] The tag determination unit 1122 is used to determine the frequency value of the kth tag among the K tags according to the total number of tags M included in the tag set and the number of times the kth tag appears in the tag set, where k is a positive integer less than or equal to K.

[0298] The label determination unit 1122 is further configured to determine a prevalence value of the kth label according to the number of audio samples in the audio sample set having the kth label and the total number of audio samples in the audio sample set.

[0299] The tag determination unit 1122 is further configured to determine a weight value corresponding to the k-th tag according to the frequency value of the k-th tag and the prevalence value of the k-th tag.

[0300] The label determination unit 1122 is further configured to select at least one label from the K labels as the label of the audio sample according to the weight values ​​respectively corresponding to the K labels.

[0301] In some embodiments, Fig.12As shown, the model training module 1140 includes a set construction unit 1141, a feature extraction unit 1142, a loss determination unit 1143 and a parameter adjustment unit 1144.

[0302] The set construction unit 1141 is used to construct a set of sample pairs based on at least one video sample and at least one audio sample, wherein the set of sample pairs includes at least one positive sample pair and at least one negative sample pair, wherein the positive sample pair includes a video sample and an audio sample having a matching relationship, and the negative sample pair includes a video sample and an audio sample not having a matching relationship.

[0303] The feature extraction unit 1142 is used to extract feature information corresponding to the video sample and the audio sample in the same sample pair through the video feature extractor, and to extract feature information corresponding to the audio sample through the audio feature extractor.

[0304] The loss determination unit 1143 is used to determine the value of the triplet loss function based on the feature information corresponding to the video sample and the feature information corresponding to the audio sample in the same sample pair; wherein the triplet loss function is used to characterize the matching degree of the sample pair.

[0305] The parameter adjustment unit 1144 is used to adjust the parameters of the audio and video matching model according to the value of the triplet loss function to obtain a trained audio and video matching model.

[0306] In some embodiments, the audio-video matching model further includes a video rhythm feature extractor and an audio rhythm feature extractor.

[0307] The feature extraction unit 1142 is further configured to extract the rhythm information corresponding to the video sample through the video rhythm feature extractor; and to extract the rhythm information corresponding to the audio sample through the audio rhythm feature extractor.

[0308] The loss determination unit 1143 is used to determine the value of the triplet loss function according to the rhythm information corresponding to the video sample, the rhythm information corresponding to the audio sample, the feature information corresponding to the video sample, and the feature information corresponding to the audio sample.

[0309] In some embodiments, the feature extraction unit 1142 is also used to determine the displacement information corresponding to each video clip according to the optical flow information corresponding to each video clip in the video sample through the video rhythm feature extractor, the optical flow information is used to reflect the displacement relationship of pixels between frames in the video clip, and the displacement information is used to reflect the average displacement value of pixels between frames in the video clip.

[0310] The feature extraction unit 1142 is further used to determine the upper and lower displacement limits corresponding to the video samples according to the displacement information corresponding to the respective video clips, wherein the upper displacement limit is the maximum value of the displacement information corresponding to the respective video clips, and the lower displacement limit is the minimum value of the displacement information corresponding to the respective video clips.

[0311] The feature extraction unit 1142 is further configured to determine, for each video segment in the video sample, a rhythm feature corresponding to the video segment according to a position of the displacement information corresponding to the video segment in the interval formed by the displacement upper limit and the displacement lower limit.

[0312] The feature extraction unit 1142 is further configured to determine the rhythm information corresponding to the video sample according to the rhythm features corresponding to the respective video clips.

[0313] In some embodiments, the feature extraction unit 1142 is also used to determine the beat intensity information, beat distance information and beat number information corresponding to each audio segment according to the beat information corresponding to each audio segment in the audio sample through the audio rhythm feature extractor, and the beat information is used to reflect the rhythm of the audio in the audio segment.

[0314] The feature extraction unit 1142 is also used to determine the upper and lower limits of the beat intensity corresponding to the audio sample according to the beat intensity information corresponding to the respective audio segments, wherein the upper limit of the beat intensity is the maximum value of the beat intensity information corresponding to the respective audio segments, and the lower limit of the beat intensity is the minimum value of the beat intensity information corresponding to the respective audio segments.

[0315] The feature extraction unit 1142 is further configured to determine, for each audio segment in the audio sample, a beat intensity feature corresponding to the audio segment according to a position of the beat intensity information corresponding to the audio segment in an interval formed by the beat intensity upper limit and the beat intensity lower limit.

[0316] The feature extraction unit 1142 is further used to determine the upper limit and lower limit of the beat distance corresponding to the audio sample according to the beat distance information corresponding to each audio segment, wherein the upper limit of the beat distance is the maximum value of the beat distance information corresponding to each audio segment, and the lower limit of the beat distance is the minimum value of the beat distance information corresponding to each audio segment.

[0317] The feature extraction unit 1142 is further configured to determine, for each audio segment in the audio sample, a beat distance feature corresponding to the audio segment according to a position of the beat distance information corresponding to the audio segment in an interval formed by the beat distance upper limit and the beat distance lower limit.

[0318] The feature extraction unit 1142 is further configured to determine, for each audio segment in the audio sample, a beat number feature corresponding to the audio segment according to the beat number information corresponding to the audio segment and the beat number information corresponding to each audio segment.

[0319] The feature extraction unit 1142 is further configured to determine the rhythm information corresponding to the audio sample according to the beat intensity feature, the beat distance feature and the beat number feature respectively corresponding to each of the audio segments.

[0320] In some embodiments, the audio-video matching model further includes a video feature encoder, an audio feature encoder, and an audio-video matching module.

[0321] The feature extraction unit 1142 is further configured to obtain, through the video feature encoder, a first hidden layer embedding feature corresponding to the video sample according to the feature information corresponding to the video sample and the rhythm information corresponding to the video sample.

[0322] The feature extraction unit 1142 is further configured to obtain, through the audio feature encoder, a first hidden layer embedding feature corresponding to the audio sample according to the feature information corresponding to the audio sample and the rhythm information corresponding to the audio sample.

[0323] The feature extraction unit 1142 is also used to obtain the second hidden layer embedding features corresponding to the video sample and the second hidden layer embedding features corresponding to the audio sample through the audio and video matching module according to the first hidden layer embedding features corresponding to the video sample and the first hidden layer embedding features corresponding to the audio sample.

[0324] The loss determination unit 1143 is also used to determine the value of the first triplet loss function based on the similarity between the second hidden layer embedding features corresponding to the video sample in the positive sample pair and the second hidden layer embedding features corresponding to the audio sample, and the similarity between the second hidden layer embedding features corresponding to the video sample in the negative sample pair and the second hidden layer embedding features corresponding to the audio sample, where the video sample in the positive sample pair is the same as the video sample in the negative sample pair.

[0325] The loss determination unit 1143 is also used to determine the value of the second triplet loss function based on the similarity between the second hidden layer embedding features corresponding to the audio sample in the positive sample pair and the second hidden layer embedding features corresponding to the video sample, and the similarity between the second hidden layer embedding features corresponding to the audio sample in the negative sample pair and the second hidden layer embedding features corresponding to the video sample, where the audio sample in the positive sample pair is the same as the audio sample in the negative sample pair.

[0326] The loss determination unit 1143 is further used to determine the value of the triple loss function according to the value of the first triple loss function and the value of the second triple loss function.

[0327] In some embodiments, the audio-video matching module includes an attention submodule, a video feature mapping submodule, and an audio feature mapping submodule.

[0328] The feature extraction unit 1142 is also used to obtain the attention information corresponding to the video sample and the attention information corresponding to the audio sample through the attention submodule according to the first hidden layer embedding features corresponding to the video sample and the first hidden layer embedding features corresponding to the audio sample.

[0329] The feature extraction unit 1142 is further used to obtain the second hidden layer embedding feature corresponding to the video sample according to the first hidden layer embedding feature corresponding to the video sample and the attention information corresponding to the video sample through the video feature mapping submodule.

[0330] The feature extraction unit 1142 is further used to obtain a second hidden layer embedding feature corresponding to the audio sample according to the first hidden layer embedding feature corresponding to the audio sample and the attention information corresponding to the audio sample through the audio feature mapping submodule.

[0331] In some embodiments, the audio-video matching model further includes a video feature reconstruction module, an audio feature reconstruction module, a video feature decoder and an audio feature decoder.

[0332] The feature extraction unit 1142 is further configured to obtain, through the video feature reconstruction module, a video reconstruction feature corresponding to the video sample according to the second hidden layer embedding feature corresponding to the video sample.

[0333] The feature extraction unit 1142 is further configured to obtain, through the audio feature reconstruction module, an audio reconstruction feature corresponding to the audio sample according to the second hidden layer embedding feature corresponding to the audio sample.

[0334] The feature extraction unit 1142 is further configured to obtain, through the video feature decoder, a video decoding feature corresponding to the video sample according to the second hidden layer embedding feature corresponding to the video sample.

[0335] The feature extraction unit 1142 is further configured to obtain, through the audio feature decoder, an audio decoding feature corresponding to the audio sample according to the second hidden layer embedding feature corresponding to the audio sample.

[0336] The feature extraction unit 1142 is also used to determine the value of a first regularized loss function based on the video reconstruction features and the first hidden layer embedding features corresponding to the video sample, and the audio reconstruction features and the first hidden layer embedding features corresponding to the audio sample, wherein the first regularized loss function is the loss of feature reconstruction of the video sample and the audio sample in the sample pair.

[0337] The loss determination unit 1143 is also used to determine the value of the classification loss function according to the video decoding features corresponding to the video sample and the audio decoding features corresponding to the audio sample, wherein the classification loss function is a loss for classifying whether the video sample and the audio sample in the sample pair match; wherein the value of the first regularized loss function and the value of the classification loss function are used to adjust the parameters of the audio and video matching model in combination with the value of the triplet loss function.

[0338] In some embodiments, the audio-video matching model further includes a text module, and the text module includes a label feature extractor, a label feature mapping submodule, and a label feature decoder.

[0339] The feature extraction unit 1142 is further used to obtain a label embedding feature corresponding to the label according to the label of the positive sample pair in the same sample pair through the label feature extractor, wherein the label of the positive sample is the label corresponding to the video sample in the positive sample pair.

[0340] The feature extraction unit 1142 is further configured to obtain a label hidden layer feature of the label according to a label embedding feature corresponding to the label through the label feature mapping submodule.

[0341] The feature extraction unit 1142 is further configured to obtain a label decoding feature corresponding to the label according to a label hidden layer feature corresponding to the label through the label feature decoder.

[0342] The loss determination unit 1143 is further used to determine the value of the second regularized loss function according to the video decoding features corresponding to the video sample, the label decoding features corresponding to the label, the audio decoding features corresponding to the audio, and the label hidden layer features corresponding to the label.

[0343] The loss determination unit 1143 is also used to determine the value of the third regularized loss function based on the second hidden layer embedding features corresponding to the video sample, the second hidden layer embedding features corresponding to the audio sample, and the label hidden layer features of the label; wherein the value of the second regularized loss function and the value of the third regularized loss function are used to adjust the parameters of the audio and video matching model in combination with the value of the triplet loss function.

[0344] In some embodiments, the loss determination unit 1143 is also used to determine the value of the third triplet loss function based on the similarity between the second hidden layer embedding features corresponding to the video sample in the positive sample pair and the label hidden layer features corresponding to the label of the positive sample pair, as well as the similarity between the second hidden layer embedding features corresponding to the video sample in the positive sample pair and the second hidden layer embedding features corresponding to the video sample in other sample pairs, where the labels of the other sample pairs are different from the labels of the positive sample pair.

[0345] The loss determination unit 1143 is also used to determine the value of the fourth triplet loss function based on the similarity between the second hidden layer embedding features corresponding to the audio samples in the positive sample pair and the label hidden layer features corresponding to the labels of the positive sample pair, and the similarity between the second hidden layer embedding features corresponding to the audio samples in the positive sample pair and the second hidden layer embedding features corresponding to the audio samples in the other sample pairs.

[0346] The loss determination unit 1143 is also used to determine the value of the fifth triplet loss function based on the similarity between the video decoding features corresponding to the video sample in the positive sample pair and the label decoding features corresponding to the label of the positive sample pair, as well as the similarity between the video decoding features corresponding to the video sample in the positive sample pair and the video decoding features corresponding to the video samples in the other sample pairs.

[0347] The loss determination unit 1143 is also used to determine the value of the sixth triplet loss function based on the similarity between the audio decoding features corresponding to the audio samples in the positive sample pair and the label decoding features corresponding to the labels of the positive sample pair, as well as the similarity between the audio decoding features corresponding to the audio samples in the positive sample pair and the audio decoding features corresponding to the audio samples in the other sample pairs; wherein the value of the third triplet loss function, the value of the fourth triplet loss function, the value of the fifth triplet loss function, and the value of the sixth triplet loss function are used to adjust the parameters of the audio and video matching model in combination with the values ​​of the triplet loss functions.

[0348] Please refer to Fig.13, which shows a block diagram of an audio and video matching device based on an audio and video matching model provided by an embodiment of the present application. The device 1300 may include: a video acquisition module 1310, a feature extraction module 1320, a matching degree determination module 1330 and an audio determination module 1340.

[0349] The video acquisition module 1310 is used to acquire a first video to be matched.

[0350] The feature extraction module 1320 is used to extract feature information corresponding to the first video through the video feature extractor.

[0351] The matching degree determination module 1330 is used to determine the matching degree between the first video and each of the audios according to the feature information corresponding to the first video and the feature information corresponding to the n audios. The feature information corresponding to the audios is obtained by the audio feature extractor, the video feature extractor and the audio feature extractor share the same label set in the pre-training stage, and n is an integer greater than 1.

[0352] The audio determination module 1340 is used to determine at least one matching audio that matches the first video from the n audios according to the matching degree between the first video and each of the audios.

[0353] In some embodiments, the audio-video matching model further includes a video rhythm feature extractor, an audio feature rhythm extractor, a video feature encoder, and an audio feature encoder.

[0354] The feature extraction module 1320 is further configured to extract rhythm information corresponding to the first video through the video rhythm feature extractor.

[0355] The feature extraction module 1320 is further configured to obtain, through the video feature encoder, a first hidden layer embedding feature corresponding to the first video according to feature information corresponding to the first video and rhythm information corresponding to the first video.

[0356] The feature extraction module 1320 is further configured to extract feature information corresponding to the n audios respectively through the audio feature extractor.

[0357] The feature extraction module 1320 is further configured to extract the rhythm information corresponding to the n audios respectively through the audio rhythm feature extractor.

[0358] The feature extraction module 1320 is further used to obtain the first hidden layer embedding features corresponding to the n audios respectively according to the feature information corresponding to the n audios and the rhythm information corresponding to the n audios respectively through the audio feature encoder.

[0359] The matching degree determination module 1330 is further used to determine the matching degree between the first video and each of the audios according to the first hidden layer embedding features corresponding to the first video and the first hidden layer embedding features corresponding to the n audios respectively.

[0360] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0361] Fig.14 A structural block diagram of a computer device provided by another exemplary embodiment of the present application is shown.

[0362] Typically, the computer device 1400 includes a processor 1401 and a memory 1402 .

[0363] Processor 1401 may include one or more processing cores, such as a 4-core processor, a 14-core processor, and the like. Processor 1401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, processor 1401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, processor 1401 may also include an AI processor for processing computing operations related to machine learning.

[0364] The memory 1402 may include one or more computer-readable storage media, which may be tangible and non-transitory. The memory 1402 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1402 stores a computer program, which is loaded and executed by the processor 1401 to implement the above-mentioned audio and video matching model training method or the above-mentioned audio and video matching method based on the audio and video matching model.

[0365] Those skilled in the art will understand that Fig.14 The structure shown in the figure does not constitute a limitation on the computer device 1400, and the computer device 1400 may include more or less components than shown in the figure, or combine some components, or adopt a different arrangement of components.

[0366] In an exemplary embodiment, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, it implements the above-mentioned training method of the audio and video matching model or the above-mentioned audio and video matching method based on the audio and video matching model.

[0367] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random Access Memory), SSD (Solid State Drives) or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).

[0368] In an exemplary embodiment, a computer program product is also provided, the computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned audio and video matching model training method or the above-mentioned audio and video matching method based on the audio and video matching model.

[0369] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.

[0370] The above are merely exemplary embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A training method for an audio and video matching model, It is characterized in that The audio and video matching model includes a video feature extractor and an audio feature extractor; The method comprises: For each audio sample in the audio sample set, determining at least one video sample using the audio sample as background music; Determine the label of the audio sample according to the label of the at least one video sample; wherein the video sample and the audio sample share the same label set, and the label refers to the classification label of the video sample or the audio sample; Pre-training the video feature extractor according to the video sample and the label of the video sample; and pre-training the audio feature extractor according to the audio sample and the label of the audio sample; After the pre-training of the video feature extractor and the audio feature extractor is completed, the audio-video matching model is trained, and the audio-video matching model is used to determine the matching relationship between the video sample and the audio sample.

2. The method according to claim 1, It is characterized in that The step of determining the label of the audio sample according to the label of the at least one video sample comprises: According to the labels corresponding to the respective video samples in the at least one video sample, a label set without deduplication is obtained, wherein the label set includes M labels, where M is a positive integer; At least one tag is selected from the tag set as a tag of the audio sample.

3. The method according to claim 2, It is characterized in that The tag set includes K non-repeating tags, where K is a positive integer less than or equal to M; The step of selecting at least one tag from the tag set as the tag of the audio sample comprises: For the jth tag among the K tags, determine the frequency value of the jth tag according to the total number of tags M included in the tag set and the number of times the jth tag appears in the tag set, where j is a positive integer less than or equal to K; Determining a prevalence value of the kth label according to the number of audio samples with the jth label in the audio sample set and the total number of audio samples in the audio sample set; Determine a weight value corresponding to the j-th tag according to the frequency value of the j-th tag and the prevalence value of the j-th tag; At least one label is selected from the K labels as the label of the audio sample according to the weight values ​​respectively corresponding to the K labels.

4. The method according to claim 1, It is characterized in that The training of the audio and video matching model includes: Based on at least one video sample and at least one audio sample, construct a set of sample pairs, wherein the set of sample pairs includes at least one positive sample pair and at least one negative sample pair, wherein the positive sample pair includes a video sample and an audio sample having a matching relationship, and the negative sample pair includes a video sample and an audio sample not having a matching relationship; For a video sample and an audio sample in the same sample pair, extracting feature information corresponding to the video sample by the video feature extractor, and extracting feature information corresponding to the audio sample by the audio feature extractor; Determining a value of a triplet loss function according to feature information corresponding to the video sample and feature information corresponding to the audio sample in the same sample pair; wherein the triplet loss function is used to characterize the matching degree of the sample pair; According to the value of the triplet loss function, the parameters of the audio and video matching model are adjusted to obtain a trained audio and video matching model.

5. The method according to claim 4, It is characterized in that The audio-video matching model also includes a video rhythm feature extractor and an audio rhythm feature extractor; the method also includes: Extracting the rhythm information corresponding to the video sample by the video rhythm feature extractor; and extracting the rhythm information corresponding to the audio sample by the audio rhythm feature extractor; The determining the value of the triplet loss function according to the feature information corresponding to the video sample and the feature information corresponding to the audio sample in the same sample pair includes: The value of the triplet loss function is determined according to the rhythm information corresponding to the video sample, the rhythm information corresponding to the audio sample, the feature information corresponding to the video sample, and the feature information corresponding to the audio sample.

6. The method according to claim 5, It is characterized in that The extracting the rhythm information corresponding to the video sample by the video rhythm feature extractor includes: Determine, by the video rhythm feature extractor, displacement information corresponding to each video segment according to optical flow information corresponding to each video segment in the video sample, wherein the optical flow information is used to reflect the displacement relationship of pixels between frames in the video segment, and the displacement information is used to reflect the average displacement value of pixels between frames in the video segment; Determine, according to the displacement information corresponding to each video clip, an upper displacement limit and a lower displacement limit corresponding to the video sample, wherein the upper displacement limit is a maximum value of the displacement information corresponding to each video clip, and the lower displacement limit is a minimum value of the displacement information corresponding to each video clip; For each video segment in the video sample, determining a rhythm feature corresponding to the video segment according to a position of the displacement information corresponding to the video segment in an interval formed by the displacement upper limit and the displacement lower limit; The rhythm information corresponding to the video sample is determined according to the rhythm features corresponding to the respective video clips.

7. The method according to claim 5, It is characterized in that The extracting the rhythm information corresponding to the audio sample by the audio rhythm feature extractor includes: Determine, by the audio rhythm feature extractor, the beat intensity information, the beat distance information and the beat number information corresponding to each audio segment according to the beat information corresponding to each audio segment in the audio sample, wherein the beat information is used to reflect the rhythm of the audio in the audio segment; Determine, according to the beat intensity information corresponding to each audio segment, an upper limit and a lower limit of the beat intensity corresponding to the audio sample, wherein the upper limit of the beat intensity is a maximum value of the beat intensity information corresponding to each audio segment, and the lower limit of the beat intensity is a minimum value of the beat intensity information corresponding to each audio segment; For each audio segment in the audio sample, determining a beat intensity feature corresponding to the audio segment according to a position of the beat intensity information corresponding to the audio segment in an interval formed by the beat intensity upper limit and the beat intensity lower limit; Determine, according to the beat distance information corresponding to each audio segment, an upper limit and a lower limit of the beat distance corresponding to the audio sample, wherein the upper limit of the beat distance is a maximum value of the beat distance information corresponding to each audio segment, and the lower limit of the beat distance is a minimum value of the beat distance information corresponding to each audio segment; For each audio segment in the audio sample, determining a beat distance feature corresponding to the audio segment according to a position of the beat distance information corresponding to the audio segment in an interval formed by the beat distance upper limit and the beat distance lower limit; For each audio segment in the audio sample, determining a beat number feature corresponding to the audio segment according to the beat number information corresponding to the audio segment and the beat number information corresponding to each audio segment; The rhythm information corresponding to the audio sample is determined according to the beat intensity characteristics, the beat distance characteristics and the beat number characteristics respectively corresponding to the audio segments.

8. The method according to claim 5, It is characterized in that The audio and video matching model also includes a video feature encoder, an audio feature encoder and an audio and video matching module; the method also includes: The determining the value of the triplet loss function according to the rhythm information corresponding to the video sample, the rhythm information corresponding to the audio sample, the feature information corresponding to the video sample, and the feature information corresponding to the audio sample includes: Obtaining, by the video feature encoder, a first hidden layer embedding feature corresponding to the video sample according to the feature information corresponding to the video sample and the rhythm information corresponding to the video sample; Obtaining, by the audio feature encoder, a first hidden layer embedding feature corresponding to the audio sample according to the feature information corresponding to the audio sample and the rhythm information corresponding to the audio sample; Obtaining, by the audio-video matching module, a second hidden layer embedding feature corresponding to the video sample and a second hidden layer embedding feature corresponding to the audio sample according to the first hidden layer embedding feature corresponding to the video sample and the first hidden layer embedding feature corresponding to the audio sample; determining a value of a first triplet loss function according to a similarity between a second hidden layer embedding feature corresponding to the video sample in the positive sample pair and a second hidden layer embedding feature corresponding to the audio sample, and a similarity between a second hidden layer embedding feature corresponding to the video sample in the negative sample pair and a second hidden layer embedding feature corresponding to the audio sample, wherein the video sample in the positive sample pair is the same as the video sample in the negative sample pair; determining a value of a second triplet loss function according to a similarity between a second hidden layer embedding feature corresponding to the audio sample in the positive sample pair and a second hidden layer embedding feature corresponding to the video sample, and a similarity between a second hidden layer embedding feature corresponding to the audio sample in the negative sample pair and a second hidden layer embedding feature corresponding to the video sample, wherein the audio sample in the positive sample pair is the same as the audio sample in the negative sample pair; The value of the triple loss function is determined according to the value of the first triple loss function and the value of the second triple loss function.

9. The method according to claim 8, It is characterized in that The audio and video matching module includes an attention submodule, a video feature mapping submodule and an audio feature mapping submodule; The obtaining, by the audio-video matching module, the second hidden layer embedding feature corresponding to the video sample and the second hidden layer embedding feature corresponding to the audio sample according to the first hidden layer embedding feature corresponding to the video sample and the first hidden layer embedding feature corresponding to the audio sample, comprises: Obtaining, by the attention submodule, attention information corresponding to the video sample and attention information corresponding to the audio sample according to the first hidden layer embedding feature corresponding to the video sample and the first hidden layer embedding feature corresponding to the audio sample; Obtaining, by the video feature mapping submodule, a second hidden layer embedding feature corresponding to the video sample according to the first hidden layer embedding feature corresponding to the video sample and the attention information corresponding to the video sample; The audio feature mapping submodule obtains a second hidden layer embedding feature corresponding to the audio sample according to the first hidden layer embedding feature corresponding to the audio sample and the attention information corresponding to the audio sample.

10. The method according to claim 8, It is characterized in that The audio-video matching model further includes a video feature reconstruction module, an audio feature reconstruction module, a video feature decoder and an audio feature decoder; the method further includes: Obtaining, by the video feature reconstruction module, a video reconstruction feature corresponding to the video sample according to the second hidden layer embedding feature corresponding to the video sample; Obtaining, by the audio feature reconstruction module, an audio reconstruction feature corresponding to the audio sample according to the second hidden layer embedding feature corresponding to the audio sample; Obtaining, by the video feature decoder, a video decoding feature corresponding to the video sample according to a second hidden layer embedding feature corresponding to the video sample; Obtaining, by the audio feature decoder, an audio decoding feature corresponding to the audio sample according to a second hidden layer embedding feature corresponding to the audio sample; Determine a value of a first regularized loss function according to the video reconstruction feature and the first hidden layer embedding feature corresponding to the video sample, and the audio reconstruction feature and the first hidden layer embedding feature corresponding to the audio sample, wherein the first regularized loss function is a loss for feature reconstruction of the video sample and the audio sample in the sample pair; Determining a value of a classification loss function according to a video decoding feature corresponding to the video sample and an audio decoding feature corresponding to the audio sample, wherein the classification loss function is a loss for classifying whether the video sample and the audio sample in the sample pair match; Among them, the value of the first regularization loss function and the value of the classification loss function are used to adjust the parameters of the audio and video matching model in combination with the value of the triplet loss function.

11. The method according to claim 9, It is characterized in that The audio and video matching model also includes a text module, and the text module includes a label feature extractor, a label feature mapping submodule and a label feature decoder; the method also includes: Obtaining a label embedding feature corresponding to the label according to the label of the positive sample pair in the same sample pair by the label feature extractor, wherein the label of the positive sample is the label corresponding to the video sample in the positive sample pair; Obtaining the label hidden layer features of the label according to the label embedding features corresponding to the label through the label feature mapping submodule; Obtaining a label decoding feature corresponding to the label according to the label hidden layer feature corresponding to the label by the label feature decoder; Determining a value of a second regularized loss function according to a video decoding feature corresponding to the video sample, a label decoding feature corresponding to the label, an audio decoding feature corresponding to the audio, and a label hidden layer feature corresponding to the label; Determining a value of a third regularized loss function according to the second hidden layer embedding feature corresponding to the video sample, the second hidden layer embedding feature corresponding to the audio sample, and the label hidden layer feature of the label; Among them, the value of the second regularized loss function and the value of the third regularized loss function are used to adjust the parameters of the audio and video matching model in combination with the value of the triplet loss function.

12. The method according to claim 11, It is characterized in that The method further comprises: Determining a value of a third triplet loss function according to the similarity between the second hidden layer embedding feature corresponding to the video sample in the positive sample pair and the label hidden layer feature corresponding to the label of the positive sample pair, and the similarity between the second hidden layer embedding feature corresponding to the video sample in the positive sample pair and the second hidden layer embedding feature corresponding to the video sample in other sample pairs, the labels of the other sample pairs being different from the labels of the positive sample pair; Determine a value of a fourth triplet loss function according to the similarity between the second hidden layer embedding feature corresponding to the audio sample in the positive sample pair and the label hidden layer feature corresponding to the label of the positive sample pair, and the similarity between the second hidden layer embedding feature corresponding to the audio sample in the positive sample pair and the second hidden layer embedding feature corresponding to the audio sample in the other sample pairs; Determine a value of a fifth triplet loss function according to the similarity between the video decoding feature corresponding to the video sample in the positive sample pair and the label decoding feature corresponding to the label of the positive sample pair, and the similarity between the video decoding feature corresponding to the video sample in the positive sample pair and the video decoding feature corresponding to the video sample in the other sample pairs; Determining a value of a sixth triplet loss function according to a similarity between an audio decoding feature corresponding to the audio sample in the positive sample pair and a label decoding feature corresponding to the label of the positive sample pair, and a similarity between an audio decoding feature corresponding to the audio sample in the positive sample pair and an audio decoding feature corresponding to the audio sample in the other sample pairs; Among them, the value of the third triplet loss function, the value of the fourth triplet loss function, the value of the fifth triplet loss function, and the value of the sixth triplet loss function are used to adjust the parameters of the audio and video matching model in combination with the values ​​of the triplet loss functions.

13. An audio and video matching method based on an audio and video matching model, It is characterized in that The audio and video matching model includes a video feature extractor and an audio feature extractor; The method comprises: Obtaining a first video to be matched; Extracting feature information corresponding to the first video by the video feature extractor; Determine the matching degree between the first video and each of the audios according to the feature information corresponding to the first video and the feature information corresponding to the n audios; wherein the feature information corresponding to the audios is obtained by the audio feature extractor, the video feature extractor and the audio feature extractor share the same label set in a pre-training stage, and n is an integer greater than 1; At least one matching audio that matches the first video is determined from the n audios according to the matching degree between the first video and each of the audios.

14. The method according to claim 13, It is characterized in that The audio-video matching model also includes a video rhythm feature extractor, an audio feature rhythm extractor, a video feature encoder and an audio feature encoder; The method further comprises: Extracting rhythm information corresponding to the first video by the video rhythm feature extractor; Obtaining, by the video feature encoder, a first hidden layer embedding feature corresponding to the first video according to feature information corresponding to the first video and rhythm information corresponding to the first video; Extracting feature information corresponding to the n audios respectively by the audio feature extractor; Extracting the rhythm information corresponding to the n audios respectively by the audio rhythm feature extractor; Obtaining, by the audio feature encoder, first hidden layer embedding features corresponding to the n audios respectively according to feature information corresponding to the n audios respectively and rhythm information corresponding to the n audios respectively; The determining, according to the feature information corresponding to the first video and the feature information corresponding to the n audios, the matching degree between the first video and each of the audios includes: The matching degree between the first video and each of the audios is determined according to the first hidden layer embedding features corresponding to the first video and the first hidden layer embedding features corresponding to the n audios respectively.

15. A training device for an audio and video matching model, It is characterized in that The audio and video matching model includes a video feature extractor and an audio feature extractor; The device comprises: A sample determination module, configured to determine, for each audio sample in the audio sample set, at least one video sample that uses the audio sample as background music; A label determination module, configured to determine a label of the audio sample according to a label of the at least one video sample; wherein the video sample and the audio sample share the same label set, and the label refers to a classification label of the video sample or the audio sample; A pre-training module, configured to pre-train the video feature extractor according to the video sample and the label of the video sample; and to pre-train the audio feature extractor according to the audio sample and the label of the audio sample; A model training module is used to train the audio-video matching model after pre-training the video feature extractor and the audio feature extractor. The audio-video matching model is used to determine the matching relationship between the video sample and the audio sample.

16. An audio and video matching device based on an audio and video matching model, It is characterized in that The audio and video matching model includes a video feature extractor and an audio feature extractor; The device comprises: A video acquisition module, used to acquire a first video to be matched; A feature extraction module, used to extract feature information corresponding to the first video through the video feature extractor; A matching degree determination module, used to determine the matching degree between the first video and each of the audios according to the feature information corresponding to the first video and the feature information corresponding to the n audios; wherein the feature information corresponding to the audios is obtained by the audio feature extractor, the video feature extractor and the audio feature extractor share the same label set in the pre-training stage, and n is an integer greater than 1; The audio determination module is used to determine at least one matching audio that matches the first video from the n audios according to the matching degree between the first video and each of the audios.

17. A computer device, It is characterized in that The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the method as described in any one of claims 1 to 12, or to implement the method as described in any one of claims 13 to 14.

18. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the method as described in any one of claims 1 to 12, or to implement the method as described in any one of claims 13 to 14.

19. A computer program product, It is characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium. The processor reads and executes the computer program from the computer-readable storage medium to implement the method as described in any one of claims 1 to 12 above, or implements the method as described in any one of claims 13 to 14 above.