A method for identifying and classifying opera sounds

Through pre-trained opera feature codecs and classifiers, using Mel spectrum and audio sequence features, combined with the Transformer encoder, automatic recognition and classification of opera sounds are realized, solving the problem of opera resource identification and classification, and improving retrieval convenience and copyright protection, providing more accurate personalized recommendations.

CN118471267BActive Publication Date: 2024-10-25SHANDONG ACAD OF ARTS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410924077.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-10-25
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

Existing technology is difficult to effectively identify and classify opera resources on the Internet, resulting in inconvenient retrieval and copyright protection problems, and the personalized recommendation effect is not good.

Method used

Using pre-trained opera feature codecs and classifiers, through Mel spectrum and audio sequence feature extraction, combined with the Transformer encoder, automatic recognition and classification of opera sounds are achieved.

Benefits of technology

It improves the convenience of management and retrieval of opera resources, enhances copyright protection capabilities, and provides more accurate personalized recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118471267B_ABST
    Figure CN118471267B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for recognizing and classifying opera sounds, and to the field of opera classification. The present application obtains a target opera sound sequence to be recognized, divides the target opera sound sequence into opera expression forms, determines a number of expression form masks according to the opera expression forms of the target opera sound sequence; multiplies the expression form mask by the target opera sound sequence to obtain different expression form segments of the target opera sound sequence; respectively inputs the different expression form segments and the mel spectra of the expression form segments into the opera feature encoder of the pre-trained opera feature codec to obtain two sets of features of the different expression form segments; the two sets of features are partially verified by the opera feature decoder to ensure that the two sets of features can effectively represent the opera, and the two sets of features of the different expression form segments are input into the pre-trained opera classifier to obtain the classification result of the target opera sound sequence, and the effect of opera classification based on the two sets of features can be guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of opera classification, and in particular to a method for recognizing and classifying opera sounds. Background Art

[0002] With the development of digital technology and the Internet, a large number of opera resources have emerged on the Internet. Many opera resources lack complete descriptions, such as the type and style of opera, which brings inconvenience to opera retrieval, browsing and listening. Secondly, in terms of copyright protection, due to the lack of an effective and reliable monitoring mechanism, many opera works are often subject to infringements such as piracy, plagiarism or abuse. If it is possible to automatically identify or trace operas on the Internet, the legitimate rights and interests of copyright holders can be effectively protected. In terms of personalized recommendations, since users' preferences for music are often closely related to the type of opera, if recognition technology can be used to automatically analyze or classify songs that users have listened to or like to listen to, it is possible to better understand users' interests and preferences, and make more accurate and diversified recommendations based on which songs users like to listen to under the condition that different attributes (type / style / language / emotion / scene, etc.) are interrelated. Summary of the invention

[0003] In order to solve the above technical problem or at least partially solve the above technical problem, the present invention provides a method for recognizing and classifying opera sounds.

[0004] In a first aspect, the present invention provides a method for recognizing and classifying opera sounds, comprising:

[0005] Acquire a target opera sound sequence to be identified, classify the target opera sound sequence into opera expression forms, and determine a plurality of expression form masks according to the opera expression forms of the target opera sound sequence;

[0006] Multiplying the target opera sound sequence by the expression mask to obtain different expression form segments of the target opera sound sequence;

[0007] Input the different expression form fragments and the mel spectrum of the expression form fragments into the opera feature encoder of the pre-trained opera feature codec to obtain two sets of features of the different expression form fragments;

[0008] The two sets of features of the fragments with different expression forms are input into the pre-trained opera classifier to obtain the classification results of the target opera sound sequence.

[0009] Furthermore, the opera feature codec includes: a mel-spectrogram encoder, an audio sequence encoder, a shared Transformer encoder, a mel-spectrogram decoder, and an audio sequence decoder, wherein the mel-spectrogram encoder and the mel-spectrogram decoder are connected according to a Unet architecture, the audio sequence encoder and the audio sequence decoder are connected according to a Unet architecture, and the shared Transformer encoder is simultaneously arranged between the mel-spectrogram encoder and the mel-spectrogram decoder and between the audio sequence encoder and the audio sequence decoder; the structure of the audio sequence encoder layer is consistent with that of the mel-spectrogram encoder layer, except that the data dimension processed by the audio sequence encoder layer is one-dimensional, and the structure of the audio sequence decoder layer is consistent with that of the mel-spectrogram decoder layer, except that the data dimension processed by the audio sequence decoder layer is one-dimensional; the mel-spectrogram encoder, the audio sequence encoder, and the shared Transformer encoder constitute an opera feature encoder.

[0010] Furthermore, the mel spectrum encoder comprises a plurality of stacked mel spectrum encoder layers for downsampling the frequency dimension, and each mel spectrum encoder layer implements the following process:

[0011] , configure the default convolution kernel size to 8 and the convolution step size to 4;

