Automatic birdsong species identification method and system based on random forest model
Through the automatic recognition method of bird singing species based on the random forest model, the model is trained using the bioacoustic feature index and Monte Carlo cross-verification, the problems of large computing volume and low recognition efficiency in the existing technology are solved, and efficient and accurate birds are achieved species identification, suitable for large-scale monitoring and low-latency requirements.
Patent Information
- Application Number
- CN202411292312.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-03
AI Technical Summary
The prior art has a large amount of computing, low recognition efficiency, and is difficult to adapt to the needs of large-scale monitoring and low-latency in practical application scenarios. It often requires manual extraction of features, resulting in a long processing cycle and is unable to effectively capture important audio information.
The automatic recognition method of bird singing species based on the random forest model is adopted. The random forest model is trained by extracting the bioacoustic feature index to identify bird species, and the robustness and prediction accuracy of the model are improved through Monte Carlo cross-validation.
It realizes automatic identification and classification of different types of bird singing signals, provides efficient bird species recognition methods, has high prediction accuracy and robustness, is suitable for practical application scenarios, and the calculation process is simple, eliminating additional data acquisition and feature extraction steps.
Smart Images

Figure CN119252264A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of species identification, and in particular to a method and system for automatically identifying bird song species based on a random forest model. Background Art
[0002] Birds are an important component of the ecosystem and an important indicator of the health of the ecosystem. Bird surveys and monitoring are an important way to obtain information on bird species, numbers, living habits, and the quality of the living environment. They can help people better understand the living habits and migration patterns of birds, while assessing the stability of the ecosystem and the richness of biodiversity, and providing a scientific basis for the protection and management of bird resources and the ecological environment. Traditional bird monitoring methods mainly rely on manual observations, which have high manpower and material costs, limited monitoring range, small amounts of information, poor continuity, and human interference in bird habitat activities. They cannot meet the requirements for accuracy, continuity, and integrity in bird species monitoring in the time domain.
[0003] Bird calls are one of the important biological characteristics of birds. They have high recognition and long transmission distances, and are widely used in bird species classification research. Under this theoretical background, using recording equipment to collect bird calls, the characteristic attributes of the calls can be analyzed through algorithms, and automatic classification and identification of bird species can be achieved, providing a new way for automatic bird monitoring.
[0004] At present, with the in-depth research of scholars at home and abroad, many species identification methods based on bird calls have emerged.
[0005] Common methods include:
[0006] 1. Bird song recognition method based on template matching, such as dynamic time warping algorithm, can achieve high recognition effect, but there is a problem of excessive computational complexity;
[0007] For example, a bird species identification method is disclosed in the patent with publication number CN107393542B, which generates a signal spectrogram based on linear frequency modulation wavelet transform by preprocessing the bird song signal, uses the signal spectrogram as the input signal of the first channel, the bird song time domain signal as the input signal of the second channel, and the bird species corresponding to the bird song signal as the identification result to train a preliminary identification model, thereby obtaining a bird species identification model. This patent provides a bird species identification method based on a dual-channel neural network, which can improve the efficiency and accuracy of bird species identification and is used for bird species identification. However, this method still has the problem of excessive computational complexity;
[0008] 2. Bird song recognition method based on feature extraction. Common features such as Mel-Frequency Cepstral Coefficients (MFCC), Linear Predictive Coding (LPC) coefficients, LPC reflection coefficients, etc. can be used to establish classification models through various machine learning or deep learning algorithms to identify bird species. However, existing classification and recognition methods often use a single feature as input, which may not capture important audio information, resulting in poor recognition results;
[0009] For example, the patent with publication number CN114863937B discloses a hybrid bird song recognition method based on deep transfer learning and XGBoost, which reflects the changing process of the bird song signal by calculating the first-order difference coefficient and the second-order difference coefficient of the log-Mel spectrum. The invention uses deep transfer learning to fine-tune the VGG16 model to build a feature extractor, which improves the generalization ability of deep convolutional neural networks under small sample training data, reduces parameter training, and improves operating efficiency. The invention maps bird song signals to bird species and has good recognition performance for the songs of various birds in the natural environment. However, this method uses a single feature as input and may not be able to capture important audio information, resulting in poor recognition results.
[0010] In addition, existing methods often require manual feature extraction, resulting in long processing cycles and low recognition efficiency, making them difficult to apply to the needs of large-scale monitoring and low latency in practical application scenarios. Summary of the invention
[0011] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a method and system for automatically identifying bird species based on a random forest model. The method for automatically identifying bird species extracts bioacoustic feature indexes from the collected bird song data to train a random forest model, and uses the model to detect the target bird species when detecting a certain bird song.
[0012] The purpose of the present invention can be achieved by the following technical solutions:
[0013] According to one aspect of the present invention, a method for automatically identifying bird song species based on a random forest model is provided, and the method steps include:
[0014] S1. Select the target species and obtain the singing data of different birds including target species and non-target species;
[0015] S2, extracting features from the sound data to obtain a bioacoustic feature index;
[0016] S3, randomly constructing a sample data set based on bird species classification and bioacoustic feature index;
[0017] S4, training a random forest model based on the sample data set constructed in S3;
[0018] S5. Calculate the AUC value as an evaluation index of prediction accuracy, and input new unknown bird song data for bird species recognition based on the trained random forest model, and output the prediction results;
[0019] S6, repeating steps S3, S4, and S5, averaging all the prediction results and prediction indicators, and the two average values obtained are the final prediction result and the final evaluation indicator respectively;
[0020] S7. The final prediction result obtained in S6 and the final evaluation index are combined to form a bird species recognition result, and the result is output.
[0021] As a preferred technical solution, the target species selected in S1 is specifically: a certain bird species of concern is selected as the target species; the call data in S1 is processed, and the processing includes segmentation and noise reduction processing, so that the call data has clear sound quality and no background interference sound.
[0022] As a preferred technical solution, the bioacoustic characteristic index in S2 includes: acoustic complexity index, acoustic diversity index, acoustic uniformity index, bioacoustic index and standard soundscape difference index.
[0023] Furthermore, the method for extracting the bioacoustic feature index in S2 is specifically as follows: for monaural sound data, directly calculate its bioacoustic feature index; for stereo sound data, respectively calculate the bioacoustic feature indexes of both channels and then take the average value as its bioacoustic feature index.
[0024] As a preferred technical solution, the data in the sample data set constructed in S3 is balanced to ensure that the number of sample data of the target species and the non-target species is similar or the same.
[0025] Furthermore, the sample data set constructed in S3 includes a training set and a test set;
[0026] The training set is used as training samples to create a random forest model;
[0027] The test set is used as a test sample to evaluate the performance of the random forest model.
[0028] As a preferred technical solution, the prediction results in S5 and S6 are the probability that the detected sound data is the target species, expressed in the form of probability.
[0029] As a preferred technical solution, the AUC value in S5 is an evaluation indicator of prediction accuracy, namely, the area under the receiver operating characteristic curve; wherein, the closer the AUC value is to 1, the better the prediction performance of the model; and the closer the AUC value is to 0.5, the worse the prediction result of the model.
[0030] As a preferred technical solution, the specific steps of averaging the intermediate results of the output prediction and evaluation based on Monte Carlo cross-validation in S6 to obtain and output the final results of the prediction and evaluation are:
[0031] Based on Monte Carlo cross-validation, after repeating the processes of S3, S4 and S5 N times, the intermediate results of prediction and evaluation obtained in these N repetitions were averaged, and the average value was the basis for the final species identification. The area under the receiver operating characteristic curve was used as the evaluation indicator of prediction accuracy, where N ≥ 100.
[0032] According to another aspect of the present invention, there is provided a system for automatically identifying bird song species based on a random forest model, the system being applied to the work of the method for automatically identifying bird song species based on a random forest model as described above;
[0033] The system includes a data acquisition module, an analysis module, and a result display module;
[0034] The data collection module is used to collect bird song data;
[0035] The analysis module is preset with a trained random forest model, and the bird song data collected by the data collection module is input into the trained random forest model, and the bird species recognition result is obtained by output;
[0036] The result display module is used to display the bird species identification results.
[0037] Compared with the prior art, the present invention has the following advantages:
[0038] 1. The present invention characterizes the acoustic characteristics of bird calls through different bioacoustic feature indices including acoustic complexity index, acoustic diversity index, acoustic uniformity index, bioacoustic index and standard soundscape difference index, and inputs them into the random forest model, effectively realizing the automatic recognition and classification of different types of bird call signals, and providing an effective method for bird species identification.
[0039] 2. The present invention adopts the trained random forest model, inputs new unknown bird song data for bird species identification, outputs the prediction results, and calculates the AUC value as the evaluation index of prediction accuracy, which can provide higher prediction accuracy for bird species identification;
[0040] 3. In the present invention, steps S3, S4, and S5 are repeated, and all the prediction results and prediction indicators are averaged. The two average values obtained are the final prediction result and the final evaluation index, respectively. The calculation process of the method introduces randomness, and the model is trained using different subsets and the final average result is calculated. It is more robust to data noise and outliers, and has a lower risk of overfitting. It can also better identify species through bird song characteristics without the need for additional parameter adjustment.
[0041] 3. The present invention only needs to extract features from bird song data to obtain bioacoustic feature indexes, and use them to construct forest models. The bioacoustic indexes are calculated using the relatively easy-to-obtain bird song data and used to construct classification models. No other data needs to be collected, and the system structure is clear and simple, and easy to operate. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of the steps of a method for automatically identifying bird song species based on a random forest model in the present invention;
[0043] Figure 2 A schematic diagram of the complete process of automatically identifying bird song species based on the random forest model in the present invention;
[0044] Figure 3 It is a comprehensive ROC curve diagram under Monte Carlo cross validation in an embodiment of the present invention;
[0045] Figure 4 1 is a box plot of the importance of the bioacoustic feature index of bird calls in an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0047] Some current methods often focus on directly determining what species the bird under test belongs to, but the establishment of the corresponding model requires a self-learning mechanism and the accuracy of the model can only be ensured after having a sufficiently large sample of each species. This is often difficult to implement in practice, and the model will have many problems such as overfitting or underfitting. The method in the present invention does not emphasize that the model can identify various species, but ensures that this method can help us determine whether it is a target species of concern through the bird's song, thereby completing the automatic identification of bird species efficiently and accurately.
[0048] Example
[0049] In this embodiment, a method for automatically identifying bird species based on a random forest model is applied, and the method steps are as follows: Figure 1 As shown, it includes the following steps:
[0050] S1. Select the target species and obtain the singing data of different birds including target species and non-target species;
[0051] S2, extracting features from the sound data to obtain a bioacoustic feature index;
[0052] S3, randomly constructing a sample data set based on bird species classification and bioacoustic feature index;
[0053] S4, training a random forest model based on the sample data set constructed in S3;
[0054] S5. Calculate the AUC value as an evaluation index of prediction accuracy, and input new unknown bird song data for bird species recognition based on the trained random forest model, and output the prediction results;
[0055] S6, repeating steps S3, S4, and S5, averaging all the prediction results and prediction indicators, and the two average values obtained are the final prediction result and the final evaluation indicator respectively;
[0056] S7. The final prediction result obtained in S6 and the final evaluation index are combined to form a bird species recognition result, and the result is output.
[0057] In this embodiment, the complete process of automatically identifying bird species based on the random forest model is as follows: Figure 2 As shown, the specific implementation is as follows:
[0058] S1. Select the target species and obtain the singing data of different birds including target species and non-target species;
[0059] In this embodiment, Shanghai is taken as the case study area, and different bird song data are obtained through the world bird song data sharing website platform xeno-canto. To ensure the clarity of the bird songs in the data, bird song data with a sound quality level of A and no background interference from other species are selected. The blackbird (Turdus merula) is taken as the target species, and 501 song data that meet the conditions are obtained; a group of other common bird species in Shanghai are randomly selected to form a non-target species data set, including gray magpie (Cyanopica cyanus), sparrow (Passer montanus), white-headed bulbul (Pycnonotussinensis) and spotted dove (Spilopelia chinensis), and a total of 540 song data that meet the conditions are obtained.
[0060] In this embodiment, the target species selected in S1 refers to a certain bird species of interest or concern, and the main goal of this method is to automatically identify whether it is the bird species through the bird's call. For example, there are many kinds of birds in the forest. In this embodiment, their calls are recorded, and this method is used to determine whether there is a blackbird living there. In this example, the blackbird is the target species.
[0061] In this embodiment, in S1, it should be ensured that the recording sound quality of the bird song data used is clear and there is no background interference sound; if necessary, the bird song data can be segmented and noise reduced.
[0062] S2. Extract features from bird song data, analyze the bird song data, and calculate the bioacoustic feature index;
[0063] In this embodiment, the bird song data is used to calculate the bioacoustic characteristic indexes such as the acoustic complexity index (ACI), the acoustic diversity index (ADI), the acoustic evenness index (AEI), the bioacoustics index (BI), and the normalized difference soundscape index (NDSI) on the R language platform through the "tuneR" and "soundecology" packages; for the monophonic recording data, the bioacoustic characteristic index is directly calculated; for the stereophonic recording data, the bioacoustic characteristic index of the two channels is calculated and then the average value is calculated.
[0064] S3, construct a sample data set based on bird species classification and bioacoustic characteristic index;
[0065] S4, training a random forest model based on the sample data set constructed in S3;
[0066] In this embodiment, the specific process of training and performance verification of the random forest model in S4 is: the preprocessed data is balanced, that is, the sample numbers of the target species and the non-target species are ensured to be similar or the same, and then randomly divided into two groups, one group of training set data is used as training samples to create the random forest model, which is 70% of the original data sample size; the other group of test data sets is used as test samples to evaluate the performance of the random forest model, which is the remaining 30% of the original data sample size.
[0067] In this embodiment, the call data are grouped: 70% are randomly selected from the 501 call data samples of target species, and 70% are also selected from the 540 call data samples of non-target species. The two are integrated to form training data, and the remaining call data of target species and non-target species are integrated to form test data.
[0068] In this embodiment, the random forest model is trained and its performance is verified: in this step, the training data is used to fit the random forest model in the R language platform through the "randomForest" and "caret" software packages, and the test data is input into the model to calculate the AUC value to evaluate the prediction performance of the model. If the AUC value is closer to 1, the prediction performance of the model is better; and if the AUC value is closer to 0.5, the prediction result of the model is worse.
[0069] In this embodiment, species identification is performed on unknown bird song data: a set of new bird song recording data with clear sound quality is used to calculate acoustic feature indices including acoustic complexity index, acoustic diversity index, acoustic uniformity index, bioacoustic index, standard soundscape difference index and other bioacoustic feature indices, which are input into the random forest model established in this embodiment for prediction, and the prediction results are expressed in the form of probability.
[0070] In this embodiment, the training data split out from S4 is used to establish a random forest model; the area under the receiver operating characteristic curve (ROC), i.e., AUC (Area Under Curve, AUC), is calculated using the above-mentioned test set data to evaluate the performance of the random forest model. If the AUC value is closer to 1, the prediction performance of the model is better; and if the AUC value is closer to 0.5, the prediction result of the model is worse.
[0071] S5. Based on the trained random forest model, new unknown bird song data is input for bird species identification, the prediction results are output, and the AUC value is calculated as an evaluation indicator of prediction accuracy;
[0072] Furthermore, in step S33, the unknown bird song data is used to calculate acoustic feature indices including acoustic complexity index, acoustic diversity index, acoustic uniformity index, bioacoustic index and standard soundscape difference index, and the indexes are input into the random forest model established in step S32 for prediction. The prediction result is expressed in the form of probability, that is, the prediction result is actually in the form of "the probability of being the target species" rather than a binary "yes" or "no".
[0073] S6. Repeat steps S3, S4, and S5 to average all the prediction results and prediction indicators. The two average values obtained are the final prediction result and the final evaluation indicator, respectively.
[0074] S7. The final prediction result obtained in S6 and the final evaluation index are combined to form a bird species recognition result, and the result is output.
[0075] In this embodiment, in S6, based on Monte Carlo cross-validation, steps S3, S4 and S5 are repeated 100 times in total, and the average value of the 100 probability prediction results is used as the basis for the final species identification of the model, and the average value of the 100 AUC values is used as the evaluation indicator of prediction accuracy.
[0076] In this embodiment, AUC is used to measure the predictive ability of the model previously constructed using the training data, rather than the predictive effect of a set of new data in this model. Therefore, assuming that after a model is established and the AUC calculated using the verification data is 0.9, then no matter what new data is input into the model, we believe that the credibility of its predicted results is high (because AUC = 0.9 on the existing verification data, this indicator reflects the predictive ability of the model itself and has nothing to do with the new data input).
[0077] In this embodiment, the comprehensive ROC curve diagram under Monte Carlo cross validation is finally obtained as follows: Figure 3 As shown, the gray curve is the effect of superimposing 100 ROC curves in the figure, and the area under the curve is the AUC value. The higher the AUC value, the higher the prediction accuracy of the model. This figure is the real data result of implementation case 1. The average area under the 100 ROC curves in the figure is 0.818. From the figure, we can see that the prediction accuracy of the model is good.
[0078] In this embodiment, the real data results of the importance of the bioacoustic feature index of bird songs are as follows: Figure 4 As shown in the figure, the contribution of the six bioacoustic characteristic indices used to build the random forest model to the model is shown. The scatter plot superimposed in the box plot is used to show the contribution values of each bioacoustic characteristic index to the model corresponding to 100 modelings. This box plot shows the contribution of the six bioacoustic characteristic indices to the model when building the random forest model. Since the data is randomly split 100 times and modeling predictions are performed, the contribution of each acoustic characteristic index each time is not a fixed value. Figure 4 It can be seen that NDSI is very important for determining whether the bird under test is a blackbird. Although this figure is not the result of identifying the target species, it can show the internal structure of the model and reflect the reliability and accuracy of species identification by bioacoustic characteristic index.
[0079] In summary, this embodiment applies a method for automatically identifying bird song species based on a random forest model. By collecting and acquiring bird song data and its acoustic characteristic index data, such data is then input into a random forest model for analysis and prediction. The random forest model integrates the results of multiple decision trees and can effectively process multidimensional data and complex classification tasks, with high classification accuracy and robustness. By performing random forest classification on the extracted acoustic characteristic index, automatic recognition and classification of different types of bird song signals can be achieved, providing an effective method for bird species identification.
[0080] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for automatic identification of bird species based on a random forest model, characterized in that: The method steps include: S1. Select the target species and obtain the singing data of different birds including target species and non-target species; S2, extracting features from the sound data to obtain a bioacoustic feature index; S3, randomly constructing a sample data set based on bird species classification and bioacoustic feature index; S4, training a random forest model based on the sample data set constructed in S3; S5. Calculate the AUC value as an evaluation index of prediction accuracy, and input new unknown bird song data for bird species recognition based on the trained random forest model, and output the prediction results; S6, repeating steps S3, S4, and S5, averaging all the prediction results and prediction indicators, and the two average values obtained are the final prediction result and the final evaluation indicator respectively; S7. The final prediction result obtained in S6 and the final evaluation index are combined to form a bird species recognition result, and the result is output.
2. The method for automatically identifying bird song species based on a random forest model according to claim 1, characterized in that: The target species selected in S1 specifically includes: selecting a certain bird species of interest as the target species; the call data in S1 is processed, and the processing includes segmentation and noise reduction processing, so that the call data has clear sound quality and no background interference sound.
3. The method for automatically identifying bird song species based on a random forest model according to claim 1, characterized in that: The bioacoustic characteristic indexes in S2 include: acoustic complexity index, acoustic diversity index, acoustic uniformity index, bioacoustic index and standard soundscape difference index.
4. The method for automatically identifying bird song species based on a random forest model according to claim 1, characterized in that: The method for extracting the bioacoustic feature index in S2 is specifically as follows: for the monophonic sound data, the bioacoustic feature index is directly calculated; for the stereophonic sound data, the bioacoustic feature indexes of the two channels are respectively calculated and then the average value is calculated as the bioacoustic feature index.
5. The method for automatically identifying bird song species based on a random forest model according to claim 1, characterized in that: The data in the sample data set constructed in S3 is balanced to ensure that the number of sample data of the target species and the non-target species is similar or the same.
6. The method for automatically identifying bird song species based on a random forest model according to claim 1, characterized in that: The sample data set constructed in S3 includes a training set and a test set; The training set is used as training samples to create a random forest model; The test set is used as a test sample to evaluate the performance of the random forest model.
7. The method for automatically identifying bird song species based on a random forest model according to claim 1, characterized in that: The prediction results in S5 and S6 are the probability that the detected sound data is the target species, expressed in the form of probability.
8. The method for automatically identifying bird song species based on a random forest model according to claim 1, characterized in that: The AUC value in S5 is an evaluation index of prediction accuracy, namely, the area under the receiver operating characteristic curve; wherein, the closer the AUC value is to 1, the better the prediction performance of the model; and the closer the AUC value is to 0.5, the worse the prediction result of the model.
9. The method for automatically identifying bird song species based on a random forest model according to claim 1, characterized in that: The specific steps of averaging the intermediate results of the output prediction and evaluation based on Monte Carlo cross-validation in S6 to obtain and output the final results of the prediction and evaluation are as follows: Based on Monte Carlo cross-validation, after repeating the processes of S3, S4 and S5 N times, the intermediate results of prediction and evaluation obtained in these N repetitions were averaged, and the average value was the basis for the final species identification. The area under the receiver operating characteristic curve was used as the evaluation indicator of prediction accuracy, where N ≥ 100.
10. An automatic bird species identification system based on a random forest model, characterized in that: The system is applied to the automatic identification method of bird song species based on the random forest model as described in any one of claims 1 to 9; the system includes a data acquisition module, an analysis module, and a result display module; The data collection module is used to collect bird song data; The analysis module is preset with a trained random forest model, and the bird song data collected by the data collection module is input into the trained random forest model, and the bird species recognition result is obtained by output; The result display module is used to display the bird species identification results.