A song recognition model training method, a song recognition method, and a device thereof

By masking invalid audio segments and constructing a loss function in the song recognition model, and training the song recognition model using a convolutional neural network, the problem of high computational cost in existing technologies is solved, and fast and accurate recognition of cover songs is achieved.

CN117133313BActive Publication Date: 2026-11-27TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311173001.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-12
Publication Date
2026-11-27
Estimated Expiration
2043-09-12

AI Technical Summary

Technical Problem

Existing cover song recognition technologies, due to the use of small offsets, result in an increase in the number of slices, leading to a large amount of computation and a long recognition time, making them inefficient for recognizing cover songs.

Method used

By acquiring songs from the same song group in a preset music library, filtering out invalid audio segments, constructing a loss function to train the song recognition model, and using convolutional neural networks and ternary loss functions to focus on effective audio features, the computational load is reduced.

Benefits of technology

It enables rapid identification of cover songs, reduces computational load, increases song recognition speed, and ensures information integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117133313B_ABST
    Figure CN117133313B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a song recognition model training method, a song recognition method and a device thereof, and is used in the technical field of song recognition, comprising: obtaining valid audio segments and invalid audio segments corresponding to a recording segment in a same song group song; inputting the recording segment, the valid audio segment and the invalid audio segment into an initial song recognition model to obtain recording audio features, valid audio features and invalid audio features; constructing a loss function based on the feature similarity of the recording audio features and the valid audio features and the feature similarity of the recording audio features and the invalid audio features, so that the obtained song recognition model focuses on the valid audio features, the audio features of the target song output by the song recognition model tend to be the valid audio features, the recording segment can not be sliced, the corresponding recognition result can be directly obtained by outputting the audio features of the target song through the song recognition model, the calculation amount of song recognition is reduced, and the song recognition rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of song recognition technology, and in particular to a training method for a song recognition model, a song recognition method, and an apparatus thereof. Background Technology

[0002] Existing song recognition technologies include cover song identification. Cover song identification uses fuzzy matching based on song feature similarity to recall the original song of a cover version. Current cover song identification technologies use short segments of fixed duration for database construction and requesting. User recordings are sliced ​​based on a fixed duration and a fixed offset, resulting in multiple slices. For example, if a user's recording is 6 seconds long, with a fixed slice duration of 2 seconds and a fixed offset of 1 second, the resulting slices would be 0-2 seconds, 1-3 seconds, 2-4 seconds, and 3-5 seconds. The audio features of these slices are compared with the audio features of songs in the database, and the similarity is calculated to identify whether a song in the database has been covered.

[0003] Existing cover song recognition technologies require a small offset to ensure information integrity, allowing the song slices to encompass more melodic information. However, a smaller offset results in more slices, necessitating comparison of the audio features of each slice during audio feature comparison. This increases the computational load and takes longer to obtain the cover song recognition result. Summary of the Invention

[0004] This application provides a method for training a song recognition model, a song recognition method, and an apparatus thereof, which can reduce the computational load of song recognition and improve the speed of song recognition.

[0005] This application provides a method for training a song recognition model, including:

[0006] Acquire a recording segment, the corresponding group of songs in a preset music library, and an initial song recognition model. The group of songs indicates that the recording segment corresponds to the original song and the cover song in the preset music library.

[0007] In the same song group, audio segments corresponding to the recording segment but not the recording segment are masked to obtain the valid audio segments corresponding to the recording segment; and in the same song group, audio segments corresponding to the recording segment are masked to obtain the invalid audio segments corresponding to the recording segment.

[0008] The recording segment, the valid audio segment, and the invalid audio segment are input into the initial song recognition model to obtain the recording audio features corresponding to the recording segment, the valid audio features corresponding to the valid audio segment, and the invalid audio features corresponding to the invalid audio segment output by the initial song recognition model.

[0009] A loss function is constructed based on the feature similarity between the recorded audio features and the effective audio features, and the feature similarity between the recorded audio features and the invalid audio features;

[0010] The initial song recognition model is considered complete once the loss function converges, thus obtaining the song recognition model. The song recognition model is used to input a recording segment to be recognized and a target song, and to identify whether the recording segment to be recognized belongs to the target song based on the audio features of the recording segment to be recognized and the audio features of the target song.

