将Melspectrogram归一化为(0,255),或者没有频率缩放

发布于 2025-02-11 17:46:09 字数 240 浏览 1 评论 0原文

我将多个日志频谱图从.wav文件转换为图像。 我想破坏尽可能少的信息,以便将结果图像用于计算机视觉任务。 要将数据转换为图像格式,我当前使用简单的sklearn.minmaxscaler(((0,255))。 为了适应这个缩放器,我在所有频谱图上都使用所有频率的最小和最大能量。

我是否应该以每个特定频率的最小和最大能量来缩放频谱图?

具有不同缩放功能的不同频率是有意义的吗?

I am converting multiple log-mel spectrograms from .wav files to images.
I want to destroy as little information as possible as I plan to use the resulting images for a computer vision task.
To convert the data to an image format, I currently use a simple sklearn.MinMaxScaler((0, 255)).
To fit this scaler, I use the minimal and the maximal energy of all frequencies on all my spectrograms.

Should I scale my spectrograms with minimal and maximal energy for each specific frequency?

Does it make sense to have different frequencies with different scaling features?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昇り龍 2025-02-18 17:46:09

由于其偏斜,非正常的分布性质,频谱图用作计算机视觉算法的输入(特别是神经网络)非常棘手。要解决这个问题,您应该:

  1. 对输入进行归一化:使用简单的日志(1+C)(第一个选项)或Box-Cox转换(第二个选项)转换值,该值应扩展低值并压缩高值分布更多的高斯。
  2. 然后将转换的值带入适合您用例的间隔。对于CNN,MinMaxScaler应该足够好,但是将间隔更改为[0,1],即sklearn.minmaxscaler(((0,1))。对于经典的计算机视觉,这可以是sklearn.minmaxscaler(((0,255))

so,

我应该以最小和最大能量来缩放频谱图
每个特定频率?

是的,一旦归一化完成

拥有不同的频率不同的频率是有意义的
缩放功能?

这取决于。对于CNN,您的输入数据必须保持一致,以获得良好的结果。对于经典的计算机视觉方法,可能是根据您想处理的

Spectrograms are tricky to use as input to computer vision algorithms, specially to neural networks, due to their skewed, non-normal distribution nature. To tackle this you should:

  1. Normalized the input: transform the values either with a simple log(1+c) (first option) or a box-cox transformation (second option), which should expand low values and compress high ones, making the distribution more Gaussian.
  2. Then bring the transformed values into an interval suitable for your use case. In the case of CNNs a MinMaxScaler should be good enough for this, but change the interval to [0, 1], i.e. sklearn.MinMaxScaler((0, 1)). For classic computer vision, this could be sklearn.MinMaxScaler((0, 255))

So,

Should I scale my spectrograms with minimal and maximal energy for
each specific frequency?

Yes, once the normalization is done

and

Does it make sense to have different frequencies with different
scaling features?

It depends. For CNNs your input data needs to be consistent for good results. For classic computer vision approaches, could be, depending on what you want to do with it

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文