栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

【开源数据下载全步骤】利用Pytorch下载开源数据到本地,以Speech Command为例

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【开源数据下载全步骤】利用Pytorch下载开源数据到本地,以Speech Command为例

背景

找开源数据来练练手,虽然可以直接通过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 
)

然后就等下载就行了(要等一段时间,不行就科学上网)

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/937946.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号