Browse Source
Update
Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
2 changed files with
1 additions and
1 deletions
-
panns.py
-
BIN
result.png
|
|
@ -57,7 +57,6 @@ class Panns(NNOperator): |
|
|
|
self.tagger = AudioTagging(checkpoint_path=weights_path, device=self.device) |
|
|
|
self.model = self.tagger.model |
|
|
|
self.model.eval() |
|
|
|
self.model.to(self.device) |
|
|
|
|
|
|
|
def __call__(self, data: List[AudioFrame]): |
|
|
|
sr = data[0].sample_rate |
|
|
@ -71,6 +70,7 @@ class Panns(NNOperator): |
|
|
|
|
|
|
|
audio = self.int2float(audio).astype('float32') |
|
|
|
if sr != self.sample_rate: |
|
|
|
audio = torch.from_numpy(audio) |
|
|
|
resampler = torchaudio.transforms.Resample(sr, self.sample_rate, dtype=audio.dtype) |
|
|
|
audio = resampler(audio) |
|
|
|
|
|
|
|
Width:
|
Height:
|
Size: 11 KiB
Width:
|
Height:
|
Size: 13 KiB
|