news 2026/6/9 20:06:46

物联网浏览器(IoTBrowser)-人脸快速搜索

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
物联网浏览器(IoTBrowser)-人脸快速搜索

最近遇到一个人脸搜索的需求,驿站的快递被人误领,拿走几天还没有送回来,所以想从出库仪中找历史出库记录的想法。

实现思路:

1.从雷现出库仪上拷贝文件下来。(拷贝几十万张人脸数据花了不少时间)

2.开发人脸搜索工具

3.搜索比对(如果能找到历史数据,就能找到人)

这里主要是开发人脸搜索工具,需要实现识别图片里面是否包含人脸、人脸匹配检测等功能,网速找了一款工具,但是需要改造3点:

1.支持并发搜索,充分利用多核CPU,从几十万张图片中快速检索到想要找的人。

2.支持参数配置,支持指定图片和查找目录、搜索第一张还是全部、找到后是否打开等参数。

3.开发UI配置界面,由于工具是控制台应用,使用起来不方便,所以需要一个UI界面。

屏幕录制 2025-10-30 102642

使用IoTBrowser做为UI前端,使用少量的代码既可实现。

屏幕录制 2025-10-30 103845

核心代码:

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

<div id="vue_root" class="fun_bd" style="padding:10px;">

<form class="am-form">

<fieldset>

<div class="am-form-group">

<label for="doc-ipt-email-1" class="am-u-sm-1">原始文件</label>

<div class="am-u-sm-3">

<input type="text" v-model="config.ImagePath" style="width: 75%;display: inline;" />

<input type="button" @click="selectFile()" value="选择" />

</div>

<label for="doc-ipt-email-1" class="am-u-sm-1">查找目录</label>

<div class="am-u-sm-3">

<input type="text" v-model="config.FindDir" style="width: 75%;display: inline;" />

<input type="button" value="选择" @click="selectSaveDir()" />

</div>

<label for="doc-ipt-email-1" class="am-u-sm-1">历史文件</label>

<div class="am-u-sm-3">

<input type="text" v-model="config.HistoryFileName" style="width: 75%;display: inline;" />

</div>

</div>

<div class="am-form-group">

<div class="am-u-sm-3">

<input id="ClearHistory" type="checkbox" v-model="config.ClearHistory" />

<label for="ClearHistory" class="">清理历史数据</label>

</div>

<div class="am-u-sm-3">

<input id="FindFirstStop" type="checkbox" v-model="config.FindFirstStop" />

<label for="FindFirstStop" class="">找到第一张停止</label>

</div>

<div class="am-u-sm-3">

<input id="FindOpen" type="checkbox" v-model="config.FindOpen" />

<label for="FindOpen" class="">找到后立即打开</label>

</div>

<div class="am-u-sm-3">

<!--<button onclick="startFace()" class="am-btn-primary" type="button">打开连接</button>-->

<button @click="find()" v-if="!isFind" class="am-btn-primary" type="button">开始查询</button>

<button @click="stop()" v-if="isFind" class="am-btn-primary" type="button">停止服务</button>

</div>

</div>

<div class="am-form-group">

<textarea id="txtInfo" rows="40">{{msg}}</textarea>

</div>

</fieldset>

</form>

</div>

<script>

var hostid;// 主机id

function startFace() {

dds.iot.com.open({

type: 'FaceCom',//人脸识别插件

port: 1,

baudRate: 1,

onReceive: function (res) {

if ($vue.isFind) {

if (res.data.indexOf('已找到:') == 0) {

alert(res.data)

}

addMsg(res.data)

}

//console.log('host', res.data)

},

onOpen: function (ar) {

if (ar.Success) {

hostid = ar.Data;

addMsg('连接成功!')

} else {

alert(ar.Message)

}

}

})

}

var $msg;

function addMsg(msg) {

var m = $vue.msg + "\n" + msg;

if ($vue.msg.length > 10000) {

$vue.msg = (msg);

} else {

$vue.msg = (m);

}

}

// 窗口初始化事件(操作窗口大小、标题)

$(document).bind('dds.window.init', function (e, win) {

$msg = $('#txtInfo')

startFace();

initVue();

})

var $vue;

