Skip to content

Commit

Permalink
fix: use lower compreface det_prob_threshold for /recognize/test (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakowenko committed Nov 24, 2021
1 parent ccd8dbf commit 6a0c435
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/src/controllers/recognize.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports.test = async (req, res) => {
for (const detector of DETECTORS) {
promises.push(
actions
.recognize({ detector, key: `${__dirname}/../static/img/lenna.jpg` })
.recognize({ test: true, detector, key: `${__dirname}/../static/img/lenna.jpg` })
.catch((error) => {
return { status: 500, data: error.message };
})
Expand Down
3 changes: 2 additions & 1 deletion api/src/util/detectors/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const factory = require('../factory');

module.exports.recognize = ({ detector, key }) => factory.get(detector).recognize({ key });
module.exports.recognize = ({ detector, key, test }) =>
factory.get(detector).recognize({ key, test });
module.exports.train = ({ name, key, detector }) => factory.get(detector).train({ name, key });
module.exports.remove = ({ name, detector }) => factory.get(detector).remove({ name });
module.exports.normalize = ({ camera, detector, data }) =>
Expand Down
4 changes: 2 additions & 2 deletions api/src/util/detectors/compreface.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config = require('../../constants/config');

const { COMPREFACE } = DETECTORS || {};

module.exports.recognize = async ({ key }) => {
module.exports.recognize = async ({ key, test }) => {
const { URL, KEY, DET_PROB_THRESHOLD, FACE_PLUGINS } = COMPREFACE;
const formData = new FormData();
formData.append('file', fs.createReadStream(key));
Expand All @@ -23,7 +23,7 @@ module.exports.recognize = async ({ key }) => {
return true;
},
params: {
det_prob_threshold: DET_PROB_THRESHOLD,
det_prob_threshold: test ? 0 : DET_PROB_THRESHOLD,
},
data: formData,
});
Expand Down

0 comments on commit 6a0c435

Please sign in to comment.