找开源数据来练练手,虽然可以直接通过pytorch或TensorFlow加载使用,但感觉太麻烦了,所以想直接下载到本地使用。上网直接搜数据集没有那种直接下载的链接,最后发现可以直接通过pytorch或是TensorFlow下载。下面以pytorch下载Speech Command数据集为例。
下载方法介绍(可直接看最后的下载代码) 1、找到对应数据的页面如Speech Command数据集
拖到下面的Dataset Loader,根据需要选择对应的下载路径。本例使用pytorch。
2、找到对应的代码仓
root (str or Path) – Path to the directory where the dataset is found or downloaded. url (str, optional) – The URL to download the dataset from, or the type of the dataset to download. Allowed type values are "speech_commands_v0.01" and "speech_commands_v0.02" (default: "speech_commands_v0.02") folder_in_archive (str, optional) – The top-level directory of the dataset. (default: "SpeechCommands") download (bool, optional) – Whether to download the dataset if it is not found at root path. (default: False). subset (str or None, optional) – Select a subset of the dataset [None, “training”, “validation”, “testing”]. None means the whole dataset. “validation” and “testing” are defined in “validation_list.txt” and “testing_list.txt”, respectively, and “training” is the rest. Details for the files “validation_list.txt” and “testing_list.txt” are explained in the README of the dataset and in the introduction of Section 7 of the original paper and its reference 12. (Default: None)
根据上面所说的调用,即可下载
下载代码下载数据
from torchaudio import datasets
datasets.SPEECHCOMMANDS(
root="./data", # 你保存数据的路径
url = 'speech_commands_v0.02', # 下载数据版本URL
folder_in_archive = 'SpeechCommands',
download = True # 这个记得选True
)
然后就等下载就行了(要等一段时间,不行就科学上网)