[0011] Furthermore, obtaining the corresponding song group in the preset music library for the recorded segment includes:

[0012] The similarity of the audio features of the recorded segment with the audio features of songs in the preset music library is compared.

[0013] Identify the first song whose similarity is greater than a preset reliability threshold;

[0014] Based on the first song, obtain the corresponding group of songs in the preset music library for the recorded segment.

[0015] Furthermore, the step of masking audio segments outside the recorded segment in the same song group to obtain the valid audio segment corresponding to the recorded segment includes:

[0016] The recording segment is determined to correspond to the target audio frame of the song in the same song group;

[0017] By using a first time-domain mask to block out audio frames other than the target audio frame in the same song group, the effective audio segment corresponding to the recording segment is obtained.

[0018] Furthermore, the step of masking the audio segment corresponding to the recording segment in the same song group to obtain the invalid audio segment corresponding to the recording segment includes:

[0019] The recording segment is determined to correspond to the target audio frame of the song in the same song group;

[0020] By masking the target audio frames of the songs in the same song group using a second time-domain mask, invalid audio segments corresponding to the recording segment are obtained.

[0021] Furthermore, the initial song recognition model includes a convolutional neural network;

[0022] The step of inputting the recording segment, the valid audio segment, and the invalid audio segment into the initial song recognition model to obtain the recording audio features corresponding to the recording segment, the valid audio features corresponding to the valid audio segment, and the invalid audio features corresponding to the invalid audio segment output by the initial song recognition model includes:

[0023] The audio features of the recorded segment, the audio features of the valid audio segment, and the audio features of the invalid audio segment are input into the convolutional neural network to obtain the audio features of the recorded segment, the valid audio features of the valid audio segment, and the invalid audio features of the invalid audio segment output by the convolutional neural network.

[0024] Furthermore, the loss function includes a ternary loss function;

[0025] The loss function constructed based on the feature similarity between the recorded audio features and the valid audio features, and the feature similarity between the recorded audio features and the invalid audio features includes:

[0026] The difference in feature similarity is obtained by subtracting the feature similarity between the recorded audio features and the valid audio features from the feature similarity between the recorded audio features and the invalid audio features.

[0027] A ternary loss function is constructed based on the difference in feature similarity.

[0028] Furthermore, the recorded audio features include a recorded audio vector, the valid audio features include a valid audio vector, and the invalid audio features include an invalid audio vector;

[0029] Feature similarity includes vector cosine distance or vector Euclidean distance.

[0030] This application also provides a song recognition method, including:

[0031] Obtain the target audio segment and the target song to be identified;

[0032] The target recording segment and the target song are input into the song recognition model trained by the above method to obtain the audio features of the target recording segment and the audio features of the target song output by the song recognition model.

[0033] The audio features of the target recording segment are compared with the audio features of the target song;

[0034] Based on the comparison results, it is determined whether the target recording segment belongs to the target song.

[0035] This application embodiment also provides a training device for a song recognition model, including:

[0036] Central processing unit, memory, and input / output interfaces;

[0037] The memory is either a short-term storage memory or a persistent storage memory;

[0038] The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method described above.

[0039] This application also provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the method described above.

[0040] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0041] In this embodiment, a recording segment, a corresponding group of songs in a preset music library, and an initial song recognition model are obtained. Audio segments outside the recording segment are masked within the group of songs to obtain the valid audio segments corresponding to the recording segment. Similarly, audio segments corresponding to the recording segment are masked within the group of songs to obtain the invalid audio segments corresponding to the recording segment. The recording segment, valid audio segments, and invalid audio segments are input into the initial song recognition model to obtain the recording audio features corresponding to the recording segment, the valid audio features corresponding to the valid audio segments, and the invalid audio features corresponding to the invalid audio segments output by the initial song recognition model. A loss function is constructed based on the feature similarity between the recording audio features and the valid audio features, and the feature similarity between the recording audio features and the invalid audio features. The initial song recognition model is considered complete when the loss function converges, thus obtaining the song recognition model. In this embodiment, a loss function is constructed based on the feature similarity between recorded audio features and valid audio features, as well as the feature similarity between recorded audio features and invalid audio features. This allows the trained song recognition model to focus on valid audio features, and the audio features of the target song output by the song recognition model are more similar to valid audio features. This eliminates the need to slice the recording segment, and the corresponding recognition result can be directly obtained by outputting the audio features of the target song through the song recognition model. This reduces the computational load of song recognition and improves the speed of song recognition. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0043] Figure 1 This is a communication network architecture diagram for song recognition disclosed in an embodiment of this application;

