Skip to content

Commit

Permalink
feat(frigate): stop_on_match config option to break process loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jakowenko committed Jun 12, 2022
1 parent ed30ad1 commit 4b98990
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ frigate:
# NOTE: requires frigate 0.11.0+
update_sub_labels: false
# stop the processing loop if a match is found
# if set to false all image attempts will be processed before determining the best match
stop_on_match: true
# object labels that are allowed for facial recognition
labels:
- person
Expand Down
9 changes: 8 additions & 1 deletion api/src/constants/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ module.exports.notify = () => {

module.exports.frigate = ({ id, camera, topic }) => {
const { topicURL } = require('../util/frigate.util');
const { url, events, attempts, image } = JSON.parse(JSON.stringify(CONFIG.frigate));
const {
url,
events,
attempts,
image,
stop_on_match: stopOnMatch,
} = JSON.parse(JSON.stringify(CONFIG.frigate));
const { masks } = module.exports;

_.mergeWith(image, events?.[camera]?.image || {}, customizer);
Expand All @@ -142,5 +148,6 @@ module.exports.frigate = ({ id, camera, topic }) => {
return objectKeysToUpperCase({
url: { frigate: url, snapshot, latest },
attempts,
stop_on_match: stopOnMatch,
});
};
1 change: 1 addition & 0 deletions api/src/constants/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
image: { height: 500 },
labels: ['person'],
update_sub_labels: false,
stop_on_match: true,
},
mqtt: {
topics: {
Expand Down
2 changes: 2 additions & 0 deletions api/src/controllers/recognize.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ module.exports.start = async (req, res) => {
{
id,
MATCH_IDS,
breakMatch: FRIGATE.STOP_ON_MATCH,
retries: FRIGATE.ATTEMPTS.LATEST,
type: 'latest',
url: FRIGATE.URL.LATEST,
Expand All @@ -121,6 +122,7 @@ module.exports.start = async (req, res) => {
{
id,
MATCH_IDS,
breakMatch: FRIGATE.STOP_ON_MATCH,
retries: FRIGATE.ATTEMPTS.SNAPSHOT,
type: 'snapshot',
url: FRIGATE.URL.SNAPSHOT,
Expand Down
1 change: 1 addition & 0 deletions api/src/schemas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ module.exports.detect = {
confidence: { type: 'number' },
purge: { type: 'number' },
min_area: { type: 'number' },
stop_on_match: { type: 'boolean' },
},
},
unknown: {
Expand Down

0 comments on commit 4b98990

Please sign in to comment.