A model training method, device, equipment and storage medium

By obtaining a set of song fragments without music type tags, using the embedding layer and fully connected layer to extract features and perform clustering, and update the model parameters, it solves the problems of tedious preparation for model training and low recognition accuracy in the existing technology, and achieves Precise music type recognition of song fragments improves the recognition precision and accuracy.

CN112445933BActive Publication Date: 2024-09-06TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011417330.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-07
Publication Date
2024-09-06
Estimated Expiration
2040-12-07

AI Technical Summary

Technical Problem

Existing model training methods require a large amount of manual annotation of music types, resulting in high time costs, and can only identify the music type of the entire song and cannot distinguish different music elements, resulting in insufficient recognition accuracy and accuracy.

Method used

By obtaining a set of song fragments without music type tags, using the embedding layer to extract fragment features, and combining the fully connected layer and clustering algorithm, the model parameters are updated to realize the music type recognition of song fragments, which reduces the preparation work before model training, and Improved recognition precision and accuracy.

Benefits of technology

It simplifies the preparation work before model training, can accurately identify different music type fragments in songs, improves the precision and accuracy of music type recognition, and is suitable for identifying songs with diversified music elements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112445933B
    Figure CN112445933B
Patent Text Reader

Abstract

The present application discloses a model training method, apparatus, device and storage medium. In the scheme, a set of song clips without music type labels is used as training data, so there is no need to label the entire song or song clips with music types, which simplifies the preparation work before model training and reduces the time cost. In addition, the embedding layer in the model that meets the convergence conditions can extract the features to be identified of each song clip in the song to be identified, so the music type corresponding to each song clip can be identified. It can be seen that the present application can accurately identify the music type corresponding to each song clip in the song to be identified, rather than generally identifying the music type of the entire song. Therefore, the present application can distinguish between clips of different music types in a song, improve the recognition precision and accuracy of the song music type, and can be applied to identifying songs with diversified music elements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a model training method, device, equipment and storage medium. Background Art

[0002] Currently, before training the model, it is necessary to label many songs (i.e. manually mark the music genre to which each song belongs) so as to obtain training data with music genre labels. The workload of labeling is large, which leads to complicated preparations before model training and requires a lot of time. In addition, since the training data is marked with the music genre to which each song belongs, the trained model can only identify the music genre to which the entire song belongs, and cannot distinguish between elements of different music genres in the song. Therefore, the current model's recognition accuracy and precision for the music genre of songs needs to be improved. Summary of the invention

[0003] In view of this, the purpose of this application is to provide a model training method, device, equipment and storage medium to improve the recognition accuracy and precision of music types. The specific scheme is as follows:

[0004] To achieve the above objectives, on the one hand, the present application provides a model training method, comprising:

[0005] Obtain a song segment set formed by multiple song segments without music type labels;

[0006] Extracting segment features of each song segment in the song segment set using the embedding layer in the target model to obtain a segment feature set;

[0007] Using the fully connected layer in the target model to classify the segment features in the segment feature set, to obtain a classification result;

[0008] If it is determined that clustering is required, clustering the segment features in the segment feature set using a clustering algorithm to obtain a current clustering result;

[0009] Updating the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model;

[0010] If the updated target model meets the convergence condition, the embedding layer in the updated target model is used to extract the features to be identified of each song segment in the song to be identified.

[0011] On the other hand, the present application also provides a model training device, comprising:

[0012] An acquisition module, used for acquiring a song segment set formed by multiple song segments without music type labels;

[0013] An extraction module, used for extracting the segment features of each song segment in the song segment set by using the embedding layer in the target model to obtain a segment feature set;

[0014] A classification module, used to classify the segment features in the segment feature set using the fully connected layer in the target model to obtain a classification result;

[0015] A clustering module, for clustering the segment features in the segment feature set using a clustering algorithm to obtain a current clustering result if clustering is determined to be required;

[0016] An updating module, used for updating the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model;

[0017] The application module is used to extract the to-be-recognized features of each song segment in the to-be-recognized song by using the embedding layer in the updated target model if the updated target model meets the convergence condition.

[0018] On the other hand, the present application also provides an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the aforementioned model training method.

[0019] On the other hand, the present application also provides a storage medium, which stores computer-executable instructions. When the computer-executable instructions are loaded and executed by a processor, the aforementioned model training method is implemented.

[0020] This application uses a set of song clips without music type labels as training data, so there is no need to label the entire song or song clips with music types, which simplifies the preparation work before model training and reduces time costs. In addition, the embedding layer in the model that meets the convergence conditions can extract the features to be identified of each song clip in the song to be identified, and then the music type corresponding to the features to be identified can be identified. It can be seen that the present application can accurately identify the music type corresponding to each song clip in the song to be identified, rather than generally identifying the music type of the entire song. Therefore, the present application can distinguish between clips of different music types in a song, improve the recognition precision and accuracy of the song music type, and can be applied to identifying songs with diversified music elements.

[0021] Correspondingly, the model training device, equipment and storage medium provided by this application also have the above-mentioned technical effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0023] Figure 1 A schematic diagram of a physical architecture applicable to the present application provided for the present application;

[0024] Figure 2 A flow chart of the first model training method provided for this application;

[0025] Figure 3 A flow chart of the second model training method provided for this application;

[0026] Figure 4 A flow chart of the third model training method provided for this application;

[0027] Figure 5 A flow chart of a music similarity identification method provided in this application;

[0028] Figure 6 A schematic diagram of model training provided for this application;

