mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 15:45:27 +03:00
Use sigmoid function for normalization for multi modal searches only
This commit is contained in:
parent
07d73e1123
commit
5e493da859
@ -187,13 +187,23 @@ export default function SearchView({
|
|||||||
}
|
}
|
||||||
}, [searchResults, searchDetail]);
|
}, [searchResults, searchDetail]);
|
||||||
|
|
||||||
// confidence score - probably needs tweaking
|
// confidence score
|
||||||
|
|
||||||
const zScoreToConfidence = (score: number) => {
|
const zScoreToConfidence = (score: number) => {
|
||||||
// Sigmoid function: 1 / (1 + e^x)
|
// Normalizing is needed for multi-modal searches only
|
||||||
const confidence = 1 / (1 + Math.exp(score));
|
// Sigmoid function for normalized: 1 / (1 + e^x)
|
||||||
|
// Cosine for non-normalized
|
||||||
|
if (searchFilter) {
|
||||||
|
const normalized =
|
||||||
|
!searchFilter.search_type ||
|
||||||
|
(Array.isArray(searchFilter.search_type) &&
|
||||||
|
searchFilter.search_type.length === 2 &&
|
||||||
|
searchFilter.search_type.includes("thumbnail") &&
|
||||||
|
searchFilter.search_type.includes("description"));
|
||||||
|
const confidence = normalized ? 1 / (1 + Math.exp(score)) : 1 - score;
|
||||||
|
|
||||||
return Math.round(confidence * 100);
|
return Math.round(confidence * 100);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasExistingSearch = useMemo(
|
const hasExistingSearch = useMemo(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user