[0044] Figure 2 This is a flowchart illustrating the training process of a song recognition model disclosed in an embodiment of this application.

[0045] Figure 3 This is a flowchart illustrating the training process of another song recognition model disclosed in an embodiment of this application;

[0046] Figure 4 This is a flowchart of a song recognition method disclosed in an embodiment of this application;

[0047] Figure 5 This is a schematic diagram illustrating song recognition as disclosed in an embodiment of this application;

[0048] Figure 6 This is a schematic diagram of a time-domain mask disclosed in an embodiment of this application;

[0049] Figure 7 This is a schematic diagram of a song recognition model disclosed in an embodiment of this application;

[0050] Figure 8 This is a diagram of a training device for a song recognition model disclosed in an embodiment of this application;

[0051] Figure 9 This is a diagram of a training device for another song recognition model disclosed in an embodiment of this application. Detailed Implementation

[0052] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] In the description of the embodiments of this application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the embodiments of this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the embodiments of this application.

[0054] In the description of the embodiments of this application, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the embodiments of this application based on the specific circumstances.

[0055] Existing song recognition technologies often include cover song recognition, such as... Figure 1 As shown, a user can record a snippet of a cover song using the recording device 102. The song recognition device 101 is connected to the recording device 102 and can acquire the recorded snippet, perform song recognition on it, and identify whether the recorded snippet corresponds to a song in the music library. The recording device 102 can be a recorder or a mobile phone, or any other device with recording capabilities; this is not a specific limitation. It is understood that the recorded snippet can also be an audio snippet obtained through a network connection or a pre-stored audio snippet; this is not a specific limitation either. The song recognition device 101 can be connected to one or more recording devices 102, and the song recognition device 101 and the recording device 102 can be located on the same device, meaning that recording and song recognition are performed on the same device. Existing cover song recognition technology slices the recorded snippet based on a fixed duration and a fixed offset, and then performs song recognition on the sliced ​​snippets. To ensure information integrity, a smaller offset is needed so that the sliced ​​snippets cover more melodic information. However, smaller offsets result in more video segments. When comparing audio features, it's necessary to compare the audio features of each segment, leading to increased computational load and a longer time required to obtain the cover song recognition result. Therefore, this application provides a method for training a song recognition model. Using the trained song recognition model can reduce the computational load of song recognition and improve the speed of song recognition. Figure 2 As shown, the specific steps are as follows:

[0056] 201. Obtain the recording segment, the corresponding songs in the preset music library, and the initial song recognition model.

[0057] In this embodiment, a recording segment, a corresponding song group in a preset music library, and an initial song recognition model can be acquired. The recording segment can be an audio segment manually entered by the user or an audio segment obtained via a network connection; the specific method is not limited here. The preset music library can be a music library in a music player or an online music library; the specific method is not limited here. The preset music library contains original versions and cover versions of multiple songs. The corresponding song group indicates that the recording segment corresponds to an original version and a cover version in the preset music library, i.e., the song corresponding to the recording segment in the preset music library, and the original version and multiple different versions of the cover version included in that song. It is understood that the preset music library generally has a corresponding song recognition system. The recording segment can be input into the song recognition system, and the audio features of the recording segment can be compared with the audio features of songs in the preset music library to find songs with similar audio features as the corresponding songs for the recording segment. The initial song recognition model can be a convolutional neural network (ResNet) or a recurrent neural network; the specific method is not limited here.

[0058] 202. By masking the corresponding audio segments in songs of the same genre, the valid and invalid audio segments corresponding to the recording segments can be obtained.

