# Automatic Classification Method of Music Genres Based on Deep Belief Network and Sparse Representation

Authors: Lina Pan
Journal: Journal of Mathematics
 (2022)

---

## Abstract

Aiming at the problems of poor classification effect, low accuracy, and long time in the current automatic classification methods of music genres, an automatic classification method of music genres based on deep belief network and sparse representation is proposed. The music signal is preprocessed by framing, pre-emphasis, and windowing, and the characteristic parameters of the music signal are extracted by Mel frequency cepstrum coefficient analysis. The restricted Boltzmann machine is trained layer by layer to obtain the connection weights between layers of the depth belief network model. According to the output classification, the connection weights in the model are fine-tuned by using the error back-propagation algorithm. Based on the deep belief network model after fine-tuning training, the structure of the music genre classification network model is designed. Combined with the classification algorithm of sparse representation, for the training samples of sparse representation music genre, the sparse solution is obtained by using the minimum norm, the sparse representation of test vector is calculated, the category of training samples is judged, and the automatic classification of music genre is realized. The experimental results show that the music genre automatic classification effect of the proposed method is better, the classification accuracy rate is higher, and the classification time can be effectively shortened.


---

## Body

## 1. Introduction

Music is an art that can effectively show human emotions. At the same time, music is a note composed of a specific rhythm, melody, or musical instrument according to certain rules [1–3]. Rock music, jazz, classical music, and other music genres are examples of diverse style tracks comprised of unique beats, timbres, and other aspects exhibited in music works. With the fast development of network and multimedia technologies, people’s primary method of listening to music has shifted to digital music, which has fueled people’s need for music appreciation to some level [4–6]. Most online music websites’ major categorization and retrieval elements are now based on the music genre. Simultaneously, the music genre has evolved into one of the categorization features used in the administration and storage of digital music databases. The pace of database updating is sluggish when dealing with a large volume of music data information. The effectiveness of manual labelling in the early days of music information retrieval could not satisfy the real demands of contemporary management. Therefore, it is of great significance to study the automatic classification of music genres.At present, scholars in related fields have studied the classification of music genres and achieved some theoretical results. Reference [7] proposed a music type classification method based on Brazilian lyrics using the BLSTM network. With the help of genre labels, songs, albums, and artists are organized into groups with common similarities. Support vector machine, random forest, and two-way short- and long-term memory networks are used to classify music types, combined with different word embedding techniques. This method is effective. Reference [8] proposed a music genre classification method based on deep learning. Machine learning technology is used to classify music types. The residual learning process, combined with peak and average pool, provides more statistical information for higher-level neural networks. This method has significant classification performance. However, the above methods still have the problems of low classification accuracy, long time, and poor effect.An automated music genre categorization technique based on deep belief networks and sparse representation is suggested to address the aforementioned issues. Framing, pre-emphasis, and windowing are used to preprocess the music signal, and Mel frequency cepstrum coefficient analysis is used to extract the signal’s distinctive properties. A music genre classification network model is built based on the deep belief network and integrated with the sparse representation classification technique to achieve autonomous music genre categorization. This method has a good effect and high accuracy in music genre classification and can effectively shorten the classification time.


## 2. Deep Belief Network and Sparse Representation

### 2.1. Deep Belief Network

#### 2.1.1. Restricted Boltzmann Machine

Restricted Boltzmann machine (RBM) belongs to a randomly generated neural network based on the probability distribution characteristics of the learning input data set [9–11]. It can be seen that the layer q=q1,q2,…,qn and the hidden layer w=w1,w2,…,wm together constitute an RBM, in which the neurons in each level have no connection. Use qi∈0,1,wj∈0,1 to describe the value of the binary random unit. The data features are mainly described by neurons in the visible layer, and the features of hidden layer neurons are used for feature extraction. The RBM network structure is shown in Figure 1.Figure 1
RBM network structure diagram.The RBM energy function is defined as the following formula:(1)Eq,w;α=−qTWw−zTq−xTw=−∑i=1nbiqi−∑j=1mzjwj−∑i=1n∑j=1mqjcijwj.In formula (1), α=a,b,w is a real parameter, qi and wj are used to describe the states of the i and j neurons in the RBM layers, zj is the bias of qi, bi is the bias of wj, cij is the weight between the states of qi and wj neurons, and n,m is its corresponding node. According to formula (1), the joint probability distribution Pq,w;α of q,w can be obtained as the following formula:(2)Pq,w;α=1Vαexp−Eq,w;α.In formula (2), Vα is a normalized function. When both q and w are known, formulas (3) and (4) are used to express the activation probability of neurons in the two layers of RBM:(3)Pwj=1q=sigmoidbj+∑iqicij,(4)Pqi=1w=sigmoidzi+∑jcijwj.In formulas (3) and (4), sigmoid=1/1+e−x is the activation function. When the training data set K is given, the likelihood function is maximized to express the RBM target as shown in the following formula:(5)Hα,K=∑n=1δlogPqn.In formula (5), δ is the number of training set data. The essence of RBM is to map the original data to different feature spaces to retain the key feature information of the data and obtain a better low-dimensional representation. According to this idea, an idea of optimizing RBM training in this paper is to replace the objective function formula (5) of RBM equally. If the output of each RBM is converted according to formula (6), the output of its hidden layer can be inversely converted and then compared with the original data. The errors of the two can be used as the standard to judge the learning effect of the current RBM network, so as to learn the key features of the data faster.(6)T=GyJ+κJT+θ.In formula (6), Gy is the original data set, J is the weight of RBM, JT is the transposed matrix of J, κ is the bias of the visible layer, and θ is the bias of the hidden layer. The difference between the new data obtained by formula (6) and the original data is calculated, and the mean square error MSE is used as the objective function of RBM, and then, the optimization algorithm is used for evaluation.


#### 2.1.2. Deep Belief Network