[0012] , configure the default convolution kernel size to 3 and the convolution step size to 1;

[0013] , configure the default convolution kernel size to 1 and the step size to 1;

[0014] ;

[0015] , configure the default convolution kernel size to 3 and the convolution step size to 1;

[0016] , configure the default convolution kernel size to 1 and the step size to 1;

[0017] ;

[0018] ;

[0019] in, are the number of channels of the tensor input to the Mel spectrum encoder layer and The number of channels, represents convolution, Represents a function for obtaining the number of channels of a tensor. represents a gated linear unit, represents the normalization layer, Represents the GLUE activation function.

[0020] Furthermore, the mel spectrum decoder comprises a plurality of stacked mel spectrum decoder layers for upsampling the frequency dimension, and each mel spectrum decoder layer implements the following process:

[0021] The structure of each Mel-spectrogram decoder layer is symmetrical with the corresponding Mel-spectrogram encoder layer. Each Mel-spectrogram decoder layer adds the features from the previous layer to the features of the corresponding Mel-spectrogram encoder layer.

[0022] , the convolution kernel size is 1, the step size is 1, and the number of channels is changed;

[0023] , configure the default convolution kernel size to 3 and the convolution step size to 1;

[0024] , configure the default convolution kernel size to 1 and the step size to 1;

[0025] ;

[0026] , configure the default convolution kernel size to 3 and the convolution step size to 1;

[0027] , configure the default convolution kernel size to 1 and the step size to 1;

[0028] ;

[0029] ;

[0030] in, A tensor representing the input to the Mel-spectrogram decoder layer, represents convolution, Represents a function for obtaining the number of channels of a tensor. represents a gated linear unit, represents the normalization layer, represents the GLUE activation function, Represents a transposed convolution.

[0031] Furthermore, the shared Transformer encoder includes: at least two layers of self-attention Transformer encoding layers and cross-attention Transformer encoding layers are alternately arranged, a single self-attention Transformer encoder layer includes a self-attention mechanism and a feedforward network connected in a residual form, wherein normalization is performed before the self-attention mechanism and the feedforward network, and the cross-attention Transformer encoding layer uses a cross-attention mechanism.

[0032] Furthermore, the opera audio clips, the decomposed audio of the opera audio clips, the Mel spectrum of the opera audio clips, and the decomposed Mel spectrum of each decomposed audio of the opera audio clips are collected to form a first opera data set;

[0033] The Mel spectrum encoder extracts the Mel spectrum features of the opera audio clip in the first opera data set, adds two-dimensional sinusoidal position coding, and then inputs the features to the shared Transformer encoder. The audio sequence encoder extracts the features of the opera audio clip in the first opera data set, adds one-dimensional sinusoidal position coding, and then inputs the features to the shared Transformer encoder. The shared Transformer encoder extracts the association between the Mel spectrum features and the features of the opera audio clip through the self-attention mechanism, and combines the Mel spectrum features of the opera audio clip with the features of the opera audio clip through the cross-attention mechanism and provides the features to the Mel spectrum decoder. The Mel spectrum decoder decodes the decomposed Mel spectrum prediction values ​​of each decomposed audio of the opera audio clip.

[0034] The Mel spectrum encoder extracts the Mel spectrum features of the opera audio clip, adds a two-dimensional sine position code, and then inputs it into the shared Transformer encoder. The audio sequence encoder extracts the features of the opera audio clip, adds a one-dimensional sine position code, and then inputs it into the shared Transformer encoder. The shared Transformer encoder extracts the association between the Mel spectrum features and the features of the opera audio clip through the self-attention mechanism, and then combines the Mel spectrum features of the opera audio clip and the features of the opera audio clip through the cross-attention mechanism and provides them to the audio sequence decoder. The audio sequence decoder decodes the decomposed audio prediction values ​​of each opera audio clip.

[0035] The first loss function for training the opera feature codec is the weighted sum of the cross entropy loss between the true value and the predicted value of each decomposed audio and the cross entropy loss between the true value and the predicted value of the decomposed Mel spectrum of each decomposed audio; a back propagation algorithm is performed based on the first loss function to optimize the parameters of the opera feature codec so that the first loss function is minimized.

[0036] Furthermore, the opera classifier includes:

[0037] Define the discriminant matrix: The discriminant matrix is ​​a learnable parameter matrix used for classification decisions of the final linear transformation; Initialize the learnable bias term: Set the bias term to an all-zero vector;

[0038] Initialize the category embedding matrix: Use the Xavier initialization method to create a category embedding matrix, which is used to capture the characteristics of different categories of opera;

[0039] Attention mechanism calculation: The multi-layer perceptron converts the two sets of features of the opera audio clips of each opera performance into feature vectors, performs a dot product operation on the category embedding matrix and the feature vector, and converts it through a softmax layer to obtain the attention score;

[0040] The feature vector is weighted and summed according to the attention score and processed by the activation function, then multiplied by the discriminant matrix and added with the bias for linear transformation to generate the final classification.

