【问题标题】:How can I change the CIFAR-10 dataset labels?如何更改 CIFAR-10 数据集标签?
【发布时间】:2021-08-29 23:36:46
【问题描述】:

我想更改数据集 CIFAR-10 的一些标签。 这意味着,我想用这个数据集中的一些错误标签来训练我的网络。

更改数据集标签后,我需要一些格式,例如:

dataset_cifar_with_some_wrongs_labels = (amount of pictures, label, image)

image.shape=(32,32,3)

我知道我可以下载它:

https://www.cs.toronto.edu/~kriz/cifar.html

有人知道我该怎么做吗?

【问题讨论】:

    标签: python tensorflow keras dataset


    【解决方案1】:

    您可以使用 keras 内部 cifar10 数据集。我已经通过排列实现了噪声机制,但可能还有很多其他选择。

    import keras
    import numpy as np
    (x_train, y_train), (x_test, y_test) = keras.datasets.cifar10.load_data()
    n = 1000
    y_train_ = y_train.copy()
    idx_to_shuffle = np.random.choice(y_train.shape[0], n)
    y_train[idx_to_shuffle] = np.random.permutation(y_train[idx_to_shuffle])
    

    【讨论】:

      猜你喜欢
      • 2018-06-22
      • 2015-11-13
      • 2022-12-04
      • 2020-10-14
      • 2017-12-19
      • 1970-01-01
      • 1970-01-01
      • 2016-05-04
      • 2017-05-15
      相关资源
      最近更新 更多