PhotoPrism for more locations

This commit is contained in:
2022-12-25 13:54:17 -07:00
parent a510019c1d
commit 37c7b6760d
31 changed files with 395 additions and 509 deletions

View File

@ -60,7 +60,6 @@ public class Configuration
[Display(Name = "Face Area Permille Tolerance"), Required] public int[] RangeFaceAreaPermilleTolerance { get; set; }
[Display(Name = "Location Minimum Confidence"), Required] public double[] RangeFaceConfidence { get; set; }
[Display(Name = "Face Distance Tolerance"), Required] public double[] RangeDistanceTolerance { get; set; }
[Display(Name = "Retry Images Without a Face"), Required] public bool? RetryImagesWithoutAFaceLocation { get; set; }
[Display(Name = "Reverse"), Required] public bool? Reverse { get; set; }
[Display(Name = "Save Face Landmark For Output Resolutions"), Required] public string[] SaveFaceLandmarkForOutputResolutions { get; set; }
[Display(Name = "Save Full Year Of Random Files"), Required] public bool? SaveFullYearOfRandomFiles { get; set; }
@ -171,8 +170,6 @@ public class Configuration
throw new NullReferenceException(nameof(configuration.RangeFaceConfidence));
if (configuration.RangeDistanceTolerance is null || configuration.RangeDistanceTolerance.Length != 3)
throw new NullReferenceException(nameof(configuration.RangeDistanceTolerance));
if (configuration.RetryImagesWithoutAFaceLocation is null)
throw new NullReferenceException(nameof(configuration.RetryImagesWithoutAFaceLocation));
if (configuration.Reverse is null)
throw new NullReferenceException(nameof(configuration.Reverse));
configuration.SaveFaceLandmarkForOutputResolutions ??= Array.Empty<string>();
@ -245,7 +242,6 @@ public class Configuration
configuration.RangeFaceAreaPermilleTolerance,
configuration.RangeFaceConfidence,
configuration.RangeDistanceTolerance,
configuration.RetryImagesWithoutAFaceLocation.Value,
configuration.Reverse.Value,
configuration.SaveFaceLandmarkForOutputResolutions,
configuration.SaveFullYearOfRandomFiles.Value,

View File

@ -58,7 +58,6 @@ public class Configuration
public int[] RangeFaceAreaPermilleTolerance { init; get; }
public double[] RangeFaceConfidence { init; get; }
public double[] RangeDistanceTolerance { init; get; }
public bool RetryImagesWithoutAFaceLocation { init; get; }
public bool Reverse { init; get; }
public string[] SaveFaceLandmarkForOutputResolutions { init; get; }
public bool SaveFullYearOfRandomFiles { init; get; }
@ -123,7 +122,6 @@ public class Configuration
int[] rangeFaceAreaPermilleTolerance,
double[] rangeFaceConfidence,
double[] rangeDistanceTolerance,
bool retryImagesWithoutAFaceLocation,
bool reverse,
string[] saveFaceLandmarkForOutputResolutions,
bool saveFullYearOfRandomFiles,
@ -187,7 +185,6 @@ public class Configuration
RangeFaceAreaPermilleTolerance = rangeFaceAreaPermilleTolerance;
RangeFaceConfidence = rangeFaceConfidence;
RangeDistanceTolerance = rangeDistanceTolerance;
RetryImagesWithoutAFaceLocation = retryImagesWithoutAFaceLocation;
Reverse = reverse;
SaveFaceLandmarkForOutputResolutions = saveFaceLandmarkForOutputResolutions;
SaveFullYearOfRandomFiles = saveFullYearOfRandomFiles;

View File

@ -231,7 +231,7 @@ public class UnitTestFace
(Model model, PredictorModel predictorModel, ModelParameter modelParameter) = GetModel(_Configuration);
FaceRecognition faceRecognition = new(_Configuration.NumberOfJitters, _Configuration.NumberOfTimesToUpsample, model, modelParameter, predictorModel);
List<(Location Location, FaceRecognitionDotNet.FaceEncoding? FaceEncoding, Dictionary<FacePart, FacePoint[]>? FaceParts)> collection;
collection = faceRecognition.GetCollection(image, includeFaceEncoding: true, includeFaceParts: true);
collection = faceRecognition.GetCollection(image, locations: new(), includeFaceEncoding: true, includeFaceParts: true);
Assert.IsTrue(collection.Count == 2);
List<FaceDistance> faceDistanceEncodings = (from l in collection where l.FaceEncoding is not null select new FaceDistance(l.FaceEncoding)).ToList();
List<FaceDistance> faceDistanceLengths = FaceRecognition.FaceDistances(faceDistanceEncodings, faceDistanceEncodings[0]);