feat(background): add face recognition functionality- Implement face recognition task type and processing

This commit is contained in:
ShiYu
2025-06-14 00:36:45 +08:00
parent a56ec32a15
commit 204bc96c56
12 changed files with 408 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ namespace Foxel.Models.DataBase
{
PictureProcessing = 0,
VisualRecognition = 1,
FaceRecognition = 2,
}
public enum TaskExecutionStatus

24
Models/DataBase/Face.cs Normal file
View File

@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Foxel.Models.DataBase;
public class Face : BaseModel
{
public float[]? Embedding { get; set; }
public int X { get; set; }
public int Y { get; set; }
public int W { get; set; }
public int H { get; set; }
[Range(0.0, 1.0)]
public double FaceConfidence { get; set; }
public int PictureId { get; set; }
[StringLength(255)]
public string? PersonName { get; set; }
[ForeignKey("PictureId")]
public Picture Picture { get; set; } = null!;
}

View File

@@ -48,6 +48,8 @@ public class Picture : BaseModel
public Album? Album { get; set; }
public ICollection<Favorite>? Favorites { get; set; }
public ICollection<Face>? Faces { get; set; }
public bool ContentWarning { get; set; } = false;
public PermissionType Permission { get; set; } = PermissionType.Public;