express-sweet 1.0.18 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +116 -1
- package/dist/build.common.js +14 -12
- package/dist/build.esm.js +14 -12
- package/docs/index.html +395 -99
- package/package.json +2 -2
- package/types/database/Model.d.ts +1 -1
- package/types/handlebars_helpers/date.d.ts +10 -17
- package/types/handlebars_helpers/index.d.ts +2 -1
- package/types/interfaces/BoundingBox.d.ts +1 -1
- package/types/interfaces/FaceDetailsEmotions.d.ts +40 -0
- package/types/services/AWSRekognitionClient.d.ts +25 -254
- package/types/utils/index.d.ts +1 -0
- package/types/utils/isArray.d.ts +8 -0
- package/types/utils/isString.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,118 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [1.0.21] - 2022-05-26
|
|
5
|
+
### Fixed
|
|
6
|
+
- Added an option to the face indexing method to retrieve details (gender, emotion, age group) of indexed faces.
|
|
7
|
+
```js
|
|
8
|
+
const sweet = require('../dist/build.common');
|
|
9
|
+
|
|
10
|
+
// Load environment variables.
|
|
11
|
+
sweet.middlewares.Environment.mount();
|
|
12
|
+
|
|
13
|
+
// Rekognition Client.
|
|
14
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
15
|
+
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
16
|
+
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
17
|
+
region: process.env.AWS_REKOGNITION_REGION
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Collection ID for testing.
|
|
21
|
+
const collectionId = 'MyCollection';
|
|
22
|
+
|
|
23
|
+
// Create a face and get the ID of the created face.
|
|
24
|
+
// Output: e65d66cb-e7bc-4bbf-966c-b1b49ddf29f8
|
|
25
|
+
const faceId = await client.indexFace(collectionId, 'img/face4.jpg');
|
|
26
|
+
console.log(faceId);
|
|
27
|
+
|
|
28
|
+
// Create a face and get the details of the created face.
|
|
29
|
+
// Output: {
|
|
30
|
+
// faceId: '7f2dd321-f047-44ff-8856-864637e1d286',
|
|
31
|
+
// ageRange: { high: 29, low: 21 },
|
|
32
|
+
// gender: 'female',
|
|
33
|
+
// emotions: {
|
|
34
|
+
// angry: 77.1907958984375,
|
|
35
|
+
// surprised: 9.944050788879395,
|
|
36
|
+
// fear: 7.514361381530762,
|
|
37
|
+
// confused: 4.780297756195068,
|
|
38
|
+
// sad: 2.91914963722229,
|
|
39
|
+
// happy: 2.5718722343444824,
|
|
40
|
+
// disgusted: 1.933768391609192,
|
|
41
|
+
// calm: 1.5354809761047363
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
const faceDetails = await client.indexFace(collectionId, 'img/face5.jpg', {returnDetails: true});
|
|
45
|
+
console.log(faceDetails);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## [1.0.20] - 2022-05-25
|
|
49
|
+
### Fixed
|
|
50
|
+
- Added an option to get details (emotion, gender, age group) to the face detection method.
|
|
51
|
+
```js
|
|
52
|
+
const sweet = require('../dist/build.common');
|
|
53
|
+
|
|
54
|
+
// Load environment variables.
|
|
55
|
+
sweet.middlewares.Environment.mount();
|
|
56
|
+
|
|
57
|
+
// Rekognition Client.
|
|
58
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
59
|
+
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
60
|
+
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
61
|
+
region: process.env.AWS_REKOGNITION_REGION
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
(async () => {
|
|
65
|
+
// Detects bounding boxes on faces.
|
|
66
|
+
// Output: [
|
|
67
|
+
// {
|
|
68
|
+
// width: 0.3099822998046875,
|
|
69
|
+
// height: 0.661512017250061,
|
|
70
|
+
// left: 0.5449195504188538,
|
|
71
|
+
// top: 0.11531734466552734
|
|
72
|
+
// }
|
|
73
|
+
// ]
|
|
74
|
+
let res = await client.detectFaces('img/face.jpg');
|
|
75
|
+
console.log(res);
|
|
76
|
+
|
|
77
|
+
// Detect facial details.
|
|
78
|
+
// Output: [
|
|
79
|
+
// {
|
|
80
|
+
// boundingBox: {
|
|
81
|
+
// width: 0.3099822998046875,
|
|
82
|
+
// height: 0.661512017250061,
|
|
83
|
+
// left: 0.5449195504188538,
|
|
84
|
+
// top: 0.11531734466552734
|
|
85
|
+
// },
|
|
86
|
+
// ageRange: { high: 14, low: 6 },
|
|
87
|
+
// gender: 'female',
|
|
88
|
+
// emotions: {
|
|
89
|
+
// happy: 99.78905487060547,
|
|
90
|
+
// surprised: 6.306276321411133,
|
|
91
|
+
// fear: 5.880091190338135,
|
|
92
|
+
// sad: 2.152125835418701,
|
|
93
|
+
// confused: 0.023256277665495872,
|
|
94
|
+
// angry: 0.018351631239056587,
|
|
95
|
+
// calm: 0.015775982290506363,
|
|
96
|
+
// disgusted: 0.013914424926042557
|
|
97
|
+
// }
|
|
98
|
+
// }
|
|
99
|
+
// ]
|
|
100
|
+
const minConfidence = 90;
|
|
101
|
+
const withDetails = true;
|
|
102
|
+
res = await client.detectFaces('img/face.jpg', minConfidence, withDetails);
|
|
103
|
+
console.log(res);
|
|
104
|
+
})();
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## [1.0.19] - 2022-05-20
|
|
108
|
+
### Fixed
|
|
109
|
+
- Add date format helper to view.
|
|
110
|
+
```html
|
|
111
|
+
{{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}} => 2021/10/24
|
|
112
|
+
{{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}} => 2021/10/24
|
|
113
|
+
{{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}} => 2021/10/24
|
|
114
|
+
```
|
|
115
|
+
|
|
4
116
|
## [1.0.18] - 2022-05-18
|
|
5
117
|
### Fixed
|
|
6
118
|
- User authentication sessions can now be stored in redis.
|
|
@@ -212,4 +324,7 @@ All notable changes to this project will be documented in this file.
|
|
|
212
324
|
[1.0.15]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.14...v1.0.15
|
|
213
325
|
[1.0.16]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.15...v1.0.16
|
|
214
326
|
[1.0.17]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.16...v1.0.17
|
|
215
|
-
[1.0.18]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.17...v1.0.18
|
|
327
|
+
[1.0.18]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.17...v1.0.18
|
|
328
|
+
[1.0.19]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.18...v1.0.19
|
|
329
|
+
[1.0.20]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.19...v1.0.20
|
|
330
|
+
[1.0.20]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.20...v1.0.21
|