You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can choose between features `mfcc`, `gfcc`, `spectral`, `chroma` or any combination of those, example `gfcc,mfcc,spectral,chroma`, to extract from your audio files for classification or just saving extracted feature for other uses.
38
+
39
+
### Classifier options
30
40
31
-
Feature options :
32
-
You can choose between `mfcc`, `gfcc` or `gfcc,mfcc` features to extract from your audio files.
33
-
Classifier options :
34
41
You can choose between `svm`, `svm_rbf`, `randomforest`, `logisticregression`, `knn`, `gradientboosting` and `extratrees`.
35
42
Hyperparameter tuning is included in the code for each using grid search.
36
43
37
44
38
-
### Examples
45
+
##Training and Testing Data structuring
39
46
40
-
Command line example of using `gfcc` feature and `svm` classifier.
47
+
Let's say you have 2 classes that you have training data for (music and speech), and you want to use pyAudioProcessing to train a model using available feature options. Save each class as a directory and all the training audio .wav files under the respective class directories. Example:
Similarly, for any test data (with known labels) you want to pass through the classifier, structure it similarly as
65
+
66
+
```bash
67
+
.
68
+
├── testing_data
69
+
├── music
70
+
│ ├── music_sample5.wav
71
+
│ ├── music_sample6.wav
72
+
├── speech
73
+
│ ├── speech_sample5.wav
74
+
│ ├── speech_sample6.wav
50
75
```
51
-
Classification results get saved in `classifier_results.json`.
76
+
If you want to classify audio samples without any known labels, structure the data similarly as
77
+
78
+
```bash
79
+
.
80
+
├── data
81
+
├── unknown
82
+
│ ├── sample1.wav
83
+
│ ├── sample2.wav
84
+
```
85
+
86
+
## Training and Classifying Audio files
87
+
88
+
Audio data can be trained, tested and classified using pyAudioProcessing. Please see [feature options](https://github.com/jsingh811/pyAudioProcessing#feature-options) and [classifier model options](https://github.com/jsingh811/pyAudioProcessing#classifier-options) for more information.
52
89
90
+
### Examples
53
91
54
-
Code example of using `gfcc` feature and `svm` classifier.
92
+
Code example of using `gfcc,spectral,chroma` feature and `svm` classifier. Sample data can be found [here](https://github.com/jsingh811/pyAudioProcessing/tree/master/data_samples). Please refer to the section on [Training and Testing Data structuring](https://github.com/jsingh811/pyAudioProcessing#training-and-testing-data-structuring) to use your own data instead.
55
93
```
56
94
from pyAudioProcessing.run_classification import train_and_classify
The above logs the filename where the classification results are saved along with the details about testing files and the classifier used.
106
+
107
+
108
+
If you cloned the project via git, the following command line example of training and classification with `gfcc,spectral,chroma` features and `svm` classifier can be used as well. Sample data can be found [here](https://github.com/jsingh811/pyAudioProcessing/tree/master/data_samples). Please refer to the section on [Training and Testing Data structuring](https://github.com/jsingh811/pyAudioProcessing#training-and-testing-data-structuring) to use your own data instead.
Classification results get saved in `classifier_results.json`.
64
120
65
-
This feature lets the user extract data features calculated on audio files.
66
121
67
-
### Choices
122
+
##Extracting features from audios
68
123
69
-
Feature options :
70
-
You can choose between `mfcc`, `gfcc` or `gfcc,mfcc` features to extract from your audio files.
71
-
To use your own audio files for feature extraction, refer to the format of directory `data_samples/testing`.
124
+
This feature lets the user extract aggregated data features calculated per audio file. See [feature options](https://github.com/jsingh811/pyAudioProcessing#feature-options) for more information on choices of features available.
72
125
73
126
### Examples
74
127
75
-
Command line example of for `gfcc` and `mfcc` feature extractions.
128
+
Code example for performing `gfcc` and `mfcc` feature extraction can be found below. To use your own audio data for feature extraction, pass the path to `get_features` in place of `data_samples/testing`. Please refer to the format of directory `data_samples/testing` or the section on [Training and Testing Data structuring](https://github.com/jsingh811/pyAudioProcessing#training-and-testing-data-structuring).
If you cloned the project via git, the following command line example of for `gfcc` and `mfcc` feature extractions can be used as well. The features argument should be a comma separated string, example `gfcc,mfcc`.
150
+
To use your own audio files for feature extraction, pass in the directory path containing .wav files as the `-f` argument. Please refer to the format of directory `data_samples/testing` or the section on [Training and Testing Data structuring](https://github.com/jsingh811/pyAudioProcessing#training-and-testing-data-structuring).
0 commit comments