[0059] Furthermore, by masking corresponding audio segments within a song group, the valid and invalid audio segments corresponding to the recorded segment can be obtained. Specifically, by masking audio segments outside the recorded segment, the valid audio segments corresponding to the recorded segment can be obtained; conversely, by masking audio segments corresponding to the recorded segment, the invalid audio segments can be obtained. This means that the audio segments corresponding to the recorded segment can be determined within the song group; specifically, the audio segments corresponding to the lyrics or melody of the recorded segment can be determined from the song audio of the song group. Masking audio segments outside the recorded segment means masking the audio features of audio segments outside the recorded segment while retaining the audio features of the audio segment corresponding to the recorded segment. In other words, the valid audio segments corresponding to the recorded segment only include the valid information (audio features) corresponding to that recorded segment. In a song group, the audio segments corresponding to the recorded segments are masked. This means that the audio features of the audio segments corresponding to the recorded segments are hidden, while the audio features of the audio segments corresponding to the recorded segments are retained. In other words, the invalid audio segments corresponding to the recorded segments do not include the valid information (audio features) corresponding to those segments. It can be understood that the valid and invalid audio segments are still audio segments of the song group, only some audio features within those segments are masked (i.e., not displayed).

[0060] 203. Input the recording segments, valid audio segments, and invalid audio segments into the initial song recognition model to obtain the recording audio features, valid audio features, and invalid audio features.

[0061] After obtaining the valid and invalid audio segments corresponding to songs in the same song group, the recording clips, valid audio segments, and invalid audio segments can be input into the initial song recognition model to obtain the recording audio features, valid audio features, and invalid audio features. Specifically, the audio features input into the initial song recognition model can be Mel-frequency cepstral coefficient features (MFCC features), Mel-spectrum features, or audio vectors; the specific type is not limited here. Similarly, the audio features output by the initial song recognition model can also be MFCC features, Mel-spectrum features, or audio vectors; the specific type is not limited here.

[0062] 204. Construct a loss function based on the feature similarity between recorded audio features and valid audio features, as well as the feature similarity between recorded audio features and invalid audio features.

[0063] After obtaining the valid and invalid audio features, a loss function can be constructed based on the feature similarity between the recorded audio features and the valid audio features, and the feature similarity between the recorded audio features and the invalid audio features. The recorded audio features can be recorded audio vectors, the valid audio features can be valid audio vectors, and the invalid audio features can be invalid audio vectors; the feature similarity can be the cosine distance or the Euclidean distance between vectors, which is not limited here. That is, the loss function can be constructed based on the cosine distance between the recorded audio vectors and the valid audio vectors, and the cosine distance between the recorded audio vectors and the invalid audio vectors, to train the initial song recognition model. It can be understood that the purpose of constructing the loss function is to make the features of the recorded audio features output by the initial song recognition model as similar as possible to the features of the valid audio features, and to make the features of the output recorded audio features as different as possible from the features of the invalid audio features. This ensures that the song recognition model focuses on the valid audio features (valid information) in the song and filters out the invalid audio features (invalid information). When the song is input into the trained song recognition model, the song recognition model can output the valid information of the song and filter out the invalid information. This loss function can be a ternary loss function or an entropy loss function, which is not limited here.

[0064] 205. Once the loss function converges, the initial song recognition model training is complete, and the song recognition model is obtained.

[0065] In this embodiment, a loss function is constructed until it converges, indicating that the initial song recognition model is complete and a song recognition model is obtained. It is understood that the training process of the initial song recognition model is iterative. In each iteration, valid and invalid audio features corresponding to different songs in the same song group are selected. During the iteration, a loss function is constructed based on the feature similarity between the recorded audio features and the valid audio features, and the feature similarity between the recorded audio features and the invalid audio features, until the loss function converges. The convergence of the loss function can be understood as training multiple times until the loss value corresponding to the loss function is within a certain range, indicating that the loss function has converged and a trained song recognition model is obtained. After training, the song recognition model is saved and used to build a database. The song recognition model is used as input for the recording segment to be recognized and the target song. Based on the audio features of the recording segment to be recognized and the audio features of the target song, it identifies whether the recording segment to be recognized belongs to the target song. It is understood that the audio features of the target song output by the song recognition model mainly contain the valid audio features of the target song. Building a database using the audio features of the target song output by the song recognition model constitutes establishing a retrieval database. By comparing the audio features of the recording segment to be identified with the audio features of the target song in the search database, the corresponding song identification result can be obtained.

