Skip to content

Commit d3c0ae5

Browse files
committed
Publish 1.0.0
0 parents  commit d3c0ae5

31 files changed

+10906
-0
lines changed

.gitignore

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
84+
# Gatsby files
85+
.cache/
86+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
87+
# https://nextjs.org/blog/next-9-1#public-directory-support
88+
# public
89+
90+
# vuepress build output
91+
.vuepress/dist
92+
93+
# Serverless directories
94+
.serverless/
95+
96+
# FuseBox cache
97+
.fusebox/
98+
99+
# DynamoDB Local files
100+
.dynamodb/
101+
102+
# TernJS port file
103+
.tern-port

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 gitguanqi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
<div align="center">
2+
<img alt="kby-face" src="https://github.com/kby-ai/FaceRecognition-Javascript/assets/82228271/cab95553-8881-41ca-b37d-a0606877c942" width="300" width="300">
3+
</div>
4+
5+
6+
<div align="left">
7+
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome Badge"/>
8+
<img src="https://img.shields.io/static/v1?label=%F0%9F%8C%9F&message=If%20Useful&style=style=flat&color=BC4E99" alt="Star Badge"/>
9+
<img src="https://img.shields.io/github/issues/genderev/assassin" alt="issue"/>
10+
<img src="https://img.shields.io/github/issues-pr/genderev/assassin" alt="pr"/>
11+
</div>
12+
13+
<details open>
14+
<summary><h2>How it works</h2></summary>
15+
16+
17+
18+
</details>
19+
20+
<details open>
21+
<summary><h2>Installation</h2></summary>
22+
23+
```bash
24+
npm install kby-face
25+
```
26+
27+
</details>
28+
29+
<details open>
30+
<summary><h2>Table of Contents</h2></summary>
31+
32+
* **[Face Detection](#face-detection)**
33+
* **[Face Landmark Extraction](#face-landmark-extraction)**
34+
* **[Face Liveness Detection](#face-expression-detection)**
35+
* **[Face Expression Detection](#face-expression-detection)**
36+
* **[Face Pose Estimation](#face-pose-estimation)**
37+
* **[Eye Closeness Detection](#eye-closeness-detection)**
38+
* **[Gender Detection](#gender-detection)**
39+
* **[Age Detection](#age-detection)**
40+
* **[Face Feature Embedding](#face-recognition)**
41+
42+
</details>
43+
44+
<details open>
45+
<summary><h2>Examples</h2></summary>
46+
47+
https://user-images.githubusercontent.com/82228271/187199680-208c7995-21b1-48d7-8758-3977452ff955.mp4
48+
49+
50+
* [Vue.js Demo](https://github.com/AI-Innovator/Face-Recognition-SDK-Demo-Vue)
51+
* [React.js Demo](https://github.com/AI-Innovator/Face-Recognition-SDK-Demo-React)
52+
53+
[**Please subscribe on Youtube channel**]
54+
<a href="http://www.youtube.com/watch?feature=player_embedded&v=1aogUPLjdtw" target="_blank">
55+
<img src="http://img.youtube.com/vi/1aogUPLjdtw/maxresdefault.jpg" alt="Watch the video" width="960" height="520" border="10" />
56+
</a>
57+
58+
</details>
59+
60+
<details>
61+
<summary><h2>Documentation</h2></summary>
62+
63+
Here are some useful documentation
64+
65+
<a name="face-detection"></a>
66+
### Face Detection
67+
Load detection model
68+
```
69+
loadDetectionModel()
70+
```
71+
Detect face in the image
72+
```
73+
detectFace(session, canvas_id)
74+
```
75+
76+
<a name="face-landmark-extraction"></a>
77+
### Face Landmark Extraction
78+
Load landmark extraction model
79+
```
80+
loadLandmarkModel()
81+
```
82+
Extract face landmark in the image using detection result
83+
```
84+
predictLandmark(session, canvas_id, bbox)
85+
```
86+
87+
<a name="face-liveness-detection"></a>
88+
### Face Liveness Detection
89+
Load liveness detection model
90+
```
91+
loadLivenessModel()
92+
```
93+
Detect face liveness in the image using detection result. (Anti-spoofing)
94+
```
95+
predictLiveness(session, canvas_id, bbox)
96+
```
97+
98+
<a name="face-expression-detection"></a>
99+
### Face Expression Detection
100+
Load expression detection model
101+
```
102+
loadExpressionModel()
103+
```
104+
Detect face expression
105+
```
106+
predictExpression(session, canvas_id, bbox)
107+
```
108+
109+
<a name="face-pose-estimation"></a>
110+
### Face Pose Estimation
111+
Load pose estimation model
112+
```
113+
loadPoseModel()
114+
```
115+
Predict facial pose
116+
```
117+
predictPose(session, canvas_id, bbox, question)
118+
```
119+
120+
<a name="eye-closeness-detection"></a>
121+
### Eye Closeness Detection
122+
Load eye closeness model
123+
```
124+
loadEyeModel()
125+
```
126+
Predict eye closeness
127+
```
128+
predictEye(session, canvas_id, landmark)
129+
```
130+
131+
<a name="gender-detection"></a>
132+
### Gender Detection
133+
Load gender detection model
134+
```
135+
loadGenderModel()
136+
```
137+
Predict gender using face image
138+
```
139+
predictGender(session, canvas_id, landmark)
140+
```
141+
142+
<a name="age-detection"></a>
143+
### Age Detection
144+
Load age detection model
145+
```
146+
loadAgeModel()
147+
```
148+
Predict age using face image
149+
```
150+
predictAge(session, canvas_id, landmark)
151+
```
152+
153+
<a name="face-recognition"></a>
154+
### Face Recognition
155+
Load feature extraction model
156+
```
157+
loadFeatureModel()
158+
```
159+
Extract face feature vector in 512 dimension
160+
```
161+
extractFeature(session, canvas_id, landmarks)
162+
```
163+
164+
</details>
165+
166+
167+
168+

add.test.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const add = require('./index.js').add;
2+
3+
test('adds 1 + 2 to equal 3', () => {
4+
expect(add(1,2)).toBe(3);
5+
})

index.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export * from "./lib/fr_detect";
2+
export * from "./lib/fr_expression";
3+
export * from "./lib/fr_eye";
4+
export * from "./lib/fr_landmark";
5+
export * from "./lib/fr_liveness";
6+
export * from "./lib/fr_pose";
7+
export * from "./lib/fr_age";
8+
export * from "./lib/fr_gender";
9+
export * from "./lib/fr_feature";
10+
export * from "./lib/load_opencv";

js/opencv.js

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/opencv_js.js

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/opencv_js.wasm

3.04 MB
Binary file not shown.

lib/download.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export const download = (url, logger = null) => {
2+
return new Promise((resolve, reject) => {
3+
const request = new XMLHttpRequest();
4+
request.open("GET", url, true);
5+
request.responseType = "arraybuffer";
6+
if (logger) {
7+
const [log, setState] = logger;
8+
request.onprogress = (e) => {
9+
const progress = (e.loaded / e.total) * 100;
10+
setState({ text: log, progress: progress.toFixed(2) });
11+
};
12+
}
13+
request.onload = function () {
14+
if (this.status >= 200 && this.status < 300) {
15+
resolve(request.response);
16+
} else {
17+
reject({
18+
status: this.status,
19+
statusText: request.statusText,
20+
});
21+
}
22+
resolve(request.response);
23+
};
24+
request.onerror = function () {
25+
reject({
26+
status: this.status,
27+
statusText: request.statusText,
28+
});
29+
};
30+
request.send();
31+
});
32+
};

0 commit comments

Comments
 (0)