Skip to main content

PANNs AT (Audio Tagging) inference

panns_AT_inference provides an easy to use Python interface for audio tagging. The audio tagging models are trained from PANNs: Large-Scale Pretrained Audio Neural Networks for Audio Pattern Recognition: https://github.com/qiuqiangkong/audioset_tagging_cnn

This is a forked repository/project w. the Top-3 models (see References)

Installation

PyTorch>=1.0 is required.

$ pip install panns_AT_inference

Usage

$ python3 example.py

For example:

import librosa
import panns_AT_inference
from panns_AT_inference import AudioTagging, labels

audio_path = 'examples/R9_ZSCveAHg_7s.wav'
(audio, _) = librosa.core.load(audio_path, sr=32000, mono=True)
audio = audio[None, :]  # (batch_size, segment_samples)

print('------ Audio tagging ------')
at = AudioTagging(model_name=None, device='cuda')
(clipwise_output, embedding) = at.inference(audio)

Results

------ Audio tagging ------
Checkpoint path: /root/panns_data/Cnn14_mAP=0.431.pth
GPU number: 1
Speech: 0.893
Telephone bell ringing: 0.754
Inside, small room: 0.235
Telephone: 0.183
Music: 0.092
Ringtone: 0.047
Inside, large room or hall: 0.028
Alarm: 0.014
Animal: 0.009
Vehicle: 0.008

References

[1] Kong, Qiuqiang, Yin Cao, Turab Iqbal, Yuxuan Wang, Wenwu Wang, and Mark D. Plumbley. "PANNs: Large-Scale Pretrained Audio Neural Networks for Audio Pattern Recognition." arXiv preprint arXiv:1912.10211 (2019).

[2]

@article{9229505,
  author={Kong, Qiuqiang and Cao, Yin and Iqbal, Turab and Wang, Yuxuan and Wang, Wenwu and Plumbley, Mark D.},
  journal={IEEE/ACM Transactions on Audio, Speech, and Language Processing}, 
  title={PANNs: Large-Scale Pretrained Audio Neural Networks for Audio Pattern Recognition}, 
  year={2020},
  volume={28},
  number={},
  pages={2880 -- 2894},
  doi={10.1109/TASLP.2020.3030497}
  }

[3] Official GitHub repository: https://github.com/qiuqiangkong/audioset_tagging_cnn , https://github.com/qiuqiangkong/panns_inference

Metadata

Release files for panns-AT-inference 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for panns-AT-inference 0.1.4
File Size Uploaded
panns_AT_inference-0.1.4.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for panns-AT-inference 0.1.4
File Interpreter ABI Platform
panns_AT_inference-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / panns_AT_inference-0.1.4.tar.gz

Download URL panns_AT_inference-0.1.4.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3b3520906647ac20c212208718645cd2f149e6b57200174a97e3d74599318c19
BLAKE2b-256 checksum
How to use checksums
3332c401f6af87924ee6114ef44d9b1d1e797b3339d544acf3ff6187a54c49ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.9

Release files / panns_AT_inference-0.1.4-py3-none-any.whl

Download URL panns_AT_inference-0.1.4-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
486c0f359cb4eada3a30faccd1528dfd585537bae9e0e66f240175d2812c7ca5
BLAKE2b-256 checksum
How to use checksums
6692e5077b0120029e33d100489ac603a35548ddf99a57fa1a6751a45a171e8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page