Deep belief network (DBN) is one of unsupervised learning algorithms [12–14]. It is composed of RBM, so there is no connection in the same layer. The relationship between the two layers of RBM is represented by a joint probability distribution.(7)Pq,w1,w2,…,wl=Pq|w1Pw1|w2,…,Pwl−2|wl−1Pwl−1,wl.In formula (7), l is the number of hidden layers of DBN. DBN is a hybrid model composed of two parts. The structure of the DBN model is shown in Figure 2.Figure 2
DBN model structure diagram.As shown in Figure2, the undirected graph model of the top two layers forms associative memory, and the other layers are directed graph models. In practice, they are stacked restricted Boltzmann machines. They are Boltzmann machine layers stacked layer by layer, two adjacent to each other. However, the training in the DBN model has direction. DBN training method can be simply summarized into two parts: first, RBM is trained layer by layer to obtain better initial parameter values, and then, the network is optimized. The specific steps are as follows:The original input is set tosi, di is used to describe the reconstructed input, and batch gradient descent tuning is used for n samples of a given training set s1,d1,…,si,di [15, 16]. The sample size loss function can be expressed as follows:(8)CR,v=1n∑i=1nCR,v;si,di+λ2∑l=1mi∑i=1si∑j=1siMijl2=1n∑i=1n12hR,vsi−si+λ2∑l=1mi−1∑i=1si∑j=1siMijl2.In formula (8), Mijl is used to describe the weight coefficient between the i and j nodes in the l and l+1 layers, vil is used to describe the i node offset in the l layer, and hR,vsi is used to describe the result after si reconstruction. The difference between the original input and the current input after reconstruction is calculated, that is, the mean square error term. In order to avoid overfitting, the weight coefficient is greatly reduced, that is, the regularization term. The above two items are balanced by λ. CR,v is used to describe the correctness of the convex function. In order to obtain the global optimal solution, the gradient descent method is used to realize it [17, 18]. In order to optimize the loss function, the mean square error is reconstructed to minimize it, and the partial derivative of CR,v is found as follows:(9)∂CR,v∂Mijl=1n∑i=1n∂CR,v;si,di∂Mijl+λMijl,(10)∂CR,v∂vil=1n∑i=1n∂CR,v;si,di∂vil.DBN has good flexibility; that is, it is easy to expand to other networks or combine with other models. A typical example of DBN expansion is the convolution depth belief network.


### 2.2. Sparse Representation

#### 2.2.1. Sparse Representation Method

If there areG type training samples, and there are sufficient numbers in any category, the i training sample data and number are denoted by Bi=bi,1,bi,2,…,bi,ni∈Rm×ni and m, respectively, and the feature set dimension is denoted by ni. Then, its space is composed of ni column vectors, and the linear combination is expressed as follows:(11)y=χi,1bi,1+χi,2bi,2+⋯+χi,nibi,ni.In formula (11), χi,ni∈R is described as the linear coefficient to be solved. Therefore, a complete vector matrix U is defined, which is represented by training samples of G categories, and the vector matrix is represented by test samples of different categories that can be written as follows:(12)U=U1,U2,…,UG=b1,1,b1,2,…,bG,nG∈Rm×ni.At this time, for the test sampley from the i category, the space formed by the training matrix U can be rewritten as follows:(13)y=Up0∈Rm.In formula (13), p0=0,…,0,χi,1,χi,2,…,χi,ni,0,…,0T∈R is the coefficient vector.


#### 2.2.2. Seeking Sparse Solution

Whenm>n, the reconstructed training matrix space has a unique solution. However, under normal circumstances, when m≤n, the reconstructed training matrix space has infinite solutions. As a result, the nonzero vectors contained in the coefficient vector obtained by reconstructing the training matrix space are reduced, which can be converted to(14)p⌢0=argminp0subject to Up=y.In formula (14), ⋅0 is described as l0 norm. However, formula (14) has an NP problem, which is difficult to solve. Therefore, solving the NP problem by minimizing the problem [19, 20] is expressed as follows:(15)p⌢1=argminp1subject to Up=y.In formula (15), ⋅1 represents the l1 norm, and p⌢1 is the approximate solution of p.


## 2.1. Deep Belief Network

### 2.1.1. Restricted Boltzmann Machine

Restricted Boltzmann machine (RBM) belongs to a randomly generated neural network based on the probability distribution characteristics of the learning input data set [9–11]. It can be seen that the layer q=q1,q2,…,qn and the hidden layer w=w1,w2,…,wm together constitute an RBM, in which the neurons in each level have no connection. Use qi∈0,1,wj∈0,1 to describe the value of the binary random unit. The data features are mainly described by neurons in the visible layer, and the features of hidden layer neurons are used for feature extraction. The RBM network structure is shown in Figure 1.Figure 1
RBM network structure diagram.The RBM energy function is defined as the following formula:(1)Eq,w;α=−qTWw−zTq−xTw=−∑i=1nbiqi−∑j=1mzjwj−∑i=1n∑j=1mqjcijwj.In formula (1), α=a,b,w is a real parameter, qi and wj are used to describe the states of the i and j neurons in the RBM layers, zj is the bias of qi, bi is the bias of wj, cij is the weight between the states of qi and wj neurons, and n,m is its corresponding node. According to formula (1), the joint probability distribution Pq,w;α of q,w can be obtained as the following formula:(2)Pq,w;α=1Vαexp−Eq,w;α.In formula (2), Vα is a normalized function. When both q and w are known, formulas (3) and (4) are used to express the activation probability of neurons in the two layers of RBM:(3)Pwj=1q=sigmoidbj+∑iqicij,(4)Pqi=1w=sigmoidzi+∑jcijwj.In formulas (3) and (4), sigmoid=1/1+e−x is the activation function. When the training data set K is given, the likelihood function is maximized to express the RBM target as shown in the following formula:(5)Hα,K=∑n=1δlogPqn.In formula (5), δ is the number of training set data. The essence of RBM is to map the original data to different feature spaces to retain the key feature information of the data and obtain a better low-dimensional representation. According to this idea, an idea of optimizing RBM training in this paper is to replace the objective function formula (5) of RBM equally. If the output of each RBM is converted according to formula (6), the output of its hidden layer can be inversely converted and then compared with the original data. The errors of the two can be used as the standard to judge the learning effect of the current RBM network, so as to learn the key features of the data faster.(6)T=GyJ+κJT+θ.In formula (6), Gy is the original data set, J is the weight of RBM, JT is the transposed matrix of J, κ is the bias of the visible layer, and θ is the bias of the hidden layer. The difference between the new data obtained by formula (6) and the original data is calculated, and the mean square error MSE is used as the objective function of RBM, and then, the optimization algorithm is used for evaluation.


### 2.1.2. Deep Belief Network