[0029] Figure 7 A schematic diagram of a model training device provided in this application;

[0030] Figure 8 A server structure diagram provided for this application;

[0031] Fig. 9 A terminal structure diagram provided for this application. DETAILED DESCRIPTION

[0032] At present, the preparation work before model training is complicated and time-consuming. In addition, the current model training model can only recognize the entire song and cannot distinguish the different musical elements in the song, so the recognition accuracy and precision of the music type need to be improved.

[0033] In view of the above-mentioned problems currently existing, this application proposes a model training scheme, which simplifies the preparation work before model training, reduces the time cost, and can accurately identify the type of a song segment in a song, rather than generally identifying the type of the entire song. Therefore, it improves the recognition accuracy and precision of music types, and can be used to identify songs with diversified musical elements.

[0034] For ease of understanding, the physical framework to which this application applies is first introduced.

[0035] It should be understood that the model training method provided in this application can be applied to a system or program with the recognition function. Specifically, the system or program with the recognition function can be run in a server, a personal computer, or other device.

[0036] like Figure 1 As shown, Figure 1 This is a schematic diagram of the physical architecture applicable to this application. Figure 1 In the invention, a system or program with the recognition function can be run on a server, which obtains a song segment set formed by multiple song segments without music type labels from other terminal devices through a network, and then uses the embedding layer in the target model to extract the segment features of each song segment in the song segment set to obtain a segment feature set; uses the fully connected layer in the target model to classify the segment features in the segment feature set to obtain a classification result; if it is determined that clustering is required, uses a clustering algorithm to cluster the segment features in the segment feature set to obtain the current clustering result; updates the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model; if the updated target model meets the convergence condition, uses the embedding layer in the updated target model to extract the features to be identified of each song segment in the song to be identified, so that the music type corresponding to each song segment can be identified.

[0037] like Figure 1 It can be seen that the server can establish communication connections with multiple devices, and the server obtains any song corresponding to the song segment set, the song to be identified, etc. from these devices. Of course, the above song segment set can also be stored in the form of a database. The server collects the data uploaded by these devices and trains the relevant model to obtain a model that meets the convergence conditions. Figure 1 A variety of terminal devices are shown in FIG. In actual scenarios, more or fewer types of terminal devices may participate in the model training process. The specific number and type depend on the actual scenario and are not limited here. In addition, Figure 1 One server is shown in FIG. 1 , but in actual scenarios, multiple servers may be involved, and the specific number of servers depends on the actual scenario. The recognition classifier may also be obtained by training based on the server.

[0038] It should be noted that the model training method provided in this embodiment can be performed offline, that is, the server locally stores a set of song clips and songs to be identified, and it can directly identify the music type of each clip in the song according to this application. In addition, if a model that meets the convergence conditions is obtained, the model can be used to identify the music type of a clip in any song without training the model again. Music types include: pop music, rock music, hip-hop music, techno, R&B music (Rhythm Blues), reggae music (ReggaeMusic), classical music (Classical), etc.

[0039] It is understandable that the above-mentioned system or program with model training can also be run on a personal mobile terminal or as a cloud service program. The specific operation mode depends on the actual scenario and is not limited here.

[0040] Combined with the above commonalities, please see Figure 2 , Figure 2 The first model training method flow chart provided in the embodiment of the present application. Figure 2 As shown, the model training method may include the following steps:

[0041] S201, obtaining a song segment set formed by multiple song segments without music type tags.

[0042] It should be noted that the song clip set includes song clips of different songs. Among them, a song can be divided to obtain at least one song clip. If a song is divided to obtain multiple song clips, different song clips may overlap or not overlap (generally set to not overlap); the lengths of different song clips may be equal or unequal (generally set to be equal for the convenience of model training). The length of the song clip can be set to any length, such as: 10s.

[0043] S202. Extract the segment features of each song segment in the song segment set by using the embedding layer in the target model to obtain a segment feature set.

[0044] The target model includes: an embedding layer and a fully connected layer. The embedding layer can extract the segment features of each song segment in the song segment set, that is, convert each song segment in the song segment set into a corresponding segment feature, and the fully connected layer can classify all segment features in the segment feature set to obtain a classification result. The fully connected layer can be regarded as a classifier.

[0045] S203. Use the fully connected layer in the target model to classify the fragment features in the fragment feature set to obtain a classification result.

[0046] S204: If it is determined that clustering is required, clustering the segment features in the segment feature set is performed using a clustering algorithm to obtain a current clustering result.

[0047] The clustering result is obtained by clustering the song clips in the song clip set. The clustering result is the reference target of the classification result output by the fully connected layer, that is, the standard value. The fully connected layer wants its own classification result to keep approaching the clustering result.

[0048] The specific implementation of clustering can adopt any clustering algorithm, such as: DBSCAN algorithm, k-means clustering algorithm or Gaussian mixture model algorithm, etc. However, the specific object of clustering can be flexibly selected, please refer to the following introduction for details.

[0049] In a specific implementation, it can be considered that all song segments in the same song belong to the same type (in fact, different song segments in the same song may belong to different types), so the clustering object can be: each feature in the song feature subset corresponding to each song. The song feature subset is such as: the features corresponding to all song segments in song A, one song segment corresponds to one feature. In a specific implementation, it can be considered that different song segments in the same song belong to different types, so the clustering object can be: each feature in the song feature subset corresponding to each song.

