image_utils.py
def _pad_images(images, padding_value=0.5, padding_width=2):
    """Pad images to create frame around them.

    Args:
        images: Numpy array of shape [batch_size, height, width] or
            [batch_size, channels, height, width].
        padding_value: Float. Value of the padding.
        padding_width: Int. Width of the padding.

    Returns:
        padded_images: Numpy array containing padded images.
    """
    image_dim = len(images.shape)
    paddings_1d = (padding_width, padding_width)
    if image_dim == 3:
        paddings = [(0, 0), paddings_1d, paddings_1d]
    elif image_dim == 4:
        paddings = [(0, 0), (0, 0), paddings_1d, paddings_1d]
    else:
        raise ValueError(
            'Image dimension is {} but must be 3 or 4.'.format(image_dim))
    padded_images = np.pad(images, pad_width=paddings,
                           constant_values=padding_value)
    return padded_images
Pad images to create frame around them.

    Args:
        images: Numpy array of shape [batch_size, height, width] or
            [batch_size, channels, height, width].
        padding_value: Float. Value of the padding.
        padding_width: Int. Width of the padding.

    Returns:
        padded_images: Numpy array containing padded images.
    
Pad images to create frame around them.
Pad images to create frame around them .
def _pad_images(images, padding_value=0.5, padding_width=2):
    image_dim = len(images.shape)
    paddings_1d = (padding_width, padding_width)
    if image_dim == 3:
        paddings = [(0, 0), paddings_1d, paddings_1d]
    elif image_dim == 4:
        paddings = [(0, 0), (0, 0), paddings_1d, paddings_1d]
    else:
        raise ValueError(
            'Image dimension is {} but must be 3 or 4.'.format(image_dim))
    padded_images = np.pad(images, pad_width=paddings,
                           constant_values=padding_value)
    return padded_images
def _pad_images ( images , padding_value = 0.5 , padding_width = 2 ) : image_dim = len ( images . shape ) paddings_1d = ( padding_width , padding_width ) if image_dim == 3 : paddings = [ ( 0 , 0 ) , paddings_1d , paddings_1d ] elif image_dim == 4 : paddings = [ ( 0 , 0 ) , ( 0 , 0 ) , paddings_1d , paddings_1d ] else : raise ValueError ( 'Image dimension is {} but must be 3 or 4.' . format ( image_dim ) ) padded_images = np . pad ( images , pad_width = paddings , constant_values = padding_value ) return padded_images
Pad images to create frame around them.
Pad images to create frame around them .
"""Pad images to create frame around them.

    Args:
        images: Numpy array of shape [batch_size, height, width] or
            [batch_size, channels, height, width].
        padding_value: Float. Value of the padding.
        padding_width: Int. Width of the padding.

    Returns:
        padded_images: Numpy array containing padded images.
    """
Numpy array containing padded images.
Numpy array containing padded images .
padded_images
images
Numpy array of shape [batch_size, height, width] or
[batch_size, channels, height, width].
Numpy array of shape [ batch_size height width ] or [ batch_size channels height width ] .
padding_value
Float. Value of the padding.
Float . Value of the padding .
padding_width
Int. Width of the padding.
Int . Width of the padding .