Deep belief network (DBN) is one of unsupervised learning algorithms [12–14]. It is composed of RBM, so there is no connection in the same layer. The relationship between the two layers of RBM is represented by a joint probability distribution.(7)Pq,w1,w2,…,wl=Pq|w1Pw1|w2,…,Pwl−2|wl−1Pwl−1,wl.In formula (7), l is the number of hidden layers of DBN. DBN is a hybrid model composed of two parts. The structure of the DBN model is shown in Figure 2.Figure 2
DBN model structure diagram.As shown in Figure2, the undirected graph model of the top two layers forms associative memory, and the other layers are directed graph models. In practice, they are stacked restricted Boltzmann machines. They are Boltzmann machine layers stacked layer by layer, two adjacent to each other. However, the training in the DBN model has direction. DBN training method can be simply summarized into two parts: first, RBM is trained layer by layer to obtain better initial parameter values, and then, the network is optimized. The specific steps are as follows:The original input is set tosi, di is used to describe the reconstructed input, and batch gradient descent tuning is used for n samples of a given training set s1,d1,…,si,di [15, 16]. The sample size loss function can be expressed as follows:(8)CR,v=1n∑i=1nCR,v;si,di+λ2∑l=1mi∑i=1si∑j=1siMijl2=1n∑i=1n12hR,vsi−si+λ2∑l=1mi−1∑i=1si∑j=1siMijl2.In formula (8), Mijl is used to describe the weight coefficient between the i and j nodes in the l and l+1 layers, vil is used to describe the i node offset in the l layer, and hR,vsi is used to describe the result after si reconstruction. The difference between the original input and the current input after reconstruction is calculated, that is, the mean square error term. In order to avoid overfitting, the weight coefficient is greatly reduced, that is, the regularization term. The above two items are balanced by λ. CR,v is used to describe the correctness of the convex function. In order to obtain the global optimal solution, the gradient descent method is used to realize it [17, 18]. In order to optimize the loss function, the mean square error is reconstructed to minimize it, and the partial derivative of CR,v is found as follows:(9)∂CR,v∂Mijl=1n∑i=1n∂CR,v;si,di∂Mijl+λMijl,(10)∂CR,v∂vil=1n∑i=1n∂CR,v;si,di∂vil.DBN has good flexibility; that is, it is easy to expand to other networks or combine with other models. A typical example of DBN expansion is the convolution depth belief network.


## 2.1.1. Restricted Boltzmann Machine

Restricted Boltzmann machine (RBM) belongs to a randomly generated neural network based on the probability distribution characteristics of the learning input data set [9–11]. It can be seen that the layer q=q1,q2,…,qn and the hidden layer w=w1,w2,…,wm together constitute an RBM, in which the neurons in each level have no connection. Use qi∈0,1,wj∈0,1 to describe the value of the binary random unit. The data features are mainly described by neurons in the visible layer, and the features of hidden layer neurons are used for feature extraction. The RBM network structure is shown in Figure 1.Figure 1
RBM network structure diagram.The RBM energy function is defined as the following formula:(1)Eq,w;α=−qTWw−zTq−xTw=−∑i=1nbiqi−∑j=1mzjwj−∑i=1n∑j=1mqjcijwj.In formula (1), α=a,b,w is a real parameter, qi and wj are used to describe the states of the i and j neurons in the RBM layers, zj is the bias of qi, bi is the bias of wj, cij is the weight between the states of qi and wj neurons, and n,m is its corresponding node. According to formula (1), the joint probability distribution Pq,w;α of q,w can be obtained as the following formula:(2)Pq,w;α=1Vαexp−Eq,w;α.In formula (2), Vα is a normalized function. When both q and w are known, formulas (3) and (4) are used to express the activation probability of neurons in the two layers of RBM:(3)Pwj=1q=sigmoidbj+∑iqicij,(4)Pqi=1w=sigmoidzi+∑jcijwj.In formulas (3) and (4), sigmoid=1/1+e−x is the activation function. When the training data set K is given, the likelihood function is maximized to express the RBM target as shown in the following formula:(5)Hα,K=∑n=1δlogPqn.In formula (5), δ is the number of training set data. The essence of RBM is to map the original data to different feature spaces to retain the key feature information of the data and obtain a better low-dimensional representation. According to this idea, an idea of optimizing RBM training in this paper is to replace the objective function formula (5) of RBM equally. If the output of each RBM is converted according to formula (6), the output of its hidden layer can be inversely converted and then compared with the original data. The errors of the two can be used as the standard to judge the learning effect of the current RBM network, so as to learn the key features of the data faster.(6)T=GyJ+κJT+θ.In formula (6), Gy is the original data set, J is the weight of RBM, JT is the transposed matrix of J, κ is the bias of the visible layer, and θ is the bias of the hidden layer. The difference between the new data obtained by formula (6) and the original data is calculated, and the mean square error MSE is used as the objective function of RBM, and then, the optimization algorithm is used for evaluation.


## 2.1.2. Deep Belief Network

Deep belief network (DBN) is one of unsupervised learning algorithms [12–14]. It is composed of RBM, so there is no connection in the same layer. The relationship between the two layers of RBM is represented by a joint probability distribution.(7)Pq,w1,w2,…,wl=Pq|w1Pw1|w2,…,Pwl−2|wl−1Pwl−1,wl.In formula (7), l is the number of hidden layers of DBN. DBN is a hybrid model composed of two parts. The structure of the DBN model is shown in Figure 2.Figure 2
DBN model structure diagram.As shown in Figure2, the undirected graph model of the top two layers forms associative memory, and the other layers are directed graph models. In practice, they are stacked restricted Boltzmann machines. They are Boltzmann machine layers stacked layer by layer, two adjacent to each other. However, the training in the DBN model has direction. DBN training method can be simply summarized into two parts: first, RBM is trained layer by layer to obtain better initial parameter values, and then, the network is optimized. The specific steps are as follows:The original input is set tosi, di is used to describe the reconstructed input, and batch gradient descent tuning is used for n samples of a given training set s1,d1,…,si,di [15, 16]. The sample size loss function can be expressed as follows:(8)CR,v=1n∑i=1nCR,v;si,di+λ2∑l=1mi∑i=1si∑j=1siMijl2=1n∑i=1n12hR,vsi−si+λ2∑l=1mi−1∑i=1si∑j=1siMijl2.In formula (8), Mijl is used to describe the weight coefficient between the i and j nodes in the l and l+1 layers, vil is used to describe the i node offset in the l layer, and hR,vsi is used to describe the result after si reconstruction. The difference between the original input and the current input after reconstruction is calculated, that is, the mean square error term. In order to avoid overfitting, the weight coefficient is greatly reduced, that is, the regularization term. The above two items are balanced by λ. CR,v is used to describe the correctness of the convex function. In order to obtain the global optimal solution, the gradient descent method is used to realize it [17, 18]. In order to optimize the loss function, the mean square error is reconstructed to minimize it, and the partial derivative of CR,v is found as follows:(9)∂CR,v∂Mijl=1n∑i=1n∂CR,v;si,di∂Mijl+λMijl,(10)∂CR,v∂vil=1n∑i=1n∂CR,v;si,di∂vil.DBN has good flexibility; that is, it is easy to expand to other networks or combine with other models. A typical example of DBN expansion is the convolution depth belief network.


## 2.2. Sparse Representation

### 2.2.1. Sparse Representation Method