[0050] It can be seen that whether it is considered that all song segments in the same song belong to the same type, or that different song segments in the same song belong to different types, all song segments in a song can be clustered separately. Therefore, the segment features in the segment feature set are clustered using a clustering algorithm to obtain the current clustering result, including: dividing the segment feature set into multiple song feature subsets according to different songs; clustering the segment features in the multiple song feature subsets respectively to obtain the second clustering sub-result corresponding to each song feature subset, and determining all the second clustering sub-results as the clustering result. Assuming that the song segment set is obtained by dividing the segments of 5 songs, then the song segment set corresponds to 5 songs, and there are 5 song feature subsets. Clustering each feature in these 5 song feature subsets can obtain 5 second clustering sub-results. Each second clustering sub-result includes multiple clusters. This method can take into account segments of different music types in the same song to improve training precision and accuracy.

[0051] In a specific implementation, whether it is considered that all song segments in the same song belong to the same type, or that different song segments in the same song belong to different types, the similarity between different songs can be considered at the same time, so the clustering object can be: all song segments included in several similar songs. Therefore, the segment features in the segment feature set are clustered using a clustering algorithm to obtain the current clustering result, including: dividing the segment feature set into multiple similar feature subsets according to the similarity between different songs; clustering the segment features in multiple similar feature subsets respectively to obtain the first clustering sub-result corresponding to each similar feature subset, and determining all the first clustering sub-results as the clustering result. Assuming that the song segment set is obtained by dividing the segments of 5 songs, then the song segment set corresponds to 5 songs, and the features of these 5 songs are classified by similarity. Assuming that 3 similar feature subsets are obtained, then each feature in these 3 similar feature subsets is further clustered to obtain 3 first clustering sub-results. Each first clustering sub-result includes multiple clusters. This method can consider segments of different music types in the same song and the similarity of different songs, thereby improving the training precision and accuracy.

[0052] The segment feature set is divided into multiple similar feature subsets according to the similarity between different songs, including: extracting a first feature group corresponding to the first song and a second feature group corresponding to the second song from the segment feature set; the first song and the second song are any two songs in the respective songs corresponding to the segment feature set; determining the group similarity of the first feature group and the second feature group, and if the group similarity is greater than a preset threshold, the first feature group and the second feature group are divided into the same similar feature subset; otherwise, the first feature group and the second feature group are divided into different similar feature subsets. Similarity can be calculated using cosine angle or Euclidean distance.

[0053] Wherein, determining the group similarity of the first feature group and the second feature group includes: calculating the first average feature value of all features in the first feature group, and the second average feature value of all features in the second feature group; calculating the feature similarity of the first average feature value and the second average feature value, and determining the feature similarity as the group similarity. Wherein, the first average feature value of all features in the first feature group is: the average value of all features in the first feature group. Correspondingly, the second average feature value of all features in the second feature group is: the average value of all features in the second feature group. The embedding layer outputs the features corresponding to each song clip.

[0054] If the first song is A, and A is divided into 3 song segments: A1, A2, and A3, then the first feature group includes 3 features, and these 3 features correspond to A1, A2, and A3 respectively. If the second song is B, and B is divided into 5 song segments: B1, B2, B3, B4, and B5, then the second feature group includes 5 features, and these 5 features correspond to B1, B2, B3, B4, and B5 respectively. The similarity between the first song and the second song is the group similarity of the first feature group and the second feature group. The group similarity of the first feature group and the second feature group can be calculated according to the following process: calculate the average value X of A1, A2, and A3 = (A1+A2+A3) / 3, calculate the average value Y of B1, B2, B3, B4, and B5 = (B1+B2+B3+B4+B5) / 5, then the similarity between X and Y can be used as the group similarity. Among them, the features corresponding to the song clip can be the output results of the embedding layer in the target model, that is, a song clip is input into the embedding layer in the target model, and the corresponding features can be output.

[0055] S205. Update the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model.

[0056] In a specific implementation, the model parameters of the target model are updated according to the loss values ​​of the classification results and the clustering results to obtain an updated target model, including: calculating the loss values ​​of the classification results and the clustering results using the target loss function; optimizing the embedding layer parameters and the fully connected layer parameters in the target model according to the loss values ​​to obtain an updated target model.

[0057] The target model includes: an embedding layer and a fully connected layer; the model parameters include: embedding layer parameters and fully connected layer parameters. The embedding layer parameters are the relevant parameters of the embedding layer. The fully connected layer parameters are the relevant parameters of the fully connected layer. Updating the model parameters of the target model is essentially: updating the embedding layer parameters and the fully connected layer parameters, so that the embedding layer continuously learns the ability to convert song clips into corresponding features, and the fully connected layer continuously learns the ability to classify all features.

[0058] Among them, the target loss function can be a multi-classification loss function, a cross entropy loss function, a noise contrast estimation function or a contrast loss function. The specific calculation process of each function can refer to the existing related technology, and this specification will not be repeated here.

[0059] S206: If the updated target model meets the convergence condition, the embedding layer in the updated target model is used to extract the features to be identified of each song segment in the song to be identified.

[0060] In a specific embodiment, after using the embedding layer in the updated target model to extract the features to be identified of each song segment in the song to be identified, it also includes: using a k-nearest neighbor algorithm, a neural network algorithm, a support vector machine or a random forest algorithm, combined with a small number of song segments of known genres to train a recognition classifier; inputting the features to be identified into the recognition classifier to output the music type of each song segment in the song to be identified.