function initVue() {

$vue = new Vue({

el: '#vue_root',

data: {

advanceSetting: false,

msg: "",

isFind:false,

config: {

ImagePath: "",

FindDir: "D:\\image",

HistoryFileName: "",

ClearHistory: true,

FindOpen: true,

FindFirstStop: true,

},

},

mounted() {

if (localStorage._faceConfig) {

this.config=JSON.parse(localStorage._faceConfig);

}

},

methods: {

selectFile() {

this.config.ImagePath = _host.selectFile();

},

find() {

var config = this.config

if (!config.ImagePath) {

alert('请选择原始文件')

return;

}

this.msg = ''

if (!config.FindDir) {

alert('请选择查找目录')

return;

}

this.isFind = true;

dds.iot.com.exeCommand({ id: hostid, name: "Find", data: { timeout1: 30000, config } }, function (ar) {

if (ar.Success) {

} else {

addMsg('操作失败:' + ar.Message)

}

})

localStorage._faceConfig = JSON.stringify(config);

},

stop() {

this.isFind = false;

dds.iot.com.exeCommand({ id: hostid, name: "Stop", data: { } }, function (ar) {

if (ar.Success) {

} else {

addMsg('操作失败:' + ar.Message)

}

})

},

clearLog() {

this.msg=''

},selectSaveDir() {

var dir = dds.file.openFolderDialog();

this.config.FindDir=(dir)

}

}

})

}

</script>

系统支持:

1.人脸数量检测、人脸匹配、人脸定位

2.多文件夹快速搜索,搜索一张还是全部

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/6/9 18:33:11

IEEE39节点风机风电一次调频探究

IEEE39节点风机风电一次调频10机39节点系统&#xff0c;风电为双馈风机风电场&#xff0c;带有虚拟惯量&#xff0c;下垂控制&#xff0c;综合惯量控制&#xff0c;频率时空分布&#xff0c;惯量时空分布一次调频&#xff0c;不同同步机组出力明显 simulink/Matlab 可加入风机&…

作者头像 李华
网站建设 2026/6/9 6:35:40

CRMEB商城系统极速部署指南:5分钟搞定Java电商平台的终极方案

CRMEB商城系统极速部署指南&#xff1a;5分钟搞定Java电商平台的终极方案 【免费下载链接】crmeb_java Java商城 免费 开源 CRMEB商城JAVA版&#xff0c;SpringBoot Maven Swagger Mybatis Plus Redis Uniapp VueelementUI 包含移动端、小程序、PC后台、Api接口&#xff1…

作者头像 李华
网站建设 2026/6/9 19:25:57

USBMap:彻底解决MacOS USB端口限制的专业工具

USBMap&#xff1a;彻底解决MacOS USB端口限制的专业工具 【免费下载链接】USBMap Python script for mapping USB ports in macOS and creating a custom injector kext. 项目地址: https://gitcode.com/gh_mirrors/us/USBMap 你是否曾经遇到过Mac设备上某些USB接口速度…

作者头像 李华
网站建设 2026/6/9 19:40:57

3个痛点告诉你为什么需要Dapper:从SQL繁琐到代码优雅的转变

3个痛点告诉你为什么需要Dapper&#xff1a;从SQL繁琐到代码优雅的转变 【免费下载链接】Dapper 项目地址: https://gitcode.com/gh_mirrors/dapper3/Dapper 你是否曾经在Entity Framework的复杂配置中迷失方向&#xff1f;是否因为手写ADO.NET代码的重复性而感到疲惫&…

作者头像 李华
网站建设 2026/6/9 12:06:20

PHP 组件未来:Livewire 4 正式发布,性能更快,功能更完整

为什么值得升级到 Livewire 4&#xff1f;先聊最核心的性能。Livewire 4 重写了请求调度逻辑&#xff0c;尤其是并发交互的处理方式。以表单中的 wire:model.live 为例&#xff0c;如今每一次输入都会独立并行发送请求&#xff0c;彼此互不阻塞&#xff0c;打字和响应都更顺畅。…

作者头像 李华
网站建设 2026/6/6 21:09:40

新来的外包,限流算法用的这么6

1.流行的限速器① 固定窗口限速 Fixed Window Counter跟踪固定时间间隔&#xff08;如 1 分钟&#xff09;内的请求数量&#xff0c;一旦达到上限&#xff0c;就会拒绝该窗口中的后续所有请求。1_VsdNn5KGd1A0rIfbczGy8Q.gifUserCase&#xff1a; 可预测流量、低精度需求的简单…

作者头像 李华