获取pkl中数据_Python - 读取pickle数据的索引

本文介绍了如何从pickle文件中读取包含多个图像及其标签的数据。当pickle文件中的数据结构为[array([图像1]), array([标签1])], 并且增加了第二个图像和其标签后,通过batch[0][0]获取第一个图像,batch[0][1]获取第二个图像,batch[1][0]获取第一个标签,batch[1][1]获取第二个标签。" 131170747,11200423,RK3588 Android12 LED控制实现,"['嵌入式硬件', '驱动开发', 'Android开发', 'Ubuntu', 'JNI']
摘要由CSDN通过智能技术生成

Having the following pickled data:

[array([[[148, 124, 115],

[150, 127, 116],

[154, 129, 121],

...,

[159, 142, 133],

[159, 142, 133],

[161, 145, 142]]]), array([1])]

I was able to retrieve the data and label, as follows:

data = batch[0]

labels = batch[1]

In which case, I had the following output when making a print for both data and label, separately:

[[[148 124 115]

[150 127 116]

[154 129 121]

...,

[159 142 133]

[159 142 133]

[161 145 142]]]

[1]

When my batch file now looks as follows as I added a new image, I didn't figure out how to read the 2nd image and its label. It seems I cannot understand how the pickled file is indexed here:

[array([[[148, 124, 115],

[150, 127, 116],

[154, 129, 121

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值