[0061] Among them, the specific process of using the recognition classifier to identify the feature to be identified includes: inputting the feature to be identified into the recognition classifier, and the recognition classifier can determine the song clip of the known music type that is closest to the feature to be identified. At this time, it is considered that the song clip of the closest known music type belongs to the same music type as the feature to be identified, so the music type of the feature to be identified can be determined.

[0062] This embodiment uses song clips without music type labels as training data, realizes unsupervised machine learning of unlabeled data, and adaptively learns recognition capabilities during the learning process. Updating the model parameters of the target model is to perform an iterative training on the target model. For details, please refer to the existing model training process.

[0063] It can be seen that this embodiment uses a set of song clips without music type labels as training data, so there is no need to label the entire song or song clips with music type, which simplifies the preparation work before model training and reduces time cost. In addition, the embedding layer in the model that meets the convergence conditions can convert each song clip in the song to be identified into a corresponding feature to be identified, and then the recognition classifier can be used to identify the music type corresponding to the feature to be identified. It can be seen that the present application can accurately identify the music type corresponding to each song clip in the song to be identified, rather than generally identifying the music type of the entire song. Therefore, the present application can distinguish between clips of different music types in a song, improve the recognition precision and accuracy of the song music type, and can be applied to identifying songs with diversified music elements.

[0064] See also Figure 3 , Figure 3 The second model training method flow chart provided in the embodiment of the present application. Figure 3 As shown, the model training method may include the following steps:

[0065] S301, obtaining a song segment set formed by multiple song segments without music type tags;

[0066] S302, extracting the segment features of each song segment in the song segment set by using the embedding layer in the target model to obtain a segment feature set;

[0067] S303, using the fully connected layer in the target model to classify the fragment features in the fragment feature set to obtain a classification result;

[0068] S304, determine whether the clustering algorithm execution cycle reaches the threshold; if so, perform the clustering operation, that is, execute S305; if not, do not perform clustering, that is, execute S308;

[0069] S305, clustering the fragment features in the fragment feature set using a clustering algorithm to obtain a current clustering result;

[0070] S306, updating the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model;

[0071] S307, if the updated target model meets the convergence condition, then using the embedding layer in the updated target model to extract the features to be identified of each song segment in the song to be identified;

[0072] S308, determine whether there is a historical clustering result; if so, execute S309; ​​if not, execute S310;

[0073] S309, updating the model parameters of the target model according to the loss values ​​of the classification results and the historical clustering results, obtaining an updated target model, and executing S307;

[0074] S310. Update the model parameters of the target model according to the classification result and the loss value of the category label to obtain an updated target model, replace the target model with the updated target model, and execute S302.

[0075] In this embodiment, different song segments in the song segment set that belong to the same song are marked with different or the same category tags. The category tags are only used to mark which song segments belong to the same music type and which song segments do not belong to the same music type, and the specific music type of each category tag is still unknown.

[0076] In this embodiment, the clustering results change in time, and the reference target of the model training also changes in time.

[0077] Specifically, the clustering results change according to the improvement of the model's capabilities. First, let the model's embedding layer process the song clip set to convert all song clips into corresponding features, and then use the clustering algorithm to cluster these features. Among them, since the conversion ability of the embedding layer in the model will continue to improve during the update process, the accuracy of these features to be processed by the clustering algorithm will continue to improve, so the accuracy of the clustering results will also increase accordingly. In this way, the accuracy of the reference target of model training will increase according to the improvement of model capabilities.

[0078] The clustering algorithm execution cycle can be preset according to the iteration cycle or time cycle. For example, if the clustering algorithm execution cycle is 5, then if each iteration is trained five times, it is considered that the clustering algorithm execution cycle has reached the threshold. The clustering algorithm execution cycle can also be set to 20 seconds, then if each iteration is trained for 20 seconds, it is considered that the clustering algorithm execution cycle has reached the threshold.

[0079] Of course, clustering can also be performed once per iteration. However, it should be noted that since the embedding layer of the initialized target model is not capable of extracting features, clustering is not performed in the first iteration of training, and clustering is started again in the second iteration. Then in the first iteration, the model parameters of the target model are updated based on the classification results and the loss value of the category label. Based on the category label, each song segment in the song segment set can be divided into different categories. Therefore, it can be considered that the song segment set is initialized with corresponding categories, but the specific music type of each category is unknown. Although the category label is not accurate enough, its accuracy is generally greater than that of the initialized embedding layer of the target model. Therefore, in the first iteration, the model parameters are updated based on the category label.

[0080] Of course, we can also ignore the inadequacy of the embedding layer of the initialized target model and perform clustering in the first iteration of training. Because the update of model parameters will gradually improve the model's capabilities, the error of the first iteration of training can be temporarily ignored.

[0081] During the model training process, the convergence conditions can refer to the relevant conditions in the existing model training process. The convergence conditions can specifically be: the loss value of the classification result and the clustering result is less than a preset threshold, or the change of the loss value is less than a certain threshold.

[0082] The specific implementation process of other steps in this embodiment can refer to the corresponding contents disclosed in other embodiments, which will not be repeated here.

[0083] It can be seen that this embodiment can accurately identify the music type corresponding to each song segment in the song to be identified, rather than generally identifying the music type of the entire song. Therefore, the present application can distinguish segments of different music types in a song, thereby improving the recognition accuracy and precision of the song music type, and can be used to identify songs with diversified music elements.

[0084] See also Figure 4 , Figure 4 The third model training method flow chart provided in the embodiment of the present application. Figure 4 As shown, the model training method may include the following steps:

