Holistically-Nested Edge Detection: pytorch-hed

This is a reimplementation in the form of a python package of Holistically-Nested Edge Detection using PyTorch based on the previous pytorch implementation by sniklaus. If you would like to use of this work, please cite the paper accordingly. Also, make sure to adhere to the licensing terms of the authors. Moreover, if you will be making use of this particular implementation, please acknowledge it.

Paper


Usage

import torchHED

# process a single image file
torchHED.process_file("./images/sample.png", "./images/sample_processed.png")

# process all images in a folder
torchHED.process_folder("./input_folder", "./output_folder")

# process a PIL.Image loaded in memory and return a new PIL.Image
# img = PIL.Image.open("./images/sample.png")
img_hed = torchHED.process_img(img)
Input Output
sample sample

Documentation

torchHED.hed.process_file(input_fn: str, output_fn: str) → None[source]

Given an image file, applies HED to it and writes the output in another image

Parameters
  • input_fn (str) – Input image filename

  • output_fn (str) – Output image filename

torchHED.hed.process_folder(input_dir: str, output_dir: str) → None[source]

Given a directory, applies to it HED to all images in it and store the output images in another directory

Parameters
  • input_dir (str) – Input directory

  • output_dir (str) – Output directory

torchHED.hed.process_img(img: PIL.Image) → PIL.Image[source]

Given a Pillow image object, applies HED to it and returns the processed PIL.Image

Parameters

img (PIL.Image) – Input image

Returns

Output Image

Return type

PIL.Image