Skip to content

Commit

Permalink
Exciting
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Mar 6, 2024
1 parent ecdc3dc commit b08d1ca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Damselfly.Core.Utils/ML/ImageDetectResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Damselfly.Core.Utils.ML;


public class ImageDetectResult
{
public Rectangle Rect { get; set; }
Expand All @@ -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;
}
3 changes: 2 additions & 1 deletion Damselfly.Core/Services/ImageRecognitionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public async Task CreateMissingPeople(IEnumerable<ImageDetectResult> detectedFac
State = Person.PersonState.Unknown,
LastUpdated = DateTime.UtcNow,
Embeddings = string.Join( ",", x.Embeddings),
PersonGuid = x.PersonGuid
PersonGuid = x.PersonGuid,
}).ToList();

if ( newPeople.Any() )
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion Damselfly.ML.FaceONNX/FaceONNXService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ public async Task<List<ImageDetectResult>> DetectFaces(Image<Rgb24> 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();
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Web.Client/wwwroot/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const CACHE_VERSION='4.1.0-20240306121028'
const CACHE_VERSION='4.1.0-20240306145206'

0 comments on commit b08d1ca

Please sign in to comment.