[0085] S401, obtaining a song segment set formed by multiple song segments without music type tags;

[0086] S402, extracting the segment features of each song segment in the song segment set by using the embedding layer in the target model to obtain a segment feature set;

[0087] S403, using the fully connected layer in the target model to classify the fragment features in the fragment feature set to obtain a classification result;

[0088] S404: If it is determined that clustering is required, clustering the segment features in the segment feature set using a clustering algorithm to obtain a current clustering result;

[0089] S405, updating the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model;

[0090] S406, judging whether the difference between the current clustering result and the historical clustering result meets the preset requirements; if so, executing S407; if not, executing S409;

[0091] S407, updating the number of times that meets the preset requirements;

[0092] S408, determining whether the number of times the preset requirements are met is less than a preset threshold; if so, executing S409; if not, executing S410;

[0093] S409, determining that the updated target model does not meet the convergence condition, replacing the target model with the updated target model, replacing the historical clustering results with the current clustering results, and executing S402;

[0094] S410, determining that the updated target model meets the convergence condition, and using the embedding layer in the updated target model to extract the features to be identified of each song segment in the song to be identified.

[0095] In this embodiment, although the update of the model parameters is based on the classification result and the loss value of the current clustering result, this loss value is not used to determine whether the model has converged. Among them, the condition for model convergence is: the difference between the current clustering result and the historical clustering result meets the preset requirements (the smaller the difference, the better), and the number of times the preset requirements are met is not less than the preset threshold. For example: if the clustering results are the same for three consecutive times, then it is considered that the model meets the convergence conditions.

[0096] The specific implementation process of other steps in this embodiment can refer to the corresponding contents disclosed in other embodiments, which will not be repeated here.

[0097] It can be seen that this embodiment can accurately identify the music type corresponding to each song segment in the song to be identified, rather than generally identifying the music type of the entire song. Therefore, the present application can distinguish segments of different music types in a song, thereby improving the recognition accuracy and precision of the song music type, and can be used to identify songs with diversified music elements.

[0098] The following describes the model training scheme provided by this application through a specific application scenario example.

[0099] See also Figure 5 , Figure 5 A flow chart of a music type identification method provided in an embodiment of the present application. Figure 5 As shown, the music type identification method may include the following steps:

[0100] S501, the terminal uploads songs to the server;

[0101] S502: The server obtains the embedding layer in the trained model;

[0102] S503, the server converts each song segment in the song into corresponding features using the embedding layer;

[0103] S504, the server uses a recognition classifier to identify the music type corresponding to each feature;

[0104] S505, the server sends the music type corresponding to each feature to the terminal;

[0105] S506: The terminal displays the music type corresponding to each feature.

[0106] Specifically, a song recommendation platform can be deployed on the server, and the platform can recommend or classify related songs based on the song recognition results.

[0107] The model can be trained in any of the following three ways.

[0108] Method 1: Use a top-down adaptive unsupervised training scheme.

[0109] Specifically, suppose the training data contains N songs, where song i contains Si segments. At the beginning of training, each different song is set to a different category, and different segments of the same song are set to the same category (in fact, different song segments in the same song may belong to different categories, this setting is the initialization assumption before clustering), that is, each song contains Li = 1 category, and a multi-classification problem with N categories is constructed.

[0110] The training data is input into the model in sequence (the model consists of two parts: a deep neural network and a fully connected layer) to output the training results. Among them, the output result of the deep neural network (that is, the embedding layer mentioned above) is not only used as the input of the fully connected layer, but also as the input of the clustering algorithm, so that the training data and clustering results can be obtained. After clustering, each cluster in the clustering result corresponds to a category, but because it is an unsupervised training process, the type of music corresponding to each cluster is unknown, then each song segment in song i corresponds to Li categories (1<=Li<=Si). Afterwards, the loss function can be used to calculate the loss value of the training results and clustering results, so as to update the model parameters of the model according to the loss value, so that it can be iterated again to iteratively update the model. Thereafter, the model is adaptively adjusted to a number of categories of ∑ i L i Multi-class training.

