@@ -46,9 +46,40 @@ We merge all the functions into one interface
46
46
TengineKitSdk .getInstance().releaseFaceDetect()
47
47
```
48
48
49
+ ## *** 3. InsightFace***
50
+ ### init
51
+ ``` kotlin
52
+ TengineKitSdk .getInstance().initInsightFace()
53
+ ```
49
54
55
+ ### predict
56
+ We merge all the functions into one interface
57
+
58
+ ``` kotlin
59
+ val byte = ImageUtils .bitmap2RGB(bitmap)
60
+ val config = InsightFaceConfig ().apply {
61
+ scrfd = true
62
+ recognition = true
63
+ registered = false
64
+ video = false
65
+ }
66
+ val imageConfig = ImageConfig ().apply {
67
+ data = byte
68
+ degree = 0
69
+ mirror = false
70
+ height = it.height
71
+ width = it.width
72
+ format = ImageConfig .FaceImageFormat .RGB
73
+ }
74
+ val faces = TengineKitSdk .getInstance().detectInsightFace(imageConfig, config)
75
+ ```
76
+
77
+ ### release
78
+ ``` kotlin
79
+ TengineKitSdk .getInstance().releaseInsightFace()
80
+ ```
50
81
51
- ## *** 3 . SegBody***
82
+ ## *** 4 . SegBody***
52
83
53
84
### init
54
85
@@ -78,7 +109,7 @@ directly return a mask, the mask is a android bitmap, the mask's width is 398, t
78
109
TengineKitSdk.getInstance().releaseSegBody()
79
110
```
80
111
81
- ## *** 4 . BodyDetect***
112
+ ## *** 5 . BodyDetect***
82
113
83
114
### init
84
115
``` kotlin
@@ -89,17 +120,17 @@ directly return a mask, the mask is a android bitmap, the mask's width is 398, t
89
120
We merge all the functions into one interface
90
121
91
122
``` kotlin
92
- val data = ImageUtils .bitmap2RGB(bitmap)
93
- val imageConfig = ImageConfig ().apply {
94
- this .data = data
95
- this .format = ImageConfig .FaceImageFormat .RGB
96
- this .height = it.height
97
- this .width = it.width
98
- this .mirror = false
99
- this .degree = 0
100
- }
101
- val bodyConfig = BodyConfig ()
102
- val bodyS = TengineKitSdk .getInstance().bodyDetect(imageConfig, bodyConfig)
123
+ val data = ImageUtils .bitmap2RGB(bitmap)
124
+ val imageConfig = ImageConfig ().apply {
125
+ this .data = data
126
+ this .format = ImageConfig .FaceImageFormat .RGB
127
+ this .height = it.height
128
+ this .width = it.width
129
+ this .mirror = false
130
+ this .degree = 0
131
+ }
132
+ val bodyConfig = BodyConfig ()
133
+ val bodyS = TengineKitSdk .getInstance().bodyDetect(imageConfig, bodyConfig)
103
134
```
104
135
105
136
### release
@@ -108,27 +139,36 @@ We merge all the functions into one interface
108
139
```
109
140
110
141
111
- ## *** 5 .Release Context***
142
+ ## *** 6 .Release Context***
112
143
```
113
144
TengineKitSdk.getInstance().release()
114
145
```
115
146
116
147
## DataStruct
148
+ ### Config
149
+ #### ImageConfig
150
+ * data(byte[ ] ): set image data byte array of image raw data
151
+ * degree(int): set rotate degree need if in camera mode, need to rotate the right angle to detect the face
152
+ * width(int): set bitmap width or preview width
153
+ * height(int): set bitmap height or preview height
154
+ * format(enum ImageConfig.FaceImageFormat): set image format, support RGB format and NV21 format current now
117
155
118
156
#### FaceConfig
157
+ * detect(boolean): set true if need detect face rect
119
158
* landmark2d(boolean): set true if need landmark2d except detect face rect
120
159
* video(boolean): set true if in camera mode
121
160
161
+ #### InsightFaceConfig
162
+ * scrfd(boolean): set true if need do scrfd
163
+ * recognition(boolean): set true if need do arcface
164
+ * registered(boolean): set true if already registered face
165
+
122
166
#### SegConfig
123
167
* default portrait segmentation config current
168
+ #### BodyConfig
169
+ * landmark(boolean): set true if need body landmark
124
170
125
- #### ImageConfig
126
- * data(byte[ ] ): set image data byte array of image raw data
127
- * degree(int): set rotate degree need if in camera mode, need to rotate the right angle to detect the face
128
- * width(int): set bitmap width or preview width
129
- * height(int): set bitmap height or preview height
130
- * format(enum ImageConfig.FaceImageFormat): set image format, support RGB format and NV21 format current now
131
-
171
+ ### Info
132
172
#### Face
133
173
134
174
all detect values are normalized from 0 to 1
@@ -146,6 +186,15 @@ all detect values are normalized from 0 to 1
146
186
* mouthClose: Mouth closure confidence 0~ 1
147
187
* mouthBigOpen: Open mouth Big confidence 0~ 1
148
188
189
+ #### InsightFace
190
+
191
+ * x1: detect body rect left
192
+ * y1: detect body rect top
193
+ * x2: detect body rect right
194
+ * y2: detect body rect bottom
195
+ * landmark: if not null landmark contain 5 face key points
196
+ * confidence: face detect confidence
197
+ * feature: if not null feature contain 512 face feature points
149
198
#### Body
150
199
151
200
* x1: detect body rect left
@@ -157,3 +206,5 @@ all detect values are normalized from 0 to 1
157
206
158
207
159
208
209
+
210
+
0 commit comments