[0066] As can be seen, in this embodiment, a loss function is constructed based on the feature similarity between the recorded audio features and the effective audio features, as well as the feature similarity between the recorded audio features and the invalid audio features. This allows the trained song recognition model to focus on the effective audio features, and the audio features of the target song output by the song recognition model are more similar to the effective audio features. Therefore, it is not necessary to slice the recording segment. The corresponding recognition result can be directly obtained by outputting the audio features of the target song through the song recognition model, which reduces the computational load of song recognition and improves the speed of song recognition.

[0067] Furthermore, the embodiments of this application also describe in detail the training process of the song recognition model, such as... Figure 3 As shown, the specific steps are as follows:

[0068] 301. Obtain a convolutional neural network and use the similarity of audio features to find the corresponding songs in the preset music library for the recorded segment.

[0069] In this embodiment, a convolutional neural network can be obtained, and the similarity of audio features can be used to obtain the corresponding group of songs in a preset music library for the recorded segment. Specifically, the audio features of the recorded segment can be compared with the audio features of songs in the preset music library; a first song with a similarity greater than a preset confidence threshold can be determined; and based on the first song, the corresponding group of songs in the preset music library for the recorded segment can be obtained. That is, the user's recorded segment for song recognition can be identified using an audio fingerprint method, and high-confidence results can be filtered out to obtain the song corresponding to the user's recorded segment and which segment of the specific song it corresponds to, and then the original song and multiple cover songs corresponding to the corresponding song in the preset music library can be obtained. Figure 4 As shown, the recording segment can be identified by the song recognition system, ignoring low-confidence results, filtering out high-confidence results, and obtaining the corresponding song group for the song corresponding to the high-confidence result.

[0070] 302. By using a time-domain mask to mask the audio frames corresponding to the recorded segments in the same song group, the valid audio segments and invalid audio segments corresponding to the recorded segments can be obtained.

[0071] After obtaining the songs in the same song group, audio frames corresponding to the recorded segments in the same song group can be masked using a temporal mask to obtain the valid and invalid audio segments corresponding to the recorded segments. Specifically, the target audio frame corresponding to the recorded segment in the same song group can be determined; audio frames other than the target audio frame in the same song group are masked using a first temporal mask to obtain the valid audio segment corresponding to the recorded segment. This valid audio segment can be called the positive, i.e., the valid information mask. Specifically, the audio vector of each audio frame in the recorded segment and the audio vector of each audio frame in the same song group can be obtained. By comparing the vector similarity of the audio vectors, the audio frame containing the audio vector with a vector similarity greater than a preset threshold in the same song group is determined. This audio frame is the target audio frame of the same song group corresponding to the recorded segment. The first temporal mask can be a temporal mask vector, where each vector value corresponds to an audio frame. Therefore, in the target audio frame that needs to be masked, the vector value "0" is used to mask the audio features, while in the audio frames of the same song group that do not need to be masked, the vector value "1" is used to preserve the audio features. Masking the audio frames corresponding to the recording segments in the same song group using the temporal mask yields invalid audio segments corresponding to the recording segments. This determines that the recording segment corresponds to the target audio frame of the same song group. Masking the target audio frames of the same song group using the second temporal mask yields invalid audio segments corresponding to the recording segments. These invalid audio segments can be called negatives, i.e., invalid information masks. The second temporal mask can also be a temporal mask vector, where each vector value corresponds to an audio frame. This temporal mask vector is used to mask the audio frames corresponding to the recording segments in the same song group to obtain invalid audio segments corresponding to the recording segments.

[0072] like Figure 7As shown, when training the initial song recognition model, triples can be constructed, where the real samples (Anchors) in the triples are recording segments. Taking the lyric "I hear rain" from song segment A as an example, the actual recording may contain irrelevant noise, recording interruptions, or only half a sentence, etc. However, fingerprint matching in song recognition only requires a very short audio segment to match, so the entire recording segment is used as the training sample for cover song recognition. Based on the songs in the same song group, a temporal mask is used to construct effective audio segments (positive) and ineffective audio segments (negative). The effective audio segments are all sentences in the same song group except "I hear rain" that are masked, and the mask vector is similar to: [00011111000…000], where 1 represents the audio frame containing the lyric "I hear rain" and 0 represents other audio frames. Similarly, the ineffective audio segments are all audio frames other than the lyric "I hear rain" that are masked, and the mask vector is similar to: [11100000111…111]. After temporal masking, only valid information is retained in the effective audio segments, while valid information is removed from the invalid audio segments. Understandably, songs can be randomly selected from the same song group for temporal masking to obtain the corresponding valid and invalid audio segments, which can then be used to train the initial song recognition model.

