UrbanSound classification using Convolutional Recurrent Networks in PyTorch
UrbanSound classification using Convolutional Recurrent Networks in PyTorch
Classification of audio with variable length using a CNN + LSTM architecture on the UrbanSound8K dataset.
Example results:
CRNN architecture:
Printing model defined with torchparse:
…Run inference on an audio file:
./run.py /path/to/audio/file.wav -r path/to/saved/model.pth ./run.py train -c config.json --cfg arch.cfgDataset transforms:
Compose(
ProcessChannels(mode=avg)
AdditiveNoise(prob=0.3, sig=0.001, dist_type=normal)
RandomCropLength(prob=0.4, sig=0.25, dist_type=half)
ToTensorAudio()
)As well as time stretching:
./run.py eval -r /path/to/saved/model.pthThen obtain defined metrics:
100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 34/34 [00:03<00:00, 12.68it/s]
{'avg_precision': '0.725', 'avg_recall': '0.719', 'accuracy': '0.804'}| Arch | Accuracy | AvgPrecision(macro) | AvgRecall(macro) |
|---|---|---|---|
| CNN | 71.0% | 63.4% | 63.5% |
| CRNN | 72.3% | 64.3% | 65.0% |
| CRNN(Bidirectional, Dropout) | 73.5% | 65.5% | 65.8% |
| CRNN(Dropout) | 73.0% | 65.5% | 65.7% |
| CRNN(Bidirectional) | 72.8% | 64.3% | 65.2% |
Per fold metrics CRNN(Bidirectional, Dropout):
| Fold | Accuracy | AvgPrecision(macro) | AvgRecall(macro) |
|---|---|---|---|
| 1 | 73.1% | 65.1% | 66.1% |
| 2 | 80.7% | 69.2% | 68.9% |
| 3 | 62.8% | 57.3% | 57.5% |
| 4 | 73.6% | 65.2% | 64.9% |
| 5 | 78.4% | 70.3% | 71.5% |
| 6 | 73.5% | 65.5% | 65.9% |
| 7 | 74.6% | 67.0% | 66.6% |
| 8 | 66.7% | 62.3% | 61.7% |
| 9 | 71.7% | 60.7% | 62.7% |
| 10 | 79.9% | 72.2% | 71.8% |
No open issues yet, or sync has not completed.