Audio retrieval method, system, electronic equipment and product
Through the segmentation processing of audio feature vectors and the matching of neural network models, the problems of low audio retrieval accuracy and high resource consumption in the existing technology are solved, and efficient and low-cost audio retrieval is achieved, which is suitable for a variety of application scenarios.
Patent Information
- Application Number
- CN202411025245.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-07-30
Smart Images

Figure CN118551075B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of digital audio signal processing, and in particular relates to an audio retrieval method, system, electronic equipment and product. Background Art
[0002] Audio storage and retrieval is an important technology in the field of computer hearing, which is used to convert audio signals into feature vectors that can be processed by computers, and to realize the storage and retrieval of audio content. With the continuous increase in the amount of audio data and the diversification of application scenarios, it is particularly important to efficiently store and retrieve audio data. At present, in the process of audio storage and retrieval, there has appeared a method and system for storing and retrieving massive digital audio fingerprints, such as the Chinese patent disclosed in publication number CN109857898A, which extracts the audio fingerprint of the audio to be identified and performs audio retrieval based on the audio fingerprint. However, in the process of using the prior art, the inventor found that there are at least the following problems in the prior art:
[0003] When using audio fingerprints for audio retrieval, the ability to capture audio details is limited, resulting in low matching accuracy when the audio contains background noise, speed changes, mixing, etc., and it is easy to fail when faced with slight changes in the audio (such as noise, pitch changes, time scaling), resulting in high false detection and missed detection rates; secondly, generating and storing large-scale audio fingerprint databases requires a large amount of storage space; in addition, due to the variety of sizes of different audio fingerprints, a large amount of computing resources is required when processing these audio fingerprints of different sizes, and in this case, hardware acceleration technology cannot be effectively used for processing, so the audio retrieval speed needs to be improved. Summary of the invention
[0004] The present invention aims to solve the above technical problems at least to a certain extent. The present invention provides an audio retrieval method, system, electronic device and product.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] In a first aspect, the present invention provides an audio retrieval method, comprising:
[0007] Acquire sample audio data, and segment the sample audio data to obtain a plurality of sample audio data segments;
[0008] Performing feature vector extraction processing on the plurality of sample audio data segments to obtain a plurality of sample audio feature vectors corresponding one-to-one to the plurality of sample audio data segments;
[0009] Storing multiple sample audio feature vectors in a preset vector database;
[0010] Acquire audio data to be retrieved, and segment the audio data to be retrieved to obtain multiple audio data segments to be retrieved;
[0011] Performing feature vector extraction processing on the plurality of audio data segments to be retrieved, to obtain a plurality of audio feature vectors to be retrieved corresponding one-to-one to the plurality of audio data segments to be retrieved; wherein the size of the audio feature vector to be retrieved is consistent with the size of the sample audio feature vector in the vector database;
[0012] A sample audio feature vector matching each of the audio feature vectors to be retrieved is retrieved from the vector database, and a retrieval result of the audio data to be retrieved is obtained based on the sample audio feature vector matching each of the audio feature vectors to be retrieved.
[0013] In a possible design, feature vector extraction processing is performed on the plurality of sample audio data segments to obtain a plurality of sample audio feature vectors corresponding one-to-one to the plurality of sample audio data segments, including:
[0014] Performing vectorization processing on the plurality of sample audio data segments respectively to obtain a plurality of sample audio data in vector form corresponding to the plurality of sample audio data segments one by one;
[0015] The feature vectors of the plurality of sample audio data in vector form are extracted respectively to obtain a plurality of sample audio feature vectors corresponding one-to-one to the plurality of sample audio data segments.
[0016] In a possible design, vectorization processing is performed on the plurality of sample audio data segments respectively to obtain a plurality of sample audio data in vector form matching the plurality of sample audio data segments, including:
[0017] Performing Fourier transform processing on the plurality of sample audio data segments respectively to obtain a plurality of frequency spectrograms corresponding to the plurality of sample audio data segments;
[0018] The logarithm of the amplitude of each frequency point in the multiple spectrograms is taken to obtain logarithmic spectra matching the multiple spectrograms, and the logarithmic spectra matching the multiple spectrograms are respectively used as sample audio data in the form of multiple vectors matching the multiple sample audio data segments.
[0019] In one possible design, when extracting feature vectors of multiple sample audio data in vector form respectively, a pre-built neural network model is used for implementation; wherein the neural network model includes multiple convolutional pooling layers connected in sequence, and each of the convolutional pooling layers includes multiple convolutional layers and a pooling layer connected in sequence.
[0020] In a possible design, after the sample audio data is segmented, identification information of multiple sample audio data segments and time position information of multiple sample audio data segments in the sample audio data are obtained; in the vector database, the sample audio feature vectors corresponding to each sample audio data segment are bound to the identification information of the current sample audio data segment and the time position information of the current sample audio data segment in the sample audio data; after the audio data to be retrieved is segmented, time position information of multiple audio data segments to be retrieved in the audio data to be retrieved is obtained.
[0021] In a possible design, retrieving a sample audio feature vector that matches each of the audio feature vectors to be retrieved from the vector database, and obtaining a retrieval result of the audio data to be retrieved based on the sample audio feature vectors that match each of the audio feature vectors to be retrieved, including:
[0022] Retrieving n sample audio feature vectors that best match each of the audio feature vectors to be retrieved from the vector database, and constructing multiple initial matching data sets based on the n sample audio feature vectors that best match each of the audio feature vectors to be retrieved; wherein n is a natural number greater than 0;
[0023] Grouping all initial matching data sets according to the values of the identification information to obtain m groups of second matching data sets with unique identification information; wherein m is a natural number greater than 0, and m≤n;
[0024] A vector distance threshold threshold_0 is set, and all second matching data sets whose vector distance between the audio to be retrieved and the matched sample feature vector is greater than the vector distance threshold threshold_0 are screened out from the m groups of second matching data sets, and the remaining second matching data sets are recorded as the screened second matching data sets;
[0025] Grouping the elements in the filtered second matching data set according to the values of the time position difference to obtain l groups of third matching data sets with unique time position difference values; wherein l is a natural number greater than 0, and l≤m;
[0026] Set an element number threshold threshold_1, and filter out all third matching data sets whose element number is less than the element number threshold threshold_1 in l groups of third matching data sets, and record the remaining third matching data sets as the filtered third matching data sets; wherein the number of the filtered third matching data sets is recorded as j, j is a natural number greater than 0, and j≤1;
[0027] Obtain the minimum time position value time_n_min and the maximum time position value time_n_max of the time position information in the j third matching data sets after screening, and record the j time segments [time_n_min, time_n_max] corresponding to the minimum time position value time_n_min and the maximum time position value time_n_max in the j third matching data sets after screening as candidate similar segments of the audio data to be retrieved, and any candidate similar segment [time_n_min, time_n_max] is a candidate similar segment of the audio data to be retrieved whose time position information is within the range of [Min(vtime_i), Min(vtime_i)+(time_n_max-time_n_min)] in the audio data to be retrieved; wherein Min(vtime_i) is the minimum value in the time position information of all audio feature vectors to be retrieved;
[0028] The comprehensive similarity between each candidate similar segment and the audio data to be retrieved is calculated, and the k candidate similar segments with the highest comprehensive similarities are taken as the final retrieval results of the audio data to be retrieved; wherein k is a natural number greater than 0, and k≤j.
[0029] In a possible design, any candidate similar segment [ , ] and the audio data to be retrieved is:
[0030]
[0031] In the formula, is a preset variable coefficient, and ; ; is the current candidate similar segment[ , ] The number of elements in the third matching data set after filtering; is the current candidate similar segment[ , ] is the vector distance between the i-th audio feature vector to be retrieved and the matching sample feature vector in the corresponding third matching data set after screening.
[0032] In a second aspect, the present invention provides an audio retrieval system for implementing any of the above-mentioned audio retrieval methods; the audio retrieval system comprises:
[0033] A database construction module, used to obtain sample audio data, and perform segmentation processing on the sample audio data to obtain multiple sample audio data segments; used to perform feature vector extraction processing on the multiple sample audio data segments to obtain multiple sample audio feature vectors corresponding to the multiple sample audio data segments; and also used to store the multiple sample audio feature vectors in a preset vector database;
[0034] A data preprocessing module, used to obtain audio data to be retrieved, and to perform segmentation processing on the audio data to be retrieved to obtain a plurality of audio data segments to be retrieved; and also used to perform feature vector extraction processing on the plurality of audio data segments to be retrieved to obtain a plurality of audio feature vectors to be retrieved corresponding to the plurality of audio data segments to be retrieved; wherein the size of the audio feature vector to be retrieved is consistent with the size of the sample audio feature vector in the vector database;
[0035] The audio retrieval module is respectively communicated with the database construction module and the data preprocessing module, and is used to retrieve sample audio feature vectors that match each of the audio feature vectors to be retrieved from the vector database, and obtain the retrieval results of the audio data to be retrieved based on the sample audio feature vectors that match each of the audio feature vectors to be retrieved.
[0036] In a third aspect, the present invention provides an electronic device, comprising:
[0037] a memory for storing computer program instructions; and,
[0038] A processor is used to execute the computer program instructions to complete the operation of the audio retrieval method as described in any one of the above.
[0039] In a fourth aspect, the present invention provides a computer program product, comprising a computer program or instructions, wherein the computer program or instructions, when executed by a computer, implements the audio retrieval method as described in any one of the above.
[0040] The beneficial effects of the present invention are:
[0041] The present invention discloses an audio retrieval method, system, electronic device and product. The audio retrieval is performed based on an audio feature vector, and the retrieval accuracy is higher, the retrieval speed can be further improved, and the storage cost is lower. Specifically, in the implementation process of the present invention, the construction process of the vector database is as follows: sample audio data is obtained, and the sample audio data is segmented to obtain a plurality of sample audio data segments, and feature vector extraction processing is performed on the plurality of sample audio data segments to obtain a plurality of sample audio feature vectors corresponding to the plurality of sample audio data segments, and then the plurality of sample audio feature vectors are stored in a preset vector database; when performing audio retrieval, the audio data to be retrieved is obtained, and the audio data to be retrieved is segmented to obtain a plurality of audio data segments to be retrieved, and feature vector extraction processing is performed on the plurality of audio data segments to be retrieved to obtain a plurality of audio feature vectors to be retrieved corresponding to the plurality of audio data segments to be retrieved, and finally, the sample audio feature vector matching each of the audio feature vectors to be retrieved is retrieved from the vector database, and the retrieval result of the audio data to be retrieved is obtained according to the sample audio feature vector matching each of the audio feature vectors to be retrieved. In this process, the present invention segments the audio data to be retrieved and extracts the audio feature vectors to be retrieved of each audio data segment to be retrieved, and then performs audio retrieval on this basis, so as to capture the multi-dimensional information of the audio (such as spectrum, time-frequency change, etc.), which is conducive to better adapting to complex audio transformations such as speed change and mixing, and can provide more details and higher resolution than audio fingerprints, thereby improving the matching accuracy during audio retrieval; at the same time, in the present invention, feature vectors are used instead of traditional audio fingerprints for audio retrieval, which has higher fault tolerance, and feature vectors are more standardized than audio fingerprints, suitable for large-scale parallel computing, and hardware acceleration technology can be used to further improve the retrieval speed; in addition, feature vectors have lower computational complexity and storage cost than audio fingerprints, and use vector databases to replace traditional full-text retrieval storage systems or column storage systems, which has lower storage costs and can be applied to speech recognition, music identification, voiceprint recognition and other fields, and has wide application value.
[0042] Other beneficial effects of the present invention will be further described in the specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a flowchart of the audio retrieval method in an embodiment;
[0044] Figure 2 It is a module block diagram of a neural network model in an embodiment;
[0045] Figure 3 It is a module block diagram of the audio retrieval system in the embodiment. DETAILED DESCRIPTION
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0047] Embodiment 1:
[0048] This embodiment discloses an audio retrieval method, which can be executed by, but is not limited to, a computer device or a virtual machine with certain computing resources, such as a personal computer, a smart phone, a personal digital assistant, or a wearable device, or by a virtual machine.
[0049] like Figure 1 As shown, an audio retrieval method may include but is not limited to the following steps:
[0050] S1. Obtain sample audio data, and perform segmentation processing on the sample audio data to obtain multiple sample audio data segments; in step S1, when the sample audio data is segmented, the segmentation duration of the multiple sample audio data segments obtained is 1 second. That is, in this embodiment, the sample audio data is segmented according to a fixed segmentation duration of 1 second, which can help reduce the computational complexity and improve the processing efficiency of subsequent steps such as feature vector extraction and processing. It is suitable for feature extraction and audio processing under limited computing resources. At the same time, it can improve the refinement and accuracy of subsequent feature extraction results, making it easier for the neural network model to learn the detailed information of the audio data, thereby improving the performance of the model, and can help the neural network model better generalize to audio data of different lengths, thereby improving the stability and applicability of the model.
[0051] S2. Perform feature vector extraction processing on the multiple sample audio data segments to obtain multiple sample audio feature vectors corresponding to the multiple sample audio data segments.
[0052] In step S2, feature vector extraction processing is performed on the plurality of sample audio data segments to obtain a plurality of sample audio feature vectors corresponding one-to-one to the plurality of sample audio data segments, including:
[0053] S201. Perform vectorization processing on the multiple sample audio data segments respectively to obtain multiple sample audio data in vector form corresponding to the multiple sample audio data segments one by one; it should be noted that, in this embodiment, the multiple sample audio data segments are vectorized, that is, the multiple sample audio data segments are converted into mathematical vectors for subsequent data processing and analysis.
[0054] In step S201, vectorization processing is performed on the plurality of sample audio data segments respectively to obtain a plurality of sample audio data in vector form matching the plurality of sample audio data segments, including:
[0055] S201a respectively perform Fourier transform processing on the plurality of sample audio data segments to obtain a plurality of spectrograms corresponding to the plurality of sample audio data segments;
[0056] S202b. Take the logarithm of the amplitude of each frequency point in the multiple spectrograms to obtain logarithmic spectra matching the multiple spectrograms, and use the logarithmic spectra matching the multiple spectrograms as multiple sample audio data in vector form matching the multiple sample audio data segments.
[0057] It should be noted that, respectively performing vectorization processing on the plurality of sample audio data segments, that is, respectively calculating the logarithmic spectrum of each sample audio data segment, can facilitate compressing the dynamic range of the sample audio data segment, thereby improving the processing efficiency of the audio data. In this embodiment, by using the logarithmic spectrum to represent the spectrum graph, the spectrum characteristics of the sample audio data segment can be displayed more clearly, which can help extract the characteristics of the audio data, facilitate subsequent feature vector extraction and other processing, and thus facilitate more effective audio retrieval and recognition.
[0058] S202. Extract feature vectors of the plurality of sample audio data in vector form respectively, and obtain a plurality of sample audio feature vectors corresponding to the plurality of sample audio data segments. It should be noted that extracting feature vectors of the plurality of sample audio data in vector form respectively means extracting data describing audio features from the plurality of sample audio data in vector form respectively, and these feature vectors may include spectral features, time domain features, and frequency domain features of the audio, etc., for subsequent analysis, classification, or recognition of the audio data to be retrieved.
[0059] In step S202, when extracting the feature vectors of the plurality of sample audio data in vector form, a pre-built neural network model is used; wherein, Figure 2 As shown, the neural network model includes a plurality of sequentially connected convolutional pooling layers, and each of the convolutional pooling layers includes a plurality of sequentially connected convolutional layers and a pooling layer.
[0060] It should be noted that the convolutional pooling layer can extract the feature vector of the input data through the convolution operation, and reduce the size of the feature through the pooling operation, thereby realizing the abstraction and compression of the feature, so as to improve the computational efficiency, reduce the overfitting phenomenon, and help the neural network model learn the feature vectors in the sample audio data in the vector form, thereby improving the generalization ability and accuracy of the neural network model. Specifically, in this embodiment, when extracting the feature vector of any sample audio data, the multiple convolutional layers in any convolutional pooling layer can extract the feature vectors of different levels in the input data. By stacking multiple convolutional layers, the receptive field of the neural network model to the input can be expanded, so that the neural network model can better understand the local features in the audio data. By setting multiple convolutional pooling layers, multiple levels of feature extraction can be realized, and more complex audio features can be captured.
[0061] It should be noted that feature vector extraction can also be achieved through methods such as MFCC (Mel-Frequency Cepstral Coefficients) feature extraction, time domain feature extraction (such as zero crossing rate, amplitude envelope, etc.) or frequency domain feature extraction (such as frequency, spectrum flatness, etc.). In this embodiment, the feature vector of the sample audio data in vector form is extracted through a neural network model. Compared with the above method, it has the following technical effects: 1) It can be beneficial to automatically adjust the network structure and parameters according to the characteristics of the input audio data to adapt to the feature extraction of different types of audio data; 2) The neural network model has a strong nonlinear modeling ability, which can better capture the complex nonlinear relationship in the audio data and improve the accuracy of feature extraction; 3) Through large-scale data training, the neural network model can have good generalization ability, suitable for different types of audio data, and can adapt to new audio data within a certain range.
[0062] S3. Store multiple sample audio feature vectors into a preset vector database.
[0063] S4. Obtain the audio data to be retrieved, and segment the audio data to be retrieved to obtain multiple audio data segments to be retrieved; it should be noted that, in this embodiment, when the audio data to be retrieved is segmented, it is consistent with the step of segmenting the sample audio data, that is, the audio data to be retrieved is segmented according to a fixed segmentation length of 1 second.
[0064] S5. Perform feature vector extraction processing on the multiple audio data segments to be retrieved, and obtain multiple audio feature vectors to be retrieved corresponding one-to-one to the multiple audio data segments to be retrieved; wherein, the size of the audio feature vector to be retrieved is consistent with the size of the sample audio feature vector in the vector database. It should be noted that, in this embodiment, the step of extracting the feature vector of the audio data segment to be retrieved is the same as the step of extracting the feature vector of the sample audio data in vector form, that is, firstly vectorize the multiple audio data segments to be retrieved respectively, and obtain multiple audio data to be retrieved in vector form corresponding one-to-one to the multiple audio data segments to be retrieved, and then extract the feature vectors of the multiple audio data to be retrieved in vector form through the pre-constructed neural network model respectively, and obtain multiple audio feature vectors to be retrieved corresponding one-to-one to the multiple audio data segments to be retrieved, so as to ensure that the size of the extracted audio feature vector to be retrieved is consistent with the size of the sample audio feature vector in the vector database.
[0065] S6. Retrieve sample audio feature vectors that match each of the audio feature vectors to be retrieved from the vector database, and obtain retrieval results of the audio data to be retrieved based on the sample audio feature vectors that match each of the audio feature vectors to be retrieved.
[0066] In step S1 of this embodiment, after the sample audio data is segmented, identification information of multiple sample audio data segments and time position information of multiple sample audio data segments in the sample audio data are obtained; in step S3, in the vector database, the sample audio feature vectors corresponding to each sample audio data segment are bound with the identification information of the current sample audio data segment and the time position information of the current sample audio data segment in the sample audio data; that is, the sample audio feature vectors of multiple sample audio data segments, the identification information of multiple sample audio data segments and the time position information of multiple sample audio data segments in the sample audio data are stored in the vector database in a one-to-one correspondence. In step S4, after the audio data to be retrieved is segmented, time position information of multiple audio data segments to be retrieved in the audio data to be retrieved is obtained.
[0067] Specifically, in step S6, a sample audio feature vector matching each of the audio feature vectors to be retrieved is retrieved from the vector database, and a retrieval result of the audio data to be retrieved is obtained according to the sample audio feature vector matching each of the audio feature vectors to be retrieved, including:
[0068] S601. Retrieve n sample audio feature vectors that best match each of the audio feature vectors to be retrieved from the vector database, and construct multiple initial matching data sets based on the n sample audio feature vectors that best match each of the audio feature vectors to be retrieved; it should be understood that the number of initial matching data sets is consistent with the number of audio feature vectors to be retrieved; wherein the i-th initial matching data set constructed based on the n sample audio feature vectors that best match the i-th audio feature vector vi to be retrieved is expressed as: [{ID_1, distance_1, t1, time_1}, {ID_2, distance_2, t2, time_2}, ..., {ID_n, distance_n, tn, time_n}], t1, t2, ... and tn are the initial matching data sets corresponding to the i-th audio feature vector vi, respectively. The 1st to nth sample feature vectors that best match the feature vector vi, ID_1, ID_2, ... and ID_n are the identification information bound to the 1st to nth sample feature vectors, time_1, time_2, ... and time_n are the time position information bound to the 1st to nth sample feature vectors, distance_1, distance_2, ... and distance_n are the vector distances between the i-th audio feature vector vi to be retrieved and the 1st to nth sample feature vectors, respectively, and i and n are both natural numbers greater than 0; it should be understood that the values of the identification information ID_1, ID_2, ... and ID_n may be repeated, such as the values of ID_1 and ID_2 are the same, in which case the feature vectors t1 and t2 corresponding to ID_1 and ID_2 are located in the same sample audio data.
[0069] Specifically, in order to improve the retrieval efficiency, in this embodiment, when retrieving n sample audio feature vectors that best match each of the audio feature vectors to be retrieved from the vector database, all the audio feature vectors to be retrieved can be first grouped into a set of audio feature vectors to be retrieved, and the set of audio feature vectors to be retrieved is expressed as: V={v1, v2,..., vi}; v1, v2,..., vi are each audio feature vector to be retrieved; and then the set of audio feature vectors to be retrieved is submitted to the vector database for retrieval to obtain n sample audio feature vectors that best match each of the audio feature vectors to be retrieved.
[0070] S602. Group all initial matching data sets according to the value of the identification information to obtain m groups of second matching data sets with unique identification information; wherein m is a natural number greater than 0, and m≤n; specifically, if in multiple initial matching data sets, the values of the identification information ID_n and other identification information are different, then the second matching data set corresponding to the identification information ID_n is expressed as: {ID_n, R}, R is a first intermediate set matching the identification information ID_n, and the elements in the first intermediate set R are: {vi, vtime_i, distance_n, tn, time_n, diff_n}, vtime_i is the time position information of the i-th audio feature vector vi to be retrieved, and diff_n is the time position difference between the time position information time_n bound to the n-th sample feature vector and the time position information vtime_i of the i-th audio feature vector vi to be retrieved;
[0071] S603. Set a vector distance threshold threshold_0, and filter out all the second matching data sets in the m groups of second matching data sets, where the value of the vector distance distance_n between the audio to be retrieved and the matching sample feature vector in the first intermediate set R is greater than the vector distance threshold threshold_0, and record the remaining second matching data sets as the filtered second matching data sets;
[0072] S604. Group the elements in all the first intermediate sets R of the second matching data set after screening according to the values of the time position difference diff_n, and obtain l groups of third matching data sets with unique time position differences; wherein l is a natural number greater than 0, and l≤m; if in the first intermediate set R of the second matching data set after screening, the time position difference diff_n and the values of other time position differences are different, then the third matching data set corresponding to the time position difference diff_n is expressed as: {diff_n,E}, E is the second intermediate set matching the time position difference diff_n, and the elements in the second intermediate set E are: {vtime_i,distance_n,time_n,diff_n};
[0073] In this embodiment, if e1, e2, ... and en are all elements in the second intermediate set E, the second intermediate set E can be expressed as: [e1, e2, ..., en], and en = {vtime_i, distance_n, time_n, diff_n};
[0074] S605. Set an element number threshold threshold_1, and filter out all third matching data sets whose number of elements in the second intermediate set E is less than the element number threshold threshold_1 in the l groups of third matching data sets, and record the remaining third matching data sets as the filtered third matching data sets; wherein the number of the filtered third matching data sets is recorded as j, j is a natural number greater than 0, and j≤1;
[0075] S606. Obtain the minimum time position value time_n_min and the maximum time position value time_n_max of the time position information time_n in the second intermediate set E of the j third matching data sets after screening, and record the j time segments [time_n_min, time_n_max] corresponding to the minimum time position value time_n_min and the maximum time position value time_n_max in the second intermediate set E of the j third matching data sets after screening as candidate similar segments of the audio data to be retrieved, and any candidate similar segment [time_n_min, time_n_max] is a candidate similar segment of the audio data to be retrieved whose time position information is within the range of [Min(vtime_i), Min(vtime_i)+(time_n_max-time_n_min)] in the audio data to be retrieved; wherein Min(vtime_i) is the minimum value in the time position information of all audio feature vectors to be retrieved;
[0076] S607. Calculate the comprehensive similarity between each candidate similar segment and the audio data to be retrieved, and take the k candidate similar segments with the highest comprehensive similarities as the final retrieval results of the audio data to be retrieved; wherein k is a natural number greater than 0, and k≤j.
[0077] In step S607, any candidate similar segment [ , ] and the comprehensive similarity between the audio data to be retrieved is:
[0078]
[0079] In the formula, is a preset variable coefficient, and ; ; is the current candidate similar segment[ , ] The number of elements in the second intermediate set E of the third matching data set after screening corresponding to the first matching data set; is the current candidate similar segment[ , ] is the vector distance between the i-th audio feature vector vi to be retrieved and the matching sample feature vector in the second intermediate set E of the corresponding third matching data set after screening.
[0080] It should be noted that, when performing audio retrieval, the present embodiment first retrieves the n sample audio feature vectors that best match each audio feature vector to be retrieved based on the vector database, and then groups and screens all retrieved sample audio feature vectors according to the value of the identification information to obtain a second matched data set after screening, and then groups and further screens the second matched data set after screening according to the value of the time position difference to obtain a third matched data set after screening, and finally extracts multiple candidate similar segments according to the third matched data set after screening, and obtains the final retrieval result of the audio data to be retrieved according to the comprehensive similarity between the candidate similar segments and the audio data to be retrieved. In this process, the present embodiment uses audio feature vectors for matching, measures the similarity between audios by calculating vector distance, uses vector databases to achieve efficient retrieval, and gradually filters out unmatched or low-matching audio segments through a multi-level, step-by-step matching and screening process to narrow the candidate range of the retrieval results, which can achieve efficient and accurate audio retrieval effects and is suitable for various application scenarios requiring high-precision audio retrieval. Specifically, in this embodiment, from the initial matching data set to the second matching data set, and then to the third matching data set, a hierarchical filtering method is adopted to gradually eliminate irrelevant data, which can reduce the amount of calculation and improve the efficiency of audio retrieval; by setting different thresholds (such as vector distance threshold threshold_0 and element number threshold threshold_1), the accuracy and scope of the retrieval can be flexibly adjusted to adapt to different application requirements; in the matching process, matching and screening are combined with time position information, which helps to better process the timing characteristics of audio data and improve the retrieval effect, and by calculating the comprehensive similarity of candidate similar segments, the relevance and reliability of the final retrieval results are further ensured.
[0081] This embodiment performs audio retrieval based on audio feature vectors, which has higher retrieval accuracy, can further improve retrieval speed, and has lower storage cost. Specifically, during the implementation of this embodiment, the construction process of the vector database is as follows: sample audio data is obtained, and the sample audio data is segmented to obtain multiple sample audio data segments, and feature vector extraction processing is performed on the multiple sample audio data segments to obtain multiple sample audio feature vectors corresponding to the multiple sample audio data segments, and then the multiple sample audio feature vectors are stored in a preset vector database; when performing audio retrieval, the audio data to be retrieved is obtained, and the audio data to be retrieved is segmented to obtain multiple audio data segments to be retrieved, and feature vector extraction processing is performed on the multiple audio data segments to be retrieved to obtain multiple audio feature vectors to be retrieved corresponding to the multiple audio data segments to be retrieved, and finally, the sample audio feature vector matching each audio feature vector to be retrieved is retrieved from the vector database, and the retrieval result of the audio data to be retrieved is obtained according to the sample audio feature vector matching each audio feature vector to be retrieved. In this process, this embodiment can capture multi-dimensional information of the audio (such as spectrum, time-frequency change, etc.) by segmenting the audio data to be retrieved and extracting the audio feature vectors of each audio data segment to be retrieved, and then performing audio retrieval on this basis, which is conducive to better adapting to complex audio transformations such as speed change and mixing, and can provide more details and higher resolution than audio fingerprints, thereby improving the matching accuracy during audio retrieval; at the same time, in this embodiment, feature vectors are used instead of traditional audio fingerprints for audio retrieval, which has higher fault tolerance, and feature vectors are more standardized than audio fingerprints, suitable for large-scale parallel computing, and hardware acceleration technology can be used to further improve the retrieval speed; in addition, feature vectors have lower computational complexity and storage cost than audio fingerprints, and using vector databases instead of traditional full-text retrieval storage systems or column storage systems has lower storage costs, can be applied to speech recognition, music identification, voiceprint recognition and other fields, and has wide application value.
[0082] Embodiment 2:
[0083] This embodiment discloses an audio retrieval system for implementing the audio retrieval method in Embodiment 1; Figure 3 As shown, the audio retrieval system comprises:
[0084] A database construction module, used to obtain sample audio data, and perform segmentation processing on the sample audio data to obtain multiple sample audio data segments; used to perform feature vector extraction processing on the multiple sample audio data segments to obtain multiple sample audio feature vectors corresponding to the multiple sample audio data segments; and also used to store the multiple sample audio feature vectors in a preset vector database;
[0085] A data preprocessing module, used to obtain audio data to be retrieved, and to perform segmentation processing on the audio data to be retrieved to obtain a plurality of audio data segments to be retrieved; and also used to perform feature vector extraction processing on the plurality of audio data segments to be retrieved to obtain a plurality of audio feature vectors to be retrieved corresponding to the plurality of audio data segments to be retrieved; wherein the size of the audio feature vector to be retrieved is consistent with the size of the sample audio feature vector in the vector database;
[0086] The audio retrieval module is respectively communicated with the database construction module and the data preprocessing module, and is used to retrieve sample audio feature vectors that match each of the audio feature vectors to be retrieved from the vector database, and obtain the retrieval results of the audio data to be retrieved based on the sample audio feature vectors that match each of the audio feature vectors to be retrieved.
[0087] It should be noted that the working process, working details and technical effects of the audio retrieval system provided in this embodiment 2 can be found in embodiment 1 and will not be repeated here.
[0088] Embodiment 3:
[0089] Based on Embodiment 1 or 2, this embodiment discloses an electronic device, which may be a smart phone, a tablet computer, a laptop computer, or a desktop computer, etc. The electronic device may be called a user terminal, a portable terminal, a desktop terminal, etc. The electronic device includes:
[0090] a memory for storing computer program instructions; and,
[0091] A processor is used to execute the computer program instructions to complete the operation of the audio retrieval method as described in any one of Example 1.
[0092] Embodiment 4:
[0093] Based on any one of Examples 1 to 3, this embodiment discloses a computer program product, including a computer program or instructions, which implement the audio retrieval method as described in any one of Example 1 when executed by a computer.
[0094] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above embodiments, a person skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An audio retrieval method, characterized in that: include: Acquire sample audio data, and segment the sample audio data to obtain a plurality of sample audio data segments; Performing feature vector extraction processing on the plurality of sample audio data segments to obtain a plurality of sample audio feature vectors corresponding one-to-one to the plurality of sample audio data segments; Storing multiple sample audio feature vectors in a preset vector database; Acquire audio data to be retrieved, and segment the audio data to be retrieved to obtain multiple audio data segments to be retrieved; Performing feature vector extraction processing on the plurality of audio data segments to be retrieved, to obtain a plurality of audio feature vectors to be retrieved corresponding one-to-one to the plurality of audio data segments to be retrieved; wherein the size of the audio feature vector to be retrieved is consistent with the size of the sample audio feature vector in the vector database; Retrieving a sample audio feature vector that matches each of the audio feature vectors to be retrieved from the vector database, and obtaining a retrieval result of the audio data to be retrieved based on the sample audio feature vectors that match each of the audio feature vectors to be retrieved; After the sample audio data is segmented, identification information of the multiple sample audio data segments and time position information of the multiple sample audio data segments in the sample audio data are obtained; in the vector database, the sample audio feature vectors corresponding to each sample audio data segment are bound with the identification information of the current sample audio data segment and the time position information of the current sample audio data segment in the sample audio data; after the audio data to be retrieved is segmented, time position information of the multiple audio data segments to be retrieved in the audio data to be retrieved is obtained; Retrieving a sample audio feature vector that matches each of the audio feature vectors to be retrieved from the vector database, and obtaining a retrieval result of the audio data to be retrieved based on the sample audio feature vectors that match each of the audio feature vectors to be retrieved, including: Retrieving n sample audio feature vectors that best match each of the audio feature vectors to be retrieved from the vector database, and constructing multiple initial matching data sets based on the n sample audio feature vectors that best match each of the audio feature vectors to be retrieved; wherein n is a natural number greater than 0; Grouping all initial matching data sets according to the values of the identification information to obtain m groups of second matching data sets with unique identification information; wherein m is a natural number greater than 0, and m≤n; A vector distance threshold threshold_0 is set, and all second matching data sets whose vector distance between the audio to be retrieved and the matched sample feature vector is greater than the vector distance threshold threshold_0 are screened out from the m groups of second matching data sets, and the remaining second matching data sets are recorded as the screened second matching data sets; Grouping the elements in the filtered second matching data set according to the values of the time position difference to obtain l groups of third matching data sets with unique time position difference values; wherein l is a natural number greater than 0, and l≤m; Set an element number threshold threshold_1, and filter out all third matching data sets whose element number is less than the element number threshold threshold_1 in l groups of third matching data sets, and record the remaining third matching data sets as the filtered third matching data sets; wherein the number of the filtered third matching data sets is recorded as j, j is a natural number greater than 0, and j≤1; Obtain the minimum time position value time_n_min and the maximum time position value time_n_max of the time position information in the j third matching data sets after screening, and record the j time segments [time_n_min, time_n_max] corresponding to the minimum time position value time_n_min and the maximum time position value time_n_max in the j third matching data sets after screening as candidate similar segments of the audio data to be retrieved, and any candidate similar segment [time_n_min, time_n_max] is a candidate similar segment of the audio data to be retrieved whose time position information is within the range of [Min(vtime_i), Min(vtime_i)+(time_n_max-time_n_min)] in the audio data to be retrieved; wherein Min(vtime_i) is the minimum value in the time position information of all audio feature vectors to be retrieved; The comprehensive similarity between each candidate similar segment and the audio data to be retrieved is calculated, and the k candidate similar segments with the highest comprehensive similarities are taken as the final retrieval results of the audio data to be retrieved; wherein k is a natural number greater than 0, and k≤j.
2. An audio retrieval method according to claim 1, characterized in that: Performing feature vector extraction processing on the plurality of sample audio data segments to obtain a plurality of sample audio feature vectors corresponding one-to-one to the plurality of sample audio data segments includes: Performing vectorization processing on the plurality of sample audio data segments respectively to obtain a plurality of sample audio data in vector form corresponding to the plurality of sample audio data segments one by one; The feature vectors of the plurality of sample audio data in vector form are extracted respectively to obtain a plurality of sample audio feature vectors corresponding one-to-one to the plurality of sample audio data segments.
3. An audio retrieval method according to claim 2, characterized in that: Performing vectorization processing on the plurality of sample audio data segments respectively to obtain a plurality of sample audio data in vector form matching the plurality of sample audio data segments comprises: Performing Fourier transform processing on the plurality of sample audio data segments respectively to obtain a plurality of frequency spectrograms corresponding to the plurality of sample audio data segments; The logarithm of the amplitude of each frequency point in the multiple spectrograms is taken to obtain logarithmic spectra matching the multiple spectrograms, and the logarithmic spectra matching the multiple spectrograms are respectively used as sample audio data in the form of multiple vectors matching the multiple sample audio data segments.
4. The audio retrieval method according to claim 2, characterized in that: When extracting feature vectors of multiple sample audio data in vector form respectively, a pre-built neural network model is used for implementation; wherein the neural network model includes multiple convolutional pooling layers connected in sequence, and each of the convolutional pooling layers includes multiple convolutional layers and a pooling layer connected in sequence.
5. The audio retrieval method according to claim 1, characterized in that: Any candidate similar fragment[ , ] and the comprehensive similarity between the audio data to be retrieved is: In the formula, is a variable coefficient, and ; ; is the current candidate similar segment[ , ] The number of elements in the third matching data set after filtering; d is the current candidate similar segment[ , ] The i-th audio feature vector vi to be retrieved in the third matching data set after screening and the matching The vector distance between the feature vectors of the samples.
6. An audio retrieval system, characterized in that: Used to implement the audio retrieval method as described in any one of claims 1 to 5; The audio retrieval system comprises: A database construction module, used to obtain sample audio data, and perform segmentation processing on the sample audio data to obtain multiple sample audio data segments; used to perform feature vector extraction processing on the multiple sample audio data segments to obtain multiple sample audio feature vectors corresponding to the multiple sample audio data segments; and also used to store the multiple sample audio feature vectors in a preset vector database; A data preprocessing module, used to obtain audio data to be retrieved, and to perform segmentation processing on the audio data to be retrieved to obtain a plurality of audio data segments to be retrieved; and also used to perform feature vector extraction processing on the plurality of audio data segments to be retrieved to obtain a plurality of audio feature vectors to be retrieved corresponding to the plurality of audio data segments to be retrieved; wherein the size of the audio feature vector to be retrieved is consistent with the size of the sample audio feature vector in the vector database; The audio retrieval module is respectively communicated with the database construction module and the data preprocessing module, and is used to retrieve sample audio feature vectors that match each of the audio feature vectors to be retrieved from the vector database, and obtain the retrieval results of the audio data to be retrieved based on the sample audio feature vectors that match each of the audio feature vectors to be retrieved.
7. An electronic device, characterized in that: include: a memory for storing computer program instructions; as well as, A processor, configured to execute the computer program instructions to complete the operation of the audio retrieval method as described in any one of claims 1 to 5.
8. A computer program product comprising a computer program or instructions, characterized in that: When the computer program or the instruction is executed by a computer, the audio retrieval method according to any one of claims 1 to 5 is implemented.
