本文整理匯總了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