zokyo.utils package
Submodules
Module contents
- exception zokyo.utils.CoefficientNotinRangeError(coefficient, coeff_type='Default', range_min=0, range_max=1)[source]
Bases:
Exception
Class to throw exception when a coefficient is not in the specified range
- exception zokyo.utils.ConfigurationError(exception_string)[source]
Bases:
Exception
Class to throw exception when a configuration is not right
- exception zokyo.utils.CrucialValueNotFoundError(operation, value_type='sample')[source]
Bases:
Exception
Class to throw exception when an expected value is not found
- exception zokyo.utils.InvalidImageArrayError(image_type='PIL')[source]
Bases:
Exception
Class to throw exception when an image is not valid
- exception zokyo.utils.OperationNotFoundOrImplemented(module, class_name)[source]
Bases:
Exception
Class to throw exception when an operation is not found
- class zokyo.utils.Path(*args, **kwargs)[source]
Bases:
pathlib.PurePath
PurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.
- absolute()[source]
Return an absolute version of this path. This function works even if the path doesn’t point to anything.
No normalization is done, i.e. all ‘.’ and ‘..’ will be kept along. Use resolve() to get the canonical path to a file.
- classmethod cwd()[source]
Return a new path pointing to the current working directory (as returned by os.getcwd()).
- expanduser()[source]
Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)
- glob(pattern)[source]
Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
- classmethod home()[source]
Return a new path pointing to the user’s home directory (as returned by os.path.expanduser(‘~’)).
- is_file()[source]
Whether this path is a regular file (also True for symlinks pointing to regular files).
- iterdir()[source]
Iterate over the files in this directory. Does not yield any result for the special paths ‘.’ and ‘..’.
- lchmod(mode)[source]
Like chmod(), except if the path points to a symlink, the symlink’s permissions are changed, rather than its target’s.
- lstat()[source]
Like stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.
- open(mode='r', buffering=- 1, encoding=None, errors=None, newline=None)[source]
Open the file pointed by this path and return a file object, as the built-in open() function does.
- read_text(encoding=None, errors=None)[source]
Open the file in text mode, read it, and close the file.
- rename(target)[source]
Rename this path to the given path, and return a new Path instance pointing to the given path.
- replace(target)[source]
Rename this path to the given path, clobbering the existing destination if it exists, and return a new Path instance pointing to the given path.
- resolve(strict=False)[source]
Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows).
- rglob(pattern)[source]
Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.
- samefile(other_path)[source]
Return whether other_path is the same or not as this file (as returned by os.path.samefile()).
- symlink_to(target, target_is_directory=False)[source]
Make this path a symlink pointing to the given path. Note the order of arguments (self, target) is the reverse of os.symlink’s.
- touch(mode=438, exist_ok=True)[source]
Create this file with the given access mode, if it doesn’t exist.
- zokyo.utils.download_s3_dir(s3_bucket, dir_path, strip_from_path=None)[source]
Downloads a directory from s3
- zokyo.utils.generate_semantic_map(img_path, ann_path, out_dir=None, opacity=0.4, gt=True, color_map=None, fill_poly=False, verbose=True)[source]
Generate semantic segmentation map for the given image and its annotations and save it to given output directory if given. If gt is true then ground truth mask is also returned. If color map list is not given then Spectral color map from matplotlib is used. (Currently accepts coco toyo annotations)