2023-02-14-DeepSpectrum特征提取
2023-02-14-DeepSpectrum特征提取
DeepSpectrum是一种重要的音频特征
环境搭建
git clone https://github.com/DeepSpectrum/DeepSpectrum.git
conda create -n deepspectrum python=3.7
conda activate deepspectrum
conda install ffmpeg
conda install cudatoolkit=10.0
pip install tensorflow-gpu==1.15.2
cd DeepSpectrum
pip install .
pip install protobuf==3.19.0
pip install matplotlib==3.0.3
pip install h5py==2.10.0
特征提取
deepspectrum features {input_path} -nl -en densenet121 -fl avg_pool -m mel -o {output_path}
完整代码
import os
import tqdm
root = "/data/abaw/Hume/"
wav_files = os.listdir(os.path.join(root,"train/wav"))
wav_files = sorted(wav_files)
save_path = os.path.join(root, "features/deepspectrum/")
if not os.path.exists(save_path):
os.makedirs(save_path,exist_ok=True)
wav_files = wav_files[5000:]
for wav in tqdm.tqdm(wav_files,desc="extracting deepspectrum features") :
input_path = os.path.join(root,"train/wav",wav)
output_path = os.path.join(save_path,wav.replace(".wav",".csv"))
cmd = f"deepspectrum features {input_path} -nl -en densenet121 -fl avg_pool -m mel -o {output_path}"
os.system(cmd)
print("finish: ",wav)
print("finish ALL")
# clean csv files

浙公网安备 33010602011771号