You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/paddlejs-models/humanseg/README.md
+31-12Lines changed: 31 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,11 @@
2
2
3
3
# humanseg
4
4
5
-
A real-time human-segmentation model. You can use it to change background. The output of the model is gray value. Model supplies simple api for users. Api drawHumanSeg can draw human segmentation, another one drawMask can draw the background without human.
5
+
A real-time human-segmentation model. You can use it to change background. The output of the model is gray value. Model supplies simple api for users.
6
+
7
+
Api drawHumanSeg can draw human segmentation with a specified background.
8
+
Api blurBackground can draw human segmentation with a blurred origin background.
9
+
Api drawMask can draw the background without human.
6
10
7
11
8
12
# Usage
@@ -11,25 +15,40 @@ A real-time human-segmentation model. You can use it to change background. The o
11
15
12
16
import*ashumansegfrom'@paddlejs-models/humanseg';
13
17
14
-
// load humanseg model
18
+
// load humanseg model, use 398x224 shape model, and preheat
15
19
awaithumanseg.load();
16
20
17
-
// get the gray value [192 * 192];
21
+
// use 288x160 shape model, preheat and predict faster with a little loss of precision
22
+
// await humanseg.load(true, true);
23
+
24
+
// get the gray value [2, 398, 224] or [2, 288, 160];
18
25
const { data } =awaithumanseg.getGrayValue(img);
19
26
27
+
// background canvas
28
+
constback_canvas=document.getElementById('background') as HTMLCanvasElement;
29
+
20
30
// draw human segmentation
21
-
constcanvas1=document.getElementById('demo1') as HTMLCanvasElement;
22
-
humanseg.drawHumanSeg(canvas1, data);
31
+
constcanvas1=document.getElementById('back') as HTMLCanvasElement;
0 commit comments