Python keras.backend.common.image_data_format() Examples
The following are 8
code examples of keras.backend.common.image_data_format().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
keras.backend.common
, or try the search function
.
Example #1
Source File: theano_backend.py From keras-contrib with MIT License | 6 votes |
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
Example #2
Source File: keras_contrib_backend.py From se_relativisticgan with MIT License | 5 votes |
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
Example #3
Source File: tensorflow_backend.py From Model-Playgrounds with MIT License | 5 votes |
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
Example #4
Source File: theano_backend.py From semantic-embeddings with MIT License | 5 votes |
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
Example #5
Source File: tensorflow_backend.py From semantic-embeddings with MIT License | 5 votes |
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
Example #6
Source File: tensorflow_backend.py From keras-onnx with MIT License | 5 votes |
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
Example #7
Source File: tensorflow_backend.py From PyTorch-Luna16 with Apache License 2.0 | 5 votes |
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
Example #8
Source File: tensorflow_backend.py From SSR-Net with Apache License 2.0 | 5 votes |
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