Skip to content

Commit c38dcad

Browse files
committed
🎉 提交示例
1 parent aa2a09d commit c38dcad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+7653
-4623
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ yarn-error.log*
1818
*.ntvs*
1919
*.njsproj
2020
*.sln
21-
*.sw*
21+
*.sw?

LICENSE

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
木兰宽松许可证, 第1版
2+
3+
木兰宽松许可证, 第1版
4+
2019年8月 http://license.coscl.org.cn/MulanPSL
5+
6+
您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第1版(“本许可证”)的如下条款的约束:
7+
8+
0. 定义
9+
10+
“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
11+
12+
“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
13+
14+
“法人实体”是指提交贡献的机构及其“关联实体”。
15+
16+
“关联实体”是指,对“本许可证”下的一方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
17+
18+
“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
19+
20+
1. 授予版权许可
21+
22+
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
23+
24+
2. 授予专利许可
25+
26+
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括仅因您或他人修改“贡献”或其他结合而将必然会侵犯到的专利权利要求。如您或您的“关联实体”直接或间接地(包括通过代理、专利被许可人或受让人),就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
27+
28+
3. 无商标许可
29+
30+
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
31+
32+
4. 分发限制
33+
34+
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
35+
36+
5. 免责声明与责任限制
37+
38+
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
39+
40+
条款结束。
41+
42+
如何将木兰宽松许可证,第1版,应用到您的软件
43+
44+
如果您希望将木兰宽松许可证,第1版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
45+
46+
1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
47+
48+
2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
49+
50+
3, 请将如下声明文本放入每个源文件的头部注释中。
51+
52+
Copyright (c) [2019] [name of copyright holder]
53+
[Software Name] is licensed under the Mulan PSL v1.
54+
You can use this software according to the terms and conditions of the Mulan PSL v1.
55+
You may obtain a copy of Mulan PSL v1 at:
56+
http://license.coscl.org.cn/MulanPSL
57+
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
58+
IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
59+
PURPOSE.
60+
See the Mulan PSL v1 for more details.
61+
62+
63+
Mulan Permissive Software License,Version 1
64+
65+
Mulan Permissive Software License,Version 1 (Mulan PSL v1)
66+
August 2019 http://license.coscl.org.cn/MulanPSL
67+
68+
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v1 (this License) with following terms and conditions:
69+
70+
0. Definition
71+
72+
Software means the program and related documents which are comprised of those Contribution and licensed under this License.
73+
74+
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
75+
76+
Legal Entity means the entity making a Contribution and all its Affiliates.
77+
78+
Affiliates means entities that control, or are controlled by, or are under common control with a party to this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
79+
80+
Contribution means the copyrightable work licensed by a particular Contributor under this License.
81+
82+
1. Grant of Copyright License
83+
84+
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
85+
86+
2. Grant of Patent License
87+
88+
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed, excluding of any patent claims solely be infringed by your or others’ modification or other combinations. If you or your Affiliates directly or indirectly (including through an agent, patent licensee or assignee), institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
89+
90+
3. No Trademark License
91+
92+
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in section 4.
93+
94+
4. Distribution Restriction
95+
96+
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
97+
98+
5. Disclaimer of Warranty and Limitation of Liability
99+
100+
The Software and Contribution in it are provided without warranties of any kind, either express or implied. In no event shall any Contributor or copyright holder be liable to you for any damages, including, but not limited to any direct, or indirect, special or consequential damages arising from your use or inability to use the Software or the Contribution in it, no matter how it’s caused or based on which legal theory, even if advised of the possibility of such damages.
101+
102+
End of the Terms and Conditions
103+
104+
How to apply the Mulan Permissive Software License,Version 1 (Mulan PSL v1) to your software
105+
106+
To apply the Mulan PSL v1 to your work, for easy identification by recipients, you are suggested to complete following three steps:
107+
108+
i. Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
109+
ii. Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
110+
iii. Attach the statement to the appropriate annotated syntax at the beginning of each source file.
111+
112+
Copyright (c) [2019] [name of copyright holder]
113+
[Software Name] is licensed under the Mulan PSL v1.
114+
You can use this software according to the terms and conditions of the Mulan PSL v1.
115+
You may obtain a copy of Mulan PSL v1 at:
116+
http://license.coscl.org.cn/MulanPSL
117+
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
118+
IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
119+
PURPOSE.
120+
121+
See the Mulan PSL v1 for more details.

README.md

Lines changed: 128 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,146 @@
1-
# Face-api Vue简单使用
2-
face-api-demo-vue
1+
# face-api-demo-vue
32