[0041] Furthermore, the opera audio clip and the Mel spectrum of the opera audio clip are configured with the opera type label, the time period in the opera audio clip and the area of ​​the Mel spectrum of the opera audio clip are configured with the corresponding opera expression form label, and the method of adding the opera expression form label to the time period in the opera audio clip is as follows [start_time, end_time, expression form: "expression form z"], where start_time is the start time of expression form z, and end_time is the end time of expression form z; the method of configuring the corresponding opera expression form label for the area of ​​the Mel spectrum is as follows: [x1, y1, x2, y2, expression form: "expression form z"], where x1, y1 are the lower left pixel coordinates of the area where expression form z is located in the Mel spectrum, and x2, y2 are the upper right pixel coordinates of the area where expression form z is located in the Mel spectrum; the opera audio clip, the Mel spectrum of the opera audio clip, the opera type label and the two opera expression form labels form a second opera data set;

[0042] According to the opera performance form labels, opera audio clips of each opera performance form and Mel-spectra of the opera audio clips of each opera performance form are obtained, and the opera audio clips of each opera performance form and the Mel-spectra of the opera audio clips of each opera performance form are input into the trained opera feature encoder to obtain two sets of features of the opera audio clips, and the two sets of features are input into the opera classifier for classification; the classification cross entropy loss of the opera audio clips in the second opera data set is used as the second loss function, and a back propagation algorithm is performed based on the second loss function to optimize the parameters of the opera classifier so that the second loss function is minimized.

[0043] In a second aspect, the present invention provides a device for implementing a method for recognizing and classifying opera sounds, comprising: at least one processing unit, the processing unit being connected to a storage unit via a bus unit, the storage unit storing a computer program, and when the computer program is executed by the processing unit, the method for recognizing and classifying opera sounds is implemented.

[0044] In a third aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for recognizing and classifying opera sounds is implemented.

[0045] The above technical solution provided by the embodiment of the present invention has the following advantages compared with the prior art:

[0046] The present application uses a pre-trained opera feature encoder of an opera feature codec to extract features of different opera performance fragments in opera sounds, and obtains two sets of features of different performance fragments. The two sets of features of different performance fragments are input into a pre-trained opera classifier to obtain the classification results of the target opera sound sequence. Classification based on the opera performance features is more accurate.

[0047] The opera feature codec described in the present application includes: a mel spectrum encoder, an audio sequence encoder, a shared Transformer encoder, a mel spectrum decoder, and an audio sequence decoder, wherein the mel spectrum encoder and the mel spectrum decoder are connected according to the Unet architecture, the audio sequence encoder and the audio sequence decoder are connected according to the Unet architecture, and the shared Transformer encoder is simultaneously arranged between the mel spectrum encoder and the mel spectrum decoder and between the audio sequence encoder and the audio sequence decoder. The mel spectrum encoder extracts the mel spectrum features of the opera audio segment in the first opera data set, adds a two-dimensional sine position code, and then inputs it to the shared Transformer encoder. The audio sequence encoder extracts the features of the opera audio segment in the first opera data set, adds a one-dimensional sine position code, and then inputs it to the shared Transformer encoder. The shared Transformer encoder extracts the association between the mel spectrum features and the features of the opera audio segment through the self-attention mechanism, and combines the mel spectrum features of the opera audio segment and the features of the opera audio segment through the cross-attention mechanism and provides them to the mel spectrum decoder and the audio sequence decoder. The mel spectrum decoder decodes the decomposed mel spectrum prediction value of each decomposed audio of the opera audio segment, and the audio sequence decoder decodes the decomposed audio prediction value of each decomposed audio of the opera audio segment. The two sets of features that integrate the opera spectrum domain and the time series domain are extracted through the Mel spectrum encoder, audio sequence encoder, and shared Transformer encoder. The Mel spectrum decoder and audio sequence decoder verify that the two sets of features can restore the decomposed Mel spectrum prediction value of each decomposed audio and the decomposed audio prediction value of each opera audio clip, thus ensuring that the two sets of features can effectively represent the opera. The effect of opera classification based on the two sets of features can be guaranteed.

[0048] Through automated opera classification, the massive amount of opera resources on the Internet can be better managed, making it easier to search, browse, and listen to operas; it can better analyze pirated operas and protect copyrights; and it can bring a better experience to user recommendations. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0050] In order to more clearly illustrate the embodiments of the present invention 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0051] Figure 1 A flowchart of a method for recognizing and classifying opera sounds provided by an embodiment of the present invention;

[0052] Figure 2 A schematic diagram of an opera feature codec provided by an embodiment of the present invention;

[0053] Figure 3 A schematic diagram of a Mel spectrum encoder layer or an audio sequence encoder layer provided in an embodiment of the present invention;

[0054] Figure 4 A schematic diagram of a Mel spectrum decoder layer or an audio sequence decoder layer provided in an embodiment of the present invention;

