upload chinese doc of dataset api - stage2

This commit is contained in:
YangLuo 2022-09-13 17:38:10 +08:00
parent 2e4e87f73e
commit c635380293
68 changed files with 1015 additions and 9 deletions

View File

@ -0,0 +1,16 @@
mindspore.dataset.audio.Biquad
==============================
.. py:class:: mindspore.dataset.audio.Biquad(b0, b1, b2, a0, a1, a2)
给音频波形施加双二阶滤波器。
具体的数学公式与参数详见 `数字双二阶滤波器 <https://zh.m.wikipedia.org/wiki/%E6%95%B0%E5%AD%97%E6%BB%A4%E6%B3%A2%E5%99%A8>`_
参数:
- **b0** (float) - 电流输入的分子系数x[n]。
- **b1** (float) - 一个时间间隔前输入的分子系数x[n-1]。
- **b2** (float) - 两个时间间隔前输入的分子系数x[n-2]。
- **a0** (float) - 电流输出y[n]的分母系数该值不能为零通常为1。
- **a1** (float) - 电流输出y[n-1]的分母系数。
- **a2** (float) - 电流输出y[n-2]的分母系数。

View File

@ -0,0 +1,17 @@
mindspore.dataset.audio.BorderType
==================================
.. py:class:: mindspore.dataset.audio.BorderType
音频波形的填充模式。
可能的枚举值包括BorderType.CONSTANT、BorderType.EDGE、BorderType.REFLECT和BorderType.SYMMETRIC。
- **BorderType.CONSTANT** - 用常量值填充边界。
- **BorderType.EDGE** - 使用各边的边界像素值进行填充。
- **BorderType.REFLECT** - 以各边的边界为轴进行镜像填充,忽略边界像素值。
例如,对 [1,2,3,4] 的两侧分别填充2个元素结果为 [3,2,1,2,3,4,3,2]。
- **BorderType.SYMMETRIC** - 以各边的边界为轴进行对称填充,包括边界像素值。
例如,对 [1,2,3,4] 的两侧分别填充2个元素结果为 [2,1,1,2,3,4,4,3]。
.. note:: 该类派生自 :class:`str` 以支持 JSON 可序列化。

View File

@ -0,0 +1,13 @@
mindspore.dataset.audio.ComputeDeltas
=====================================
.. py:class:: mindspore.dataset.audio.ComputeDeltas(win_length=5, pad_mode=BorderType.EDGE)
计算光谱图的增量系数。
.. math::
d_{t}=\frac{{\textstyle\sum_{n=1}^{N}}n(c_{t+n}-c_{t-n})}{2{\textstyle\sum_{n=1}^{N}}n^{2}}
参数:
- **win_length** (int, 可选) - 计算窗口长度长度必须不小于3默认值5。
- **pad_mode** (BorderType, 可选) - 边界填充模式默认值BorderType.EDGE。

View File

@ -0,0 +1,10 @@
mindspore.dataset.audio.DBToAmplitude
=====================================
.. py:class:: mindspore.dataset.audio.DBToAmplitude(ref, power)
将音频波形从分贝转换为功率或振幅。
参数:
- **ref** (float) - 输出波形的缩放系数。
- **power** (float) - 如果 `power` 等于1则将分贝值转为功率如果为0.5,则将分贝值转为振幅。

View File

@ -0,0 +1,10 @@
mindspore.dataset.audio.DCShift
===============================
.. py:class:: mindspore.dataset.audio.DCShift(shift, limiter_gain=None)
对输入音频波形施加直流移位可以从音频中删除直流偏移DC Offset
参数:
- **ref** (float) - 音频的移位量,值必须在[-2.0, 2.0]范围内。
- **limiter_gain** (float, 可选) - 防止截断仅在波峰生效。值应远小于1如0.05或0.02。

View File

