How to detect and classify multiple sound at the same time?
iotproductions opened this issue · 2 comments
Hey !
Thank you so much for the interesting project.
I have some questions about the Audio Classification, could you please make me clearly understand?
Your project working properly! But, in case the WAV file contains many kinds of sounds at the same time, how to detect and classification??
For, Example below figure is the spectrogram of the sample WAV file, which contains Cricket and Dog barking sounds at some moments.
But your project only detected Dog barking.
Thanks !
您可以对您的音频进行分割,如3秒分割一次,每段音频可以有重复部分,例如:第一段:0-3s,第二段:2-5s.....然后使用这些分割的音频去推理,就可以实现你说的识别多个类别。
machine translation:
You can split your audio, such as 3 seconds split once, each audio can have repeated parts, for example: the first segment: 0-3s, the second segment: 2-5s..... Then use these audio segmentation to reasoning, can achieve what you said to identify multiple categories.
@iotproductions like this:
predictor = MAClsPredictor(configs=args.configs,
model_path=args.model_path,
use_gpu=args.use_gpu)
sample, sr = soundfile.read(args.audio_path)
for i in range(0, int(len(sample)/sr), 2):
data = sample[i*sr:(i + 3)*sr]
label, score = predictor.predict(audio_data=data, sample_rate=sr)
print(label)