[0111] Among them, clustering operation is not required in every iteration process. Repeated clustering conditions can be set (such as clustering once every 10 epochs), so the clustering process can be repeated at a specific period in the training process. Among them, since the input of the clustering algorithm is the output result of the deep neural network, the input of each clustering will change (because the model parameters of the deep neural network are constantly optimized with the model update, the deep neural network's processing ability for the input will continue to improve, so for the same input, it may output results of different accuracy), so the clustering results will also change accordingly, thus realizing the adaptive adjustment of the training strategy.

[0112] Since the number of categories contained in each song i during this training process is split from one category to multiple categories, it is called a top-down training scheme. Figure 6 , the scheme can be implemented as follows:

[0113] Step 1: Select the embedding layer and classification layer, and use them to build the model to be trained;

[0114] Step 2: Select different segments from a large number of songs as training data, denoted as (x i,j ,y i,j ). Where i represents the song index, j represents the segment index, and x i,j Indicates a song clip, y i,j Indicates the category corresponding to the song clip, y i,j It will be changed adaptively during the training process. Here, the number of different segments of a song can be one or more; they can overlap or not overlap each other; they can be of any fixed length, and can also be changed during the training process. In order to realize the recognition of short song segments, the song segments can be set to 10s non-overlapping segments.

[0115] Step 3: Set each song as an independent category, and different segments of the same song belong to the same category, that is, y i,j and i,k They represent different segments of the same song.

[0116] Step 4: Input the training data into the model to be trained, cluster the training data to obtain the clustering results, and use the multi-classification loss function to calculate the loss value.

[0117] Step 5: After training for a period of time, use the output of the embedding layer in the model to cluster the training data again to obtain new clustering results. Each song may have at least one cluster, that is, at least one category. In other words, for song i, Make y i,j ≠y i,k , that is: y in song i i,j and i,k belong to the same category; or, for song i, Make y i,j =y i,k , that is: y in song i i,j and i,k Belong to different categories.

[0118] Step 6: If the model converges, the song to be identified is input into the embedding layer of the current model to output the features to be identified corresponding to each song segment in the song; at the same time, some song segments of known music types are also input into the embedding layer of the current model to output the features of the known music types; then the features to be identified and the features of these known music types are processed using the k-nearest neighbor algorithm, neural network algorithm, support vector machine or random forest algorithm to determine the music type corresponding to the features to be identified.

[0119] Among them, the classifier can be pre-trained using the k-nearest neighbor algorithm, neural network algorithm, support vector machine or random forest algorithm, and then the features to be identified and the features of known music types are input into the classifier to output the music type corresponding to the features to be identified.

[0120] Method 2: Use a bottom-up adaptive unsupervised training scheme.

[0121] Specifically, suppose the training data contains N songs, where song i contains Si segments. At the beginning of training, different segments of each song are set to different categories (of course, different segments of a song may also belong to the same category, this setting is the initialization assumption before clustering), that is, song i contains Li = Si categories, and the number of categories is ∑ i S i =P multi-classification problem.

[0122] The training data is input into the model in sequence (the model includes two parts: a deep neural network and a fully connected layer), and the first training result is output. Among them, the output result of the deep neural network (that is, the embedding layer mentioned above) is not only used as the input of the fully connected layer, but also as the input of the clustering algorithm, so that the first clustering result of the training data can be obtained. After clustering, each cluster in the clustering result corresponds to a category, but because it is an unsupervised training process, the type of music corresponding to each cluster is unknown, then each song segment in song i corresponds to Li categories (1<=Li<=Si). Afterwards, the loss function can be used to calculate the loss value of the first training result and the first clustering result, so as to update the model parameters of the model according to the loss value, so that it can be iterated again to iteratively update the model. Thereafter, the model is adaptively adjusted to a number of categories of ∑ i L i Multi-class training.

[0123] Since the number of categories contained in song i decreases from Li=Si during this training process, that is, multiple categories are aggregated into a small number of categories, it is called a bottom-up training scheme. The specific implementation steps of this scheme can refer to the top-down training scheme, and this manual will not go into details here.

[0124] Method 3: Classify the training data by similarity first, and then cluster each class in the classification result. The model training process and the process of using the model to identify the music type can refer to the above two methods, which will not be repeated here.

[0125] Specifically, before clustering, the feature average of all song segments in each song is calculated as the song feature value of the song. The similarity of the feature values ​​of different songs is calculated, and songs with similarity greater than a preset threshold are connected. Finally, the different song segments in the connected songs are clustered, and each cluster corresponds to a category. This method can reduce the complexity of clustering.

[0126] Among them, similarity can be calculated using cosine angle, Euclidean distance, etc.

[0127] The trained model can identify the music genres to which different segments in any song belong, so as to recommend songs that the user likes to the user. This solution can be implemented based on a central processing unit (CPU) and a graphics processing unit (GPU). This embodiment can find similar segments in two songs of different music genres, as well as different segments in two songs of the same music genre. At the same time, the process of manually labeling music genres is omitted, saving the cost of collecting training data.

[0128] See also Figure 7 , Figure 7 A schematic diagram of a model training device provided in an embodiment of the present application includes:

[0129] An acquisition module 701 is used to acquire a song segment set formed by multiple song segments without music type tags;

[0130] An extraction module 702, configured to extract segment features of each song segment in the song segment set by using an embedding layer in a target model to obtain a segment feature set;

[0131] A classification module 703 is used to classify the segment features in the segment feature set using the fully connected layer in the target model to obtain a classification result;

[0132] A clustering module 704 is used to cluster the segment features in the segment feature set using a clustering algorithm to obtain a current clustering result if clustering is determined to be required;

[0133] An updating module 705 is used to update the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model;

[0134] The application module 706 is used to extract the to-be-recognized features of each song segment in the to-be-recognized song by using the embedding layer in the updated target model if the updated target model meets the convergence condition.

[0135] In a specific embodiment, it also includes:

[0136] The clustering algorithm execution cycle judgment module is used to judge whether the clustering algorithm execution cycle reaches a threshold; if the clustering algorithm execution cycle reaches the threshold, the clustering operation is performed; if the clustering algorithm execution cycle does not reach the threshold, no clustering is performed.

[0137] In a specific embodiment, it also includes:

[0138] The clustering result judgment module is used to update the model parameters of the target model according to the classification result and the loss value of the historical clustering result if it is determined that there is a historical clustering result, so as to obtain an updated target model.

[0139] In a specific implementation, the clustering result judgment module is also used to:

[0140] If it is determined that there is no historical clustering result, the model parameters of the target model are updated according to the classification result and the loss value of the category label to obtain an updated target model, the target model is replaced by the updated target model, and the model training is repeated; wherein different song clips in the song clip set belonging to the same song are marked with different or the same category labels.

[0141] In a specific embodiment, it also includes:

[0142] The model convergence judgment module is used to update the number of times that meet the preset requirements if it is determined that the difference between the current clustering result and the historical clustering result meets the preset requirements. If the number is not less than the preset threshold, it is determined that the updated target model meets the convergence conditions.

[0143] In a specific implementation, the model convergence judgment module is also used to:

[0144] If it is determined that the difference does not meet the preset requirements, or the number of times is less than the preset threshold, it is determined that the updated target model does not meet the convergence conditions, the target model is replaced with the updated target model, the historical clustering results are replaced with the current clustering results, and the model training is repeated.

[0145] In a specific implementation, the update module includes:

[0146] A calculation unit, used to calculate the loss value of the classification result and the clustering result using the target loss function;

[0147] The optimization unit is used to optimize the embedding layer parameters and the fully connected layer parameters in the target model according to the loss value to obtain an updated target model.

[0148] In a specific implementation, the clustering module includes:

[0149] A first division unit is used to divide the segment feature set into a plurality of similar feature subsets according to the similarities between different songs;

[0150] The first clustering unit is used to cluster the segment features in the multiple similar feature subsets respectively to obtain the first clustering sub-result corresponding to each similar feature subset, and determine all the first clustering sub-results as the current clustering result.

[0151] In a specific implementation, the first division unit includes:

[0152] An extraction subunit, used to extract a first feature group corresponding to a first song and a second feature group corresponding to a second song from a segment feature set; the first song and the second song are any two songs corresponding to the segment feature set;

[0153] The division subunit is used to determine the group similarity between the first feature group and the second feature group. If the group similarity is greater than a preset threshold, the first feature group and the second feature group are divided into the same similar feature subset; otherwise, the first feature group and the second feature group are divided into different similar feature subsets.

[0154] In a specific implementation, the division subunit is specifically used for:

[0155] A first average feature value of all features in the first feature group and a second average feature value of all features in the second feature group are calculated; feature similarity of the first average feature value and the second average feature value is calculated, and the feature similarity is determined as group similarity.

[0156] In a specific implementation, the clustering module includes:

[0157] A second division unit is used to divide the segment feature set into a plurality of song feature subsets according to different songs;

[0158] The second clustering unit is used to cluster the segment features in the plurality of song feature subsets respectively to obtain a second clustering sub-result corresponding to each song feature subset, and determine all the second clustering sub-results as the current clustering result.

[0159] In a specific embodiment, it also includes:

[0160] The recognition module is used to train a recognition classifier using a k-nearest neighbor algorithm, a neural network algorithm, a support vector machine or a random forest algorithm; input the features to be recognized into the recognition classifier to output the music type of each song segment in the song to be recognized.

[0161] Among them, for more specific working processes of each module and unit in this embodiment, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0162] It can be seen that the present embodiment provides a model training device, which can accurately identify the music type corresponding to each song segment in the song to be identified, rather than generally identifying the music type of the entire song. Therefore, the present application can distinguish segments of different music types in a song, thereby improving the recognition accuracy and precision of the song music type, and can be used to identify songs with diversified music elements.

