💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
提出了一种名为BST的S变换的批处理实现,以提高频繁计算S变换的算法的效率。所提出的BST支持基于MATLAB的GPU加速和CPU矢量化加速,与原版S变换相比,分别可以实现约12倍和5倍的加速度。此外,所设计的BST还可以嵌入到深度神经网络中,并结合在线增强策略来增强模型性能。此外,BST支持水平挤压操作,可实现降维。BST已经在我们之前的多个作品中使用,显示了它的有效性和影响。
📚2 运行结果
部分代码如下:
%% Main
clear;
ThisToolRootPath = pwd;
addpath(genpath(ThisToolRootPath));
%% Settings
rng('default')
s = rng;
nChannels = 10000;
randSignals = rand(1,256, nChannels);
Fs = 256;
sqzSize = 8; % Squeeze size (pooling size) along time axis
outputMode = 'psd'; % Output method ('amplitude', 'psd', 'phase', 'amplitude+phase', 'psd+phase')
selFreqRange = [1,50]; % Frequency range (Hz)
freqPrecision = 1; % Frequency domain resolution
gaussianFactor = 0.5; % p-value of generalized S-transform to ajust the Gaussian window shape
for iRepeat = 1:10
%% Vanilla ST
tic_vst = tic;
stMap_vanilla_single = zeros(50, 32, nChannels);
for i = 1:size(randSignals,3)
curSignal = randSignals(:,:,i);
stMap_vanilla_single(:,:,i) = FeatureExtract_STransSingle(curSignal,Fs,selFreqRange,freqPrecision,gaussianFactor,sqzSize, outputMode);
end
t_vst(iRepeat) = toc(tic_vst);
disp(['Vanilla ST consumes: ' num2str(t_vst(iRepeat)) 's']);
%% Mex ST
tic_mst = tic;
stMap_mex_single = zeros(50, 32, nChannels);
for i = 1:size(randSignals,3)
curSignal = randSignals(:,:,i);
stMap_mex_single(:,:,i) = FeatureExtract_STransSingleMex(curSignal,Fs,selFreqRange,freqPrecision,gaussianFactor,sqzSize, outputMode);
end
t_mst(iRepeat) = toc(tic_mst);
disp(['Mex ST consumes: ' num2str(t_mst(iRepeat)) 's']);
%% Vectorized ST
tic_gst = tic;
stMap_Vec = FeatureExtract_STransGPU(randSignals,Fs,selFreqRange,freqPrecision,gaussianFactor,sqzSize, outputMode);
t_vecst(iRepeat) = toc(tic_gst);
disp(['Vectorized ST consumes: ' num2str(t_vecst(iRepeat)) 's']);
%% GPU ST
if canUseGPU
randSignals_gpu = gpuArray(randSignals);
tic_gst = tic;
stMap_GPU = FeatureExtract_STransGPU(randSignals_gpu,Fs,selFreqRange,freqPrecision,gaussianFactor,sqzSize, outputMode);
t_gst(iRepeat) = toc(tic_gst);
stMap_GPU = gather(stMap_GPU);
disp(['GPU ST consumes: ' num2str(t_gst(iRepeat)) 's']);
end
%% Validation
error_GPU_V = sum(abs(stMap_Vec-stMap_vanilla_single), 'all');
error_GPU_M = sum(abs(stMap_Vec-stMap_mex_single), 'all');
error_V_M = sum(abs(stMap_vanilla_single-stMap_mex_single), 'all');
end
t_vst_mean = mean(t_vst);
t_vst_std = std(t_vst);
t_mst_mean = mean(t_mst);
t_mst_std = std(t_mst);
t_vecst_mean = mean(t_vecst);
t_vecst_std = std(t_vecst);
t_gst_mean = mean(t_gst);
t_gst_std = std(t_gst);
🎉3 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]Guoyang Liu (2023) BST: A tool for batch processing of S-transform
[2]王鹏飞,任丽佳,高燕.基于不完全S变换和改进SVM的电能质量分类方法[J].制造业自动化,2023,45(01):115-119.