Cropping3D
類別tf_keras.layers.Cropping3D(
cropping=((1, 1), (1, 1), (1, 1)), data_format=None, **kwargs
)
用於 3D 資料(例如空間或時空資料)的裁剪層。
# 範例
>>> input_shape = (2, 28, 28, 10, 3)
>>> x = np.arange(np.prod(input_shape)).reshape(input_shape)
>>> y = tf.keras.layers.Cropping3D(cropping=(2, 4, 2))(x)
>>> print(y.shape)
(2, 24, 20, 6, 3)
參數
(symmetric_dim1_crop, symmetric_dim2_crop, symmetric_dim3_crop)
。((left_dim1_crop, right_dim1_crop), (left_dim2_crop, right_dim2_crop), (left_dim3_crop, right_dim3_crop))
channels_last
(預設)或 channels_first
其中之一。輸入中維度的排序。channels_last
對應的輸入形狀為 (batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)
,而 channels_first
對應的輸入形狀為 (batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)
。如果未指定,則會使用在您的 TF-Keras 設定檔 ~/.keras/keras.json
(如果存在)中找到的 image_data_format
值,否則預設為 'channels_last'。預設為 'channels_last'。輸入形狀
形狀為 5D 張量:- 如果 data_format
為 "channels_last"
:(batch_size, first_axis_to_crop, second_axis_to_crop, third_axis_to_crop, depth)
- 如果 data_format
為 "channels_first"
:(batch_size, depth, first_axis_to_crop, second_axis_to_crop, third_axis_to_crop)
輸出形狀
形狀為 5D 張量:- 如果 data_format
為 "channels_last"
:(batch_size, first_cropped_axis, second_cropped_axis, third_cropped_axis, depth)
- 如果 data_format
為 "channels_first"
:(batch_size, depth, first_cropped_axis, second_cropped_axis, third_cropped_axis)