[0073] 303. Input the recording segment, valid audio segment, and invalid audio segment into the convolutional neural network to obtain the recording audio features, valid audio features, and invalid audio features.

[0074] The initial song recognition model can be a convolutional neural network (CNN), which effectively avoids gradient problems. After obtaining valid and invalid audio segments through temporal masking, the recorded audio segments, valid audio segments, and invalid audio segments can be input into the CNN to obtain recorded audio features, valid audio features, and invalid audio features. Specifically, the audio features of the recorded audio segments, valid audio segments, and invalid audio segments can be input into the CNN to obtain the recorded audio features corresponding to the recorded audio segments, valid audio features corresponding to the valid audio segments, and invalid audio features corresponding to the invalid audio segments output by the CNN. It can be understood that the audio features input to the CNN can be MFCC features, and corresponding MFCC features can be extracted from the recorded audio segments, valid audio segments, and invalid audio segments. The audio features output by the CNN can be audio vectors (embeddings), which can be used to construct a loss function to train the CNN.

[0075] 304. Construct a ternary loss function based on the feature similarity between recorded audio features and valid audio features, and the feature similarity between recorded audio features and invalid audio features.

[0076] After obtaining the valid and invalid audio features output by the initial song recognition model, a ternary loss function can be constructed based on the feature similarity between the recorded audio features and the valid audio features, and the feature similarity between the recorded audio features and the invalid audio features. Specifically, the feature similarity between the recorded audio features and the valid audio features can be subtracted from the feature similarity between the recorded audio features and the invalid audio features to obtain the difference in feature similarity; the ternary loss function is then constructed based on this difference. The ternary loss function can be defined as follows:

[0077] Where d(a,p) represents the feature similarity between the recorded audio features and the valid audio features, d(a,n) represents the feature similarity between the recorded audio features and the invalid audio features, and margin is an adjustable degree coefficient. It can be understood that the feature similarity between the recorded audio features and the invalid audio features can be represented as the cosine distance between the recorded audio vector and the invalid audio vector.

[0078] The training process is an iterative process, such as... Figure 7 As shown, the purpose of iterative training is to make the recorded audio features output by the song recognition model as similar to invalid audio features as possible (i.e., the cosine distance between the recorded audio vector and the invalid audio vector is closer), and to make the recorded audio features output by the song recognition model as dissimilar to invalid audio features as possible (i.e., the cosine distance between the recorded audio vector and the invalid audio vector is farther). Through iterative training, it can be ensured that the song recognition model focuses on the valid audio segments (valid information) in the same song group and filters out invalid audio segments (irrelevant information). It can be understood that the initial training of the song recognition model is an iterative training process. In the loss function constructed in each iteration, the valid and invalid audio features used can be the audio features of the valid and invalid audio segments corresponding to the same song in the same song group.

[0079] 305. Once the loss function converges, the initial song recognition model training is complete, and the song recognition model is obtained.

[0080] It is understandable that step 305 is similar to step 205 above, and will not be described in detail here.

[0081] As can be seen, this application proposes a single-segment cover song recognition method based on a temporal mask. A convolutional neural network combined with a ternary loss function is used for training. First, a song recognition system is used to obtain the corresponding song group from the music library. For the anchor, positive, and negative terms in the ternary loss function, a temporal mask is used to construct the loss function. The anchor represents the actual recording segment, the positive represents the valid audio segment of the corresponding song group, and the negative represents the invalid audio segment of the corresponding song group. The song recognition model learns the relationship between the recording segment and songs containing the recording segment (i.e., valid audio segments) and the difference between songs not containing the recording segment (i.e., invalid audio segments). The trained song recognition model is used to recognize songs. It calculates that even if recording starts at any point in time and pauses or resumes, the song information in the recording segment can be recognized by the song recognition model. This not only reduces computation and improves retrieval efficiency but also ensures information integrity by avoiding segmentation. Building a database for the entire song also prevents information loss and segment information offset.

[0082] This application also provides a song recognition method, such as... Figure 4 As shown, the specific steps are as follows:

