pyEdgeEval.edge_tools package

Submodules

pyEdgeEval.edge_tools.mask2edge_loop module

pyEdgeEval.edge_tools.mask2edge_loop.loop_mask2edge(mask, ignore_indices, radius, thin=False, use_cv2=True, quality=0)[source]

mask2edge with looping

pyEdgeEval.edge_tools.mask2edge_loop.loop_instance_mask2edge(mask, inst_mask, inst_labelIds, ignore_indices, radius, thin=False, use_cv2=True, quality=0)[source]

mask2edge with looping (instance sensitive)

pyEdgeEval.edge_tools.mask2edge_mp module

NOTE: not much speed ups probably because allocating memory is slower than the gain from multiprocessing

Might be beneficial when each worker has more things to do…

TODO: - add thin

pyEdgeEval.edge_tools.mask2edge_mp.mp_mask2edge(mask, ignore_indices, nproc, radius, thin=False, use_cv2=True, quality=0)[source]

mask2edge multiprocessing

pyEdgeEval.edge_tools.mask2edge_mp.mp_instance_mask2edge(mask, inst_mask, inst_labelIds, ignore_indices, nproc, radius, thin=False, use_cv2=True, quality=0)[source]

mask2edge multiprocessing

pyEdgeEval.edge_tools.transforms module

Mask2Edge transform module.

pyEdgeEval.edge_tools.transforms.mask2edge(run_type: str, instance_sensitive: bool, **kwargs)[source]

mask2edge function

Parameters
  • run_type (str) – can choose between loop or mp where loop loops over the classes while mp uses multiprocessing.

  • instance_sensitive (bool) – set to True if generating instance-aware edges.

  • mask (np.ndarray) – input one-hot mask

  • inst_mask (np.ndarray) – instance mask (required for instance sensitive)

  • inst_labelIds (List[int]) – labels that have instances

  • ignore_indices (List[int]) – ignore indices (corresponds to order of labelIds)

  • radius (int) – edge radius (thickness)

  • use_cv2 (bool) – whether to use cv2 distance transform (default True)

  • quality (int) – default 0

Returns

np.ndarray – generated edges.

Raises

ValueError – if run_type is not set correctly.

class pyEdgeEval.edge_tools.transforms.Mask2Edge(labelIds, ignore_indices=[], label2trainId=None, radius: int = 2, use_cv2: bool = True, quality: int = 0)[source]

Bases: object

Transform function

LABEL_IDS = None
label2trainId = None
class pyEdgeEval.edge_tools.transforms.InstanceMask2Edge(inst_labelIds, **kwargs)[source]

Bases: Mask2Edge

Transform function (instance sensitive)

Module contents

class pyEdgeEval.edge_tools.Mask2Edge(labelIds, ignore_indices=[], label2trainId=None, radius: int = 2, use_cv2: bool = True, quality: int = 0)[source]

Bases: object

Transform function

LABEL_IDS = None
label2trainId = None
class pyEdgeEval.edge_tools.InstanceMask2Edge(inst_labelIds, **kwargs)[source]

Bases: Mask2Edge

Transform function (instance sensitive)

pyEdgeEval.edge_tools.mask2edge(run_type: str, instance_sensitive: bool, **kwargs)[source]

mask2edge function

Parameters
  • run_type (str) – can choose between loop or mp where loop loops over the classes while mp uses multiprocessing.

  • instance_sensitive (bool) – set to True if generating instance-aware edges.

  • mask (np.ndarray) – input one-hot mask

  • inst_mask (np.ndarray) – instance mask (required for instance sensitive)

  • inst_labelIds (List[int]) – labels that have instances

  • ignore_indices (List[int]) – ignore indices (corresponds to order of labelIds)

  • radius (int) – edge radius (thickness)

  • use_cv2 (bool) – whether to use cv2 distance transform (default True)

  • quality (int) – default 0

Returns

np.ndarray – generated edges.

Raises

ValueError – if run_type is not set correctly.

pyEdgeEval.edge_tools.loop_mask2edge(mask, ignore_indices, radius, thin=False, use_cv2=True, quality=0)[source]

mask2edge with looping

pyEdgeEval.edge_tools.loop_instance_mask2edge(mask, inst_mask, inst_labelIds, ignore_indices, radius, thin=False, use_cv2=True, quality=0)[source]

mask2edge with looping (instance sensitive)

pyEdgeEval.edge_tools.mp_mask2edge(mask, ignore_indices, nproc, radius, thin=False, use_cv2=True, quality=0)[source]

mask2edge multiprocessing

pyEdgeEval.edge_tools.mp_instance_mask2edge(mask, inst_mask, inst_labelIds, ignore_indices, nproc, radius, thin=False, use_cv2=True, quality=0)[source]

mask2edge multiprocessing