UNET()

The U-Net is a convolutional neural network that was developed for biomedical image segmentation at the Computer Science Department of the University of Freiburg, Germany.[1] The network is based on the fully convolutional network [2] and its architecture was modified and extended to work with fewer training images and to yield more precise segmentations.

The U-Net is a convolutional neural network that was developed for biomedical image segmentation at the Computer Science Department of the University of Freiburg, Germany.[1] The network is based on the fully convolutional network [2] and its architecture was modified and extended to work with fewer training images and to yield more precise segmentations.


UNET allows you to segment an image, removing, for example, the background from video of you while sitting at your desk.

Example

// load your model...
const uNet = ml5.uNet('face');

// assuming you have an HTMLVideo feed...
uNet.segment(video, gotResult);

function gotResult(error, result) {
  // if there's an error return it
  if (error) {
    console.error(error);
    return;
  }
  // log your result
  console.log(result)
}

Syntax

ml5.uNet(model)
ml5.uNet(model, ?callback)

Parameters

  • model - A string to the path of the JSON model.
  • callback - Optional. A callback function that is called once the model has loaded. If no callback is provided, it will return a promise that will be resolved once the model has loaded.

Properties

.ready

Boolean value that specifies if the model has loaded.

Methods

.segment(video, ?callback);

Segments the image

  • video - Optional. A HTML video element or a p5 video element.
  • callback - Optional. A function to run once the model has been loaded.

Source

/src/UNET/