ai.natml.vision.hair-matte-net

    1.0.0 • Public • Published

    Hair Matte Net

    Hair matte segmentation. This predictor implements HairMatteNet. This package requires NatML.

    Segmenting Hair in an Image

    First, create the predictor:

    // Fetch model data from NatML Hub
    var modelData = await MLModelData.FromHub("@natsuite/hair-matte-net");
    // Deserialize the model
    var model = modelData.Deserialize();
    // Create the hair segmentation predictor
    var predictor = new HairMatteNetPredictor(model);

    Then segment hair in an image:

    Texture2D image = ...; // Can also be an `MLImageFeature`
    // Segment the hair in the image
    HairMatteNetPredictor.Matte matte = predictor.Predict(image);

    Finally, render the segmentation map to a RenderTexture:

    // Create a `RenderTexture`
    var hairMask = new RenderTexture(image.width, image.height, 0);
    // Render the segmentation map into the render texture
    matte.Render(hairMask);

    References

    Requirements

    Quick Tips

    Thank you very much!

    Install

    npm i ai.natml.vision.hair-matte-net

    DownloadsWeekly Downloads

    143

    Version

    1.0.0

    License

    Apache-2.0

    Unpacked Size

    12.3 kB

    Total Files

    18

    Last publish

    Collaborators

    • olokobayusuf