-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbaidu-face.html
561 lines (531 loc) · 20.4 KB
/
baidu-face.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
<script type="text/javascript">
RED.nodes.registerType('baidu-face', {
category: '百度',
color: '#7ac6cb',
paletteLabel: '人脸识别',
label() {
return this.name || '人脸识别'
},
defaults: {
name: {
value: ''
},
baiduface: {
value: '',
type: 'baidu-face-configurator'
},
image: {
value: ''
},
max_face_num: {
value: ''
},
max_score: {
value: ''
},
group_id_list: {
value: ''
},
user_list: {
value: '',
}
},
inputs: 1,
outputs: 2,
icon: 'white-globe.png'
})
RED.nodes.registerType('baidu-body-num', {
category: '百度',
color: '#7ac6cb',
paletteLabel: '人流量统计',
label() {
return this.name || '人流量统计'
},
defaults: {
name: {
value: ''
},
baiduface: {
value: '',
type: 'baidu-face-configurator'
},
image: {
value: ''
},
show: {
value: false
},
},
inputs: 1,
outputs: 2,
icon: 'white-globe.png'
})
RED.nodes.registerType('baidu-dynamic-body-num', {
category: '百度',
color: '#7ac6cb',
paletteLabel: '人流量统计(动态版)',
label() {
return this.name || '人流量统计(动态版)'
},
defaults: {
name: {
value: ''
},
baiduface: {
value: '',
type: 'baidu-face-configurator'
},
image: {
value: ''
},
show: {
value: false
},
},
inputs: 1,
outputs: 1,
icon: 'white-globe.png'
})
RED.nodes.registerType('baidu-body-attr', {
category: '百度',
color: '#7ac6cb',
paletteLabel: '人体检测',
label() {
return this.name || '人体检测'
},
defaults: {
name: {
value: ''
},
baiduface: {
value: '',
type: 'baidu-face-configurator'
},
image: {
value: ''
},
baidu_type: {
value: 'is_human'
},
},
inputs: 1,
outputs: 2,
icon: 'white-globe.png'
})
</script>
<script type="text/x-red" data-template-name="baidu-face">
<div class="form-row">
<label for="node-input-baiduface"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-baiduface">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-image"><i class="icon-tag"></i>Base64图片</label>
<input type="text" id="node-input-image" placeholder="需要识别的图片信息">
</div>
<div class="form-row">
<label for="node-input-max_face_num"><i class="icon-tag"></i>人脸的数目</label>
<input type="number" id="node-input-max_face_num" placeholder="最多处理人脸的数目,默认5">
</div>
<div class="form-row">
<label for="node-input-max_score"><i class="icon-tag"></i>人脸相似阈值</label>
<input type="number" id="node-input-max_score" placeholder="相似度低于这个值定义为客人,默认70">
</div>
<div class="form-row">
<label for="node-input-group_id_list"><i class="icon-tag"></i>用户组</label>
<input type="text" id="node-input-group_id_list" placeholder="从指定的group中进行查找 用逗号分隔,上限10个" >
</div>
<div class="form-row">
<label for="node-input-user_list"><i class="icon-tag"></i>自定义用户</label>
<input type="text" id="node-input-user_list" placeholder="定义用户列表,用于对应百度图库里面的用户" >
</div>
<div class="form-row">
<label style="width: 100%;text-align: right;padding-right: 34px;box-sizing: border-box;" >
<a href="https://bbs.iobroker.cn/thread-195-1-1.html" target="_blank">手摸手图文教程 (ioBroker中国|智能家居)提供</a>
</label>
</div>
</script>
<script type="text/x-red" data-help-name="baidu-face">
<p>人脸搜索 M:N识别:也称为M:N识别,待识别图片中含有多个人脸时,在指定人脸集合中,找到这多个人脸分别最相似的人脸</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>image
<span class="property-type">string</span>
</dt>
<dd>Base64图片,Base64图片</dd>
<dt class="optional">max_face_num <span class="property-type">number</span>
</dt>
<dd>最多处理人脸的数目,默认5</dd>
<dd>Base64图片,Base64图片</dd>
<dt >group_id_list <span class="property-type">string</span>
</dt>
<dd>从指定的group中进行查找 用逗号分隔,上限10个</dd>
</dl>
<h3>输出</h3>
<p>当发生错误的时候,将会从输出2里面输出msg.payload = {} ,如果需要请做相关业务处理</p>
<table>
<thead>
<tr>
<th>字段</th>
<th>必选</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>face_num</td>
<td>是</td>
<td>int</td>
<td>图片中的人脸数量</td>
</tr>
<tr>
<td>face_list</td>
<td>是</td>
<td>array</td>
<td>人脸信息列表</td>
</tr>
<tr>
<td>+face_token</td>
<td>是</td>
<td>string</td>
<td>人脸标志</td>
</tr>
<tr>
<td>+location</td>
<td>是</td>
<td>array</td>
<td>人脸在图片中的位置</td>
</tr>
<tr>
<td>++left</td>
<td>是</td>
<td>double</td>
<td>人脸区域离左边界的距离</td>
</tr>
<tr>
<td>++top</td>
<td>是</td>
<td>double</td>
<td>人脸区域离上边界的距离</td>
</tr>
<tr>
<td>++width</td>
<td>是</td>
<td>double</td>
<td>人脸区域的宽度</td>
</tr>
<tr>
<td>++height</td>
<td>是</td>
<td>double</td>
<td>人脸区域的高度</td>
</tr>
<tr>
<td>++rotation</td>
<td>是</td>
<td>int64</td>
<td>人脸框相对于竖直方向的顺时针旋转角,[-180,180]</td>
</tr>
<tr>
<td>+user_list</td>
<td>是</td>
<td>array</td>
<td>匹配的用户信息列表</td>
</tr>
<tr>
<td>++group_id</td>
<td>是</td>
<td>string</td>
<td>用户所属的group_id</td>
</tr>
<tr>
<td>++user_id</td>
<td>是</td>
<td>string</td>
<td>用户的user_id</td>
</tr>
<tr>
<td>++user_info</td>
<td>是</td>
<td>string</td>
<td>注册用户时携带的user_info</td>
</tr>
<tr>
<td>++score</td>
<td>是</td>
<td>float</td>
<td>用户的匹配得分<br><strong>80分以上可以判断为同一人,此分值对应万分之一误识率</strong></td>
</tr>
</tbody>
</table>
</script>
<script type="text/x-red" data-template-name="baidu-body-num">
<div class="form-row">
<label for="node-input-baiduface"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-baiduface">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-image"><i class="icon-tag"></i>Base64图片</label>
<input type="text" id="node-input-image" placeholder="需要识别的图片信息">
</div>
<div class="form-row">
<label for="node-input-show"><i class="icon-tag"></i>结果</label>
<input type="checkbox" id="node-input-show" style="display: inline-block; width: auto; vertical-align: top;">
<label style="width: 50%;"><span >是否输出渲染的结果?</span></label>
</div>
<div class="form-row">
<label style="width: 100%;text-align: right;padding-right: 34px;box-sizing: border-box;" >
<a href="https://bbs.iobroker.cn/thread-195-1-1.html" target="_blank">手摸手图文教程 (ioBroker中国|智能家居)提供</a>
</label>
</div>
</script>
<script type="text/x-red" data-help-name="baidu-body-num">
<p>对于输入的一张图片(可正常解码,且长宽比适宜),识别和统计图像当中的人体个数(静态统计,不支持追踪和去重)。</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>image
<span class="property-type">string</span>
</dt>
<dd>Base64图片,Base64图片</dd>
<dt class="optional">show <span class="property-type">boolean</span>
</dt>
<dd>是否输出渲染的图片,默认不返回,选true时返回渲染后的图片(base64),其它无效值或为空则默认false</dd>
</script>
<script type="text/x-red" data-template-name="baidu-body-num">
<div class="form-row">
<label for="node-input-baiduface"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-baiduface">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-image"><i class="icon-tag"></i>Base64图片</label>
<input type="text" id="node-input-image" placeholder="需要识别的图片信息">
</div>
<div class="form-row">
<label for="node-input-show"><i class="icon-tag"></i>结果</label>
<input type="checkbox" id="node-input-show" style="display: inline-block; width: auto; vertical-align: top;">
<label ><span >是否输出渲染的结果?</span></label>
</div>
<div class="form-row">
<label style="width: 100%;text-align: right;padding-right: 34px;box-sizing: border-box;" >
<a href="https://bbs.iobroker.cn/thread-195-1-1.html" target="_blank">手摸手图文教程 (ioBroker中国|智能家居)提供</a>
</label>
</div>
</script>
<script type="text/x-red" data-help-name="baidu-body-num">
<p>对于输入的一张图片(可正常解码,且长宽比适宜),识别和统计图像当中的人体个数(静态统计,不支持追踪和去重)。</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string</span>
</dt>
<dd>Base64图片,Base64图片</dd>
<dt class="optional">show <span class="property-type">boolean</span>
</dt>
<dd>否输出渲染的图片,默认不返回,选true时返回渲染后的图片(base64),其它无效值或为空则默认false</dd>
</dl>
<h3>输出</h3>
<p>当发生错误的时候,将会从输出2里面输出msg.payload = {} ,如果需要请做相关业务处理</p>
<table>
<thead>
<tr>
<th>字段</th>
<th>是否必选</th>
<th>类型</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>person_num</td>
<td>是</td>
<td>uint64</td>
<td>识别出的人体数目;<strong>当未设置area参数时,返回的是全图人数;设置了有效的area参数时,返回的人数是所有区域的人数总和(所有区域求并集后的不规则区域覆盖的人数)</strong></td>
</tr>
<tr>
<td>image</td>
<td>否</td>
<td>string</td>
<td>渲染后的图片,输入参数show=true时输出该字段</td>
</tr>
<tr>
<td>area_counts</td>
<td>否</td>
<td>array</td>
<td>每一个框选区域的人数,<strong>仅当请求中有area参数且参数有效时才会返回,否则该字段不返回</strong>;成功返回示例:[5,3,8]</td>
</tr>
</tbody>
</table>
</script>
<script type="text/x-red" data-template-name="baidu-dynamic-body-num">
<div class="form-row">
<label for="node-input-baiduface"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-baiduface">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-image"><i class="icon-tag"></i>Base64图片</label>
<input type="text" id="node-input-image" placeholder="需要识别的图片信息">
</div>
<div class="form-row">
<label for="node-input-show"><i class="icon-tag"></i>结果</label>
<input type="checkbox" id="node-input-show" style="display: inline-block; width: auto; vertical-align: top;">
<label style="width: 50%;"><span >是否输出渲染的结果?</span></label>
</div>
<div class="form-row">
<label style="width: 100%;text-align: right;padding-right: 34px;box-sizing: border-box;" >
<a href="https://bbs.iobroker.cn/thread-195-1-1.html" target="_blank">手摸手图文教程 (ioBroker中国|智能家居)提供</a>
</label>
</div>
</script>
<script type="text/x-red" data-help-name="baidu-dynamic-body-num">
<p>统计图像中的人体个数和流动趋势。静态人数统计:传入单帧图像,检测图片中的人体头肩,返回图中总人数。</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>image
<span class="property-type">string</span>
</dt>
<dd>Base64图片,Base64图片</dd>
<dt class="optional">show <span class="property-type">boolean</span>
</dt>
<dd>是否输出渲染的图片,默认不返回,选true时返回渲染后的图片(base64),其它无效值或为空则默认false</dd>
</dl>
<h3>输出</h3>
<table>
<thead>
<tr>
<th>字段</th>
<th>是否必选</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>person_num</td>
<td>是</td>
<td>int</td>
<td>检测到的人体框数目</td>
</tr>
<tr>
<td>person_info</td>
<td>否</td>
<td>object[]</td>
<td>每个框的具体信息</td>
</tr>
<tr>
<td>+location</td>
<td>否</td>
<td>object</td>
<td>跟踪到的人体框位置</td>
</tr>
<tr>
<td>++left</td>
<td>否</td>
<td>int</td>
<td>人体框左坐标</td>
</tr>
<tr>
<td>++top</td>
<td>否</td>
<td>int</td>
<td>人体框顶坐标</td>
</tr>
<tr>
<td>++width</td>
<td>否</td>
<td>int</td>
<td>人体框宽度</td>
</tr>
<tr>
<td>++height</td>
<td>否</td>
<td>int</td>
<td>人体框高度</td>
</tr>
<tr>
<td>+ID</td>
<td>否</td>
<td>int</td>
<td>人体的ID编号</td>
</tr>
<tr>
<td>person_count</td>
<td>否</td>
<td>object</td>
<td>进出区域的人流统计</td>
</tr>
<tr>
<td>+in</td>
<td>否</td>
<td>int</td>
<td>进入区域的人数</td>
</tr>
<tr>
<td>+out</td>
<td>否</td>
<td>int</td>
<td>离开区域的人数</td>
</tr>
<tr>
<td>image</td>
<td>否</td>
<td>string</td>
<td>结果图,含跟踪框和统计值(渲染jpg图片byte内容的base64编码,得到后先做base64解码再以字节流形式imdecode)</td>
</tr>
</tbody>
</table>
</script>
<script type="text/x-red" data-template-name="baidu-body-attr">
<div class="form-row">
<label for="node-input-baiduface"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-baiduface">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-image"><i class="icon-tag"></i>Base64图片</label>
<input type="text" id="node-input-image" placeholder="需要识别的图片信息">
</div>
<div class="form-row">
<label for="node-input-baidu_type"><i class="icon-tag"></i>可选值类型</label>
<input type="text" id="node-input-baidu_type" placeholder="baidu_type 参数值可以是可选值的组合,用逗号分隔" >
</div>
<div class="form-row">
<label style="width: 100%;text-align: right;padding-right: 34px;box-sizing: border-box;" >
<a href="https://bbs.iobroker.cn/thread-195-1-1.html" target="_blank">手摸手图文教程 (ioBroker中国|智能家居)提供</a>
</label>
</div>
</script>
<script type="text/x-red" data-help-name="baidu-body-attr">
<p>对于输入的一张图片(可正常解码,且长宽比适宜),检测图像中的所有人体并返回每个人体的矩形框位置,识别人体的静态属性和行为,共支持20余种属性,包括:性别、年龄阶段、衣着(含类别/颜色)、是否戴帽子、是否戴眼镜、是否背包、是否使用手机、身体朝向等。</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string</span>
</dt>
<dd>Base64图片,Base64图片</dd>
<dt class="optional">baidu_type <span class="property-type">string</span>
</dt>
<dd>baidu_type 参数值可以是可选值的组合,用逗号分隔;如果无此参数默认输出全部21个属性</dd>
</dl>
<h3>输出</h3>
<p>当发生错误的时候,将会从输出2里面输出msg.payload = {} ,如果需要请做相关业务处理</p>
<a href='https://ai.baidu.com/docs#/Body-API/2a682e7c'>具体返回说明看这里</a>
</script>