Fix plugin configuration

face-manager-integrated
Elad Bar 2022-12-09 22:17:27 +02:00
parent a7f70803d6
commit 57d2e3879d
1 changed files with 10 additions and 5 deletions

View File

@ -113,12 +113,12 @@ const initialize = () => {
const detectionType = config.plug.split("-")[1].toLowerCase(); const detectionType = config.plug.split("-")[1].toLowerCase();
const detectorConfig = DETECTOR_CONFIGUTATION[detectionType]; const detectorConfig = DETECTOR_CONFIGUTATION[detectionType];
const detectorConfigKeys = Object.keys(detectorConfig); const detectorConfigKeys = Object.keys(detectorConfig);
detectorSettings = { detectorSettings = {
type: detectionType, type: detectionType,
active: false, active: false,
baseUrl: baseUrl, baseUrl: baseUrl,
apiKey: config.deepStack.apiKey, apiKey: config.deepStack.apiKey,
fullyControlledByFaceManager: config.fullyControlledByFaceManager || false,
faces: { faces: {
shinobi: null, shinobi: null,
server: null, server: null,
@ -195,6 +195,10 @@ const registerFace = (serverFileName) => {
}; };
const unregisterFace = (serverFileName) => { const unregisterFace = (serverFileName) => {
if (serverFileName === null) {
return;
}
const form = { const form = {
userid: serverFileName userid: serverFileName
}; };
@ -216,12 +220,12 @@ const getServerFileNameByShinobi = (name, image) => {
return fileName; return fileName;
} }
const compareShinobiVSServer = () => { const compareShinobiVSServer = () => {
const allFaces = detectorSettings.faces; const allFaces = detectorSettings.faces;
const shinobiFaces = allFaces.shinobi; const shinobiFaces = allFaces.shinobi;
const serverFaces = allFaces.server; const serverFaces = allFaces.server;
const compareShinobiVSServerDelayID = detectorSettings.compareShinobiVSServerDelayID || null; const compareShinobiVSServerDelayID = detectorSettings.compareShinobiVSServerDelayID || null;
if (compareShinobiVSServerDelayID !== null) { if (compareShinobiVSServerDelayID !== null) {
clearTimeout(compareShinobiVSServerDelayID) clearTimeout(compareShinobiVSServerDelayID)
} }
@ -268,8 +272,9 @@ const compareShinobiVSServer = () => {
logInfo(`Skip unregistering the following faces: ${facesToUnregister}`); logInfo(`Skip unregistering the following faces: ${facesToUnregister}`);
detectorSettings.faces.legacy = facesToUnregister; detectorSettings.faces.legacy = facesToUnregister;
} }
} }
}; };
const processImage = (frameBuffer, d, tx, frameLocation, callback) => { const processImage = (frameBuffer, d, tx, frameLocation, callback) => {
@ -517,8 +522,8 @@ const onRecompileFaceDescriptors = (d) => {
if(detectorSettings.faces.shinobi !== d.faces) { if(detectorSettings.faces.shinobi !== d.faces) {
detectorSettings.faces.shinobi = d.faces; detectorSettings.faces.shinobi = d.faces;
detectorSettings.facesPath = d.path; detectorSettings.facesPath = d.path;
compareShinobiVSServer(); compareShinobiVSServer();
} }
}; };