[0083] 401. Obtain the target audio segment and target song to be identified.

[0084] In this embodiment, a target audio recording segment and a target song can be acquired. The target audio recording segment can be a manually entered audio segment or an audio segment obtained via a network connection; the specific method is not limited here. The duration of the target audio recording segment is generally shorter than the entire song's duration, typically less than 15 seconds. The target song is generally multiple songs from a preset music library, which can be a music library in an audio player or an online music library; the specific method is not limited here. This embodiment primarily identifies whether the target audio recording segment belongs to a target song, i.e., whether it belongs to a song in the preset music library.

[0085] 402. Input the target recording segment and the target song into the song recognition model to obtain the audio features of the target recording segment and the audio features of the target song output by the song recognition model.

[0086] After obtaining the target recording segment and the target song, they are input into the song recognition model to obtain the audio features of the target recording segment and the target song, respectively, output by the song recognition model. It can be understood that this song recognition model is obtained through the training method described above. After inputting the target song into the song recognition model, the audio vector output by the model is obtained. A database is built using this audio vector to obtain a retrieval database corresponding to the preset music library. This audio vector mainly contains the valid information of the target song; that is, the retrieval database mainly contains the valid information of songs in the preset music library.

[0087] 403. Compare the audio features of the target recording segment with the audio features of the target song.

[0088] After obtaining the audio features of the recording segment and the target song, the audio features of the target recording segment can be compared with the audio features of the target song; specifically, the audio vector of the target recording segment can be compared with the audio vector in the search database, that is, the cosine distance between the audio vectors can be calculated.

[0089] 404. Identify whether the target recording segment belongs to the target song based on the comparison results.

[0090] Based on the comparison results, it can be determined whether the target recording segment belongs to the target song. Specifically, the song with the closest feature similarity in the search database can be taken as the song corresponding to the target recording segment, that is, the result with the closest cosine distance can be taken as the final recognition result.

[0091] This application also provides a training device for a song recognition model, such as... Figure 8 As shown, it includes:

[0092] The acquisition unit 801 is used to acquire a recording segment, a song group corresponding to the recording segment in a preset music library, and an initial song recognition model. The song group indicates that the recording segment corresponds to the original song and the cover song in the preset music library.

[0093] The masking unit 802 is used to mask audio segments outside the recorded segment in the same song group to obtain the valid audio segment corresponding to the recorded segment; and to mask audio segments corresponding to the recorded segment in the same song group to obtain the invalid audio segment corresponding to the recorded segment.

[0094] The input unit 803 is used to input the recording segment, the valid audio segment, and the invalid audio segment into the initial song recognition model to obtain the recording audio features corresponding to the recording segment, the valid audio features corresponding to the valid audio segment, and the invalid audio features corresponding to the invalid audio segment output by the initial song recognition model.

[0095] Construction unit 804 is used to construct a loss function based on the feature similarity between the recorded audio features and the effective audio features, and the feature similarity between the recorded audio features and the invalid audio features;

[0096] The convergence unit 805 is used to determine that the initial song recognition model training is completed and a song recognition model is obtained when the loss function converges. The song recognition model is used to input the recording segment to be recognized and the target song, and to identify whether the recording segment to be recognized belongs to the target song based on the audio features of the recording segment to be recognized and the audio features of the target song.

[0097] This application embodiment also provides a training device 900 for a song recognition model, such as... Figure 9 As shown, the training device 900 for the song recognition model in this application embodiment may include one or more central processing units (CPUs) 901 and a memory 902, wherein the memory 902 stores one or more applications or data.

[0098] The memory 902 can be volatile or persistent storage. The program stored in the memory 902 can include one or more modules, each module including a series of instruction operations on the electronic device. Furthermore, the central processing unit 901 can be configured to communicate with the memory 902 and execute the series of instruction operations in the memory 902 on the training device 900 for the song recognition model.

[0099] The training device 900 for the song recognition model may also include one or more power supplies 905, one or more wired or wireless network interfaces 904, one or more input / output interfaces 903, and / or one or more operating systems, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0100] The central processing unit 901 can perform the operations performed in any of the aforementioned specific method embodiments, which will not be described in detail here.

