如何在zip文件中使用kaggle数据集?

2024-03-28 12:34:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在研究来自“APTOS 2019盲人检测”的kaggle数据集,数据集在一个zip文件中。我想对数据集进行预处理,以输入到深度学习模型中。在

我的代码如下:

train_dir = '../input/train_images'
train_labels = pd.read_csv('../input/train.csv')
train_labels['diagnosis'] = train_labels['diagnosis'].astype(str)

test_dir = '../input/test_images'

然后为了预处理,我写了:

^{pr2}$

但当我运行代码时。我得到的结果是:

找到0个属于0类的已验证图像文件名。
找到0个属于0类的已验证映像文件名。在

我也尝试过解压文件,但它不会解压说
FileNotFoundError:[Errno 2]没有这样的文件或目录:'train_图像.zip'

# importing required modules 
from zipfile import ZipFile 

# specifying the zip file name 
file_name = "../input/train_images.zip"

# opening the zip file in READ mode 
with ZipFile(file_name, 'r') as zip: 

    # extracting all the files 
    print('Extracting all the files now...') 
    zip.extractall() 

有人能帮我解决这个问题吗?我会很感激的


Tags: 文件csvthe数据代码nametestinput