[0163] Furthermore, the present application also provides an electronic device. The electronic device can be Figure 8 The server 50 shown may also be Fig. 9 Terminal 60 is shown. Figure 8 and Fig. 9 All of them are structural diagrams of electronic devices according to an exemplary embodiment, and the contents in the diagrams cannot be regarded as any limitation on the scope of use of the present application.

[0164] Figure 8A schematic diagram of the structure of a server provided in an embodiment of the present application. The server 50 may specifically include: at least one processor 51, at least one memory 52, a power supply 53, a communication interface 54, an input / output interface 55, and a communication bus 56. The memory 52 is used to store a computer program, which is loaded and executed by the processor 51 to implement the relevant steps in the model training disclosed in any of the aforementioned embodiments.

[0165] In this embodiment, the power supply 53 is used to provide working voltage for each hardware device on the server 50; the communication interface 54 can create a data transmission channel between the server 50 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 55 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0166] In addition, the memory 52, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 521, a computer program 522 and data 523, etc. The storage method can be temporary storage or permanent storage.

[0167] Among them, the operating system 521 is used to manage and control the hardware devices and computer programs 522 on the server 50 to realize the operation and processing of the data 523 in the memory 52 by the processor 51, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the model training method disclosed in any of the aforementioned embodiments, the computer program 522 can further include a computer program that can be used to complete other specific tasks. In addition to data such as a song clip collection, the data 523 can also include data such as the developer information of the application.

[0168] Fig. 9 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. The terminal 60 may specifically include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.

[0169] Generally, the terminal 60 in this embodiment includes: a processor 61 and a memory 62 .

[0170] Among them, the processor 61 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 61 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 61 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 61 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, the processor 61 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0171] The memory 62 may include one or more computer-readable storage media, which may be non-transitory. The memory 62 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 this embodiment, the memory 62 is at least used to store the following computer program 621, wherein, after the computer program is loaded and executed by the processor 61, it can implement the relevant steps in the model training method performed by the terminal side disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 62 may also include an operating system 622 and data 623, etc., and the storage method may be short-term storage or permanent storage. Among them, the operating system 622 may include Windows, Unix, Linux, etc. Data 623 may include, but is not limited to, song information.

[0172] In some embodiments, the terminal 60 may further include a display screen 63 , an input / output interface 64 , a communication interface 65 , a sensor 66 , a power supply 67 , and a communication bus 68 .

[0173] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the terminal 60, and the terminal 60 may include more or less components than those shown in the figure.

