當前位置: 首頁>>代碼示例>>Python>>正文


Python common.image_data_format方法代碼示例

本文整理匯總了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 
開發者ID:keras-team,項目名稱:keras-contrib,代碼行數:19,代碼來源:theano_backend.py

示例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 
開發者ID:deepakbaby,項目名稱:se_relativisticgan,代碼行數:11,代碼來源:keras_contrib_backend.py

示例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 
開發者ID:OlafenwaMoses,項目名稱:Model-Playgrounds,代碼行數:15,代碼來源:tensorflow_backend.py

示例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 
開發者ID:cvjena,項目名稱:semantic-embeddings,代碼行數:17,代碼來源:theano_backend.py


注:本文中的keras.backend.common.image_data_format方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。