Comments (3)
Hi, thank you!
I think in order to get the best performance, it's better to retrain on 16khz.
Alternatively, you can adapt the pre-trained model to accept 16khz input like this:
First get the models as usual:
from hear21passt.base import get_basic_model, get_model_passt
model = get_basic_model(mode="logits")
Then replace the mel layer with this adapted config:
from hear21passt.models.preprocess import AugmentMelSTFT
model.mel = AugmentMelSTFT(n_mels=128, sr=16000, win_length=400, hopsize=160, n_fft=512, freqm=48,
timem=192,
htk=False, fmin=0.0, fmax=None, norm=1, fmin_aug_range=10,
fmax_aug_range=1000)
you can comapre it with original mel layer here: https://github.com/kkoutini/passt_hear21/blob/4dd6b9e426f528e2e8409b9bacecf58a2f464548/hear21passt/base.py#L52
The main difference were in the original: sr=32000, win_length=800, hopsize=320, n_fft=1024
I hope this helps.
The audio files I downloaded where in 32khz
from passt.
Thank you for the reply.
Can you please confirm if the following code looks good?
from hear21passt.base import get_basic_model,get_model_passt
import torch
#get the PaSST model wrapper, includes Melspectrogram and the default pre-trained transformer
model = get_basic_model(mode="logits")
print(model.mel) # Extracts mel spectrogram from raw waveforms.
from hear21passt.models.preprocess import AugmentMelSTFT
model.mel = AugmentMelSTFT(n_mels=128, sr=16000, win_length=400, hopsize=160, n_fft=512, freqm=48,
timem=192,
htk=False, fmin=0.0, fmax=None, norm=1, fmin_aug_range=10,
fmax_aug_range=1000)
#example inference
model.eval()
with torch.no_grad():
#audio_wave has the shape of [batch, seconds*16000] sampling rate is 16k
#example audio_wave of batch=3 and 10 seconds
audio = torch.ones((3, 16000 * 10))*0.5
logits=model(audio)
Also I assume, these logits should be followed by application of sigmoid function to get the output classes? Please correct me if I am wrong.
Thanks in advance.
from passt.
yes, this looks correct.
from passt.
Related Issues (20)
- setup.py
- I have a problem. why convert wav to mp3? HOT 3
- difference of fine-tuning the pretrained models HOT 2
- Inference Issue HOT 2
- Getting started with a custom dataset HOT 8
- 音频事件检测
- test my own model HOT 1
- RuntimeError: stft requires the return_complex parameter be given for real inputs HOT 3
- Error when trying to pip install repo HOT 2
- Pre-trained models on ESC-50 HOT 3
- can use on 8k audio ? HOT 1
- time_new_pos_embed HOT 6
- Which config can reproduce the results in paper? HOT 1
- Fixing weights for fine-tuning? HOT 2
- From ViT models to audio HOT 7
- .net and .net_swa parameters in .ckpt file HOT 1
- Changing the depth of PASST. HOT 1
- EOF (End Of File) Error on num_workers>0 HOT 1
- Where is input normalization applied? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from passt.