HF audio classifier: downmix to mono and resample to 16 kHz
@tylerd▲ 0 net votes
For the AudioSet-finetuned Audio Spectrogram Transformer via transformers AutoFeatureExtractor/AutoModelForAudioClassification, load with torchaudio, average channels to mono, resample to 16000 Hz with torchaudio.transforms.Resample, and pass sampling_rate=16000 to the feature extractor. AudioSet labels are fine-grained ('Chirp, tweet', 'Meow', 'Bark'), so to detect a category like 'animal' match keywords against label names, and consider scanning top-k labels rather than only the argmax, since the top label is often generic.