Deep learning 图像数据集维度转换为tensorflow 2.0数据集后为何/如何更改

Deep learning 图像数据集维度转换为tensorflow 2.0数据集后为何/如何更改,deep-learning,conv-neural-network,tensorflow2.0,tensorflow-datasets,Deep Learning,Conv Neural Network,Tensorflow2.0,Tensorflow Datasets,我使用的是CIFAR10数据集。该数据集具有原始大小:(60000,32,32,3) ,将其转换为tensorflow数据集后,将转换为tf.Tensor:shape(64,24,24,3)。 我从上面了解到的是,每批在3个通道中有64张24 x 24的图像(让我知道我是否错了) 这是我的代码片段 (x_train,y_train),(x_test,y_test)=tf.keras.datasets.cifar10.load_data() train_dataset=tf.data.Datase

我使用的是CIFAR10数据集。该数据集具有原始大小:(60000,32,32,3) ,将其转换为tensorflow数据集后,将转换为tf.Tensor:shape(64,24,24,3)。 我从上面了解到的是,每批在3个通道中有64张24 x 24的图像(让我知道我是否错了) 这是我的代码片段

(x_train,y_train),(x_test,y_test)=tf.keras.datasets.cifar10.load_data()
train_dataset=tf.data.Dataset.from_tensor_slices((x_train,y_train)).batch(64).shuffle(10000)
train_dataset=train_dataset.map(lambda x,y:(tf.cast(x,tf.float32)/255.0,y))
train_dataset=train_dataset.map(lambda x,y:(tf.image.central_crop(x,0.75),y))
train_dataset=train_dataset.map(lambda x,y:(tf.image.random_flip_left_right(x),y))
train_dataset=train_dataset.repeat()

据我了解,这是因为它被集中种植了75%。如果它是正确的,那么准确程度如何?

您的理解是正确的。
central_裁剪
通过移除图像的外部部分来裁剪图像的中心区域。因此,使用
central_分数=0.75
,图像的新维度将是
32*0.75=24
。以下是该方法的文档:

central_crop(image, central_fraction)
    Crop the central region of the image(s).

    Remove the outer parts of an image but retain the central region of the image
    along each dimension. If we specify central_fraction = 0.5, this function
    returns the region marked with "X" in the below diagram.

         --------
        |        |
        |  XXXX  |
        |  XXXX  |
        |        |   where "X" is the central 50% of the image.
         --------

    This function works on either a single image (`image` is a 3-D Tensor), or a
    batch of images (`image` is a 4-D Tensor).

    Args:
      image: Either a 3-D float Tensor of shape [height, width, depth], or a 4-D
        Tensor of shape [batch_size, height, width, depth].
      central_fraction: float (0, 1], fraction of size to crop
    Usage Example: ```python >> import tensorflow as tf >> x =
      tf.random.normal(shape=(256, 256, 3)) >> tf.image.central_crop(x, 0.5) ```

    Raises:
      ValueError: if central_crop_fraction is not within (0, 1].

    Returns:
      3-D / 4-D float Tensor, as per the input.

你的理解是正确的。
central_裁剪
通过移除图像的外部部分来裁剪图像的中心区域。因此,使用
central_分数=0.75
,图像的新维度将是
32*0.75=24
。以下是该方法的文档:

central_crop(image, central_fraction)
    Crop the central region of the image(s).

    Remove the outer parts of an image but retain the central region of the image
    along each dimension. If we specify central_fraction = 0.5, this function
    returns the region marked with "X" in the below diagram.

         --------
        |        |
        |  XXXX  |
        |  XXXX  |
        |        |   where "X" is the central 50% of the image.
         --------

    This function works on either a single image (`image` is a 3-D Tensor), or a
    batch of images (`image` is a 4-D Tensor).

    Args:
      image: Either a 3-D float Tensor of shape [height, width, depth], or a 4-D
        Tensor of shape [batch_size, height, width, depth].
      central_fraction: float (0, 1], fraction of size to crop
    Usage Example: ```python >> import tensorflow as tf >> x =
      tf.random.normal(shape=(256, 256, 3)) >> tf.image.central_crop(x, 0.5) ```

    Raises:
      ValueError: if central_crop_fraction is not within (0, 1].

    Returns:
      3-D / 4-D float Tensor, as per the input.