If there areG type training samples, and there are sufficient numbers in any category, the i training sample data and number are denoted by Bi=bi,1,bi,2,…,bi,ni∈Rm×ni and m, respectively, and the feature set dimension is denoted by ni. Then, its space is composed of ni column vectors, and the linear combination is expressed as follows:(11)y=χi,1bi,1+χi,2bi,2+⋯+χi,nibi,ni.In formula (11), χi,ni∈R is described as the linear coefficient to be solved. Therefore, a complete vector matrix U is defined, which is represented by training samples of G categories, and the vector matrix is represented by test samples of different categories that can be written as follows:(12)U=U1,U2,…,UG=b1,1,b1,2,…,bG,nG∈Rm×ni.At this time, for the test sampley from the i category, the space formed by the training matrix U can be rewritten as follows:(13)y=Up0∈Rm.In formula (13), p0=0,…,0,χi,1,χi,2,…,χi,ni,0,…,0T∈R is the coefficient vector.


### 2.2.2. Seeking Sparse Solution

Whenm>n, the reconstructed training matrix space has a unique solution. However, under normal circumstances, when m≤n, the reconstructed training matrix space has infinite solutions. As a result, the nonzero vectors contained in the coefficient vector obtained by reconstructing the training matrix space are reduced, which can be converted to(14)p⌢0=argminp0subject to Up=y.In formula (14), ⋅0 is described as l0 norm. However, formula (14) has an NP problem, which is difficult to solve. Therefore, solving the NP problem by minimizing the problem [19, 20] is expressed as follows:(15)p⌢1=argminp1subject to Up=y.In formula (15), ⋅1 represents the l1 norm, and p⌢1 is the approximate solution of p.


## 2.2.1. Sparse Representation Method

If there areG type training samples, and there are sufficient numbers in any category, the i training sample data and number are denoted by Bi=bi,1,bi,2,…,bi,ni∈Rm×ni and m, respectively, and the feature set dimension is denoted by ni. Then, its space is composed of ni column vectors, and the linear combination is expressed as follows:(11)y=χi,1bi,1+χi,2bi,2+⋯+χi,nibi,ni.In formula (11), χi,ni∈R is described as the linear coefficient to be solved. Therefore, a complete vector matrix U is defined, which is represented by training samples of G categories, and the vector matrix is represented by test samples of different categories that can be written as follows:(12)U=U1,U2,…,UG=b1,1,b1,2,…,bG,nG∈Rm×ni.At this time, for the test sampley from the i category, the space formed by the training matrix U can be rewritten as follows:(13)y=Up0∈Rm.In formula (13), p0=0,…,0,χi,1,χi,2,…,χi,ni,0,…,0T∈R is the coefficient vector.


## 2.2.2. Seeking Sparse Solution

Whenm>n, the reconstructed training matrix space has a unique solution. However, under normal circumstances, when m≤n, the reconstructed training matrix space has infinite solutions. As a result, the nonzero vectors contained in the coefficient vector obtained by reconstructing the training matrix space are reduced, which can be converted to(14)p⌢0=argminp0subject to Up=y.In formula (14), ⋅0 is described as l0 norm. However, formula (14) has an NP problem, which is difficult to solve. Therefore, solving the NP problem by minimizing the problem [19, 20] is expressed as follows:(15)p⌢1=argminp1subject to Up=y.In formula (15), ⋅1 represents the l1 norm, and p⌢1 is the approximate solution of p.


## 3. Automatic Classification Method of Music Genre

Music genre is a traditional means of categorising the attribution of musical works, and it is commonly separated into categories based on historical context, geography, origin, religion, musical instruments, emotional topics, performance styles, and so on. Western music dominates the music genres. Western music encompasses a wide range of musical styles. Classical, blues, rock, pop, metal, jazz, country, hip-hop, and other music genres are widespread [21–25]. This research proposes a deep belief network and sparse representation-based automated music genre categorization approach. A music genre categorization network model is created by preprocessing music signals, extracting music signal characteristic parameters, pretraining, and fine-tuning the DBN model. The sparse representation of the test vector is calculated, the category of the training samples is assessed, and the automated classification of music genres on this basis is achieved, in combination with the sparse representation classification method. The automatic classification process of music genres based on a deep belief network and sparse representation is shown in Figure 3.Figure 3
Flow chart of automatic classification of music genres based on deep belief network and sparse representation.


### 3.1. Preprocessing Music Signal

Usually, before classifying music genres, music signals need to be preprocessed, which is mainly divided into three steps: framing, preemphasis, and windowing. The music signal preprocessing process is shown in Figure4.(1)
Framing: For signal processing, framing is generally performed. The purpose of framing is to facilitate the extraction of features, and framing can also reduce the dimensionality of the feature matrix. When framing, you need to select the appropriate frame length and frame width. The following relationship among the sampling periodT=1/f, window width L, and frequency F can be expressed as:(16)F=1LT.It can be seen from formula (16) that when T is constant, the frequency F is determined by the change of the window width L, which is inversely proportional. At this time, the frequency resolution is improved, but the time resolution is reduced. Increasing the window width will result in a decrease in frequency resolution and an increase in time resolution, resulting in a contradiction between window width and frequency resolution. For this reason, an appropriate window length should be selected according to different needs. If the window width becomes larger, the appropriate window width is selected according to different needs. When selecting the length, we should also consider that it is suitable for computer operation. The computer operation is based on binary, so the selected length should also be an integer multiple of 2 as far as possible.(2)
Pre-emphasis: When classifying music genres, because glottic excitation directly affects the average power spectrum of music signals, it is difficult to obtain the spectrum. Therefore, pre-emphasis processing of music signals is required. In this paper, the first-order digital filter is used to pre-emphasis the music signal. The formula is as follows:(17)Hz=1−az−1.In formula (17), a is the pre-emphasis factor, which is generally taken as a decimal number close to 1. Assuming that the sample value of the music genre signal at time n is xn, the result after pre-emphasis is as follows:(18)yn=xn−axn−1.(3)
Windowing: It is for framing service. Framing itself means adding a window function. However, due to the truncation effect of the frame during framing, it is necessary to select a good window function. The good slope at both ends of the window shall be reduced as slowly as possible to avoid drastic changes. The frame division is realized by the method of movable finite-length window weighting; that is, the music signal with window is expressed as follows:(19)swn=sn×ωn.Figure 4
Flow chart of preprocessing music signal.Digital processing of music signal using rectangular window and Hamming window is expressed as follows:Rectangular window:(20)ωn=1,0≤n≤n−1,0,otherwise.Hamming window:(21)ωn=0.54−0.46cos2πnM−1,0≤n≤M−1,0,n=else.In formula (21), M is expressed as the frame length. The comparison of relevant indexes of the rectangular window and Hamming window function is shown in Table 1.Table 1
Comparison of relevant indexes of rectangular window and Hamming window function.
Window typeSidelobe peak (dB)Main lobe widthMinimum stopband attenuation (dB)Rectangular window−144Π/M−23Hamming window−158Π/M−51As can be seen from Table1, for the main lobe width, the rectangular window is smaller than the Hamming window. However, the outer band attenuation of the rectangular window also decreases. Although the rectangular window has a good smoothing performance, its high-frequency component has a certain loss and loses the detail component. According to the above analysis, the Hamming window function has good performance.