[0174] Furthermore, the embodiment of the present application also discloses a storage medium, in which computer executable instructions are stored, and when the computer executable instructions are loaded and executed by the processor, the model training method disclosed in any of the above embodiments is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.

[0175] It should be pointed out that the above is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

[0176] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0177] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A model training method, characterized in that: include: Obtain a song segment set formed by multiple song segments without music type labels; Extracting segment features of each song segment in the song segment set using the embedding layer in the target model to obtain a segment feature set; Using the fully connected layer in the target model to classify the segment features in the segment feature set, to obtain a classification result; If it is determined that clustering is required, clustering the segment features in the segment feature set using a clustering algorithm to obtain a current clustering result; Updating the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model; If the updated target model meets the convergence condition, the embedding layer in the updated target model is used to extract the features to be identified of each song segment in the song to be identified.

2. The model training method according to claim 1, characterized in that: The determining that clustering is required includes: Determine whether the clustering algorithm execution cycle reaches the threshold; If the clustering algorithm execution cycle reaches the threshold, the clustering operation is performed; If the clustering algorithm execution cycle does not reach the threshold, no clustering is performed.

3. The model training method according to claim 2, characterized in that: After determining that clustering is not required, the method further includes: If it is determined that there are historical clustering results, the model parameters of the target model are updated according to the classification results and the loss values ​​of the historical clustering results to obtain an updated target model.

4. The model training method according to claim 3, characterized in that: Also includes: If it is determined that the historical clustering result does not exist, updating the model parameters of the target model according to the classification result and the loss value of the category label to obtain an updated target model, replacing the target model with the updated target model, and performing model training in a loop; Different song segments in the song segment set that belong to the same song are marked with different or same category labels.

5. The model training method according to claim 1, characterized in that: The updated target model meets the convergence conditions, including: If it is determined that the difference between the current clustering result and the historical clustering result meets the preset requirement, the number of times that the preset requirement is met is updated. If the number is not less than a preset threshold, it is determined that the updated target model meets the convergence condition.

6. The model training method according to claim 5, characterized in that: Also includes: If it is determined that the difference does not meet the preset requirement, or the number is less than the preset threshold, it is determined that the updated target model does not meet the convergence condition, the target model is replaced by the updated target model, the historical clustering result is replaced by the current clustering result, and the model training is repeated.

7. The model training method according to claim 1, characterized in that: The updating of the model parameters of the target model according to the loss value of the classification result and the current clustering result to obtain an updated target model includes: Calculating the loss value of the classification result and the current clustering result using the target loss function; The embedding layer parameters and the fully connected layer parameters in the target model are optimized respectively according to the loss value to obtain the updated target model.

8. The model training method according to claim 1, characterized in that: The clustering algorithm is used to cluster the segment features in the segment feature set to obtain a current clustering result, including: Dividing the segment feature set into a plurality of similar feature subsets according to similarities between different songs; The segment features in the multiple similar feature subsets are clustered respectively to obtain a first clustering sub-result corresponding to each similar feature subset, and all the first clustering sub-results are determined as the current clustering result.

9. The model training method according to claim 8, characterized in that: The segment feature set is divided into a plurality of similar feature subsets according to the similarities between different songs, including: Extracting a first feature group corresponding to a first song and a second feature group corresponding to a second song from the segment feature set; the first song and the second song are any two songs corresponding to the segment feature set; Determine the group similarity of the first feature group and the second feature group. If the group similarity is greater than a preset threshold, classify the first feature group and the second feature group into the same similar feature subset; otherwise, classify the first feature group and the second feature group into different similar feature subsets.

10. The model training method according to claim 9, characterized in that: The determining the group similarity between the first feature group and the second feature group includes: Calculate a first average feature value of all features in the first feature group and a second average feature value of all features in the second feature group; calculate feature similarity of the first average feature value and the second average feature value, and determine the feature similarity as the group similarity.

11. The model training method according to claim 1, characterized in that: The clustering algorithm is used to cluster the segment features in the segment feature set to obtain a current clustering result, including: Dividing the segment feature set into a plurality of song feature subsets according to different songs; The segment features in the plurality of song feature subsets are clustered respectively to obtain a second clustering sub-result corresponding to each song feature subset, and all the second clustering sub-results are determined as the current clustering result.

12. The model training method according to any one of claims 1 to 11, characterized in that: Also includes: The recognition classifier is trained using the k-nearest neighbor algorithm, neural network algorithm, support vector machine or random forest algorithm; The features to be identified are input into the identification classifier to output the music type of each song segment in the song to be identified.

13. A model training device, characterized in that: include: An acquisition module, used for acquiring a song segment set formed by multiple song segments without music type labels; An extraction module, used for extracting the segment features of each song segment in the song segment set by using the embedding layer in the target model to obtain a segment feature set; A classification module, used to classify the segment features in the segment feature set using the fully connected layer in the target model to obtain a classification result; A clustering module, for clustering the segment features in the segment feature set using a clustering algorithm to obtain a current clustering result if clustering is determined to be required; An updating module, used for updating the model parameters of the target model according to the classification result and the loss value of the current clustering result to obtain an updated target model; The application module is used to extract the to-be-recognized features of each song segment in the to-be-recognized song by using the embedding layer in the updated target model if the updated target model meets the convergence condition.

14. An electronic device, characterized in that: The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the model training method as described in any one of claims 1 to 12.

15. A storage medium, characterized in that: The storage medium stores computer executable instructions, which, when loaded and executed by a processor, implement the model training method according to any one of claims 1 to 12.