[0055] Figure 5 A schematic diagram of an opera classifier provided by an embodiment of the present invention;

[0056] Figure 6 A schematic diagram of a device for implementing a method for recognizing and classifying opera sounds provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0059] Example 1

[0060] like Figure 1 As shown, the technology of the present invention implements a method for recognizing and classifying opera sounds, including:

[0061] A first opera dataset for training an opera feature codec and a second opera dataset for training an opera classifier are created.

[0062] Various types of original opera audio are collected and divided into opera audio segments. The opera audio segments are separated by sound source to obtain corresponding decomposed audios, and the Mel spectrum of the opera audio segments is obtained, and the decomposed Mel spectrum of each decomposed audio of the opera audio segments is obtained. The opera audio segments, the decomposed audio of the opera audio segments, the Mel spectrum of the opera audio segments, and the decomposed Mel spectrum of each decomposed audio of the opera audio segments constitute the first opera data set.

[0063] The opera audio clip and the Mel spectrum of the opera audio clip are configured with the opera type label, and the time period in the opera audio clip and the area of ​​the Mel spectrum of the opera audio clip are configured with the corresponding opera expression form label. The method of adding the opera expression form label to the time period in the opera audio clip is as follows [start_time, end_time, expression form: "Expression form z"], where start_time is the start time of expression form z, and end_time is the end time of expression form z. Opera expression forms such as "singing" and "reciting" are configured with the corresponding opera expression form label for the Mel spectrum area as follows: [x1, y1, x2, y2, expression form: "Expression form z"], where x1, y1 are the lower left pixel coordinates of the area where expression form z is located in the Mel spectrum, and x2, y2 are the upper right pixel coordinates of the area where expression form z is located in the Mel spectrum. The opera audio clip, the Mel spectrum of the opera audio clip, the opera type label and the two opera expression form labels form the second opera data set.

[0064] The first opera data set is used to train an opera feature codec, wherein: Figure 2 As shown, the opera feature codec includes: a mel spectrum encoder, an audio sequence encoder, a shared Transformer encoder, a mel spectrum decoder, and an audio sequence decoder. The mel spectrum encoder and the mel spectrum decoder are connected according to the Unet architecture, the audio sequence encoder and the audio sequence decoder are connected according to the Unet architecture, and the shared Transformer encoder is set between the mel spectrum encoder and the mel spectrum decoder and between the audio sequence encoder and the audio sequence decoder. The mel spectrum encoder, the audio sequence encoder, and the shared Transformer encoder constitute the opera feature encoder.

[0065] The mel-spectrometric encoder includes a plurality of stacked mel-spectrometric encoder layers for downsampling the frequency dimension, and the mel-spectrometric decoder includes a plurality of stacked mel-spectrometric decoder layers for upsampling the frequency dimension.

[0066] Combination Figure 3 As shown, each Mel spectrum encoder layer implements the following process:

[0067] , configure the default convolution kernel size to 8 and the convolution step size to 4;

[0068] , configure the default convolution kernel size to 3 and the convolution step size to 1;

[0069] , configure the default convolution kernel size to 1 and the step size to 1;

[0070] , The process implements the dilated convolution process with residual connections, which can capture the characteristics of input data at different scales;

[0071] , configure the default convolution kernel size to 3 and the convolution step size to 1;

[0072] , configure the default convolution kernel size to 1 and the step size to 1;

[0073] , The process implements the dilated convolution process with residual connections, which can capture the characteristics of input data at different scales;

[0074] .

[0075] in, are the number of channels of the tensor input to the Mel spectrum encoder layer and The number of channels, represents convolution, Represents a function for obtaining the number of channels of a tensor. represents a gated linear unit, represents the normalization layer, Represents the GLUE activation function. Construct a Mel spectrum encoder layer with residual connections. The Mel spectrum encoder layer creates a series of residual branches of dilated convolutions, which can capture the features of input data at different scales and support the construction of deeper encoding layers to enhance the model's ability to express Mel spectrum. The Mel spectrum encoder ultimately obtains a mapping feature of a single frequency dimension, and its number of channels is consistent with the number of channels of the output feature of the audio sequence encoder.

[0076] The structure of the audio sequence encoder layer is consistent with that of the mel spectrum encoder layer, except that the data dimension processed by the audio sequence encoder layer is one-dimensional.