### 3.2. Extracting Characteristic Parameters of Music Signal

The process of precisely describing a music signal using a set of parameters is known as music signal feature parameter extraction. To some degree, the performance of music genre categorization is determined by the selection of music characteristics. The accuracy and speed of music genre categorization may be improved by using good music signal properties.Through the examination of the results of hearing trials, Mel frequency cepstral coefficient (MFCC) analysis, it is thought that its voice qualities are excellent [26, 27]. The linear spectrum is first mapped to the Mel nonlinear spectrum based on auditory perception and then turned into a cepstrum, taking into consideration the features of human hearing. According to the work of Stevens and Volkman, there is the following conversion relationship:(22)fmel=2595×log101+f700.In formula (22), fmel is used to describe the perceived frequency, which is in Mel, and f is used to describe the actual frequency, in Hz. The music signal is preprocessed by the first-order FIR high-pass filter to the MFCC music signal. The goal is to compensate for the spectrum. Next, the preprocessed signal is divided into multiple overlapping frames, and each frame is multiplied by the Hamming window to reduce the ringing effect. The FFT operation is performed on each frame, and the corresponding frequency spectrum is obtained corresponding to the frame of the Hamming window. After the discrete cosine transform (DCT) processes the logarithm of Yb, the parameters for obtaining MFCC are expressed as follows:(23)MFCCγ=∑b=0Z−1ln1+EbcosγπZb+0.5,(24)Eb=∑k=0O−1Xak2Hbk,0≤b≤Z.In formula (23), Z is the total number of filters, and γ is the length of the MFCC feature vector. The function of offset 1 in MFCC is to get positive energy for any value. Finally, the MFCC feature vector is expressed as follows:(25)XMFCC=MFCC0,MFCC1,…,MFCCγ−1T.


### 3.3. Design of Music Genre Classification Network Model

The DBN model structure is formed by stacking RBMs. The feature dimension of the input sample is set to the number of visible units, and the number of hidden layer units needs to be given in advance. For the visible layer and the hidden layer,c is used to describe the connection matrix, and κ and θ are used to describe the bias vector. The implementation steps of the fast contrast divergence learning method are as follows:(1)
Initialization:q1=x0 is used to describe the initial state of the visible layer, and c, κ, and θ is used as random small values.(2)
Cycle allqt,t=1,2,3,…,T:Find the conditional probability distributionPq,w;α, and select q∈0,1 from itFind the conditional probability distributionPw′,q;α, and select w′∈0,1 from itFind the conditional probability distributionPq′,w′;α, and select q′∈0,1 from it.(3)
Parameter update:(26)ct+1=ct+ϑPq,w;αw−Pq′,w′;αw′κt+1=κt+ϑw′−wθt+1=θt+ϑPq,w;α−Pq′,w′;α.This article is based on the DBN model training implemented by the Theano library written in Python. The training of the DBN model includes two stages. The first step is the pretraining stage. The RBM is trained layer by layer from the DBN input layer to the output layer to obtain the DBN model layer and layer. The connection weight among each neural unit in the hidden layer is independent and obtained throughGibbs sampling. In the second step, in the fine-tuning stage, DBN uses the error back-propagation algorithm to fine-tune the connection weights in the model according to the output classification and sets the objective function as the maximum likelihood function to optimize the whole model. According to the RBM network structure [28–30], this paper designs the music genre classification network model structure as shown in Figure 5.Figure 5
Structure diagram of music genre classification network model.


### 3.4. Classification Algorithm Based on Sparse Representation

Under the music genre classification network model structure, for the test sampley, the sparse representation p⌢1 of the test vector can be calculated through formulas (13) and (15). The nonzero coefficients in the estimation should be related to the atoms belonging to a certain class i in U. Based on these nonzero coefficients, we can quickly judge which class the test sample belongs to [31, 32]. However, due to the existence of factors such as noise and model errors, there will be a small number of cases where p⌢1 is not zero in the projection coefficient. In order to distinguish the categories where y exists, a new vector δip⌢1=0,…,0,χi,1,χi,2,…,χi,ni,0,…,0T,i=1,2,…,G is constructed, whose nonzero elements are only p⌢1 related components. If y⌢i=Uδip⌢1, and there is a small distance from y, then y⌢i belongs to this category has a higher probability. The calculation formula is as follows:(27)μiy=y−Uδip⌢12,i=1,2,…,G.So the method of judging which categoryy belongs to is as follows:(28)identityy=argminiμiy.Through the above steps, the automatic classification of music genres is realized.


## 3.1. Preprocessing Music Signal

Usually, before classifying music genres, music signals need to be preprocessed, which is mainly divided into three steps: framing, preemphasis, and windowing. The music signal preprocessing process is shown in Figure4.(1)
Framing: For signal processing, framing is generally performed. The purpose of framing is to facilitate the extraction of features, and framing can also reduce the dimensionality of the feature matrix. When framing, you need to select the appropriate frame length and frame width. The following relationship among the sampling periodT=1/f, window width L, and frequency F can be expressed as:(16)F=1LT.It can be seen from formula (16) that when T is constant, the frequency F is determined by the change of the window width L, which is inversely proportional. At this time, the frequency resolution is improved, but the time resolution is reduced. Increasing the window width will result in a decrease in frequency resolution and an increase in time resolution, resulting in a contradiction between window width and frequency resolution. For this reason, an appropriate window length should be selected according to different needs. If the window width becomes larger, the appropriate window width is selected according to different needs. When selecting the length, we should also consider that it is suitable for computer operation. The computer operation is based on binary, so the selected length should also be an integer multiple of 2 as far as possible.(2)
Pre-emphasis: When classifying music genres, because glottic excitation directly affects the average power spectrum of music signals, it is difficult to obtain the spectrum. Therefore, pre-emphasis processing of music signals is required. In this paper, the first-order digital filter is used to pre-emphasis the music signal. The formula is as follows:(17)Hz=1−az−1.In formula (17), a is the pre-emphasis factor, which is generally taken as a decimal number close to 1. Assuming that the sample value of the music genre signal at time n is xn, the result after pre-emphasis is as follows:(18)yn=xn−axn−1.(3)
Windowing: It is for framing service. Framing itself means adding a window function. However, due to the truncation effect of the frame during framing, it is necessary to select a good window function. The good slope at both ends of the window shall be reduced as slowly as possible to avoid drastic changes. The frame division is realized by the method of movable finite-length window weighting; that is, the music signal with window is expressed as follows:(19)swn=sn×ωn.Figure 4
Flow chart of preprocessing music signal.Digital processing of music signal using rectangular window and Hamming window is expressed as follows:Rectangular window:(20)ωn=1,0≤n≤n−1,0,otherwise.Hamming window:(21)ωn=0.54−0.46cos2πnM−1,0≤n≤M−1,0,n=else.In formula (21), M is expressed as the frame length. The comparison of relevant indexes of the rectangular window and Hamming window function is shown in Table 1.Table 1
Comparison of relevant indexes of rectangular window and Hamming window function.
Window typeSidelobe peak (dB)Main lobe widthMinimum stopband attenuation (dB)Rectangular window−144Π/M−23Hamming window−158Π/M−51As can be seen from Table1, for the main lobe width, the rectangular window is smaller than the Hamming window. However, the outer band attenuation of the rectangular window also decreases. Although the rectangular window has a good smoothing performance, its high-frequency component has a certain loss and loses the detail component. According to the above analysis, the Hamming window function has good performance.


