Files
FastDeploy/examples/vision/segmentation/paddleseg/web/README.md
charl-u 1135d33dd7 [Doc]Add English version of documents in examples/ (#1042)
* 第一次提交

* 补充一处漏翻译

* deleted:    docs/en/quantize.md

* Update one translation

* Update en version

* Update one translation in code

* Standardize one writing

* Standardize one writing

* Update some en version

* Fix a grammer problem

* Update en version for api/vision result

* Merge branch 'develop' of https://github.com/charl-u/FastDeploy into develop

* Checkout the link in README in vision_results/ to the en documents

* Modify a title

* Add link to serving/docs/

* Finish translation of demo.md

* Update english version of serving/docs/

* Update title of readme

* Update some links

* Modify a title

* Update some links

* Update en version of java android README

* Modify some titles

* Modify some titles

* Modify some titles

* modify article to document

* update some english version of documents in examples

* Add english version of documents in examples/visions

* Sync to current branch

* Add english version of documents in examples
2023-01-06 09:35:12 +08:00

45 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

English | [简体中文](README_CN.md)
# PP-Humanseg v1 Model Frontend Deployment
## Model Version
- [PP-HumanSeg Release/2.6](https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.6/contrib/PP-HumanSeg/)
## Deploy PP-Humanseg v1 Model on Frontend
To deploy and use PP-Humanseg v1 model of web demo, please refer to [document](../../../../application/js/web_demo/README.md).
## PP-Humanseg v1 js interface
```
import * as humanSeg from "@paddle-js-models/humanseg";
# Load and initialise model
await humanSeg.load(Config);
# Portrait segmentation
const res = humanSeg.getGrayValue(input)
# Extract the binary map of portrait and background
humanSeg.drawMask(res)
# Visualization function for background replacement
humanSeg.drawHumanSeg(res)
# Blur background
humanSeg.blurBackground(res)
```
**Parameters in function load()**
> * **Config**(dict): Configuration parameter for PP-Humanseg model, default is {modelpath : 'https://paddlejs.bj.bcebos.com/models/fuse/humanseg/humanseg_398x224_fuse_activation/model.json', mean: [0.5, 0.5, 0.5], std: [0.5, 0.5, 0.5], enableLightModel: false}modelPath is the default PP-Humanseg js model. Mean, std respectively represent the mean and standard deviation of the preprocessing, and enableLightModel represents whether to use a lighter model.
**Parameters in function getGrayValue()**
> * **input**(HTMLImageElement | HTMLVideoElement | HTMLCanvasElement): Input image parameter.
**Parameters in function drawMask()**
> * **seg_values**(number[]): Input parameter, generally the result of function getGrayValue is used as input.
**Parameters in function blurBackground()**
> * **seg_values**(number[]): Input parameter, generally the result of function getGrayValue is used as input.
**Parameters in function drawHumanSeg()**
> * **seg_values**(number[]): Input parameter, generally the result of function getGrayValue is used as input.