[0077] For the output features of the Mel spectrum encoder and the audio sequence encoder, two-dimensional sinusoidal position coding and one-dimensional sinusoidal position coding are added respectively to encode the position information into the features, and then input into the shared Transformer encoder, wherein the output features of the Mel spectrum encoder are adapted to the shared Transformer encoder through dimensional conversion after adding the position coding, and the features transmitted by the shared Transformer encoder to the Mel spectrum decoder are adapted through dimensional conversion. The process of generating a one-dimensional sinusoidal position coding includes: defining the length of the one-dimensional sinusoidal position coding, defining the dimension of the one-dimensional sinusoidal position coding, defining the starting position offset and the maximum period of the sinusoidal wave, calculating the position according to the given starting position offset and the length of the one-dimensional sinusoidal position coding, generating a frequency array, the frequency array contains the dimension of the one-dimensional sinusoidal position coding different frequencies, calculating the phase of the sinusoidal wave of each frequency according to the position and the maximum period, and splicing the calculated sine and cosine values ​​of each position along the last dimension to form a one-dimensional sinusoidal position coding. The process of generating two-dimensional sinusoidal position coding includes: defining the length of the two-dimensional sinusoidal position coding, defining the width and height of the two-dimensional space represented by the two-dimensional sinusoidal position coding, defining the maximum period of the sine wave, initializing a position coding matrix according to the length of the two-dimensional sinusoidal position coding, the width and height of the two-dimensional space represented by the two-dimensional sinusoidal position coding, generating a scaling factor representing the relationship between frequency and dimension, wherein the scaling factor controls the frequency to decrease exponentially as the dimension increases, for the position in the width direction, calculating the sine and cosine values ​​in each dimension, and expanding to the entire height of the position coding matrix through transposition and repetition, and for the position in the height direction, calculating the sine and cosine values ​​in each dimension, and expanding to the entire width of the position coding matrix through transposition and repetition.

[0078] The shared Transformer encoder includes: at least two layers of self-attention Transformer encoding layers and cross-attention Transformer encoding layers are alternately arranged, and a single self-attention Transformer encoder layer includes a self-attention mechanism and a feedforward network connected in a residual form, wherein normalization is performed before the self-attention mechanism and the feedforward network. The input / output dimensions of the shared Transformer encoder are consistent; they are converted to the processing dimensions of the shared Transformer encoder through linear layers respectively. The self-attention mechanism has 8 heads, and the hidden state size of the feedforward network is equal to 4 times the processing dimension of the shared Transformer encoder. The cross-attention Transformer encoding layer uses a cross-attention mechanism. The shared Transformer encoder realizes the joint encoding of dual-path features, which is particularly suitable for tasks that require simultaneous processing of time-frequency representation and time series information of audio or images.

[0079] Combination Figure 4 As shown, each Mel spectrum decoder layer implements the following process:

[0080] The structure of each Mel-spectrogram decoder layer is symmetrical with the corresponding Mel-spectrogram encoder layer. Each Mel-spectrogram decoder layer adds the features from the previous layer to the features of the corresponding Mel-spectrogram encoder layer.

[0081] , the convolution kernel size is 1, the step size is 1, and the number of channels is changed;

[0082] , configure the default convolution kernel size to 3 and the convolution step size to 1;

[0083] , configure the default convolution kernel size to 1 and the step size to 1;

[0084] , The process of implementing the dilated convolution process with residual connections can restore the characteristics of input data at different scales;

[0085] , configure the default convolution kernel size to 3 and the convolution step size to 1;

[0086] , configure the default convolution kernel size to 1 and the step size to 1;

[0087] , The process realizes the dilated convolution process with residual connection, which can restore the characteristics of input data at different scales;

[0088] ;

[0089] in, A tensor representing the input to the Mel-spectrogram decoder layer, represents convolution, Represents a function for obtaining the number of channels of a tensor. represents a gated linear unit, represents the normalization layer, represents the GLUE activation function, Represents transposed convolution. A Mel spectrum decoder layer with residual connection is constructed. The Mel spectrum decoder layer creates a series of residual branches of dilated convolutions, which can restore the features of input data at different scales. The Mel spectrum decoder finally obtains the mask of each decomposed audio. The mask of each decomposed audio is multiplied by the Mel spectrum of the opera audio clip to obtain the decomposed Mel spectrum of each decomposed audio.

[0090] The structure of the audio sequence decoder layer is consistent with that of the mel spectrum decoder layer, except that the data dimension processed by the audio sequence decoder layer is one-dimensional.

[0091] The process of training the opera feature encoder-decoder is as follows:

[0092] The Mel spectrum encoder extracts the Mel spectrum features of the opera audio clips in the first opera data set, adds two-dimensional sinusoidal position coding, and inputs the features into the shared Transformer encoder. The audio sequence encoder extracts the features of the opera audio clips in the first opera data set, adds one-dimensional sinusoidal position coding, and inputs the features into the shared Transformer encoder. The shared Transformer encoder extracts the association between the Mel spectrum features and the features of the opera audio clips through the self-attention mechanism, and combines the Mel spectrum features of the opera audio clips with the features of the opera audio clips through the cross-attention mechanism and provides the results to the Mel spectrum decoder. The Mel spectrum decoder decodes the decomposed Mel spectrum prediction values ​​of each decomposed audio of the opera audio clip.

