Esempio n. 1
0
def prep_rgb(key, batch, i=0):
    """
    Converts an RGB image from a batch for logging
    Parameters
    ----------
    key : str
        Key from data containing the image
    batch : dict
        Dictionary containing the key
    i : int
        Batch index from which to get the image
    Returns
    -------
    image : numpy array
        image as numpy array
    """
    rgb = batch[key] if is_dict(batch) else batch
    return prep_image(rgb[i])
Esempio n. 2
0
def log_rgb(key, batch, i=0, caption=None):
    """
    Converts an RGB image from a batch for logging
    Parameters
    ----------
    key : str
        Key from data containing the image
    batch : dict
        Dictionary containing the key
    i : int
        Batch index from which to get the image
    Returns
    -------
    image : wandb.Image
        Wandb image ready for logging
    """
    rgb = batch[key] if is_dict(batch) else batch
    return prep_image(key, rgb[i], caption=caption)
Esempio n. 3
0
def prep_inv_depth(key, batch, i=0):
    """
    Converts an inverse depth map from a batch for logging
    Parameters
    ----------
    key : str
        Key from data containing the inverse depth map
    batch : dict
        Dictionary containing the key
    i : int
        Batch index from which to get the inverse depth map
    Returns
    -------
    image : numpy array
        image as numpy array
    """
    inv_depth = batch[key] if is_dict(batch) else batch
    # converts an inverse depth map to a colormap for visualization.
    inv_depth_colormapped = viz_inv_depth(inv_depth[i])

    return inv_depth_colormapped
Esempio n. 4
0
def log_inv_depth(key, batch, i=0, caption=None):
    """
    Converts an inverse depth map from a batch for logging
    Parameters
    ----------
    key : str
        Key from data containing the inverse depth map
    batch : dict
        Dictionary containing the key
    i : int
        Batch index from which to get the inverse depth map
    Returns
    -------
    image : wandb.Image
        Wandb image ready for logging
    """
    inv_depth = batch[key] if is_dict(batch) else batch
    # converts an inverse depth map to a colormap for visualization.
    inv_depth_colormapped = viz_inv_depth(inv_depth[i])

    return prep_image(key, inv_depth_colormapped, caption=caption)