[0101] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0102] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0103] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0104] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0105] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A training method for a song recognition model, characterized in that, include: Acquire a recording segment, the corresponding group of songs in a preset music library, and an initial song recognition model. The group of songs indicates that the recording segment corresponds to the original song and the cover song in the preset music library. In the same song group, audio segments corresponding to the recording segment but not the recording segment are masked to obtain the valid audio segments corresponding to the recording segment; and in the same song group, audio segments corresponding to the recording segment are masked to obtain the invalid audio segments corresponding to the recording segment. The recording segment, the valid audio segment, and the invalid audio segment are input into the initial song recognition model to obtain the recording audio features corresponding to the recording segment, the valid audio features corresponding to the valid audio segment, and the invalid audio features corresponding to the invalid audio segment output by the initial song recognition model. A loss function is constructed based on the feature similarity between the recorded audio features and the effective audio features, and the feature similarity between the recorded audio features and the invalid audio features; The initial song recognition model is considered complete once the loss function converges, thus obtaining the song recognition model. The song recognition model is used to input a recording segment to be recognized and a target song, and to identify whether the recording segment to be recognized belongs to the target song based on the audio features of the recording segment to be recognized and the audio features of the target song.

2. The training method according to claim 1, characterized in that, The step of obtaining the corresponding song group in the preset music library for the recorded segment includes: The similarity of the audio features of the recorded segment with the audio features of songs in the preset music library is compared. Identify the first song whose similarity is greater than a preset reliability threshold; Based on the first song, obtain the corresponding group of songs in the preset music library for the recorded segment.

3. The training method according to claim 1, characterized in that, The step of filtering out audio segments outside the recorded segment in the same song group to obtain the valid audio segment corresponding to the recorded segment includes: The recording segment is determined to correspond to the target audio frame of the song in the same song group; By using a first time-domain mask to block out audio frames other than the target audio frame in the same song group, the effective audio segment corresponding to the recording segment is obtained.

4. The training method according to claim 1, characterized in that, The step of masking the audio segment corresponding to the recording segment in the same song group to obtain the invalid audio segment corresponding to the recording segment includes: The recording segment is determined to correspond to the target audio frame of the song in the same song group; By masking the target audio frames of the songs in the same song group using a second time-domain mask, the invalid audio segments corresponding to the recording segments are obtained.

5. The training method according to claim 1, characterized in that, The initial song recognition model includes a convolutional neural network; The step of inputting the recording segment, the valid audio segment, and the invalid audio segment into the initial song recognition model to obtain the recording audio features corresponding to the recording segment, the valid audio features corresponding to the valid audio segment, and the invalid audio features corresponding to the invalid audio segment output by the initial song recognition model includes: The audio features of the recorded segment, the audio features of the valid audio segment, and the audio features of the invalid audio segment are input into the convolutional neural network to obtain the audio features of the recorded segment, the valid audio features of the valid audio segment, and the invalid audio features of the invalid audio segment output by the convolutional neural network.

6. The training method according to claim 1, characterized in that, The loss function includes a ternary loss function; The loss function constructed based on the feature similarity between the recorded audio features and the valid audio features, and the feature similarity between the recorded audio features and the invalid audio features includes: The difference in feature similarity is obtained by subtracting the feature similarity between the recorded audio features and the valid audio features from the feature similarity between the recorded audio features and the invalid audio features. A ternary loss function is constructed based on the difference in feature similarity.

7. The training method according to claim 1, characterized in that, The recorded audio features include a recorded audio vector, the valid audio features include a valid audio vector, and the invalid audio features include an invalid audio vector; Feature similarity includes vector cosine distance or vector Euclidean distance.

8. A song recognition method, characterized in that, include: Obtain the target audio segment and the target song to be identified; The target recording segment and the target song are input into the song recognition model trained by the method as described in any one of claims 1 to 7, and the audio features of the target recording segment and the audio features of the target song are output by the song recognition model. The audio features of the target recording segment are compared with the audio features of the target song; Based on the comparison results, it is determined whether the target recording segment belongs to the target song.

9. A training device for a song recognition model, characterized in that, include: Central processing unit, memory, and input / output interfaces; The memory is either a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, Includes instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Audio similarity detection method and device, medium and computing equipment

    CN114464214A

  • Recording fragment identification method, computer equipment and storage medium

    CN116386667A