facebook360_dep
Facebook360 Depth Estimation Pipeline
Functions | Variables
verify_data Namespace Reference

Functions

def log (msg)
 
def get_stem (p)
 
def check_image_existance (image_dir, recursive=True)
 
def get_rigs (parent)
 
def get_rigs_s3 (parent)
 
def have_data (parent, dirs, is_levels=False)
 
def have_color (parent, is_levels=False)
 
def have_disparity (parent, is_levels=False)
 
def unpack_tars (parent, dir_local, recursive=True)
 
def download_frame_s3 (parent, dir_s3, dir_local, frames_s3_names, is_levels=False)
 
def get_data_s3 (parent, have_data_in, is_levels=False, is_disp=False)
 
def resize_local_frame (parent, dir_full, dir_level, rig_ref)
 
def get_cameras (parent, rig_fn)
 
def get_rig_width (parent, rig_fn)
 
def is_frame (name)
 
def get_local_frame_names (dir)
 
def get_s3_frame_names (parent, dir)
 
def get_frame_names (parent, dir, is_cache=True)
 
def print_frame_range (parent, suffix)
 
def download_s3_disparities (parent)
 
def update_frame_names (parent, data_types=None, image_types=None, update_local=True, update_s3=True)
 
def verify (parent, save_frame_ranges=True)
 
def make_path_dirs (parent)
 
def set_default_top_level_paths (parent, mkdirs=False)
 

Variables

 dir_scripts = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
 dir_root = os.path.dirname(dir_scripts)
 

Function Documentation

◆ check_image_existance()

def verify_data.check_image_existance (   image_dir,
  recursive = True 
)
Check if we have at least one image in the directory.

Args:
    image_dir (str): Path to the local directory.
    recursive (bool, optional): Whether or not to check through all contained dirs.

Returns:
    str: Extension of the first file encountered.

◆ download_frame_s3()

def verify_data.download_frame_s3 (   parent,
  dir_s3,
  dir_local,
  frames_s3_names,
  is_levels = False 
)

◆ download_s3_disparities()

def verify_data.download_s3_disparities (   parent)
Download disparities (both full size and level) from the S3 bucket.

Args:
    parent: class instance

◆ get_cameras()

def verify_data.get_cameras (   parent,
  rig_fn 
)
Finds the camera names in the captured project.

Args:
    parent: class instance
    rig_fn (str): Path to the rig. If no path is provided, cameras are determined
        by the directory structure.

Returns:
    list[str]: Names of the cameras.

◆ get_data_s3()

def verify_data.get_data_s3 (   parent,
  have_data_in,
  is_levels = False,
  is_disp = False 
)
Checks if we have color images in S3, and downloads a sample frame.

Args:
    parent: class instance
    have_data_in dict[str, bool]: Map of directories and whether or not they
        are non-empty.
    is_levels (bool, optional): Whether or not to use full-size (False) or
        level_0 images (True).
    is_disp (bool, optional): Whether to download disparity images (True) or
        color (False).

Returns:
    dict[str, bool]: Map of local data directory and whether or not it is non-empty.

Raises:
    Exception: If attempting to get data from S3 on a non-AWS render.

◆ get_frame_names()

def verify_data.get_frame_names (   parent,
  dir,
  is_cache = True 
)
Finds all the frames in a local directory.

Args:
    parent: class instance
    dir (str): Path to the local directory being scanned.
    is_cache (bool): Whether or not to check the cache for getting frame names.

Returns:
    list[str]: Sorted list of frame names in the directory.

◆ get_local_frame_names()

def verify_data.get_local_frame_names (   dir)
Finds all the frames in a directory.

Args:
    dir (str): Path to a local directory.

Returns:
    list[str]: Sorted list of frame names in the directory. If an invalid directory
        is passed in, an empty result is returned.

◆ get_rig_width()

def verify_data.get_rig_width (   parent,
  rig_fn 
)
Finds the camera image width.

Args:
    parent: class instance
    rig_fn (str): Path to the rig