4-
## 通过vue构建使用
5-
>案例含:人脸框跟踪 人脸对比(一对一) 人脸组比对(一对多)
6-
更多一些示例请浏览
7-
[作者Github](https://github.com/justadudewhohacks/face-api.js)
8-
[在线示例](https://justadudewhohacks.github.io/face-api.js)
3+
使用 `Vue` 框架搭建演示,`H5``Web``NodeJS` 实现人脸检测识别,基于 `TensorFlowJS` 实现的 `face-api.js` 人脸识别库。
4+
5+
起初在 2018 年时,有个项目用人脸检测,当时我在百度寻找了一下关于在浏览器网页 `JavaScript` 实现人脸识别的方法很少,好多都是用 `百度AI` 人脸识别接口来实现的。当时 `Python` 人工智能方面最为热门,很多是做人脸识别和数据分析处理,在 `GitHub` 上找到人脸识别、机器视觉都是基于 `OpenCV` 来处理图片,当时发现有个 `NodeJS` 图像识别处理叫做 `opencv4nodejs` 的识别库,在作者的仓库内还发现 `face-api.js` 这个人脸识别库。采用 `TensorFlowJS` 机器学习库进行模型训练,提升识别功能精确度,感觉不错而且功能也强。
6+
7+
安装依赖库,模型文件放在 `public\models` 目录下,npm 主要安装以下:
8+
9+
```shell
10+
npm i --save face-api.js
11+
npm i --save webrtc-adapter
12+
```
13+
14+
- [face-api 使用文档](https://justadudewhohacks.github.io/face-api.js/docs/globals.html)
15+
- [我仓库 browser 示例 0.13.8 含 dist/文档/模型/示例](https://github.com/TsMask/face-api-demo)
16+
- [GitHub 作者识别库源码](https://github.com/justadudewhohacks/face-api.js)
17+
- [GitHub 作者在线示例](https://justadudewhohacks.github.io/face-api.js)
18+
19+
## 项目说明
20+
21+
示例参考 `face-api.js` 作者提供示例源码 `examples-browser`
22+
23+
内含功能:
24+
25+
1. 脸标志检测
26+
2. 人脸表情识别
27+
3. 年龄和性别识别
28+
4. 人脸提取
29+
5. 人脸识别
30+
6. 人脸识别多图处理
31+
7. BBT 图片相似度
32+
8. BBT 图片相似度多查找
33+
9. BBT 人脸识别
34+
10. Video 人脸跟踪
35+
11. Video 人脸识别
36+
12. WebRTC 人脸跟踪
37+
13. WebRTC 人脸识别
38+
14. WebRTC 媒体流基础
39+
40+
编译执行环境:
41+
42+
- NodeJS:`v12.13.0`
43+
- Vue 脚手架:`@vue/cli@4.3.1`
44+
- Vue:`^2.6.11`
45+
- face-api.js:`^0.22.2`
46+
- webrtc-adapter:`^7.5.1`
47+
48+
## 项目结构
49+
50+
```text
51+
face-api-demo-vue
52+
┌─public 应用引用静态资源的目录
53+
├─src
54+
│ ├─components 复用组件目录
55+
│ ├─router 页面路由配置文件目录
56+
│ ├─utils 常用函数工具文件目录
57+
│ ├─views 页面视图文件目录
58+
│ ├─App.vue 配置App全局应用页面
59+
│ └─main.js Vue初始化入口文件
60+
├─babel.config.js Babel格式规范化配置
61+
├─package-lock.json 依赖版本校验信息
62+
├─package.json 项目依赖包、编译配置
63+
└─README.md 项目说明
64+
```
65+
66+
## 其他
67+
68+
**使用前引入模型**
69+
70+
```
71+
console.log(faceapi.nets);
72+
// ageGenderNet
73+
// faceExpressionNet
74+
// faceLandmark68Net
75+
// faceLandmark68TinyNet
76+
// faceRecognitionNet
77+
// ssdMobilenetv1
78+
// tinyFaceDetector
79+
// tinyYolov2
80+
// 放在public/models内
81+
// 通过url地址访问
82+
// await faceapi.nets.ssdMobilenetv1.loadFromUri("/models");
83+
// 本地路径
84+
// await faceapi.nets.ssdMobilenetv1.loadFromDisk("../../public/models");
85+
```
86+
87+
**侦测人脸**
88+
89+
- detectAllFaces :检测图像中的所有脸部
90+
- detectSingleFace :检测图像中具有最高置信度得分的脸部
91+
92+
默认情况下,`detectAllFaces``detectSingleFace` 使用 `SSD Mobilenet V1` 人脸检测器。
93+
94+
您可以通过传递相应的 options 对象来指定面部检测器:
95+
96+
```
97+
const detections1 = await faceapi.detectAllFaces(输入, 使用的模型参数)
98+
const detections2 = await faceapi.detectSingleFace(输入, 使用的模型参数)
99+
```
100+
101+
输入 :使用 `HTMLImageElement | HTMLVideoElement | HTMLCanvasElement` 类型
102+
103+
使用的模型参数 :配置识别度和修改人脸框,请看 `识别库说明` 或者 `查阅文档`
104+
105+
**识别库工具**
106+
107+
```
108+
// 请求json格式文件数据
109+
const json = await faceapi.fetchJson("http://www.example.com/file/example.json");
110+
111+
// 从Blob/File对象创建HTMLImageElement
112+
const imgEl = await faceapi.bufferToImage(imgFile);
113+
114+
// 从图像或视频元素创建画布元素
115+
const canvas = faceapi.createCanvasFromMedia(HTMLImageElement | HTMLVideoElement)
116+
```
117+
118+
---
119+
120+
## Project setup / 项目依赖安装初始化
9121

10-
## Project setup 项目安装依赖
11122
```
12123
npm install
13124
```
14125

15-
### Compiles and hot-reloads for development
126+
### Compiles and hot-reloads for development / 项目编译热更新用于开发调试
127+
16128
```
17129
npm run serve
18130
```
19131

20-
### Compiles and minifies for production
132+
### Compiles and minifies for production / 项目编译打包用于部署
133+
21134
```
22135
npm run build
23136
```
24137

25-
### Run your tests
26-
```
27-
npm run test
28-
```
138+
### Lints and fixes files / 代码检查和文件规范格式化
29139

30-
### Lints and fixes files
31140
```
32141
npm run lint
33142
```
143+
144+
### Customize configuration / 更多脚手架配置
145+
146+
See [Configuration Reference](https://cli.vuejs.org/config/).

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ["@vue/app"]
2+
presets: ["@vue/cli-plugin-babel/preset"],
33
};

0 commit comments

Comments
 (0)