Skip to content

Commit

Permalink
feat(api): opencv preprocess face check
Browse files Browse the repository at this point in the history
  • Loading branch information
jakowenko committed Jun 12, 2022
1 parent 78e9808 commit ed30ad1
Show file tree
Hide file tree
Showing 9 changed files with 42,927 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ detectors:
# minimum required confidence that a recognized face is actually a face
# value is between 0.0 and 1.0
det_prob_threshold: 0.8
# require opencv to find a face before processing with detector
opencv_face_required: false
# comma-separated slugs of face plugins
# https://github.com/exadel-inc/CompreFace/blob/master/docs/Face-services-and-plugins.md)
# face_plugins: mask,gender,age
Expand All @@ -452,11 +454,15 @@ detectors:
key:
# number of seconds before the request times out and is aborted
timeout: 15
# require opencv to find a face before processing with detector
opencv_face_required: false

facebox:
url:
# number of seconds before the request times out and is aborted
timeout: 15
# require opencv to find a face before processing with detector
opencv_face_required: false
```

### `schedule`
Expand Down
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"get-orientation": "^1.1.2",
"joi": "^17.6.0",
"js-yaml": "^4.1.0",
"jsdom": "^19.0.0",
"jsonschema": "^1.4.1",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.21",
Expand Down
2 changes: 2 additions & 0 deletions api/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const config = require('./src/constants/config');
const shutdown = require('./src/util/shutdown.util');
const heartbeat = require('./src/util/heartbeat.util');
const validate = require('./src/schemas/validate');
const opencv = require('./src/util/opencv');

module.exports.start = async () => {
config.setup();
Expand All @@ -18,6 +19,7 @@ module.exports.start = async () => {
validate(config());
console.verbose(config());
await database.init();
if (opencv.shouldLoad()) await opencv.load();
const server = http.Server(require('./src/app')).listen(SERVER.PORT);
mqtt.connect();
storage.purge();
Expand Down
3 changes: 3 additions & 0 deletions api/src/constants/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ module.exports = {
compreface: {
det_prob_threshold: 0.8,
timeout: 15,
opencv_face_required: false,
},
deepstack: {
timeout: 15,
opencv_face_required: false,
},
facebox: {
timeout: 15,
opencv_face_required: false,
},
},
notify: {
Expand Down
3 changes: 3 additions & 0 deletions api/src/schemas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,23 @@ module.exports.config = {
required: ['url', 'key'],
properties: {
url: { type: 'string' },
opencv_face_required: { type: 'boolean' },
},
},
deepstack: {
type: 'object',
required: ['url'],
properties: {
url: { type: 'string' },
opencv_face_required: { type: 'boolean' },
},
},
facebox: {
type: 'object',
required: ['url'],
properties: {
url: { type: 'string' },
opencv_face_required: { type: 'boolean' },
},
},
},
Expand Down

0 comments on commit ed30ad1

Please sign in to comment.