我有2个独立的DataFrames
其中包含大约 50 万张图像的信息,总计达 6+ GB。有 4 个.parquet
我必须的文件pd.concat()
逐一制作一个新的DataFrameimgs
包含的像素137*236
,值范围为0-32331
和图像的 id 列。
imgs
>>
image_id 0 1 ... 32330 32331
0 Train_50210 246 253 ... 251 250
1 Train_50211 250 245 ... 241 244
... ...
... ...
... ...
453651 Train_50210 0 253 ... 251 250
453652 Train_50211 250 245 ... 241 244
第二csv
包含图像的标签以及每个图像所属的三个不同类的值。我将 csv 导入到train
.
train
>>
image_id class_1 class_2 class_3
0 Train_5 15 9 5
1 Train_1 159 0 0
...
...
...
453651 Train_342524 0 15 34
453652 Train_9534 18 0 7
中的行数train
等于中的行imgs
。这意味着图像的 Y 标签存储在train
对应的像素属性在imgs
我尝试使用合并两个数据框pd.merge(imgs,train,on='image_id').drop('image_id')
and 花了很长时间,在处理上述两个步骤时,我的内核每次都会死掉。如果有的话请建议一种替代方法
有人可以告诉我如何制作自定义数据生成器吗
1. producing batches of images
2. Augmented images for robustness
using keras
或任何其他用于快速处理的库。
或者,有人可以告诉我如何在我的情况下使用 ImageDataGenerator().flow()