【问题标题】:how to train a deep learning model with many data sets present inside the directories如何使用目录中存在的许多数据集来训练深度学习模型
【发布时间】:2021-01-05 10:49:16
【问题描述】:

专家我需要训练一个模型,该模型保存在目录train_datavalid_data 中的许多数据集。相应目录中的每个数据都是一个 numpy 数组,其中行 = 456,列 55。此外,我总共有 100 个训练数据文件和 20 个用于验证的数据。这两个目录中的每个文件都包含数据 clean(data1) 和数据噪声(data2) 在单个 .npz 文件中。下面是我的生成器代码代码,但它对正确训练模型没有帮助...谁能帮我找出问题所在..

def tf_train_generator(file_list, batch_size = 256):
    i = 0
    while True:
        if i*batch_size >= len(file_list):  
            i = 0
            np.random.shuffle(file_list)
        else:
            file_chunk = file_list[i*batch_size:(i+1)*batch_size]
            print(len(file_chunk))      


            for file in file_chunk:
                print(file)
                temp = np.load(file)

               
                X = temp['data1']
               
                Y= temp['data2']  


               
                i = i + 1
                yield X, Y

【问题讨论】:

  • 你的任务是什么?图片或文字,还是其他?

标签: python numpy tensorflow keras deep-learning


【解决方案1】:

如果是npzImage-like,你可以使用ImageDataGeneratorImageDataGenerator。它同时支持from_directoryfrom_dataframe

【讨论】:

  • 不是数字数据,不是图像
猜你喜欢
  • 2019-11-30
  • 2021-05-05
  • 2016-01-03
  • 2021-01-06
  • 2020-11-10
  • 1970-01-01
  • 2023-03-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多