1.首先需要有 Kaggle 账号,下载个人 API Token
2.把下载的kaggle.json
上传到 Google Drive 上的文件夹, 例如Kaggle
文件夹
3.找到想要的数据集, 复制 API
!kaggle competitions download -c cassava-leaf-disease-classification
4.在colab中运行以下代码:
import os
from google.colab import drivedrive.mount('./mount')#运行后点击链接,复制密钥os.environ['KAGGLE_CONFIG_DIR'] = '/content/mount/My Drive/Colab Notebooks/kaggle' #注意kaggle文件夹包含json文件os.chdir('/content/mount/My Drive/Colab Notebooks/kaggle') #切换到kaggle文件夹!kaggle competitions download -c cassava-leaf-disease-classification#下载数据集即可!unzip cassava-leaf-disease-classification.zip#解压数据集
下载相当快~