From b08d1cafb1c90b8cd37bbbc32cabc3aaa711ffde Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Wed, 6 Mar 2024 15:04:14 +0000 Subject: [PATCH] Exciting --- Damselfly.Core.Utils/ML/ImageDetectResult.cs | 3 ++- Damselfly.Core/Services/ImageRecognitionService.cs | 3 ++- Damselfly.ML.FaceONNX/FaceONNXService.cs | 3 ++- Damselfly.Web.Client/wwwroot/version.js | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Damselfly.Core.Utils/ML/ImageDetectResult.cs b/Damselfly.Core.Utils/ML/ImageDetectResult.cs index 03042d08..897b0ef0 100644 --- a/Damselfly.Core.Utils/ML/ImageDetectResult.cs +++ b/Damselfly.Core.Utils/ML/ImageDetectResult.cs @@ -2,6 +2,7 @@ namespace Damselfly.Core.Utils.ML; + public class ImageDetectResult { public Rectangle Rect { get; set; } @@ -11,6 +12,6 @@ public class ImageDetectResult public float Score { get; set; } public float[] Embeddings { get; set; } public bool IsNewPerson { get; set; } - public string PersonGuid { get; set; } + public string? PersonGuid { get; set; } public bool IsFace => string.Compare(Tag, "Face", true) == 0; } \ No newline at end of file diff --git a/Damselfly.Core/Services/ImageRecognitionService.cs b/Damselfly.Core/Services/ImageRecognitionService.cs index 91df4bfa..bab68768 100644 --- a/Damselfly.Core/Services/ImageRecognitionService.cs +++ b/Damselfly.Core/Services/ImageRecognitionService.cs @@ -310,7 +310,7 @@ public async Task CreateMissingPeople(IEnumerable detectedFac State = Person.PersonState.Unknown, LastUpdated = DateTime.UtcNow, Embeddings = string.Join( ",", x.Embeddings), - PersonGuid = x.PersonGuid + PersonGuid = x.PersonGuid, }).ToList(); if ( newPeople.Any() ) @@ -426,6 +426,7 @@ private async Task DetectObjects(ImageMetaData metadata) { RecogntionSource = ImageObject.RecognitionType.FaceONNX, ImageId = image.ImageId, + PersonId = _peopleCache[x.PersonGuid].PersonId, RectX = x.Rect.Left, RectY = x.Rect.Top, RectHeight = x.Rect.Height, diff --git a/Damselfly.ML.FaceONNX/FaceONNXService.cs b/Damselfly.ML.FaceONNX/FaceONNXService.cs index 5432b834..d59b5481 100644 --- a/Damselfly.ML.FaceONNX/FaceONNXService.cs +++ b/Damselfly.ML.FaceONNX/FaceONNXService.cs @@ -151,7 +151,8 @@ public async Task> DetectFaces(Image image) bool isNewPerson = true; - if( personGuid == null || similarity < 0.75 ) + // TODO - maybe make this similarity threshold a preference? + if( personGuid == null || similarity < 0.5 ) { // No match, so create a new person GUID face.PersonGuid = Guid.NewGuid().ToString(); diff --git a/Damselfly.Web.Client/wwwroot/version.js b/Damselfly.Web.Client/wwwroot/version.js index 7fba3a7f..ccf09a43 100644 --- a/Damselfly.Web.Client/wwwroot/version.js +++ b/Damselfly.Web.Client/wwwroot/version.js @@ -1 +1 @@ -const CACHE_VERSION='4.1.0-20240306121028' +const CACHE_VERSION='4.1.0-20240306145206'