View Source Evision.Zoo.ImageSegmentation.PPHumanSeg (Evision v0.2.9)
PP-Human Segmentation model.
Summary
Functions
Default configuration.
Docs in smart cell.
Inference.
Initialize model.
Model URL and filename of predefined model.
Preprocessing the input image.
Customizable parameters from smart cell.
Smart cell tasks.
Generate quoted code from smart cell attrs.
Visualize the result.
Functions
@spec default_config() :: map()
Default configuration.
@spec docs() :: String.t()
Docs in smart cell.
@spec infer(Evision.DNN.Net.t(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t()
Inference.
Positional arguments
self:
Evision.DNN.Net.t()
.An initialized PPHumanSeg model.
image:
Evision.Mat.maybe_mat_in()
.Input image.
@spec init(binary() | :default_model | :quant_model, nil | Keyword.t()) :: {:error, String.t()} | Evision.DNN.Net.t()
Initialize model.
Positional arguments
model:
String.t()
|:default_model
|:quant_model
.
Keyword arguments
cache_dir:
String.t()
.Path to the cache directory.
Optional. Defaults to
:filename.basedir(:user_cache, "", ...)
backend:
integer()
.Specify the backend.
Optional. Defaults to
Evision.Constant.cv_DNN_BACKEND_OPENCV()
.target:
integer()
.Specify the target.
Optional. Defaults to
Evision.Constant.cv_DNN_TARGET_CPU()
.
Model URL and filename of predefined model.
@spec preprocess(Evision.Mat.maybe_mat_in()) :: Evision.Mat.t()
Preprocessing the input image.
infer/2
will call this function automatically.
Positional arguments
image:
Evision.Mat.maybe_mat_in()
.Input image.
@spec smartcell_params() :: Evision.Zoo.smartcell_params()
Customizable parameters from smart cell.
@spec smartcell_tasks() :: Evision.Zoo.smartcell_tasks()
Smart cell tasks.
A list of variants of the current model.
Generate quoted code from smart cell attrs.
@spec visualize(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Keyword.t()) :: [ Evision.Mat.t() ]
Visualize the result.
Positional arguments
image:
Evision.Mat.maybe_mat_in()
.Original image.
results:
Evision.Mat.maybe_mat_in()
.Results given by
infer/2
.
Keyword arguments
weight:
number()
.A number in
[0.0, 1.0]
. Defaults to0.6
.Specify the weight of the original image. The weight of the segmentation visualization image will be
1 - weight
.
Return
A list that contains two images (Evision.Mat.t()
).
- The first one is the original image with the segmentation overlay.
- The second one is the segmentation image.