@ -0,0 +1,12 @@
mindspore.dataset.audio.DeemphBiquad
====================================
.. py:class:: mindspore.dataset.audio.DeemphBiquad(sample_rate)
为(..., time形状的音频波形施加双极点去声滤波器。
参数:
- **sample_rate** (int) - 采样频率单位Hz值必须为44100或48000。
异常:
- **RuntimeError** - 当输入音频的shape不为<..., time>。

View File

@ -0,0 +1,12 @@
mindspore.dataset.audio.DensityFunction
=======================================
.. py:class:: mindspore.dataset.audio.DensityFunction
密度函数。
可能的枚举值包括DensityFunction.TPDF、DensityFunction.RPDF和DensityFunction.GPDF。
- **DensityFunction.TPDF**:表示三角形概率密度函数。
- **DensityFunction.RPDF**:表示矩形概率密度函数。
- **DensityFunction.GPDF**:表示高斯概率密度函数。

View File

@ -0,0 +1,13 @@
mindspore.dataset.audio.DetectPitchFrequency
============================================
.. py:class:: mindspore.dataset.audio.DetectPitchFrequency(sample_rate, frame_time=0.01, win_length=30, freq_low=85, freq_high=3400)
检测音调频率,基于归一化互相关函数和中位平滑来实现。
参数:
- **sample_rate** (int) - 采样频率单位Hz值必须为44100或48000。
- **frame_time** (float, 可选) - 帧的持续时间值必须大于零。默认值0.01。
- **win_length** (int, 可选) - 中位平滑的窗口长度以帧数为单位该值必须大于零。默认值30。
- **freq_low** (int, 可选) - 可检测的最低频率Hz该值必须大于零。默认值85。
- **freq_high** (int, 可选) - 可检测的最高频率Hz该值必须大于零。默认值3400。

View File

@ -0,0 +1,12 @@
mindspore.dataset.audio.Dither
==============================
.. py:class:: mindspore.dataset.audio.Dither(density_function=DensityFunction.TPDF, noise_shaping=False)
通过消除非线性截断失真,增加存储在特定位深度的音频的感知动态范围。
参数:
- **density_function** (DensityFunction, 可选) - 连续随机变量的密度函数。
可以是DensityFunction.TPDF三角形概率密度函数、DensityFunction.RPDF矩形概率密度函数
或DensityFunction.GPDF高斯概率密度函数之一。默认值DensityFunction.TPDF。
- **noise_shaping** (bool, 可选) - 是否塑造量化误差的光谱能量。默认值False。

View File

@ -0,0 +1,14 @@
mindspore.dataset.audio.EqualizerBiquad
=======================================
.. py:class:: mindspore.dataset.audio.EqualizerBiquad(sample_rate, center_freq, gain, Q=0.707)
给音频波形施加双二次均衡器滤波器。
接口实现方式类似于 `SoX库 <http://sox.sourceforge.net/sox.html>`_
参数:
- **sample_rate** (int) - 采样频率单位Hz值不能为零。
- **center_freq** (float) - 中心频率单位Hz
- **gain** (float) - 期望提升或衰减的音频增益单位dB
- **Q** (float, 可选) - `品质因子 <https://zh.wikipedia.org/wiki/%E5%93%81%E8%B3%AA%E5%9B%A0%E5%AD%90>`_ ,能够反映带宽与采样频率和中心频率的关系,取值范围为(0, 1]默认值0.707。

View File

@ -0,0 +1,16 @@
mindspore.dataset.audio.Fade
============================
.. py:class:: mindspore.dataset.audio.Fade(fade_in_len=0, fade_out_len=0, fade_shape=FadeShape.LINEAR)
向波形添加淡入和/或淡出。
参数:
- **fade_in_len** (int, 可选) - 淡入长度时间帧必须是非负。默认值0。
- **fade_out_len** (int, 可选) - 淡出长度时间帧必须是非负。默认值0。
- **fade_shape** (FadeShape, 可选) - 淡入淡出形状可以是FadeShape.QUARTER_SINE、FadeShape.HALF_SINE、
FadeShape.LINEAR、FadeShape.LOGARITHMIC或FadeShape.EXPONENTIAL中的一个。默认值FadeShape.LINEAR。
异常:
- **RuntimeError** - 如果 `fade_in_len` 超过音频波形长度。
- **RuntimeError** - 如果 `fade_out_len` 超过音频波形长度。

View File

@ -0,0 +1,14 @@
mindspore.dataset.audio.FadeShape
=================================
.. py:class:: mindspore.dataset.audio.FadeShape
淡入淡出形状。
可能的枚举值包括FadeShape.QUARTER_SINE、FadeShape.HALF_SINE、FadeShape.LINEAR、FadeShape.LOGARITHMIC、FadeShape.EXPONENTIAL。
- **FadeShape.QUARTER_SINE**:表示淡入淡出形状为四分之一正弦模式。
- **FadeShape.HALF_SINE**:表示淡入形状为半正弦模式。
- **FadeShape.LINEAR**:表示淡入淡出形状为线性模式。
- **FadeShape.LOGARITHMIC**:表示淡入淡出形状为对数模式。
- **FadeShape.EXPONENTIAL**:表示淡入淡出形状为指数模式。

View File

@ -0,0 +1,20 @@
mindspore.dataset.audio.Flanger
===============================
.. py:class:: mindspore.dataset.audio.Flanger(sample_rate, delay=0.0, depth=2.0, regen=0.0, width=71.0, speed=0.5, phase=25.0, modulation=Modulation.SINUSOIDAL, interpolation=Interpolation.LINEAR)
对音频应用法兰盘效果。
参数:
- **sample_rate** (int) - 采样频率单位Hz例如44100 (Hz)。
- **delay** (float, 可选) - 延迟时间(毫秒),范围:[0, 30]。默认值0.0。
- **depth** (float, 可选) - 延迟深度(毫秒),范围:[0, 10]。默认值2.0。
- **regen** (float, 可选) - 反馈增益单位为dB范围[-95, 95]。默认值0.0。
- **width** (float, 可选) - 延迟增益单位为dB范围[0, 100]。默认值71.0。
- **speed** (float, 可选) - 调制速度单位为Hz范围[0.1, 10]。默认值0.5。
- **phase** (float, 可选) - 多通道的相移百分比,范围:[0, 100]。默认值25.0。
- **modulation** (Modulation, 可选) - 指定调制模式。
可以是Modulation.SINUSOIDAL或Modulation.TRIANGULAR之一。默认值Modulation.SINUSOIDAL。
- **interpolation** (Interpolation, 可选) - 指定插值模式。
可以是Interpolation.LINEAR或Interpolation.QUADRATIC中的一种。默认值Interpolation.LINEAR。

View File

@ -0,0 +1,9 @@
mindspore.dataset.audio.Gain
============================
.. py:class:: mindspore.dataset.audio.Gain(gain_db=1.0)
放大或衰减音频波形。
参数:
- **gain_db** (float) - 增益调整单位为分贝dB。默认值1.0。

View File

@ -0,0 +1,12 @@
mindspore.dataset.audio.GainType
================================
.. py:class:: mindspore.dataset.audio.GainType
增益类型。
可选的枚举值包括GainType.AMPLITUDE、GainType.POWER和GainType.DB。
- **GainType.AMPLITUDE** - 表示输入增益类型为振幅。
- **GainType.POWER** - 表示输入增益类型为功率。
- **GainType.DB** - 表示输入增益类型为分贝。

View File

@ -0,0 +1,25 @@
mindspore.dataset.audio.GriffinLim
==================================
.. py:class:: mindspore.dataset.audio.GriffinLim(n_fft=400, n_iter=32, win_length=None, hop_length=None, window_type=WindowType.HANN, power=2, momentum=0.99, length=None, rand_init=True)
使用GriffinLim算法对音频波形进行近似幅度谱图反演。
.. math::
x(n)=\frac{\sum_{m=-\infty}^{\infty} w(m S-n) y_{w}(m S, n)}{\sum_{m=-\infty}^{\infty} w^{2}(m S-n)}
其中w表示窗口函数y表示每个帧的重建信号x表示整个信号。
参数:
- **n_fft** (int, 可选) - FFT的长度默认值400。
- **n_iter** (int, 可选) - 相位恢复的迭代次数默认值32。
- **win_length** (int, 可选) - GriffinLim的窗口大小默认值None将设置为 `n_fft` 的值。
- **hop_length** (int, 可选) - STFT窗口之间的跳数长度默认值None将设置为 `win_length//2`
- **window_type** (WindowType, 可选) - GriffinLim的窗口类型可以是WindowType.BARTLETT
WindowType.BLACKMANWindowType.HAMMINGWindowType.HANN或WindowType.KAISER。
默认值WindowType.HANN目前macOS上不支持kaiser窗口。
- **power** (float, 可选) - 幅度谱图的指数默认值2.0。
- **momentum** (float, 可选) - 快速Griffin-Lim的动量默认值0.99。
- **length** (int, 可选) - 预期输出波形的长度。默认值None将设置为stft矩阵的最后一个维度的值。
- **rand_init** (bool, 可选) - 随机相位初始化或全零相位初始化标志默认值True。

View File

@ -0,0 +1,13 @@
mindspore.dataset.audio.HighpassBiquad
======================================
.. py:class:: mindspore.dataset.audio.HighpassBiquad(sample_rate, cutoff_freq, Q=0.707)
给音频波形上施加双二阶高通滤波器。
接口实现方式类似于 `SoX库 <http://sox.sourceforge.net/sox.html>`_
参数:
- **sample_rate** (int) - 采样频率单位Hz不能为零。
- **central_freq** (float) - 中心频率单位Hz
- **Q** (float, 可选) - `品质因子 <https://zh.wikipedia.org/wiki/%E5%93%81%E8%B3%AA%E5%9B%A0%E5%AD%90>`_ ,能够反映带宽与采样频率和中心频率的关系,取值范围为(0, 1]默认值0.707。

View File

@ -0,0 +1,11 @@
mindspore.dataset.audio.Interpolation
=====================================
.. py:class:: mindspore.dataset.audio.Interpolation
音频波形的插值模式。
可选的枚举值包括Interpolation.LINEAR和Interpolation.QUADRATIC。
- **Interpolation.LINEAR** - 插值类型为线性。
- **Interpolation.QUADRATIC** - 插值类型为二次型。

View File

@ -0,0 +1,20 @@
mindspore.dataset.audio.InverseMelScale
=======================================
.. py:class:: mindspore.dataset.audio.InverseMelScale(n_stft, n_mels=128, sample_rate=16000, f_min=0.0, f_max=None, max_iter=100000, tolerance_loss=1e-05, tolerance_change=1e-08, sgdargs=None, norm=NormType.NONE, mel_type=MelType.HTK)
使用转换矩阵求解STFT形成梅尔频率的STFT。
参数:
- **n_stft** (int, 可选) - STFT中的滤波器的组数。
- **n_mels** (int, 可选) - mel滤波器的数量默认值128。
- **sample_rate** (int, 可选) - 音频信号采样频率默认值16000。
- **f_min** (float, 可选) - 最小频率默认值0.0。
- **f_max** (float, 可选) - 最大频率默认值None将设置为 `sample_rate//2`
- **max_iter** (int, 可选) - 最大优化迭代次数默认值100000。
- **tolerance_loss** (float, 可选) - 当达到损失值时停止优化默认值1e-5。
- **tolerance_change** (float, 可选) - 指定损失差异当达到损失差异时停止优化默认值1e-8。
- **sgdargs** (dict, 可选) - SGD优化器的参数默认值None将设置为{'sgd_lr': 0.1, 'sgd_momentum': 0.9}。
- **norm** (NormType, 可选) - 标准化方法可以是NormType.SLANEY或NormType.NONE。默认值NormType.NONE。
- **mel_type** (MelType, 可选) - 要使用的Mel比例可以是MelType.SLAN或MelType.HTK。默认值MelType.HTK。

View File

@ -0,0 +1,16 @@
mindspore.dataset.audio.LFilter
===============================
.. py:class:: mindspore.dataset.audio.LFilter(a_coeffs, b_coeffs, clamp=True)
为(...time形状的音频波形施加双极滤波器。
参数:
- **a_coeffs** (sequence) - (n_order + 1)维数差分方程的分母系数。较低的延迟系数是第一位的,例如[a0, a1, a2, ...]。
大小必须与 `b_coeffs` 相同根据需要填充0
- **b_coeffs** (sequence) - (n_order + 1)维数差分方程的分子系数。较低的延迟系数是第一位的,例如[b0, b1, b2, ...]。
大小必须与 `a_coeffs` 相同根据需要填充0
- **clamp** (bool, 可选) - 如果为True则将输出信号截断在[-1, 1]范围内默认值True。
异常:
- **RuntimeError** - 当输入音频的shape不为<..., time>。

View File

@ -0,0 +1,12 @@
mindspore.dataset.audio.Magphase
================================
.. py:class:: mindspore.dataset.audio.Magphase(power=1.0)
将具有(..., 2形状的复值光谱图分离输出幅度和相位。
参数:
- **power** (float) - 范数的功率必须是非负的默认值1.0。
异常:
- **RuntimeError** - 当输入音频的shape不为<..., 2>。

View File

@ -0,0 +1,12 @@
mindspore.dataset.audio.MaskAlongAxis
=====================================
.. py:class:: mindspore.dataset.audio.MaskAlongAxis(mask_start, mask_width, mask_value, axis)
对音频波形应用掩码。掩码的起始和长度由 `[mask_start, mask_start + mask_width)` 决定。
参数:
- **mask_start** (int) - 掩码的起始位置,必须是非负的。
- **mask_width** (int) - 掩码的宽度,必须是非负的。
- **mask_value** (float) - 掩码值。
- **axis** (int) - 要应用掩码的轴1表示频率2表示时间

View File

@ -0,0 +1,14 @@
mindspore.dataset.audio.MaskAlongAxisIID
========================================
.. py:class:: mindspore.dataset.audio.MaskAlongAxisIID(mask_param, mask_value, axis)
对音频波形应用掩码。掩码的起始和长度由 `[mask_start, mask_start + mask_width)` 决定。
其中 `mask_width``uniform[0, mask_param]` 中采样, `mask_start``uniform[0, max_length - mask_width]` 中采样,
`max_length` 是光谱图中特定轴的列数。
参数:
- **mask_param** (int) - 要屏蔽的列数,将从[0, mask_param]统一采样,必须是非负数。
- **mask_value** (float) - 掩码值。
- **axis** (int) - 要应用掩码的轴1表示频率2表示时间

View File

@ -0,0 +1,16 @@
mindspore.dataset.audio.MelScale
================================
.. py:class:: mindspore.dataset.audio.MelScale(n_mels=128, sample_rate=16000, f_min=0, f_max=None, n_stft=201, norm=NormType.NONE, mel_type=MelType.HTK)
将正常STFT转换为梅尔尺度的STFT。
参数:
- **n_mels** (int, 可选) - 梅尔滤波器的数量默认值128。
- **sample_rate** (int, 可选) - 音频信号采样速率默认值16000。
- **f_min** (float, 可选) - 最小频率默认值0.0。
- **f_max** (float, 可选) - 最大频率默认值None将设置为 `sample_rate//2`
- **n_stft** (int, 可选) - STFT中的滤波器的组数默认值201。
- **norm** (NormType, 可选) - 标准化方法可以是NormType.SLANEY或NormType.NONE。默认值NormType.NONE。
- **mel_type** (MelType, 可选) - 要使用的Mel比例可以是MelType.SLAN或MelType.HTK。默认值MelType.HTK。

View File

@ -0,0 +1,15 @@
mindspore.dataset.audio.MelType
===============================
.. py:class:: mindspore.dataset.audio.MelType
梅尔尺度类型。
可选的枚举值包括MelType.HTK、MelType.SLANEY。
- **MelType.HTK** - 使用htk实现方式参考文献Slaney, M. Auditory Toolbox:
A MATLAB Toolbox for Auditory Modeling Work. Technical Report, version 2,
Interval Research Corporation, 1998.
- **MelType.SLANEY** - 使用slaney实现方式参考文献Young, S., Evermann, G.,
Gales, M., Hain, T., Kershaw, D., Liu, X., Moore, G., Odell, J., Ollason, D.,
Povey, D., Valtchev, V., & Woodland, P. The HTK book, version 3.4. Cambridge University, March 2009.

View File

@ -0,0 +1,11 @@
mindspore.dataset.audio.Modulation
==================================
.. py:class:: mindspore.dataset.audio.Modulation
调制类型。
可选的枚举值包括Modulation.SINUSOIDAL、Modulation.TRIANGULAR。
- **Modulation.SINUSOIDAL** - 表示输入调制类型为正弦。
- **Modulation.TRIANGULAR** - 表示输入调制类型为三角形。

View File

@ -0,0 +1,9 @@
mindspore.dataset.audio.MuLawDecoding
=====================================
.. py:class:: mindspore.dataset.audio.MuLawDecoding(quantization_channels=256)
解码mu-law编码信号。
参数:
- **quantization_channels** (int, 可选) - 通道数必须为正数。默认值256。

View File

@ -0,0 +1,9 @@
mindspore.dataset.audio.MuLawEncoding
=====================================
.. py:class:: mindspore.dataset.audio.MuLawEncoding(quantization_channels=256)
基于mu-law压缩的信号编码。
参数:
- **quantization_channels** (int, 可选) - 通道数必须为正数。默认值256。

View File

@ -0,0 +1,11 @@
mindspore.dataset.audio.NormMode
================================
.. py:class:: mindspore.dataset.audio.NormMode
规范类型。
可选的枚举值包括NormMode.ORTHO、NormMode.NONE。
- **NormMode.ORTHO** - 表示输入音频的模式为正交。
- **NormMode.NONE** - 表示输入音频的模式为none。

View File

@ -0,0 +1,11 @@
mindspore.dataset.audio.NormType
================================
.. py:class:: mindspore.dataset.audio.NormType
规范类型。
可选的枚举值包括NormType.SLANEY、NormType.NONE。
- **NormType.SLANEY** - 使用slaney规范化。
- **NormType.None** - 不使用规范化。

View File

@ -0,0 +1,10 @@
mindspore.dataset.audio.Overdrive
=================================
.. py:class:: mindspore.dataset.audio.Overdrive(gain=20.0, color=20.0)
对输入音频应用过载。
参数:
- **gain** (float, 可选) - 期望提升或衰减的音频增益单位dB范围为[0, 100]。默认值20.0。
- **color** (float, 可选) - 控制过驱动输出中的偶次谐波内容量,范围为[0, 100]。默认值20.0。

View File

@ -0,0 +1,10 @@
mindspore.dataset.audio.PhaseVocoder
====================================
.. py:class:: mindspore.dataset.audio.PhaseVocoder(rate, phase_advance)
给定STFT张量在不修改速率系数的情况下加速音高。
参数:
- **rate** (float) - 加速系数。
- **phase_advance** (numpy.ndarray) - 每个滤波器的预期相位前进形状为freq, 1

View File

@ -0,0 +1,17 @@
mindspore.dataset.audio.Phaser
==============================
.. py:class:: mindspore.dataset.audio.Phaser(sample_rate, gain_in=0.4, gain_out=0.74, delay_ms=3.0, decay=0.4, mod_speed=0.5, sinusoidal=True)
对音频应用相位效果。
参数:
- **sample_rate** (int) - 波形的采样率例如44100 (Hz)。
- **gain_in** (float, 可选) - 期望提升或衰减所需输入增益单位为dB。允许的值范围为[0, 1]默认值0.4。
- **gain_out** (float, 可选) - 期望提升或衰减期望输出增益单位为dB。允许的值范围为[0, 1e9]默认值0.74。
- **delay_ms** (float, 可选) - 延迟数,以毫秒为单位。允许的值范围为[0, 5]默认值3.0。
- **decay** (float, 可选) - 增益的期望衰减系数。允许的值范围为[0, 0.99]默认值0.4。
- **mod_speed** (float, 可选) - 调制速度单位为Hz。允许的值范围为[0.1, 2]默认值0.5。
- **sinusoidal** (bool, 可选) - 如果为True请使用正弦调制对于多个乐器效果最好
如果为False则使用triangular modulation使单个乐器具有更清晰的相位效果。默认值True。

View File

@ -0,0 +1,16 @@
mindspore.dataset.audio.Resample
================================
.. py:class:: mindspore.dataset.audio.Resample(orig_freq=16000, new_freq=16000, resample_method=ResampleMethod.SINC_INTERPOLATION, lowpass_filter_width=6, rolloff=0.99, beta=None)
将音频波形从一个频率重新采样到另一个频率,必要时可以指定重采样方法。
参数:
- **orig_freq** (float, 可选) - 音频波形的原始频率必须为正默认值16000。
- **new_freq** (float, 可选) - 目标音频波形频率必须为正默认值16000。
- **resample_method** (ResampleMethod, 可选) - 重采样方法可以是ResampleMethod.SINC_INTERPOLATION和ResampleMethod.KAISER_WINDOW。
默认值=ResampleMethod.SINC_INTERPOLATION。
- **lowpass_filter_width** (int, 可选) - 控制滤波器的宽度越多意味着更清晰但效率越低必须为正。默认值6。
- **rolloff** (float, 可选) - 滤波器的滚降频率作为Nyquist的一小部分。
较低的值减少了抗锯齿,但也减少了一些最高频率,范围:(0, 1]。默认值0.99。
- **beta** (float, 可选) - 用于kaiser窗口的形状参数默认值None将使用14.769656459379492。

View File

@ -0,0 +1,11 @@
mindspore.dataset.audio.ResampleMethod
======================================
.. py:class:: mindspore.dataset.audio.ResampleMethod
音频重采样方法。
可选的枚举值包括ResampleMethod.SINC_INTERPOLATION、ResampleMethod.KAISER_WINDOW。
- **ResampleMethod.SINC_INTERPOLATION** - 使用sinc插值重新采样。
- **ResampleMethod.KAISER_WINDOW** - 使用kaiser窗口重新采样。

View File

@ -0,0 +1,9 @@
mindspore.dataset.audio.RiaaBiquad
==================================
.. py:class:: mindspore.dataset.audio.RiaaBiquad(sample_rate)
对输入音频波形施加RIAA均衡。类似于SoX实现。
参数:
- **sample_rate** (int) - 波形的采样率例如44100 (Hz)只能是44100、48000、88200、96000中的一个。

View File

@ -7,5 +7,5 @@ mindspore.dataset.audio.ScaleType
可选枚举值为ScaleType.MAGNITUDE和ScaleType.POWER。
- **ScaleType.MAGNITUDE**表示输入音频的标度为振幅。
- **ScaleType.POWER**表示输入音频的标度为功率。
- **ScaleType.MAGNITUDE** - 表示输入音频的标度为振幅。
- **ScaleType.POWER** - 表示输入音频的标度为功率。

View File

@ -0,0 +1,14 @@
mindspore.dataset.audio.SlidingWindowCmn
========================================
.. py:class:: mindspore.dataset.audio.SlidingWindowCmn(cmn_window=600, min_cmn_window=100, center=False, norm_vars=False)
应用滑动窗口倒谱平均值(和可选的方差)标准化每个对话语句。
参数:
- **cmn_window** (int, 可选) - 用于运行平均CMN计算的帧中窗口默认值600。
- **min_cmn_window** (int, 可选) - 解码开始时使用的最小CMN窗口仅在开始时增加延迟
仅在中心为False时适用在中心为True时忽略默认值100。
- **center** (bool, 可选) - 如果为True则使用以当前帧为中心的窗口。如果为False则窗口在左侧。默认值False。
- **norm_vars** (bool, 可选) - 如果为True则将方差规范化为1。默认值False。

View File

@ -0,0 +1,15 @@
mindspore.dataset.audio.SpectralCentroid
========================================
.. py:class:: mindspore.dataset.audio.SpectralCentroid(sample_rate, n_fft=400, win_length=None, hop_length=None, pad=0, window=WindowType.HANN)
从音频信号创建光谱质心。
参数:
- **sample_rate** (int) - 波形的采样率例如44100 (Hz)。
- **n_fft** (int, 可选) - FFT的大小创建n_fft // 2 + 1 bins。默认值400。
- **win_length** (int, 可选) - 窗口大小默认值None将设置为 `n_fft` 的值。
- **hop_length** (int, 可选) - STFT窗口之间的跳数长度默认值None将设置为 `win_length//2`
- **pad** (int, 可选)信号的两侧填充数量默认值0。
- **window** (WindowType, 可选) - 窗口函数可以是WindowType.BARTLETT、WindowType.BLACKMAN、
WindowType.HAMMING、WindowType.HANN或WindowType.KAISER。默认值WindowType.HANN。

View File

@ -0,0 +1,22 @@
mindspore.dataset.audio.Spectrogram
===================================
.. py:class:: mindspore.dataset.audio.Spectrogram(n_fft=400, win_length=None, hop_length=None, pad=0, window=WindowType.HANN, power=2.0, normalized=False, center=True, pad_mode=BorderType.REFLECT, onesided=True)
从音频信号创建光谱图。
参数:
- **n_fft** (int, 可选) - FFT的大小创建 `n_fft // 2 + 1` 组滤波器默认值400。
- **win_length** (int, 可选) - 窗口大小默认值None将设置为 `n_fft` 的值。
- **hop_length** (int, 可选) - STFT窗口之间的跳数长度默认值None将设置为 `win_length//2`
- **pad** (int, 可选)信号的双面填充默认值0。
- **window_type** (WindowType, 可选) - GriffinLim的窗口类型可以是WindowType.BARTLETT
WindowType.BLACKMANWindowType.HAMMINGWindowType.HANN或WindowType.KAISER。
默认值WindowType.HANN目前macOS上不支持kaiser窗口。
- **power** (float, 可选) - 幅度谱图的指数默认值2.0。
- **normalized** (bool, 可选) - 是否在stft之后按幅度归一化。默认值False。
- **center** (bool, 可选) - 是否在两侧填充波形默认值True。
- **pad_mode** (BorderType, 可选) - 控制中心为True时使用的填充方法可以是BorderType.REFLECT、BorderType.CONSTANT、
BorderType.EDGE、BorderType.SYMMETRIC默认值BorderType.REFLECT。
- **onesided** (bool, 可选) - 控制是否返回一半结果以避免冗余默认值True。

View File

@ -0,0 +1,12 @@
mindspore.dataset.audio.TrebleBiquad
====================================
.. py:class:: mindspore.dataset.audio.TrebleBiquad(sample_rate, gain, central_freq=3000, Q=0.707)
对音频波形施加高音调控效果。类似于SoX实现。
参数:
- **sample_rate** (int) - 采样频率单位Hz不能为零。
- **gain** (float) - 期望提升或衰减的音频增益单位dB
- **central_freq** (float) - 中心频率单位Hz默认值3000。
- **Q** (float, 可选) - `品质因子 <https://zh.wikipedia.org/wiki/%E5%93%81%E8%B3%AA%E5%9B%A0%E5%AD%90>`_ ,能够反映带宽与采样频率和中心频率的关系,取值范围为(0, 1]默认值0.707。

View File

@ -0,0 +1,25 @@
mindspore.dataset.audio.Vad
===========================
.. py:class:: mindspore.dataset.audio.Vad(sample_rate, trigger_level=7.0, trigger_time=0.25, search_time=1.0, allowed_gap=0.25, pre_trigger_time=0.0, boot_time=0.35, noise_up_time=0.1, noise_down_time=0.01, noise_reduction_amount=1.35, measure_freq=20.0, measure_duration=None, measure_smooth_time=0.4, hp_filter_freq=50.0, lp_filter_freq=6000.0, hp_lifter_freq=150.0, lp_lifter_freq=2000.0)
从录音结束后修剪无声背景声音。
参数:
- **sample_rate** (int) - 采样频率单位Hz不能为零。
- **trigger_level** (float, 可选) - 用于触发活动检测的测量级别默认值7.0。
- **trigger_time** (float, 可选) - 用于帮助忽略短音的时间常数以秒为单位默认值0.25。
- **search_time** (float, 可选) - 在检测到的触发点之前搜索要包括的更安静/更短声音的音频量以秒为单位默认值1.0。
- **allowed_gap** (float, 可选) - 包括检测到的触发点之前较短/较短声音之间允许的间隙以秒为单位默认值0.25。
- **pre_trigger_time** (float, 可选) - 在触发点和任何找到的更安静/更短的声音突发之前要保留的音频量以秒为单位默认值0.0。
- **boot_time** (float, 可选) - 初始噪声估计的时间默认值0.35。
- **noise_up_time** (float, 可选) - 当噪音水平增加时自适应噪音估计器使用的时间常数默认值0.1。
- **noise_down_time** (float, 可选) - 当噪音水平降低时自适应噪音估计器使用的时间常数默认值0.01。
- **noise_reduction_amount** (float, 可选) - 检测算法中使用的降噪量默认值1.35。
- **measure_freq** (float, 可选) - 算法处理的频率默认值20.0。
- **measure_duration** (float, 可选) - 测量持续时间默认值None使用测量周期的两倍。
- **measure_smooth_time** (float, 可选) - 用于平滑光谱测量的时间常数默认值0.4。
- **hp_filter_freq** (float, 可选) - 应用于检测器算法输入的高通滤波器的"Brick-wall"频率默认值50.0。
- **lp_filter_freq** (float, 可选) - 应用于检测器算法输入的低通滤波器的"Brick-wall"频率默认值6000.0。
- **hp_lifter_freq** (float, 可选) - 应用于检测器算法输入的高通升降机的"Brick-wall"频率默认值150.0。
- **lp_lifter_freq** (float, 可选) - 应用于检测器算法输入的低通升降机的"Brick-wall"频率默认值20000.0。

View File

@ -0,0 +1,14 @@
mindspore.dataset.audio.Vol
===========================
.. py:class:: mindspore.dataset.audio.Vol(gain, gain_type=GainType.AMPLITUDE)
对音频波形施加放大或衰减。
参数:
- **gain** (float) - 增益调整的值。
如果 `gain_type` = GainType.AMPLITUDE则增益代表非负幅度比。
如果 `gain_type` = GainType.POWER则增益代表功率。
如果 `gain_type` = GainType.DB则增益代表分贝。
- **gain_type** (GainType, 可选) - 增益类型,包含以下三个枚举值增益类型.GainType.AMPLITUDE、
GainType.POWER和GainType.DB。默认值GainType.AMPLITUDE。

View File

@ -0,0 +1,15 @@
mindspore.dataset.audio.WindowType
==================================
.. py:class:: mindspore.dataset.audio.WindowType
窗口函数类型,
可选的枚举值包括WindowType.BARTTT、WindowType.BACKMAN、WindowType.HAMMING、WindowType.HANN、WindowType.KAISER。
- **WindowType.BARTTT** - 表示窗口函数的类型为Bartlett。
- **WindowType.BACKMAN** - 表示窗口函数的类型为Blackman。
- **WindowType.HAMMING** - 表示窗口函数的类型为Hamming。
- **WindowType.HANN** - 表示窗口函数的类型为Hann。
- **WindowType.KAISER** - 表示窗口函数的类型为Kaiser目前在macOS上不支持。

View File

@ -0,0 +1,14 @@
mindspore.dataset.audio.create_dct
==================================
.. py:function:: mindspore.dataset.audio.create_dct(n_mfcc, n_mels, norm=NormMode.NONE)
创建一个shape为(`n_mels`, `n_mfcc`)的DCT变换矩阵并根据范数进行标准化。
参数:
- **n_mfcc** (int) - 要保留mfc系数的数量该值必须大于0。
- **n_mels** (int) - mel滤波器的数量该值必须大于0。
- **norm** (NormMode, 可选) - 标准化模式可以是NormMode.NONE或NormMode.ORTHO。默认值NormMode.NONE。
返回:
numpy.ndarrayDCT转换矩阵。

View File

@ -0,0 +1,18 @@
mindspore.dataset.audio.melscale_fbanks
=======================================
.. py:function:: mindspore.dataset.audio.melscale_fbanks(n_freqs, f_min, f_max, n_mels, sample_rate, norm=NormType.NONE, mel_type=MelType.HTK)
创建shape为(`n_freqs`, `n_mels`)的频率变换矩阵。
参数:
- **n_freqs** (int) - 频率数。
- **f_min** (float) - 频率的最小值单位为Hz。
- **f_max** (float) - 频率的最大值单位为Hz。
- **n_mels** (int) - 梅尔滤波器的数量。
- **sample_rate** (int) - 采样频率单位Hz
- **norm** (audio.NormType, 可选) - 规范化的类型可以是NormType.NONE或NormType.SLANEY。默认值NormType.NONE。
- **mel_type** (audio.MelType, 可选) - 梅尔滤波器的类型可以是MelType.HTK或MelType.SLAN。默认值NormType.SLAN。
返回:
numpy.ndarray频率变换矩阵。

View File

@ -0,0 +1,19 @@
mindspore.dataset.text.CharNGram
=================================
.. py:class:: mindspore.dataset.text.CharNGram
CharNGram对象用于将tokens映射到预训练的向量中。
.. py:method:: from_file(file_path, max_vectors=None)
从文件构建CharNGram向量。
参数:
- **file_path** (str) - 包含CharNGram向量的文件路径。
- **max_vectors** (int可选) - 用于限制加载的预训练向量的数量。
大多数预训练的向量集是按词频降序排序的。因此,在如果内存不能存放整个向量集,或者由于其他原因不需要,
可以传递 `max_vectors` 限制加载数量。默认值None无限制。
返回:
CharNGram对象。

View File

@ -0,0 +1,19 @@
mindspore.dataset.text.FastText
================================
.. py:class:: mindspore.dataset.text.FastText
用于将tokens映射到矢量的FastText对象。
.. py:method:: from_file(file_path, max_vectors=None)
从文件构建CharNGram向量。
参数:
- **file_path** (str) - 包含向量的文件的路径。预训练向量集的文件后缀必须是 `*.vec`
- **max_vectors** (int可选) - 用于限制加载的预训练向量的数量。
大多数预训练的向量集是按词频降序排序的。因此,在如果内存不能存放整个向量集,或者由于其他原因不需要,
可以传递 `max_vectors` 限制加载数量。默认值None无限制。
返回:
FastText对象。

View File

@ -0,0 +1,8 @@
mindspore.dataset.text.FilterWikipediaXML
=========================================
.. py:class:: mindspore.dataset.text.FilterWikipediaXML(vocab, unknown_token=None, data_type=mstype.int32)
docs/api/api_python/dataset_text/mindspore.dataset.text.FilterWikipediaXML.rst
.. note:: Windows平台尚不支持 `FilterWikipediaXML`

View File

@ -0,0 +1,19 @@
mindspore.dataset.text.GloVe
=============================
.. py:class:: mindspore.dataset.text.GloVe
用于将tokens映射到矢量的GloVe对象。
.. py:method:: from_file(file_path, max_vectors=None)
从文件构建CharNGram向量。
参数:
- **file_path** (str) - 包含向量的文件的路径。预训练向量集的格式必须是 `glove.6B.*.txt`
- **max_vectors** (int可选) - 用于限制加载的预训练向量的数量。
大多数预训练的向量集是按词频降序排序的。因此,在如果内存不能存放整个向量集,或者由于其他原因不需要,
可以传递 `max_vectors` 限制加载数量。默认值None无限制。
返回:
GloVe对象。

View File

@ -0,0 +1,17 @@
mindspore.dataset.text.ToVectors
================================
.. py:class:: mindspore.dataset.text.ToVectors(vectors, unk_init=None, lower_case_backup=False)
根据输入向量表查找向量中的tokens。
参数:
- **vectors** (Vectors) - 矢量对象。
- **unk_init** (sequence, 可选) - 用于初始化矢量外OOV令牌的序列默认值None用零向量初始化。
- **lower_case_backup** (bool, 可选) - 是否查找小写的token。如果为False则将查找原始大小写中的每个token。
如果为True则将首先查找原始大小写中的每个token如果在属性soi的键中找不到则将查找小写中的token。默认值False。
异常:
- **TypeError** - 如果 `unk_init` 不是序列。
- **TypeError** - 如果 `unk_init` 的元素不是float或int类型。
- **TypeError** - 如果 `lower_case_backup` 不是bool类型。

View File

@ -0,0 +1,19 @@
mindspore.dataset.text.Vectors
===============================
.. py:class:: mindspore.dataset.text.Vectors
用于将tokens映射到矢量的Vectors对象。
.. py:method:: from_file(file_path, max_vectors=None)
从文件构建Vectors向量。
参数:
- **file_path** (str) - 包含向量的文件的路径。
- **max_vectors** (int可选) - 用于限制加载的预训练向量的数量。
大多数预训练的向量集是按词频降序排序的。因此,在如果内存不能存放整个向量集,或者由于其他原因不需要,
可以传递 `max_vectors` 限制加载数量。默认值None无限制。
返回:
Vectors对象。

View File

@ -0,0 +1,19 @@
mindspore.dataset.vision.AdjustGamma
====================================
.. py:class:: mindspore.dataset.vision.AdjustGamma(gamma, gain=1)
对输入图像应用伽马校正。更多详细信息,请参见 `Gamma矫正 <https://en.wikipedia.org/wiki/Gamma_correction>`_
.. math::
I_{\text{out}} = 255 \times \text{gain} \times \left(\frac{I_{\text{in}}}{255}\right)^{\gamma}
参数:
- **gamma** (float) - 输出图像像素值与输入图像像素值呈指数相关。 `gamma` 大于1使阴影更暗`gamma` 小于1使黑暗区域更亮。
- **gain** (float, 可选) - 常数乘数默认值1。
异常:
- **TypeError** - 如果 `gain` 不是浮点类型。
- **TypeError** - 如果 `gamma` 不是浮点类型。
- **ValueError** - 如果 `gamma` 小于0。
- **RuntimeError** - 如果给定的张量形状不是<H, W>或<..., H, W, C>。

View File

@ -0,0 +1,33 @@
mindspore.dataset.vision.AutoAugment
====================================
.. py:class:: mindspore.dataset.vision.AutoAugment(policy=AutoAugmentPolicy.IMAGENET, interpolation=Inter.NEAREST, fill_value=0)
应用AutoAugment数据增强方法基于论文 `AutoAugment: Learning Augmentation Strategies from Data <https://arxiv.org/pdf/1805.09501.pdf>`_
此操作仅适用于3通道RGB图像。
参数:
- **policy** (AutoAugmentPolicy, 可选) - 在不同数据集上学习的AutoAugment策略默认值AutoAugmentPolicy.IMAGENET。
可以是[AutoAugmentPolicy.IMAGENET, AutoAugmentPolicy.CIFAR10, AutoAugmentPolicy.SVHN]中的任何一个。
- **AutoAugmentPolicy.IMAGENET**表示应用在ImageNet数据集上学习的AutoAugment。
- **AutoAugmentPolicy.CIFAR10**表示应用在Cifar10数据集上学习的AutoAugment。
- **AutoAugmentPolicy.SVHN**表示应用在SVHN数据集上学习的AutoAugment。
- **interpolation** (Inter, 可选) - 调整大小算子的图像插值模式默认值Inter.NEAREST。
可以是[Inter.NEAREST, Inter.BILINEAR, Inter.BICUBIC, Inter.AREA]中的任何一个。
- **Inter.NEAREST**:表示插值方法是最近邻插值。
- **Inter.BILINEAR**:表示插值方法是双线性插值。
- **Inter.BICUBIC**:表示插值方法为双三次插值。
- **Inter.AREA**:表示插值方法为面积插值。
- **fill_value** (Union[int, tuple[int]], 可选) - 填充的像素值。
如果是3元素元组则分别用于填充R、G、B通道。
如果是整数,则用于所有 RGB 通道。 `fill_value` 值必须在 [0, 255] 范围内默认值0。
异常:
- **TypeError** - 如果 `policy` 不是AutoAugmentPolicy类型。
- **TypeError** - 如果 `interpolation` 不是Inter类型。
- **TypeError** - 如果 如果 `fill_value` 不是整数或长度为3的元组。
- **RuntimeError** - 如果给定的张量形状不是<H, W, C>。

View File

@ -0,0 +1,67 @@
mindspore.dataset.vision.AutoAugmentPolicy
==========================================
.. py:class:: mindspore.dataset.vision.AutoAugmentPolicy
不同数据集的自动增强策略。
可能的枚举值包括AutoAugmentPolicy.IMAGENET、AutoAugmentPolicy.CIFAR10、AutoAugmentPolicy.SVHN。
每个策略包含25对增强操作。使用AutoAugment时每个图像都会使用这些操作对中的一个随机转换。每对有2个不同的操作。下面显示了所有这些增强操作包括操作名称及其概率和随机参数。
- AutoAugmentPolicy.IMAGENETImageNet的数据集自动增强策略。
.. code-block::
Augmentation operations pair:
[(("Posterize", 0.4, 8), ("Rotate", 0.6, 9)), (("Solarize", 0.6, 5), ("AutoContrast", 0.6, None)),
(("Equalize", 0.8, None), ("Equalize", 0.6, None)), (("Posterize", 0.6, 7), ("Posterize", 0.6, 6)),
(("Equalize", 0.4, None), ("Solarize", 0.2, 4)), (("Equalize", 0.4, None), ("Rotate", 0.8, 8)),
(("Solarize", 0.6, 3), ("Equalize", 0.6, None)), (("Posterize", 0.8, 5), ("Equalize", 1.0, None)),
(("Rotate", 0.2, 3), ("Solarize", 0.6, 8)), (("Equalize", 0.6, None), ("Posterize", 0.4, 6)),
(("Rotate", 0.8, 8), ("Color", 0.4, 0)), (("Rotate", 0.4, 9), ("Equalize", 0.6, None)),
(("Equalize", 0.0, None), ("Equalize", 0.8, None)), (("Invert", 0.6, None), ("Equalize", 1.0, None)),
(("Color", 0.6, 4), ("Contrast", 1.0, 8)), (("Rotate", 0.8, 8), ("Color", 1.0, 2)),
(("Color", 0.8, 8), ("Solarize", 0.8, 7)), (("Sharpness", 0.4, 7), ("Invert", 0.6, None)),
(("ShearX", 0.6, 5), ("Equalize", 1.0, None)), (("Color", 0.4, 0), ("Equalize", 0.6, None)),
(("Equalize", 0.4, None), ("Solarize", 0.2, 4)), (("Solarize", 0.6, 5), ("AutoContrast", 0.6, None)),
(("Invert", 0.6, None), ("Equalize", 1.0, None)), (("Color", 0.6, 4), ("Contrast", 1.0, 8)),
(("Equalize", 0.8, None), ("Equalize", 0.6, None))]
- AutoAugmentPolicy.CIFAR10Cifar10的数据集自动增强策略。
.. code-block::
Augmentation operations pair:
[(("Invert", 0.1, None), ("Contrast", 0.2, 6)), (("Rotate", 0.7, 2), ("TranslateX", 0.3, 9)),
(("Sharpness", 0.8, 1), ("Sharpness", 0.9, 3)), (("ShearY", 0.5, 8), ("TranslateY", 0.7, 9)),
(("AutoContrast", 0.5, None), ("Equalize", 0.9, None)), (("ShearY", 0.2, 7), ("Posterize", 0.3, 7)),
(("Color", 0.4, 3), ("Brightness", 0.6, 7)), (("Sharpness", 0.3, 9), ("Brightness", 0.7, 9)),
(("Equalize", 0.6, None), ("Equalize", 0.5, None)), (("Contrast", 0.6, 7), ("Sharpness", 0.6, 5)),
(("Color", 0.7, 7), ("TranslateX", 0.5, 8)), (("Equalize", 0.8, None), ("Invert", 0.1, None)),
(("TranslateY", 0.4, 3), ("Sharpness", 0.2, 6)), (("Brightness", 0.9, 6), ("Color", 0.2, 8)),
(("Solarize", 0.5, 2), ("Invert", 0.0, None)), (("TranslateY", 0.9, 9), ("TranslateY", 0.7, 9)),
(("Equalize", 0.2, None), ("Equalize", 0.6, None)), (("Color", 0.9, 9), ("Equalize", 0.6, None)),
(("AutoContrast", 0.8, None), ("Solarize", 0.2, 8)), (("Brightness", 0.1, 3), ("Color", 0.7, 0)),
(("Solarize", 0.4, 5), ("AutoContrast", 0.9, None)),
(("AutoContrast", 0.9, None), ("Solarize", 0.8, 3)),
(("TranslateY", 0.7, 9), ("AutoContrast", 0.9, None)),
(("Equalize", 0.3, None), ("AutoContrast", 0.4, None)),
(("Equalize", 0.2, None), ("AutoContrast", 0.6, None))]
- AutoAugmentPolicy.SVHNSVHN的数据集自动增强策略。
.. code-block::
Augmentation operations pair:
[(("ShearX", 0.9, 4), ("Invert", 0.2, None)), (("ShearY", 0.9, 8), ("Invert", 0.7, None)),
(("Equalize", 0.6, None), ("Solarize", 0.6, 6)), (("Invert", 0.9, None), ("Equalize", 0.6, None)),
(("Equalize", 0.6, None), ("Rotate", 0.9, 3)), (("ShearX", 0.9, 4), ("AutoContrast", 0.8, None)),
(("ShearY", 0.9, 8), ("Invert", 0.4, None)), (("ShearY", 0.9, 5), ("Solarize", 0.2, 6)),
(("Invert", 0.9, None), ("AutoContrast", 0.8, None)), (("Equalize", 0.6, None), ("Rotate", 0.9, 3)),
(("ShearX", 0.9, 4), ("Solarize", 0.3, 3)), (("ShearY", 0.8, 8), ("Invert", 0.7, None)),
(("Equalize", 0.9, None), ("TranslateY", 0.6, 6)), (("Invert", 0.9, None), ("Equalize", 0.6, None)),
(("Contrast", 0.3, 3), ("Rotate", 0.8, 4)), (("Invert", 0.8, None), ("TranslateY", 0.0, 2)),
(("ShearY", 0.7, 6), ("Solarize", 0.4, 8)), (("Invert", 0.6, None), ("Rotate", 0.8, 4)),
(("ShearY", 0.3, 7), ("TranslateX", 0.9, 3)), (("ShearX", 0.1, 6), ("Invert", 0.6, None)),
(("Solarize", 0.7, 2), ("TranslateY", 0.6, 7)), (("ShearY", 0.8, 4), ("Invert", 0.8, None)),
(("ShearX", 0.7, 9), ("TranslateY", 0.8, 3)), (("ShearY", 0.8, 5), ("AutoContrast", 0.7, None)),
(("ShearX", 0.7, 2), ("Invert", 0.1, None))]

View File

@ -10,6 +10,8 @@ mindspore.dataset.vision.Border
- **Border.CONSTANT** - 使用常量值进行填充。
- **Border.EDGE** - 使用各边的边界像素值进行填充。
- **Border.REFLECT** - 以各边的边界为轴进行镜像填充,忽略边界像素值。
例如,对 [1,2,3,4] 的两侧分别填充2个元素结果为 [3,2,1,2,3,4,3,2]。
- **Border.SYMMETRIC** - 以各边的边界为轴进行对称填充,包括边界像素值。
例如,对 [1,2,3,4] 的两侧分别填充2个元素结果为 [2,1,1,2,3,4,4,3]。
.. note:: 该类派生自 :class:`str` 以支持 JSON 可序列化。

View File

@ -0,0 +1,34 @@
mindspore.dataset.vision.PadToSize
==================================
.. py:class:: mindspore.dataset.vision.PadToSize(size, offset=None, fill_value=0, padding_mode=Border.CONSTANT)
将图像填充到固定大小。
参数:
- **size** (Union[int, Sequence[int]]) - 要填充的目标大小。
若输入整型,则将图像填充为(size, size)大小;如果提供了序列[int, int],则将图像填充为(高度, 宽度)大小。
- **offset** (Union[int, Sequence[int]], 可选) - 顶部和左侧要填充的长度。
如果输入整型,使用此值填充图像上侧和左侧。
如果提供了序列[int, int],则应按[top, left]的顺序排列,填充图像上侧和左侧。
默认值None表示对称填充。
- **fill_value** (Union[int, tuple[int]], 可选) - 填充的像素值,仅在 `padding_mode` 取值为Border.CONSTANT时有效。
如果是3元素元组则分别用于填充R、G、B通道。
如果是整数,则用于所有 RGB 通道。
`fill_value` 值必须在 [0, 255] 范围内默认值0。
- **padding_mode** (Border, 可选) - 边界填充方式。可以是 [Border.CONSTANT、Border.EDGE、Border.REFLECT、Border.SYMMETRIC] 中的任何一个默认值Border.CONSTANT。
- **Border.CONSTANT** - 使用常量值进行填充。
- **Border.EDGE** - 使用各边的边界像素值进行填充。
- **Border.REFLECT** - 以各边的边界为轴进行镜像填充,忽略边界像素值。
- **Border.SYMMETRIC** - 以各边的边界为轴进行对称填充,包括边界像素值。
异常:
- **TypeError** - 如果 `size` 不是int或tuple[int, int]类型。
- **TypeError** - 如果 `offset` 不是int或tupl[int, int]类型。
- **TypeError** - 如果 `fill_value` 不是int或tuple[int]类型。
- **TypeError** - 如果 `padding_mode` 不是 :class:`mindspore.dataset.vision.Border` 的类型。
- **ValueErrorr** - 如果 `size` 不是正数。
- **ValueErrorr** - 如果 `offset` 为负数。
- **ValueErrorr** - 如果 `fill_value` 不在[0, 255]的范围内。
- **RuntimeErrorr** - 如果输入图像的形状不是<H, W>或<H, W, C>。

View File

@ -0,0 +1,18 @@
mindspore.dataset.vision.RandomAdjustSharpness
==============================================
.. py:class:: mindspore.dataset.vision.RandomAdjustSharpness(degree, prob=0.5)
以给定的概率随机调整输入图像的清晰度。
参数:
- **degrees** (float) - 锐度调整度,必须是非负的。
0.0度表示模糊图像1.0度表示原始图像2.0度表示清晰度增加2倍。
- **prob** (float, 可选) - 图像被锐化的概率默认值0.5。
异常:
- **TypeError** - 如果 `degree` 的类型不为float。
- **TypeError** - 如果 `prob` 的类型不为bool。
- **ValueError** - 如果 `prob` 不在 [0, 1] 范围。
- **ValueError** - 如果 `degree` 为负数。
- **RuntimeError** -如果给定的张量形状不是<H, W>或<H, W, C>。

View File

@ -0,0 +1,20 @@
mindspore.dataset.vision.RandomAutoContrast
===========================================
.. py:class:: mindspore.dataset.vision.RandomAutoContrast(cutoff=0.0, ignore=None, prob=0.5)
以给定的概率自动调整图像的对比度。
参数:
- **cutoff** (float, 可选) - 输入图像直方图中最亮和最暗像素的百分比。该值必须在 [0.0, 50.0) 范围内默认值0.0。
- **ignore** (Union[int, sequence], 可选) - 要忽略的背景像素值,忽略值必须在 [0, 255] 范围内默认值None。
- **prob** (float, 可选) - 图像被调整对比度的概率默认值0.5。
异常:
- **TypeError** - 如果 `cutoff` 不是float类型。
- **TypeError** - 如果 `ignore` 不是int或sequence类型。
- **TypeError** - 如果 `prob` 的类型不为bool。
- **ValueError** - 如果 `cutoff` 不在[0, 50.0) 范围内。
- **ValueError** - 如果 `ignore` 不在[0, 255] 范围内。
- **ValueError** - 如果 `prob` 不在 [0, 1] 范围。
- **RuntimeError** - 如果输入图像的shape不是 <H, W> 或 <H, W, C>。

View File

@ -0,0 +1,14 @@
mindspore.dataset.vision.RandomEqualize
=======================================
.. py:class:: mindspore.dataset.vision.RandomEqualize(prob=0.5)
以给定的概率随机对输入图像进行直方图均衡化。
参数:
- **prob** (float, 可选) - 图像被均衡化的概率默认值0.5。
异常:
- **TypeError** - 如果 `prob` 的类型不为bool。
- **ValueError** - 如果 `prob` 不在 [0, 1] 范围。
- **RuntimeError** - 如果输入图像的shape不是 <H, W> 或 <H, W, C>。

View File

@ -0,0 +1,14 @@
mindspore.dataset.vision.RandomInvert
=====================================
.. py:class:: mindspore.dataset.vision.RandomInvert(prob=0.5)
以给定的概率随机反转图像的颜色。
参数:
- **prob** (float, 可选) - 图像被反转颜色的概率默认值0.5。
异常:
- **TypeError** - 如果 `prob` 的类型不为bool。
- **ValueError** - 如果 `prob` 不在 [0, 1] 范围。
- **RuntimeError** - 如果输入图像的shape不是 <H, W, C>。

View File

@ -0,0 +1,14 @@
mindspore.dataset.vision.RandomLighting
========================================
.. py:class:: mindspore.dataset.vision.RandomLighting(alpha=0.05)
将AlexNet PCA的噪声添加到图像中其中Alexnet PCA噪声的特征值和特征向量是由ImageNet数据集计算得出。
参数:
- **alpha** (float, 可选) - 图像的强度必须是非负的。默认值0.05。
异常:
- **TypeError** - 如果 `alpha` 的类型不为bool。
- **ValueError** - 如果 `alpha` 为负数。
- **RuntimeError** - 如果输入图像的shape不是 <H, W, C>。

View File

@ -0,0 +1,12 @@
mindspore.dataset.text.get_image_num_channels
==============================================
.. py:function:: mindspore.dataset.text.get_image_num_channels(image)
获取输入图像通道数。
参数:
- **image** (Union[numpy.ndarray, PIL.Image.Image]) - 用于获取通道数的图像。
返回:
int输入图像通道数。

View File

@ -0,0 +1,12 @@
mindspore.dataset.text.get_image_size
======================================
.. py:function:: mindspore.dataset.text.get_image_size(image)
获取输入图像的大小为[高度, 宽度]。
参数:
- **image** (Union[numpy.ndarray, PIL.Image.Image]) - 要获取大小的图像。
返回:
list[int, int],图像大小。

View File

@ -420,6 +420,7 @@ class BassBiquad(AudioTensorOperation):
class Biquad(TensorOperation):
"""
Perform a biquad filter of input audio.
Mathematical fomulas refer to: `Digital_biquad_filter <https://en.wikipedia.org/wiki/Digital_biquad_filter>`_ .
Args:
b0 (float): Numerator coefficient of current input, x[n].
@ -644,6 +645,9 @@ class DeemphBiquad(AudioTensorOperation):
sample_rate (int): sampling rate of the waveform, e.g. 44100 (Hz),
the value must be 44100 or 48000.
Raises:
RuntimeError: If the shape of input audio waveform does not match <..., time>.
Examples:
>>> import numpy as np
>>>
@ -837,6 +841,9 @@ class Filtfilt(AudioTensorOperation):
Must be same size as a_coeffs (pad with 0's as necessary).
clamp (bool, optional): If True, clamp the output signal to be in the range [-1, 1]. Default=True.
Raises:
RuntimeError: If the shape of input audio waveform does not match <..., time>.
Examples:
>>> import numpy as np
>>>
@ -1225,6 +1232,9 @@ class Magphase(AudioTensorOperation):
Args:
power (float): Power of the norm, which must be non-negative (default=1.0).
Raises:
RuntimeError: If the shape of input audio waveform does not match <..., 2>.
Examples:
>>> import numpy as np
>>>

View File

@ -31,9 +31,12 @@ class BorderType(str, Enum):
- BorderType.CONSTANT: means it fills the border with constant values.
- BorderType.EDGE: means it pads with the last value on the edge.
- BorderType.REFLECT: means it reflects the values on the edge omitting the last value of edge.
For example, padding [1,2,3,4] with 2 elements on both sides will result in [3,2,1,2,3,4,3,2].
- BorderType.SYMMETRIC: means it reflects the values on the edge repeating the last value of edge.
For example, padding [1,2,3,4] with 2 elements on both sides will result in [2,1,1,2,3,4,4,3].
Note: This class derived from class str to support json serializable.
Note:
This class derived from class str to support json serializable.
"""
CONSTANT: str = "constant"
EDGE: str = "edge"
@ -111,8 +114,12 @@ class MelType(str, Enum):
Possible enumeration values are: MelType.HTK, MelType.SLANEY.
- MelType.NONE: scale the input data with htk.
- MelType.ORTHO: scale the input data with slaney.
- MelType.HTK: scale the input data with htk implementation, refer to "Slaney, M. Auditory Toolbox:
A MATLAB Toolbox for Auditory Modeling Work. Technical Report, version 2,
Interval Research Corporation, 1998".
- MelType.SLANEY: scale the input data with slaney implementation, refer to "Young, S., Evermann, G.,
Gales, M., Hain, T., Kershaw, D., Liu, X., Moore, G., Odell, J., Ollason, D.,
Povey, D., Valtchev, V., & Woodland, P. The HTK book, version 3.4. Cambridge University, March 2009".
"""
HTK: str = "htk"
SLANEY: str = "slaney"

View File

@ -42,7 +42,7 @@ class CharNGram(cde.CharNGram):
file_path (str): Path of the file that contains the CharNGram vectors.
max_vectors (int, optional): This can be used to limit the number of pre-trained vectors loaded.
Most pre-trained vector sets are sorted in the descending order of word frequency. Thus, in
situations where the entire set doesnt fit in memory, or is not needed for another reason,
situations where the entire set doesn't fit in memory, or is not needed for another reason,
passing max_vectors can limit the size of the loaded set (default=None, no limit).
Examples:
@ -69,7 +69,7 @@ class FastText(cde.FastText):
must be `*.vec`.
max_vectors (int, optional): This can be used to limit the number of pre-trained vectors loaded.
Most pre-trained vector sets are sorted in the descending order of word frequency. Thus, in
situations where the entire set doesnt fit in memory, or is not needed for another reason,
situations where the entire set doesn't fit in memory, or is not needed for another reason,
passing max_vectors can limit the size of the loaded set (default=None, no limit).
Examples:
@ -96,7 +96,7 @@ class GloVe(cde.GloVe):
must be `glove.6B.*.txt`.
max_vectors (int, optional): This can be used to limit the number of pre-trained vectors loaded.
Most pre-trained vector sets are sorted in the descending order of word frequency. Thus, in
situations where the entire set doesnt fit in memory, or is not needed for another reason,
situations where the entire set doesn't fit in memory, or is not needed for another reason,
passing max_vectors can limit the size of the loaded set (default=None, no limit).
Examples:
@ -327,7 +327,7 @@ class Vectors(cde.Vectors):
file_path (str): Path of the file that contains the vectors.
max_vectors (int, optional): This can be used to limit the number of pre-trained vectors loaded.
Most pre-trained vector sets are sorted in the descending order of word frequency. Thus, in
situations where the entire set doesnt fit in memory, or is not needed for another reason,
situations where the entire set doesn't fit in memory, or is not needed for another reason,
passing max_vectors can limit the size of the loaded set (default=None, no limit).
Examples:

View File

@ -119,7 +119,9 @@ class Border(str, Enum):
- Border.CONSTANT: means it fills the border with constant values.
- Border.EDGE: means it pads with the last value on the edge.
- Border.REFLECT: means it reflects the values on the edge omitting the last value of edge.
For example, padding [1,2,3,4] with 2 elements on both sides will result in [3,2,1,2,3,4,3,2].
- Border.SYMMETRIC: means it reflects the values on the edge repeating the last value of edge.
For example, padding [1,2,3,4] with 2 elements on both sides will result in [2,1,1,2,3,4,4,3].
Note:
This class derived from class str to support json serializable.