A shortwave communication voice detection method based on HOG+SVM
Patent Information
- Application Number
- CN202210175396.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-24
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-02-24
AI Technical Summary
In short-wave communication detection and control, existing technology is difficult to accurately detect speech, especially in environments with severe noise and interference, resulting in a high false detection rate, and a more accurate and efficient method is urgently needed.
A method based on HOG+SVM is used to convert audio data into spectrograms, extract directional gradient histogram features, and use support vector machine classifiers for training and classification to distinguish speech and noise.
It improves the accuracy of speech detection, has good generalization ability, adapts to different languages, genders and conversation forms, and reduces the false detection rate.
Smart Images

Figure CN114792529B
Abstract
Description
Technical Field
[0001] The invention relates to the field of shortwave communication monitoring, and in particular to an automatic voice detection method. Background Art
[0002] In the shortwave detection work, shortwave radio stations with known frequencies are often monitored 24 hours a day to avoid missing important emergencies. Shortwave signals are collected, identified, and demodulated to generate audio data, which is then manually screened and re-listened.
[0003] In order to save manpower, automatic means are currently used to detect recordings, and valid voices are screened out before manual transcription. The current main voice detection method is to set a volume threshold value. When the volume of the audio data exceeds this threshold value, it is regarded as the starting point of the voice. When the volume is lower than the threshold value for a period of time, the voice extraction ends.
[0004] However, as the spatial spectrum environment deteriorates, the RF spectrum becomes very crowded and channels interfere with each other seriously. The controlled frequency is usually mixed with strong noise and interference signals even when there is no call, which greatly reduces the accuracy of voice detection of current methods.
[0005] At present, the improved voice detection method in engineering applications is to use the fact that the volume of voice fluctuates greatly and frequently within a unit time, unlike noise which is almost continuous and has a small volume change. However, this improved method still has a large false detection rate in the case of changing noise and fast and continuous voice, and a more accurate and efficient method for detecting voice from noise is urgently needed. Summary of the invention
[0006] In order to solve the problems in the background technology, the present invention proposes a shortwave communication voice detection method based on HOG+SVM.
[0007] The technical solution adopted by the present invention is:
[0008] A shortwave communication voice detection method based on HOG+SVM comprises the following steps:
[0009] Step 1: classify the audio data into speech and noise and cut them into audio segments, generate a spectrogram based on the audio segments, and then perform grayscale preprocessing on the spectrogram;
[0010] Step 2: Divide the spectrogram into cells, calculate the gradient magnitude and gradient direction of each pixel in cells, count the gradient magnitudes distributed in different directions in each cell, form a directional gradient histogram, and calculate the directional gradient histogram of all cells in the graph to form the HOG feature of the spectrogram;
[0011] Step 3, using the HOG features of the speech spectrogram as positive samples and the HOG features of the noise spectrogram as negative samples, train the SVM classifier;
[0012] Step 4, set the detection window width, scan the shortwave communication recording data with the detection window as the unit, generate a spectrogram based on the audio data in the window, extract HOG features after preprocessing the spectrogram, and then input the HOG features into the trained SVM classifier for classification to extract the voice data.
[0013] Furthermore, the step 1 comprises:
[0014] Step 1-1, classify the audio data recorded in the shortwave communication monitoring work into voice and noise, wherein the voice is used as a positive sample during training, and the noise is used as a negative sample during training;
[0015] Step 1-2, dividing the speech and noise data into segments according to the predetermined detection window and spectrogram resolution requirements;
[0016] Step 1-3, generating a spectrogram based on the audio clip according to a predetermined resolution requirement;
[0017] Step 1-4, grayscale the spectrogram, converting the three RGB color components of the image into a grayscale value of only one component.
[0018] Furthermore, the step 2 comprises:
[0019] Step 2-1, dividing the spectrogram into cells according to a predetermined size;
[0020] Step 2-2, calculating the gradient magnitude in the horizontal and vertical directions of each pixel in the cell, and calculating the gradient direction value of each pixel position accordingly;
[0021] Step 2-3, divide the 360-degree gradient direction into multiple strips, traverse all the pixels in the cell, count the gradient amplitude falling into each strip, and form a directional gradient histogram of a single cell;
[0022] Step 2-4, traverse all cells in the image, calculate and count the directional gradient histogram of each cell in the same way as step 2-3, and form the HOG feature of the entire spectrogram.
[0023] Furthermore, the step 3 is: training the SVM classifier using the HOG features of the speech spectrogram as positive samples and the HOG features of the noise spectrogram as negative samples; and adjusting the classifier parameters by combining multiple types of training samples so that the separation hyperplane of the SVM classifier has the maximum distance between the speech HOG feature samples and the noise HOG feature samples.
[0024] Further, the step 4 comprises:
[0025] Step 4-1, according to the segment duration when the audio data for training is segmented in step 1, the detection window width is set, and the audio data recorded in the shortwave communication monitoring service is sequentially scanned in units of the detection window;
[0026] Step 4-2, generating a spectrogram from the audio data in each detection window according to the image resolution when generating the training spectrogram in step 1, and graying the spectrogram;
[0027] Step 4-3, extracting HOG features from the spectrogram generated in step 4-2;
[0028] Step 4-4, input the HOG features extracted in step 4-3 into the SVM classifier trained in step 3 for classification, detect whether there is voice or noise in the window, and extract the voice data.
[0029] The beneficial effects of the present invention compared with the prior art are:
[0030] The average accuracy of the present invention is better than the detection method based on volume fluctuation which is currently used in engineering projects, and has good generalization ability, and can adapt to voice types of different languages, different genders, and different dialogue forms. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is a flow chart of the method of the present invention.
[0032] Figure 2 is an example of a spectrogram generated from speech and noise.
[0033] Figure 3 Schematic diagram of the statistical principle of oriented gradient histogram.
[0034] Figure 4 It is a schematic diagram of the HOG features of the speech spectrogram. DETAILED DESCRIPTION
[0035] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0036] The invention discloses a shortwave communication voice detection method based on HOG+SVM, wherein HOG is the abbreviation of Histogram of Oriented Gradient, i.e., histogram of oriented gradient; SVM is the abbreviation of Support Vector Machines, i.e., support vector machine.
[0037] The method comprises the following steps:
[0038] Step 1: Manually classify the audio data into speech and noise, cut it into segments according to the model training requirements, generate a spectrogram based on the audio segments, and then pre-process the spectrogram into grayscale.
[0039] Step 2: Divide the spectrogram into cells, and then calculate the gradient amplitude and gradient direction of each pixel in cells. Count the gradient amplitudes distributed in different directions in each cell to form a directional gradient histogram. The directional gradient histogram of all cells in the calculation graph constitutes the HOG feature of the spectrogram.
[0040] Step 3: Use the HOG features of the speech spectrogram as positive samples and the HOG features of the noise spectrogram as negative samples to train the SVM classifier, so that the trained SVM classifier has better generalization ability and adaptability.
[0041] Step 4, set the detection window width, scan the shortwave communication recording data with the detection window as the unit, generate a spectrogram based on the audio data in the window, extract HOG features after preprocessing the spectrogram, and then input the HOG features into the trained SVM classifier for classification to extract the voice data.
[0042] Furthermore, in one implementation, step 1 includes:
[0043] Step 1-1, manually classify the audio data recorded in the shortwave communication monitoring work into voice and noise, where the voice is used as a positive sample during training and the noise is used as a negative sample during training.
[0044] Step 1-2, the speech and noise data are divided into small segments according to the predetermined detection window and spectrogram resolution requirements.
[0045] Step 1-3, based on the audio clip, generate a spectrogram according to a predetermined resolution requirement.
[0046] Step 1-4, grayscale the spectrogram, converting the three RGB color components of the image into a grayscale value of only one component.
[0047] Furthermore, in one implementation, step 2 includes:
[0048] Step 2-1, divide the spectrogram into cells according to a predetermined size.
[0049] Step 2-2, calculate the gradient magnitude in the horizontal and vertical directions of each pixel in the cell, and calculate the gradient direction value of each pixel position based on it.
[0050] Step 2-3, divide the 360-degree gradient direction into several strips, traverse all the pixels in the cell, count the gradient amplitude falling into each strip, and form a directional gradient histogram of a single cell.
[0051] Step 2-4, traverse all cells in the image, calculate and count the directional gradient histogram of each cell according to step 2-3, and form the HOG feature of the entire spectrogram.
[0052] Furthermore, in one implementation, step 4 includes:
[0053] Step 4-1, setting the detection window width according to the segment duration when the audio data for training is segmented in step 1, and sequentially scanning the audio data recorded in the shortwave communication monitoring service using the detection window as a unit.
[0054] Step 4-2, according to the image resolution when generating the training spectrogram in step 1, generate the audio data in each detection window as a spectrogram, and grayscale the spectrogram.
[0055] Step 4-3, extract HOG features from the spectrogram generated in step 4-2.
[0056] Step 4-4, input the HOG features extracted in step 4-3 into the SVM classifier trained in step 3 for classification, and detect whether the window contains speech or noise.
[0057] The following is a more specific example:
[0058] The computer used in this embodiment has a CPU of i5-11400F, a memory of 16GB, and a graphics card of GTX1070; the running software environment is Windows 10+pyCharm2019.2.1+OpenCV v4.5.4. The data sets used in the experiment are all from the actual application of engineering projects. The voice sample data covers Chinese, English, Russian, Japanese, Korean, and Mongolian in terms of language, male and female in terms of gender, and double male dialogue, double female dialogue, male and female dialogue, single male self-talk, and single female self-talk in terms of dialogue form. The total duration of various test sample data is 2540 seconds; the noise sample data takes 1320 seconds of shortwave communication background noise of different volumes.
[0059] like Figure 1 As shown, the method of this embodiment includes the following steps:
[0060] Step 1: Manually classify the audio data into speech and noise, cut it into segments according to the model training requirements, generate a spectrogram based on the audio segments, and then pre-process the spectrogram into grayscale.
[0061] Step 2: Divide the spectrogram into cells, and then calculate the gradient amplitude and gradient direction of each pixel in cells. Count the gradient amplitudes distributed in different directions in each cell to form a directional gradient histogram. The directional gradient histogram of all cells in the calculation graph constitutes the HOG feature of the spectrogram.
[0062] Step 3: Use the HOG features of the speech spectrogram as positive samples and the HOG features of the noise spectrogram as negative samples to train the SVM classifier, so that the trained SVM classifier has better generalization ability and adaptability.
[0063] Step 4, set the detection window width, scan the shortwave communication recording data with the detection window as the unit, generate a spectrogram based on the audio data in the window, extract HOG features after preprocessing the spectrogram, and then input the HOG features into the trained SVM classifier for classification to extract the voice data.
[0064] In this embodiment, step 1 includes:
[0065] Step 1-1, manually classify the audio data recorded in the shortwave communication monitoring work into voice and noise, where the voice is used as a positive sample during training and the noise is used as a negative sample during training.
[0066] Step 1-2: During the model training process, the continuous audio signal needs to be cut into audio segments in order to generate spectrograms as sample data for training. In order to reduce the detection delay, the audio signal is cut into segments with a duration of 5 seconds.
[0067] Step 1-3, since the purpose of this method is to distinguish the spectrograms of noise and speech, rather than to identify the speaker or speech content based on the spectrogram, there is no need to pay attention to the characteristics such as formants and fricatives, only the vertical bars representing the fundamental tone need to be paid attention to. Therefore, the horizontal resolution of the spectrogram does not need to be very large, and the aspect ratio should be as small as possible to form a thin and long detection window during actual detection. The spectrogram resolution selected by this method is 240×600. Examples of spectrograms of speech and noise are shown in Figure 2.
[0068] Step 1-4, grayscale the color spectrogram, convert the three RGB color components of the image into a grayscale value of only one component, so that the range of each pixel is reduced from 0 to 16,581,375 to 0 to 255, which can greatly improve the algorithm calculation speed.
[0069] Step 2 includes:
[0070] Step 2-1, divide the spectrogram into cells. In this embodiment, the cell size finally selected after repeated experiments is 12×12.
[0071] Step 2-2, use the following formula to calculate the horizontal and vertical gradients of each pixel in the cell.
[0072]
[0073] G in the formula x (x, y), G t (x, y) and H(x, y) represent the horizontal gradient, vertical gradient and grayscale value of the pixel point (x, y) in the input image, respectively.
[0074] The calculation formula for the gradient amplitude of each pixel is as follows:
[0075]
[0076] The gradient direction of each pixel is calculated as follows:
[0077]
[0078] Step 2-3, taking the cell as the unit, divide the 360-degree gradient direction into 9 strips, traverse all the pixels in the cell, count the gradient amplitude falling into each strip, and form the directional gradient histogram of a single cell. The statistical principle is as follows Figure 3 As shown in Figure 2, the feature dimension of each cell is 9.
[0079] Step 2-4, traverse all cells in the image, calculate and count the directional gradient histogram of each cell according to step 2-3, and form the HOG feature of the entire spectrogram. The HOG feature of the speech spectrogram is as follows: Figure 4 As shown in the figure, the feature dimension of each spectrogram is 9000.
[0080] Step 3 includes:
[0081] The kernel function of the SVM classifier selects SVM_LINEAR linear classification, the polynomial function dimension is set to 3, and the penalty coefficient is set to 0.01. The classifier is trained with positive and negative sample sets. After training, the classifier is tested with test data to ensure that the classifier has good generalization ability and adaptability.
[0082] Step 4 includes:
[0083] Step 4-1, set the detection window time domain width to 5 seconds, the window resolution to 240×600, and sequentially scan the audio data recorded in the shortwave communication monitoring service using the detection window as a unit.
[0084] Step 4-2, generate the audio data in each detection window into a spectrogram with a resolution of 240×600, and perform grayscale processing on the spectrogram.
[0085] Step 4-3, extract HOG features from the spectrogram generated in step 4-2.
[0086] Step 4-4, input the HOG features extracted in step 4-3 into the SVM classifier trained in step 3 for classification, and detect whether the window contains speech or noise.
[0087] The present invention first generates a spectrogram based on shortwave communication audio data, then extracts HOG features from the spectrogram, uses the HOG features as input, and uses a trained SVM to distinguish between noise and voice, thereby achieving the goal of detecting voice from shortwave communication audio data. The present invention has the advantages of high detection accuracy and strong model adaptability, and can be applied to automatically detect voice from audio data recorded in shortwave surveillance work.
Claims
1. A shortwave communication voice detection method based on HOG+SVM, characterized in that: The following steps are involved: Step 1: classify the audio data into speech and noise and cut them into audio segments, generate a spectrogram based on the audio segments, and then perform grayscale preprocessing on the spectrogram; Step 2: Divide the spectrogram into cells, calculate the gradient magnitude and gradient direction of each pixel in cells, count the gradient magnitudes distributed in different directions in each cell, form a directional gradient histogram, and calculate the directional gradient histogram of all cells in the graph to form the HOG feature of the spectrogram; Step 3, using the HOG features of the speech spectrogram as positive samples and the HOG features of the noise spectrogram as negative samples, train the SVM classifier; Step 4, set the detection window width, scan the shortwave communication recording data with the detection window as the unit, generate a spectrogram based on the audio data in the window, extract HOG features after preprocessing the spectrogram, and then input the HOG features into the trained SVM classifier for classification to extract the voice data.
2. The shortwave communication voice detection method based on HOG+SVM according to claim 1 is characterized in that: The step 1 comprises: Step 1-1, classify the audio data recorded in the shortwave communication monitoring work into voice and noise, wherein the voice is used as a positive sample during training, and the noise is used as a negative sample during training; Step 1-2, dividing the speech and noise data into segments according to the predetermined detection window and spectrogram resolution requirements; Step 1-3, generating a spectrogram based on the audio clip according to a predetermined resolution requirement; Step 1-4, grayscale the spectrogram, converting the three RGB color components of the image into a grayscale value of only one component.
3. The shortwave communication voice detection method based on HOG+SVM according to claim 1 is characterized in that: The step 2 comprises: Step 2-1, dividing the spectrogram into cells according to a predetermined size; Step 2-2, calculating the gradient magnitude in the horizontal and vertical directions of each pixel in the cell, and calculating the gradient direction value of each pixel position accordingly; Step 2-3, divide the 360-degree gradient direction into multiple strips, traverse all the pixels in the cell, count the gradient amplitude falling into each strip, and form a directional gradient histogram of a single cell; Step 2-4, traverse all cells in the image, calculate and count the directional gradient histogram of each cell in the same way as step 2-3, and form the HOG feature of the entire spectrogram.
4. The shortwave communication voice detection method based on HOG+SVM according to claim 1 is characterized in that: The step 3 is: training the SVM classifier using the HOG features of the speech spectrogram as positive samples and the HOG features of the noise spectrogram as negative samples; and adjusting the classifier parameters by combining multiple types of training samples so that the separation hyperplane of the SVM classifier has the maximum distance between the speech HOG feature samples and the noise HOG feature samples.
5. The shortwave communication voice detection method based on HOG+SVM according to claim 1 is characterized in that: The step 4 comprises: Step 4-1, according to the segment duration when the audio data for training is segmented in step 1, the detection window width is set, and the audio data recorded in the shortwave communication monitoring service is sequentially scanned in units of the detection window; Step 4-2, generating a spectrogram from the audio data in each detection window according to the image resolution when generating the training spectrogram in step 1, and graying the spectrogram; Step 4-3, extracting HOG features from the spectrogram generated in step 4-2; Step 4-4, input the HOG features extracted in step 4-3 into the SVM classifier trained in step 3 for classification, detect whether there is voice or noise in the window, and extract the voice data.