Returns:
    int: Camera image width.

◆ get_rigs()

def verify_data.get_rigs (   parent)
Gets filenames corresponding to the project rigs.

Args:
    parent: class instance

Returns:
    list[str]: Rig filenames (assumed to be named *.json).

◆ get_rigs_s3()

def verify_data.get_rigs_s3 (   parent)
Downloads a calibrated rig from S3 if it exists.

Args:
    parent: class instance

Returns:
    str: Local filename of the calibrated rig.

◆ get_s3_frame_names()

def verify_data.get_s3_frame_names (   parent,
  dir 
)
Finds all the frames in an S3 directory.

Args:
    parent: class instance
    dir (str): Path to the S3 directory being scanned.

Returns:
    list[str]: Sorted list of frame names in the directory.

◆ get_stem()

def verify_data.get_stem (   p)
Gets the name of a file without its extension.

Args:
    p (str): File path.

Returns:
    str: Basename of the file (i.e. without its extension).

◆ have_color()

def verify_data.have_color (   parent,
  is_levels = False 
)
Checks that the color directories have images.

Args:
    parent: class instance
    is_levels (bool, optional): Whether or not to use full-size (False) or
        level_0 images (True).

Returns:
    dict[str, bool]: Map of color directories and whether or not it is non-empty.

◆ have_data()

def verify_data.have_data (   parent,
  dirs,
  is_levels = False 
)
Checks that the directories expected to have input images are non-empty.

Args:
    parent: class instance
    dirs (list[str]): Directories to be verified.
    is_levels (bool, optional): Whether or not the levels are being used
        instead of full-size images (usually only relevant in AWS renders).

Returns:
    dict[str, bool]: Map of each directory and whether or not it is non-empty.

◆ have_disparity()

def verify_data.have_disparity (   parent,
  is_levels = False 
)
Checks that disparity directories have images.

Args:
    parent: class instance
    is_levels (bool, optional): Whether or not to use full-size (False) or
        level_0 images (True).

Returns:
    dict[str, bool]: Map of disparity directory and whether or not it is non-empty.

◆ is_frame()

def verify_data.is_frame (   name)
Whether or not the name is a valid (expected) frame name.

Args:
    name (str): Frame name to be tested.

Returns:
    bool: Whether or not this is valid (i.e. if it can be cast as an int).

◆ log()

def verify_data.log (   msg)
Prints logs if in verbose mode.

Args:
    msg (str): Message to be displayed.

◆ make_path_dirs()

def verify_data.make_path_dirs (   parent)
Create directories expected on the specified tab.

Args:
    parent: class instance

◆ print_frame_range()

def verify_data.print_frame_range (   parent,
  suffix 
)
Displays frame range.

Args:
    parent: class instance
    suffix (str): Prefixed text to display before the frames.

◆ resize_local_frame()

def verify_data.resize_local_frame (   parent,
  dir_full,
  dir_level,
  rig_ref 
)

◆ set_default_top_level_paths()

def verify_data.set_default_top_level_paths (   parent,
  mkdirs = False 
)
Defines class referenceable attributes for paths on the specified tab.

Args:
    parent: class instance
    mkdirs (bool, optional): Whether or not to make the defined directories.

◆ unpack_tars()

def verify_data.unpack_tars (   parent,
  dir_local,
  recursive = True 
)

◆ update_frame_names()

def verify_data.update_frame_names (   parent,
  data_types = None,
  image_types = None,
  update_local = True,
  update_s3 = True 
)
Updates frame names for given data types

Args:
    parent: class instance
    data_types (list[str]): List of data types.
    image_types (list[str]): List of image types.

◆ verify()

def verify_data.verify (   parent,
  save_frame_ranges = True 
)
Performs all validation on data. Warnings are displayed if an unexpected structure
is encountered.

Variable Documentation

◆ dir_root

verify_data.dir_root = os.path.dirname(dir_scripts)

◆ dir_scripts

verify_data.dir_scripts = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))