## 3.2. Extracting Characteristic Parameters of Music Signal

The process of precisely describing a music signal using a set of parameters is known as music signal feature parameter extraction. To some degree, the performance of music genre categorization is determined by the selection of music characteristics. The accuracy and speed of music genre categorization may be improved by using good music signal properties.Through the examination of the results of hearing trials, Mel frequency cepstral coefficient (MFCC) analysis, it is thought that its voice qualities are excellent [26, 27]. The linear spectrum is first mapped to the Mel nonlinear spectrum based on auditory perception and then turned into a cepstrum, taking into consideration the features of human hearing. According to the work of Stevens and Volkman, there is the following conversion relationship:(22)fmel=2595×log101+f700.In formula (22), fmel is used to describe the perceived frequency, which is in Mel, and f is used to describe the actual frequency, in Hz. The music signal is preprocessed by the first-order FIR high-pass filter to the MFCC music signal. The goal is to compensate for the spectrum. Next, the preprocessed signal is divided into multiple overlapping frames, and each frame is multiplied by the Hamming window to reduce the ringing effect. The FFT operation is performed on each frame, and the corresponding frequency spectrum is obtained corresponding to the frame of the Hamming window. After the discrete cosine transform (DCT) processes the logarithm of Yb, the parameters for obtaining MFCC are expressed as follows:(23)MFCCγ=∑b=0Z−1ln1+EbcosγπZb+0.5,(24)Eb=∑k=0O−1Xak2Hbk,0≤b≤Z.In formula (23), Z is the total number of filters, and γ is the length of the MFCC feature vector. The function of offset 1 in MFCC is to get positive energy for any value. Finally, the MFCC feature vector is expressed as follows:(25)XMFCC=MFCC0,MFCC1,…,MFCCγ−1T.


## 3.3. Design of Music Genre Classification Network Model

The DBN model structure is formed by stacking RBMs. The feature dimension of the input sample is set to the number of visible units, and the number of hidden layer units needs to be given in advance. For the visible layer and the hidden layer,c is used to describe the connection matrix, and κ and θ are used to describe the bias vector. The implementation steps of the fast contrast divergence learning method are as follows:(1)
Initialization:q1=x0 is used to describe the initial state of the visible layer, and c, κ, and θ is used as random small values.(2)
Cycle allqt,t=1,2,3,…,T:Find the conditional probability distributionPq,w;α, and select q∈0,1 from itFind the conditional probability distributionPw′,q;α, and select w′∈0,1 from itFind the conditional probability distributionPq′,w′;α, and select q′∈0,1 from it.(3)
Parameter update:(26)ct+1=ct+ϑPq,w;αw−Pq′,w′;αw′κt+1=κt+ϑw′−wθt+1=θt+ϑPq,w;α−Pq′,w′;α.This article is based on the DBN model training implemented by the Theano library written in Python. The training of the DBN model includes two stages. The first step is the pretraining stage. The RBM is trained layer by layer from the DBN input layer to the output layer to obtain the DBN model layer and layer. The connection weight among each neural unit in the hidden layer is independent and obtained throughGibbs sampling. In the second step, in the fine-tuning stage, DBN uses the error back-propagation algorithm to fine-tune the connection weights in the model according to the output classification and sets the objective function as the maximum likelihood function to optimize the whole model. According to the RBM network structure [28–30], this paper designs the music genre classification network model structure as shown in Figure 5.Figure 5
Structure diagram of music genre classification network model.


## 3.4. Classification Algorithm Based on Sparse Representation

Under the music genre classification network model structure, for the test sampley, the sparse representation p⌢1 of the test vector can be calculated through formulas (13) and (15). The nonzero coefficients in the estimation should be related to the atoms belonging to a certain class i in U. Based on these nonzero coefficients, we can quickly judge which class the test sample belongs to [31, 32]. However, due to the existence of factors such as noise and model errors, there will be a small number of cases where p⌢1 is not zero in the projection coefficient. In order to distinguish the categories where y exists, a new vector δip⌢1=0,…,0,χi,1,χi,2,…,χi,ni,0,…,0T,i=1,2,…,G is constructed, whose nonzero elements are only p⌢1 related components. If y⌢i=Uδip⌢1, and there is a small distance from y, then y⌢i belongs to this category has a higher probability. The calculation formula is as follows:(27)μiy=y−Uδip⌢12,i=1,2,…,G.So the method of judging which categoryy belongs to is as follows:(28)identityy=argminiμiy.Through the above steps, the automatic classification of music genres is realized.


## 4. Experimental Analysis

### 4.1. Experimental Environment and Data Set

The MATLAB 2016a programming software is utilised as an experimental platform, and a deep belief network based on the Theano library of Python language is developed to validate the efficiency of the automated categorization technique of music genres based on deep belief networks and sparse representation. Too much sample data will take up a lot of processing time while updating each level in the deep belief network. The sample database is separated into tiny batches of data packets in preparation to boost computing performance, and then, the batch learning approach is utilised. The fine-tuning learning rate is set to 0.1, while the pretraining learning rate is set to 0.01, in this study, and tests and verifications are carried out using the GTZAN data set, which contains 1000 audio files. There are ten different sorts of music genres included in these 1000 files, each having 100 samples. MPCC is utilised to extract the distinctive characteristics of a music signal in this experiment [33, 34]. The frame length is 512, and the number of frames is 2133. The sampling frequency is 48000 Hz, the sample bits are 16, the frame length is 512, and the number of frames is 2133 [33, 34]. In the stage of extracting Mel frequency cepstrum coefficient, 12 dimensional Mel filter is used, and its frequency index is shown in Table 2.Table 2
Frequency index of Mel filter.
NumberFrequency range (Hz)Center frequency (Hz)1[0, 76)242[24, 135)763[76, 213)1354[135, 305)2135[213, 368)3056[305, 468)3687[368, 543)4688[468, 659)5439[543, 768)65910[659, 905)76811[768, 1023)90512[905, 1154)1023The classification algorithm is based on the combination of a deep belief network and sparse representation. The methods of reference [7] and the methods of reference [8] are compared with the proposed methods to verify the effectiveness of the proposed methods.


