Main Content

spacetodepth

重排空间块Dlarray沿深度维度的数据

描述

例子

y= spaceToDepth(X,,,,阻止rearranges spatial blocks of the formattedDlarray目的,,,,X,沿深度尺寸。数据块具有大小阻止

给定一个大小的输入特征图[HwC]和大小的块[高度宽度],输出功能映射大小为[floor((H/高度floor((w/宽度C*高度*宽度]。

此功能需要深度学习工具箱™。

例子

y= spaceToDepth(X,,,,阻止,“ dataformat”,dataFormatrearranges spatial blocks of the unformattedDlarray目的,,,,X,沿深度尺寸。dataFormat指定尺寸标签。

例子

全部收缩

创建一个numeric array with three channels that simulates a 4-by-4 RGB image.

x =重塑(1:48,4,4,3);

创建一个Dlarray包含数字数据的对象,将数据格式指定为“ SSC”(空间,空间,通道)。

x = dlarray(x,'SSC'
x = 4(s)x 4(s)x 3(c)dlarray(:,:,:,1)= 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16(:,::,:,2)= 1721 25 29 18 26 30 19 23 27 31 20 24 28 32(::::,3)= 33 37 41 45 34 34 38 42 46 35 39 43 47 36 46 40 44 44 48

指定一个2 by-2块大小,用于重新排序输入激活。

blocksize = 2;

从空间尺寸到深度维度的数据重新排列。

z = spacetodepth(x,blocksize)
Z = 2 (S) x 2 (S) x 12 (C) dlarray (:,: 1) = 1 9 3 11((:,:,2) = 17 25 19 27 (:,:,3) = 33 41 35 43 (:,:,4) = 5 13 7 15 (:,:,5) = 21 29 23 31 (:,:,6) = 37 45 39 47 (:,:,7) = 2 10 4 12 (:,:,8) = 18 26 20 28 (:,:,9) = 34 42 36 44 (:,:,10) = 6 14 8 16 (:,:,11) = 22 30 24 32 (:,:,12) = 38 46 40 48 2(S) x 2(S) x 12(C) dlarray

创建一个numeric array with three channels that simulates a 4-by-4 RGB image.

x =重塑(1:48,4,4,3);

创建一个未形式的Dlarray包含数字数据的对象。

DLX= dlarray(X);

指定一个2 by-2块大小,用于重新排序输入激活。

blocksize = 2;

从空间尺寸到深度维度的数据重新排列。将输入数据的格式指定为“ SSC”。

DLZ= spaceToDepth(dlX,blockSize,“ dataformat”,,,,"SSC");

Compare the dimensions of the original and rearranged data.

谁是DLXDLZ
名称大小字节类属性DLX 4x4x3 384 dlarray dlz 2x2x12 384 dlarray

输入参数

全部收缩

深度学习数据重新排列,指定为Dlarray(深度学习工具箱)目的。

重新排序输入激活的块大小,指定为两个正整数的正整数或向量[H W], 在哪里His the height andwis the width. When you specify阻止as a scalar, the function uses the same value for both dimensions.

例子:[2 4]指定高度2和宽度4。

例子:32指定高度和宽度块32。

尺寸标签当输入深度学习数据时Xis unlabeled, specified as a string scalar or character vector. The number of labels must match the number of dimensions of the input data,X。每个字符在dataFormat必须是这些标签之一:

  • s- 空间

  • C- 渠道

  • b-batch observations

不支持“ T”(时间或序列)和“ U”(未指定)标签。万博1manbetx不要指定dataFormat何时输入深度学习数据是格式化的Dlarray目的。

例子:'SSC'指示该数组具有两个空间维度和一个通道维度,适用于2-D RGB图像数据。

数据类型:char|细绳

输出参数

全部收缩

重新安排深度学习数据,返回Dlarray(深度学习工具箱)目的。

扩展功能

版本历史记录

在R2021a中引入

也可以看看

|

话题