本文整理汇总了Python中keras.backend.common.image_data_format方法的典型用法代码示例。如果您正苦于以下问题:Python common.image_data_format方法的具体用法?Python common.image_data_format怎么用?Python common.image_data_format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keras.backend.common
的用法示例。
在下文中一共展示了common.image_data_format方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: depth_to_space
# 需要导入模块: from keras.backend import common [as 别名]
# 或者: from keras.backend.common import image_data_format [as 别名]
def depth_to_space(input, scale, data_format=None):
"""Uses phase shift algorithm to convert
channels/depth for spatial resolution
"""
if data_format is None:
data_format = image_data_format()
data_format = data_format.lower()
input = _preprocess_conv2d_input(input, data_format)
b, k, row, col = input.shape
out_channels = k // (scale ** 2)
x = T.reshape(input, (b, scale, scale, out_channels, row, col))
x = T.transpose(x, (0, 3, 4, 1, 5, 2))
out = T.reshape(x, (b, out_channels, row * scale, col * scale))
out = _postprocess_conv2d_output(out, input, None, None, None, data_format)
return out
示例2: depth_to_space
# 需要导入模块: from keras.backend import common [as 别名]
# 或者: from keras.backend.common import image_data_format [as 别名]
def depth_to_space(input, scale, data_format=None):
''' Uses phase shift algorithm to convert channels/depth for spatial resolution '''
if data_format is None:
data_format = image_data_format()
data_format = data_format.lower()
input = _preprocess_conv2d_input(input, data_format)
out = tf.depth_to_space(input, scale)
out = _postprocess_conv2d_output(out, data_format)
return out
示例3: depth_to_space
# 需要导入模块: from keras.backend import common [as 别名]
# 或者: from keras.backend.common import image_data_format [as 别名]
def depth_to_space(input, scale, data_format=None):
''' Uses phase shift algorithm to convert channels/depth for spatial resolution '''
if data_format is None:
data_format = image_data_format()
if data_format == 'channels_first':
data_format = 'NCHW'
else:
data_format = 'NHWC'
data_format = data_format.lower()
out = tf.depth_to_space(input, scale, data_format=data_format)
return out
示例4: depth_to_space
# 需要导入模块: from keras.backend import common [as 别名]
# 或者: from keras.backend.common import image_data_format [as 别名]
def depth_to_space(input, scale, data_format=None):
''' Uses phase shift algorithm to convert channels/depth for spatial resolution '''
if data_format is None:
data_format = image_data_format()
data_format = data_format.lower()
input = _preprocess_conv2d_input(input, data_format)
b, k, row, col = input.shape
out_channels = k // (scale ** 2)
x = T.reshape(input, (b, scale, scale, out_channels, row, col))
x = T.transpose(x, (0, 3, 4, 1, 5, 2))
out = T.reshape(x, (b, out_channels, row * scale, col * scale))
out = _postprocess_conv2d_output(out, input, None, None, None, data_format)
return out