[0093] The Mel spectrum encoder extracts the Mel spectrum features of the opera audio clip, adds two-dimensional sinusoidal position coding, and then inputs the features into the shared Transformer encoder. The audio sequence encoder extracts the features of the opera audio clip, adds one-dimensional sinusoidal position coding, and then inputs the features into the shared Transformer encoder. The shared Transformer encoder extracts the association between the Mel spectrum features and the features of the opera audio clip through the self-attention mechanism, and combines the Mel spectrum features of the opera audio clip and the features of the opera audio clip through the cross-attention mechanism and provides the results to the audio sequence decoder. The audio sequence decoder decodes the decomposed audio prediction values ​​of the opera audio clip.

[0094] The first loss function of the training is the weighted sum of the cross entropy loss between the true value and the predicted value of each decomposed audio and the cross entropy loss between the true value and the predicted value of the decomposed Mel spectrum of each decomposed audio. The back propagation algorithm is performed based on the first loss function to optimize the parameters of the opera feature codec to minimize the first loss function.

[0095] The opera classifier is trained using the second opera data set; in the specific implementation process, Figure 5 As shown, the opera classifier includes:

[0096] Define the discriminant matrix: The discriminant matrix is ​​a learnable parameter matrix used for classification decisions of the final linear transformation. Initialize the learnable bias term: Set the bias term to an all-zero vector.

[0097] Initialize the category embedding matrix: Use the Xavier initialization method to create a category embedding matrix, which is used to capture the characteristics of different categories of opera;

[0098] Attention mechanism calculation: The multi-layer perceptron converts the two sets of features of the opera audio clips of each opera performance form into feature vectors. According to the opera type label of the opera to which the feature vector belongs, a specific category embedding matrix is ​​selected to calculate the current relationship representation, and then a dot product operation is performed with the feature vector. The attention score is obtained through softmax layer conversion.

[0099] The feature vector is weighted and summed according to the attention score and processed by the activation function, then multiplied by the discriminant matrix and added with the bias for linear transformation to generate the final classification.

[0100] The process of training the opera classifier is as follows:

[0101] According to the opera performance form label, the opera audio clips of each opera performance form and the Mel spectrum of the opera audio clips of each opera performance form are obtained, and the opera audio clips of each opera performance form and the Mel spectrum of the opera audio clips of each opera performance form are input into the trained opera feature encoder to obtain two sets of features of the opera audio clips of each opera performance form. The two sets of features are input into the opera classifier for classification. The classification cross entropy loss of the opera audio clips in the second opera data set is used as the second loss function, and the back propagation algorithm is performed based on the second loss function to optimize the parameters of the opera classifier so that the second loss function is minimized.

[0102] When performing opera recognition, a target opera sound sequence to be recognized is obtained, the target opera sound sequence is divided into opera expression forms, and a number of corresponding expression form masks are determined according to the opera expression forms of the target opera sound sequence.

[0103] The target opera sound sequence is multiplied by the expression mask to obtain different expression form fragments of the target opera sound sequence.

[0104] The fragments with different expression forms and the mel spectrograms of the fragments with different expression forms are respectively input into the opera feature encoder of the pre-trained opera feature codec to obtain two sets of features of the fragments with different expression forms.

[0105] The two sets of features of the fragments with different expression forms are input into the pre-trained opera classifier to obtain the classification results of the target opera sound sequence.

[0106] Example 2

[0107] See also Figure 6 As shown, an embodiment of the present invention provides a device for implementing a method for recognizing and classifying opera sounds, comprising: at least one processing unit, the processing unit is connected to a storage unit via a bus unit, the storage unit is a computer-readable storage medium, and can be used to store software programs, computer executable programs, and modules, such as the software programs, computer executable programs, and modules corresponding to a method for recognizing and classifying opera sounds in an embodiment of the present invention. The processing unit implements the above-mentioned method for recognizing and classifying opera sounds by running the software programs, computer executable programs, and modules stored in the storage unit, comprising:

[0108] Acquire a target opera sound sequence to be identified, classify the target opera sound sequence into opera expression forms, and determine a plurality of expression form masks according to the opera expression forms of the target opera sound sequence;

[0109] Multiplying the target opera sound sequence by the expression mask to obtain different expression form segments of the target opera sound sequence;

[0110] Input the different expression form fragments and the mel spectrum of the expression form fragments into the opera feature encoder of the pre-trained opera feature codec to obtain two sets of features of the different expression form fragments;

[0111] The two sets of features of the fragments with different expression forms are input into the pre-trained opera classifier to obtain the classification results of the target opera sound sequence.

[0112] Of course, the computer program stored in the storage unit of the device for implementing the method for recognizing and classifying opera sounds provided in an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in the method for recognizing and classifying opera sounds provided in any embodiment of the present invention.

[0113] Example 3

[0114] The embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed, the method for recognizing and classifying opera sounds is implemented, including:

[0115] Acquire a target opera sound sequence to be identified, classify the target opera sound sequence into opera expression forms, and determine a plurality of expression form masks according to the opera expression forms of the target opera sound sequence;

[0116] Multiplying the target opera sound sequence by the expression mask to obtain different expression form segments of the target opera sound sequence;

[0117] Input the different expression form fragments and the mel spectrum of the expression form fragments into the opera feature encoder of the pre-trained opera feature codec to obtain two sets of features of the different expression form fragments;

[0118] The two sets of features of the fragments with different expression forms are input into the pre-trained opera classifier to obtain the classification results of the target opera sound sequence.

[0119] A computer-readable storage medium provided by an embodiment of the present invention stores a computer program which is not limited to the method operations described above, but can also execute related operations in a method for recognizing and classifying opera sounds provided by any embodiment of the present invention.

[0120] In the embodiments provided by the present invention, it should be understood that the disclosed structures and methods can be implemented in other ways. For example, the structural embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, structures or units, which can be electrical, mechanical or other forms.

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

[0122] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0123] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for recognizing and classifying opera sounds, It is characterized in that include: Acquire a target opera sound sequence to be identified, classify the target opera sound sequence into opera expression forms, and determine a plurality of expression form masks according to the opera expression forms of the target opera sound sequence; The expression form mask is multiplied by the target opera sound sequence to obtain different expression form segments of the target opera sound sequence; Inputting the fragments of different expression forms and the Mel-spectrum of the fragments of the expression forms into the opera feature encoder of the pre-trained opera feature codec respectively to obtain two sets of features of the fragments of different expression forms; wherein the opera feature codec comprises: a Mel-spectrum encoder, an audio sequence encoder, a shared Transformer encoder, a Mel-spectrum decoder, and an audio sequence decoder, wherein the Mel-spectrum encoder and the Mel-spectrum decoder are connected according to the Unet architecture, the audio sequence encoder and the audio sequence decoder are connected according to the Unet architecture, and the shared Transformer encoder is simultaneously arranged between the Mel-spectrum encoder and the Mel-spectrum decoder and between the audio sequence encoder and the audio sequence decoder; the structure of the audio sequence encoder layer is consistent with that of the Mel-spectrum encoder layer, except that the data dimension processed by the audio sequence encoder layer is one-dimensional, and the structure of the audio sequence decoder layer is consistent with that of the Mel-spectrum decoder layer, except that the data dimension processed by the audio sequence decoder layer is one-dimensional; the Mel-spectrum encoder, the audio sequence encoder, and the shared Transformer encoder constitute the opera feature encoder; The two sets of features of the fragments with different expression forms are input into the pre-trained opera classifier to obtain the classification results of the target opera sound sequence.

2. The method for recognizing and classifying opera sounds according to claim 1, It is characterized in that The Mel spectrum encoder comprises a plurality of stacked Mel spectrum encoder layers for downsampling the frequency dimension, and each Mel spectrum encoder layer implements the following process: , configure the default convolution kernel size to 8 and the convolution step size to 4; , configure the default convolution kernel size to 3 and the convolution step size to 1; , configure the default convolution kernel size to 1 and the step size to 1; ; , configure the default convolution kernel size to 3 and the convolution step size to 1; , configure the default convolution kernel size to 1 and the step size to 1; ; ; in, are the number of channels of the tensor input to the Mel spectrum encoder layer and The number of channels, represents convolution, Represents a function for obtaining the number of channels of a tensor. represents a gated linear unit, represents the normalization layer, Represents the GLUE activation function.

3. The method for recognizing and classifying opera sounds according to claim 1, It is characterized in that The Mel spectrum decoder comprises a plurality of stacked Mel spectrum decoder layers for upsampling the frequency dimension, and each Mel spectrum decoder layer implements the following process: The structure of each Mel-spectrogram decoder layer is symmetrical with the corresponding Mel-spectrogram encoder layer. Each Mel-spectrogram decoder layer adds the features from the previous layer to the features of the corresponding Mel-spectrogram encoder layer. , the convolution kernel size is 1, the step size is 1, and the number of channels is changed; , configure the default convolution kernel size to 3 and the convolution step size to 1; , configure the default convolution kernel size to 1 and the step size to 1; ; , configure the default convolution kernel size to 3 and the convolution step size to 1; , configure the default convolution kernel size to 1 and the step size to 1; ; ; in, A tensor representing the input to the Mel-spectrogram decoder layer, represents convolution, Represents a function for obtaining the number of channels of a tensor. represents a gated linear unit, represents the normalization layer, represents the GLUE activation function, Represents a transposed convolution.

4. The method for recognizing and classifying opera sounds according to claim 1, It is characterized in that The shared Transformer encoder includes: at least two layers of self-attention Transformer encoding layers and cross-attention Transformer encoding layers are alternately arranged, a single self-attention Transformer encoder layer includes a self-attention mechanism and a feedforward network connected in a residual form, wherein normalization is performed before the self-attention mechanism and the feedforward network, and the cross-attention Transformer encoding layer uses a cross-attention mechanism.

