pyEdgeEval.preprocess.nms package

Submodules

pyEdgeEval.preprocess.nms.fast_nms module

pyEdgeEval.preprocess.nms.fast_nms.fast_nms(img: ndarray, r: int = 1, s: int = 5, m: float = 1.01, half_prec: bool = False, return_as_uint8: bool = False) ndarray[source]

NMS for binary edges

Parameters
  • img (np.ndarray) – edge (np.uint8 or float)

  • r (int) – radius for nms supr

  • s (int) – radius for supr boundaries

  • m (float) – multiplier for conservative supr

Returns

supressed edge

References: - https://github.com/pdollar/edges/blob/master/private/edgesNmsMex.cpp

Current runtime is around 20ms

pyEdgeEval.preprocess.nms.fast_nms.nms_process_one_image(img, save_path=None, save=True)[source]

NMS single image

Parameters
  • img (np.ndarray) – edge, model output

  • save_path (str) – save path

  • save (bool) – if True, save .png

Returns

edge

pyEdgeEval.preprocess.nms.fast_nms.nms_results(result_dir, save_dir, loader)[source]
pyEdgeEval.preprocess.nms.fast_nms.nms_all_results(model_name_list, result_dir, save_dir, key=None, file_format='.mat')[source]

pyEdgeEval.preprocess.nms.toolbox module

pyEdgeEval.preprocess.nms.toolbox.conv_tri(image: ndarray, r: int, s: int = 1) ndarray[source]

2D image convolution with a triangle filter (no fast) See https://github.com/pdollar/toolbox/blob/master/channels/convTri.m Note: signal.convolve2d does not support float16(‘single’ in MATLAB)

pyEdgeEval.preprocess.nms.toolbox.grad2(image: ndarray) Tuple[ndarray, ndarray][source]

numerical gradients along x and y directions (no fast) See https://github.com/pdollar/toolbox/blob/master/channels/gradient2.m Note: np.gradient return [oy, ox], MATLAB version return [ox, oy]

Module contents

pyEdgeEval.preprocess.nms.fast_nms(img: ndarray, r: int = 1, s: int = 5, m: float = 1.01, half_prec: bool = False, return_as_uint8: bool = False) ndarray[source]

NMS for binary edges

Parameters
  • img (np.ndarray) – edge (np.uint8 or float)

  • r (int) – radius for nms supr

  • s (int) – radius for supr boundaries

  • m (float) – multiplier for conservative supr

Returns

supressed edge

References: - https://github.com/pdollar/edges/blob/master/private/edgesNmsMex.cpp

Current runtime is around 20ms