Operations

Operations with bounding box coordinates.

source

update_keys

def update_keys(
    annots:dict, default_keys:NoneType=None
):

Modify the default class label key that the JsonBx method looks for. By default, JsonBx uses the parameter ops.voc_keys and looks for the key “label” in the dict. If called, update_keys looks inside the parameter ops.label_keys for matching key in the passed annots and uses this as the key to identify class label. Fixes #3. :param annots: dictionary of annotations :param default_keys: voc_keys by default :return: new keys with updated label key


source

intersection_box

def intersection_box(
    b1:list, b2:list
):

Return the box that intersects two boxes in pascal_voc format.


source

named_idx

def named_idx(
    ncoords:int, sfx:str=''
):

Return a list of indices as str matching the array size, suffixed with sfx :param ncoords: number of coordinates :param sfx: suffix to be added to the index :return: list of strings


source

make_single_iterable

def make_single_iterable(
    x, keys:list=['x_min', 'y_min', 'x_max', 'y_max', 'label']
):

Method to convert a single dict or a list to an array. :param x: dict with keys {“x_min”: 0, “y_min”: 0, “x_max”: 1, “y_max”: 1, “label”: ‘none’} :return: coords as ndarray, label as list


source

get_op

def get_op(
    op:str
):

*Given a string of aps.__ops__, return the function reference.*


source

noop

def noop(
    x, _
):

Perform no operation (“no-op”) on x. :param x: input object 1 :param _: input object 2 :return: input object 1


source

mul

def mul(
    x, y
):

Multiply two objects.


source

sub

def sub(
    x, y
):

Subtract two objects.


source

add

def add(
    x, y
):

Add two objects.