5. The method for recognizing and classifying opera sounds according to claim 1, It is characterized in that Collecting opera audio clips, decomposed audio of the opera audio clips, Mel spectra of the opera audio clips, and decomposed Mel spectra of each decomposed audio of the opera audio clips to form a first opera data set; The Mel spectrum encoder extracts the Mel spectrum features of the opera audio clip in the first opera data set, adds two-dimensional sinusoidal position coding, and then inputs the features to the shared Transformer encoder. The audio sequence encoder extracts the features of the opera audio clip in the first opera data set, adds one-dimensional sinusoidal position coding, and then inputs the features to the shared Transformer encoder. The shared Transformer encoder extracts the association between the Mel spectrum features and the features of the opera audio clip through the self-attention mechanism, and combines the Mel spectrum features of the opera audio clip with the features of the opera audio clip through the cross-attention mechanism and provides the features to the Mel spectrum decoder. The Mel spectrum decoder decodes the decomposed Mel spectrum prediction values ​​of each decomposed audio of the opera audio clip. The Mel spectrum encoder extracts the Mel spectrum features of the opera audio clip, adds a two-dimensional sine position code, and then inputs it into the shared Transformer encoder. The audio sequence encoder extracts the features of the opera audio clip, adds a one-dimensional sine position code, and then inputs it into the shared Transformer encoder. The shared Transformer encoder extracts the association between the Mel spectrum features and the features of the opera audio clip through the self-attention mechanism, and then combines the Mel spectrum features of the opera audio clip and the features of the opera audio clip through the cross-attention mechanism and provides them to the audio sequence decoder. The audio sequence decoder decodes the decomposed audio prediction values ​​of each opera audio clip. The first loss function for training the opera feature codec is the weighted sum of the cross entropy loss between the true value and the predicted value of each decomposed audio and the cross entropy loss between the true value and the predicted value of the decomposed Mel spectrum of each decomposed audio; a back propagation algorithm is performed based on the first loss function to optimize the parameters of the opera feature codec so that the first loss function is minimized.

6. The method for recognizing and classifying opera sounds according to claim 1, It is characterized in that The opera classifier comprises: Define the discriminant matrix: The discriminant matrix is ​​a learnable parameter matrix used for classification decisions of the final linear transformation; Initialize the learnable bias term: Set the bias term to an all-zero vector; Initialize the category embedding matrix: Use the Xavier initialization method to create a category embedding matrix, which is used to capture the characteristics of different categories of opera; Attention mechanism calculation: The multi-layer perceptron converts the two sets of features of the opera audio clips of each opera performance into feature vectors, performs a dot product operation on the category embedding matrix and the feature vector, and converts it through a softmax layer to obtain the attention score; The feature vector is weighted and summed according to the attention score and processed by the activation function, then multiplied by the discriminant matrix and added with the bias for linear transformation to generate the final classification.

7. The method for recognizing and classifying opera sounds according to claim 1, It is characterized in that The opera audio clip and the Mel spectrum of the opera audio clip are configured with the opera type label, the time period in the opera audio clip and the area of ​​the Mel spectrum of the opera audio clip are configured with the corresponding opera expression form label, and the method of adding the opera expression form label to the time period in the opera audio clip is as follows [start_time, end_time, expression form: "expression form z"], where start_time is the start time of expression form z, and end_time is the end time of expression form z; the method of configuring the corresponding opera expression form label for the area of ​​the Mel spectrum is as follows: [x1, y1, x2, y2, expression form: "expression form z"], where x1, y1 are the lower left pixel coordinates of the area where expression form z is located in the Mel spectrum, and x2, y2 are the upper right pixel coordinates of the area where expression form z is located in the Mel spectrum; the opera audio clip, the Mel spectrum of the opera audio clip, the opera type label and the two opera expression form labels form a second opera data set; According to the opera performance form labels, opera audio clips of each opera performance form and Mel-spectra of the opera audio clips of each opera performance form are obtained, and the opera audio clips of each opera performance form and the Mel-spectra of the opera audio clips of each opera performance form are input into the trained opera feature encoder to obtain two sets of features of the opera audio clips, and the two sets of features are input into the opera classifier for classification; the classification cross entropy loss of the opera audio clips in the second opera data set is used as the second loss function, and a back propagation algorithm is performed based on the second loss function to optimize the parameters of the opera classifier so that the second loss function is minimized.

8. A device for realizing a method for recognizing and classifying opera sounds, It is characterized in that include: At least one processing unit, the processing unit is connected to a storage unit via a bus unit, the storage unit stores a computer program, and when the computer program is executed by the processing unit, the method for recognizing and classifying opera sounds as described in any one of claims 1-7 is implemented.

9. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the method for recognizing and classifying opera sounds as described in any one of claims 1 to 7 is implemented.