audio-classification
copied
Fix for stereo audio
Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
@ -74,6 +74,7 @@ class Panns(NNOperator):
resampler = torchaudio.transforms.Resample(sr, self.sample_rate, dtype=audio.dtype)
audio = resampler(audio)
if len(audio.shape) == 1:
audio = audio[None, :]
clipwise_output, embedding = self.tagger.inference(audio)