【数据集】OpenxLab 数据集下载

本文详细介绍了如何在OpenXLab平台上进行环境配置,包括Python环境设置和使用AK/SK进行身份验证。还提供了CIL和SDK下载数据集的方法,以ImageNet-22k为例展示了具体操作步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 环境配置

  • 创建 conda 环境:要求 python >= 3.8
    conda create -n openxlab python=3.9
    
  • openxlab 安装
    pip install openxlab -i  https://pypi.mirrors.ustc.edu.cn/simple/
    

2. AK 和 SK 配置

  • 用户中心的【密钥管理】中【添加密钥】
    在这里插入图片描述

2.1 通过 CLI 命令配置

>> openxlab login

OpenXLab Access Key ID : xxxxxxxxxxxxxxxxxxxx
OpenXLab Secret Access Key : xxxxxxxxxxxxxxxxxxx
  • 通过openxlab login命令按照提示输入对应的 Access keySecret key。完成后会在 ~/.openxlab 目录下生成 config.json 文件,格式如下:
    {
        "ak": "xxxxxxxxxxxxxxxxxxxx",
        "sk": "xxxxxxxxxxxxxxxxxxxx"
    }
    

2.2 通过创建 config.json 文件方式配置

  • 直接在 ~/.openxlab 目录下创建对应的 config.json 文件,填入对应的 Access keySecret key,格式如下:
    {
        "ak": "xxxxxxxxxxxxxxxxxxxx",
        "sk": "xxxxxxxxxxxxxxxxxxxx"
    }
    

2.3 AK 和 SK 鉴权

  • 通过 openxlab.login() 函数进行配置 AK / SK 进行鉴权。
    import openxlab
    openxlab.login(ak=<Access Key>, sk=<Secrete Key>)
    

3. 数据集下载

3.1 使用 CIL 下载数据集

#TODO 下载数据集的整个仓库
openxlab dataset get --dataset-repo username/repo-name
                     --target-path /path/to/local/folder
# 示例
openxlab dataset get -r username/repo-name 
                     -t /path/to/local/folder

#TODO 下载数据集文件
openxlab dataset download --dataset-repo username/repo-name
                          --source-path /train/file
                          --target-path /path/to/local/folder

openxlab dataset download -r username/repo-name
                          -s /train/file
                          -t /path/to/local/folder
  • 参数说明:

    参数缩写是否必填参数类型参数说明示例
    dataset-repo-rString数据集仓库的地址,由 username/repo_name 组成username/repo-name
    source-path-sString对应数据集仓库下文件的相对路径-s /train/file
    target-path-tString下载仓库指定的本地路径username/–target-path /path/to/local/folder

3.2 使用 SDK 下载数据集

#TODO 下载数据集的整个仓库
from openxlab.dataset import get
get(dataset_repo='username/repo_name', target_path='/path/to/local/folder')

#TODO 下载数据集文件
from openxlab.dataset import download
download(dataset_repo='username/repo_name', source_path='/train/file', target_path='/path/to/local/folder')
  • 参数说明:

    参数缩写是否必填参数类型参数说明示例
    dataset-repo-rString数据集仓库的地址,由 username/repo_name 组成username/repo-name
    source-path-sString对应数据集仓库下文件的相对路径-s /train/file
    target-path-tString下载仓库指定的本地路径username/–target-path /path/to/local/folder

4. 下载示例

  • 本文以ImageNet-22k下载为例,openxlab 中显示界面如下:
    在这里插入图片描述
  • 使用 SDK 下载:
    from openxlab.dataset import get
    get(dataset_repo='OpenDataLab/ImageNet-21k', target_path='./Datasets/ImageNet-21k') 
    
  • 数据集下载中界面展示:
    在这里插入图片描述耐心等待数据下载完成即可!!!

参考链接: openxlab 文档中心

### 如何下载 KITTI 数据集 #### 使用百度网盘下载 对于希望利用百度网盘获取 KITTI `data_odometry_gray` 部分的用户而言,可以通过访问特定链接并输入提取码完成文件下载。具体来说,提供的链接为 [百度网盘分享](https://pan.baidu.com/s/1ecGfOSZpfXNtif7RWikhMg),而对应的提取密码则是 `du1t`[^1]。 #### 利用 GitCode 获取资源包集合中的 KITTI 数据集 另一种方法是从 GitCode 平台上的资源包集合项目中找到所需数据集。该项目位于 [GitCode 资源库](https://gitcode.com/Resource-Bundle-Collection/00bf2),这里提供了关于如何获取更多有关 KITTI 数据集的信息以及可能存在的其他版本或扩展资料[^2]。 #### 借助 OpenXLab 工具加速下载过程 为了更高效地获得包括但不限于 nuscenes 和 KITTI 的大型公开数据集,可以考虑采用由 OpenDriveLab 开发的一套工具来简化这一流程。通过安装 openxlab CLI 客户端之后,能够轻松实现对目标仓库内全部内容或是仅限于某些子目录下文件的选择性拉取。例如: ```bash # 下载整个数据集 openxlab dataset get --dataset-repo OpenDriveLab/CVPR2023-3D-Occupancy # 或者只下载部分数据 openxlab dataset download --dataset-repo OpenDriveLab/CVPR2023-3D-Occupancy \ --source-path raw/mini/gts.tar.gz \ --target-path /home/work/dataDownload/ ``` 上述命令展示了两种不同场景下的应用方式——前者适用于想要一次性取得所有可用素材的情况;后者则允许使用者根据实际需求精确指定感兴趣的部分进行传输[^4]。
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值