### 4.2. Evaluation Indicators for Automatic Classification of Music Genres

The automatic classification evaluation indexes of music genres used in this paper are classification accuracy, recall, F1 value, confusion matrix, and classification time. The above classification evaluation indexes are used to evaluate the performance of the proposed method. The classification accuracy is expressed as the ratio of the number of correct samples to the total number of music genre samples. The calculation formula is expressed as follows:(29)Pr=FyFs×100%.In formula (29), Fy is the number of correctly classified samples, and Fs is the number of classified samples. The classification recall rate is expressed as the ratio of the number of correct samples classified to the total number of music genre samples. The higher the classification recall rate, the higher the classification accuracy of the method. The calculation formula is expressed as follows:(30)Re=FyFz×100%.In formula (30), Fz is the population size of the sample. The F1 value represents the harmonic mean of the accuracy rate and the recall rate. The closer the F1 value is to 1, the higher the classification accuracy of the method. The calculation formula is expressed as follows:(31)F1=2Pr×RePr+Re.


### 4.3. Effect of Automatic Classification of Music Genres

In order to verify the effect of automatic music genre classification, the confusion matrix is used to represent the effect of automatic music genre classification. Rock, metal, country, classical, and blues music genre samples are selected, the proposed method to evaluate the classification performance of the trained music genre classification network model is used, and the automatic classification effect of the proposed method is obtained as shown in Figure6.Figure 6
Automatic classification effect of music genre of the proposed method.Figure6 shows that rock, blues, and classical music all have high classification effects, with confusion matrices of 0.98, 0.96, and 0.95, respectively, although metal and country music had less misclassification, with confusion matrices of 0.88 and 0.85, respectively. Because certain country music may be used to accompany country dancing, and some related metal music is incorrectly labelled as country music, country music can easily be misclassified as metal music. There are also some differences between metal and rock music, maybe due to the fact that they all pay attention to rhythm and share commonalities. However, the suggested technique can successfully accomplish the automated classification of five music genres, according to the above study, and the automatic classification impact of music genres is superior.


### 4.4. Accuracy of Automatic Classification of Music Genres

In order to verify the classification accuracy of the proposed method, 1000 music genre samples are selected, and the methods of reference [7] and the methods of reference [8] and the proposed method are used for automatic classification of music genres, respectively. According to formula (29), the accuracy of automatic classification of music genres by different methods is calculated, and the comparison results are shown in Figure 7.Figure 7
Comparison results of automatic classification accuracy of music genres by different methods.It can be seen from Figure7 that under the number of 1000 music genre samples, the average accuracy of automatic music genre classification of the methods of reference [7] is 88%, the average accuracy of automatic music genre classification of the methods of reference [8] method is 82%, and the average accuracy of automatic music genre classification of the proposed method is as high as 95%. It can be seen that compared with the methods of reference [7] and the methods of reference [8], the proposed method has higher accuracy in automatic classification of music genres and can effectively improve the accuracy of automatic classification of music genres.On this basis, the accuracy comparison results of automatic classification of music genres by different methods are calculated according to formula (30), as shown in Figure 8.Figure 8
Comparison results of recall rates of automatic classification of music genres by different methods.As can be seen from Figure8, under the number of 1000 music genre samples, the average recall rate of automatic music genre classification of the methods of reference [7] is 85%, the average accuracy rate of automatic music genre classification of the methods of reference [8] is 78%, and the average accuracy rate of automatic music genre classification of the proposed method is as high as 97%. Therefore, compared with the methods of reference [7] and the methods of reference [8], the proposed method has a higher recall rate of automatic music genre classification, indicating that the automatic music genre classification accuracy of the proposed method is higher.On this basis, F1 values of automatic music genre classification of different methods are calculated according to formula (31), and the comparison results are shown in Figure 9.Figure 9
Comparison results of F1 values of automatic classification of music genres by different methods.The average music genre automatic classification F1 value of the methods of reference [7] is 0.74, the average music genre automatic classification F1 value of the methods of reference [8] method is 0.6, and the average music genre automatic classification F1 value of the proposed method is 0.98, as shown in Figure 9. As a result, when compared to the approaches of references [7, 8], the suggested method’s F1 value is closer to 1, suggesting that the proposed method’s accuracy is greater.Finally, the suggested technique has a high accuracy and recall rate for automated music genre classification, and the F1 value is near to 1, demonstrating that the proposed method may significantly increase automatic music genre classification accuracy.


### 4.5. Automatic Classification Time of Music Genres

On this basis, the automatic classification time of the proposed method is further verified. The methods of reference [7], the methods of reference [34], and the proposed method are used for the automatic classification of music genres, respectively. The comparison results of automatic classification time of music genres of different methods are shown in Table 3.Table 3
Comparison results of different methods of music genre automatic classification time.
Music genre samples (piece)The proposed method (s)The methods of reference [7] (s)The methods of reference [8] (s)2005.88.310.24008.212.715.160010.915.918.680013.618.422.9100015.822.625.8According to the data in Table3, the automated categorization time of music genres of various approaches grows as the number of music genre samples increases. The automatic classification time of music genre of the methods of reference [27] is 22.6 s, the automatic classification time of music genre of the methods of reference [8] is 25.8, and the automatic classification time of music genre of the proposed method is only 15.8 s when the number of music genre samples is 1000. It can be noticed that the suggested method’s automated categorization time of music genres is shorter than the approaches of reference [27, 28].


## 4.1. Experimental Environment and Data Set

The MATLAB 2016a programming software is utilised as an experimental platform, and a deep belief network based on the Theano library of Python language is developed to validate the efficiency of the automated categorization technique of music genres based on deep belief networks and sparse representation. Too much sample data will take up a lot of processing time while updating each level in the deep belief network. The sample database is separated into tiny batches of data packets in preparation to boost computing performance, and then, the batch learning approach is utilised. The fine-tuning learning rate is set to 0.1, while the pretraining learning rate is set to 0.01, in this study, and tests and verifications are carried out using the GTZAN data set, which contains 1000 audio files. There are ten different sorts of music genres included in these 1000 files, each having 100 samples. MPCC is utilised to extract the distinctive characteristics of a music signal in this experiment [33, 34]. The frame length is 512, and the number of frames is 2133. The sampling frequency is 48000 Hz, the sample bits are 16, the frame length is 512, and the number of frames is 2133 [33, 34]. In the stage of extracting Mel frequency cepstrum coefficient, 12 dimensional Mel filter is used, and its frequency index is shown in Table 2.Table 2
Frequency index of Mel filter.
NumberFrequency range (Hz)Center frequency (Hz)1[0, 76)242[24, 135)763[76, 213)1354[135, 305)2135[213, 368)3056[305, 468)3687[368, 543)4688[468, 659)5439[543, 768)65910[659, 905)76811[768, 1023)90512[905, 1154)1023The classification algorithm is based on the combination of a deep belief network and sparse representation. The methods of reference [7] and the methods of reference [8] are compared with the proposed methods to verify the effectiveness of the proposed methods.


## 4.2. Evaluation Indicators for Automatic Classification of Music Genres

The automatic classification evaluation indexes of music genres used in this paper are classification accuracy, recall, F1 value, confusion matrix, and classification time. The above classification evaluation indexes are used to evaluate the performance of the proposed method. The classification accuracy is expressed as the ratio of the number of correct samples to the total number of music genre samples. The calculation formula is expressed as follows:(29)Pr=FyFs×100%.In formula (29), Fy is the number of correctly classified samples, and Fs is the number of classified samples. The classification recall rate is expressed as the ratio of the number of correct samples classified to the total number of music genre samples. The higher the classification recall rate, the higher the classification accuracy of the method. The calculation formula is expressed as follows:(30)Re=FyFz×100%.In formula (30), Fz is the population size of the sample. The F1 value represents the harmonic mean of the accuracy rate and the recall rate. The closer the F1 value is to 1, the higher the classification accuracy of the method. The calculation formula is expressed as follows:(31)F1=2Pr×RePr+Re.


## 4.3. Effect of Automatic Classification of Music Genres

In order to verify the effect of automatic music genre classification, the confusion matrix is used to represent the effect of automatic music genre classification. Rock, metal, country, classical, and blues music genre samples are selected, the proposed method to evaluate the classification performance of the trained music genre classification network model is used, and the automatic classification effect of the proposed method is obtained as shown in Figure6.Figure 6
Automatic classification effect of music genre of the proposed method.Figure6 shows that rock, blues, and classical music all have high classification effects, with confusion matrices of 0.98, 0.96, and 0.95, respectively, although metal and country music had less misclassification, with confusion matrices of 0.88 and 0.85, respectively. Because certain country music may be used to accompany country dancing, and some related metal music is incorrectly labelled as country music, country music can easily be misclassified as metal music. There are also some differences between metal and rock music, maybe due to the fact that they all pay attention to rhythm and share commonalities. However, the suggested technique can successfully accomplish the automated classification of five music genres, according to the above study, and the automatic classification impact of music genres is superior.


## 4.4. Accuracy of Automatic Classification of Music Genres

In order to verify the classification accuracy of the proposed method, 1000 music genre samples are selected, and the methods of reference [7] and the methods of reference [8] and the proposed method are used for automatic classification of music genres, respectively. According to formula (29), the accuracy of automatic classification of music genres by different methods is calculated, and the comparison results are shown in Figure 7.Figure 7
Comparison results of automatic classification accuracy of music genres by different methods.It can be seen from Figure7 that under the number of 1000 music genre samples, the average accuracy of automatic music genre classification of the methods of reference [7] is 88%, the average accuracy of automatic music genre classification of the methods of reference [8] method is 82%, and the average accuracy of automatic music genre classification of the proposed method is as high as 95%. It can be seen that compared with the methods of reference [7] and the methods of reference [8], the proposed method has higher accuracy in automatic classification of music genres and can effectively improve the accuracy of automatic classification of music genres.On this basis, the accuracy comparison results of automatic classification of music genres by different methods are calculated according to formula (30), as shown in Figure 8.Figure 8
Comparison results of recall rates of automatic classification of music genres by different methods.As can be seen from Figure8, under the number of 1000 music genre samples, the average recall rate of automatic music genre classification of the methods of reference [7] is 85%, the average accuracy rate of automatic music genre classification of the methods of reference [8] is 78%, and the average accuracy rate of automatic music genre classification of the proposed method is as high as 97%. Therefore, compared with the methods of reference [7] and the methods of reference [8], the proposed method has a higher recall rate of automatic music genre classification, indicating that the automatic music genre classification accuracy of the proposed method is higher.On this basis, F1 values of automatic music genre classification of different methods are calculated according to formula (31), and the comparison results are shown in Figure 9.Figure 9
Comparison results of F1 values of automatic classification of music genres by different methods.The average music genre automatic classification F1 value of the methods of reference [7] is 0.74, the average music genre automatic classification F1 value of the methods of reference [8] method is 0.6, and the average music genre automatic classification F1 value of the proposed method is 0.98, as shown in Figure 9. As a result, when compared to the approaches of references [7, 8], the suggested method’s F1 value is closer to 1, suggesting that the proposed method’s accuracy is greater.Finally, the suggested technique has a high accuracy and recall rate for automated music genre classification, and the F1 value is near to 1, demonstrating that the proposed method may significantly increase automatic music genre classification accuracy.


## 4.5. Automatic Classification Time of Music Genres

On this basis, the automatic classification time of the proposed method is further verified. The methods of reference [7], the methods of reference [34], and the proposed method are used for the automatic classification of music genres, respectively. The comparison results of automatic classification time of music genres of different methods are shown in Table 3.Table 3
Comparison results of different methods of music genre automatic classification time.
Music genre samples (piece)The proposed method (s)The methods of reference [7] (s)The methods of reference [8] (s)2005.88.310.24008.212.715.160010.915.918.680013.618.422.9100015.822.625.8According to the data in Table3, the automated categorization time of music genres of various approaches grows as the number of music genre samples increases. The automatic classification time of music genre of the methods of reference [27] is 22.6 s, the automatic classification time of music genre of the methods of reference [8] is 25.8, and the automatic classification time of music genre of the proposed method is only 15.8 s when the number of music genre samples is 1000. It can be noticed that the suggested method’s automated categorization time of music genres is shorter than the approaches of reference [27, 28].


## 5. Conclusion

The automatic music genre classification method based on deep belief network and sparse representation proposed in this paper gives full play to the advantages of deep belief network and effectively realizes the automatic music genre classification combined with the sparse representation method. It has a good classification effect and high accuracy and can effectively shorten the time of automatic classification of music genres. However, in the process of automatic classification of music genres, this paper ignores the fuzziness of music genres. Therefore, in the next research, we can consider reasonably analyzing the music theory components of music genres and propose a direct end-to-end audio spectrum classification method to further improve the accuracy of music genre classification.



---

*Source: 8752217-2022-03-07.xml*