Range
This commit is contained in:
@ -6,7 +6,7 @@ namespace View_by_Distance.Shared.Models;
|
||||
public record class FaceDistance : Properties.IFaceDistance
|
||||
{
|
||||
|
||||
public double? Confidence { init; get; }
|
||||
public int? ConfidencePercent { init; get; }
|
||||
public object? Encoding { init; get; }
|
||||
public int Id { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
@ -15,9 +15,9 @@ public record class FaceDistance : Properties.IFaceDistance
|
||||
public int? NormalizedPixelPercentage { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public FaceDistance(double? confidence, object? encoding, int id, bool? isWrongYear, double? length, DateTime? minimumDateTime, int? normalizedPixelPercentage)
|
||||
public FaceDistance(int? confidencePercent, object? encoding, int id, bool? isWrongYear, double? length, DateTime? minimumDateTime, int? normalizedPixelPercentage)
|
||||
{
|
||||
Confidence = confidence;
|
||||
ConfidencePercent = confidencePercent;
|
||||
Encoding = encoding;
|
||||
Id = id;
|
||||
IsWrongYear = isWrongYear;
|
||||
@ -26,12 +26,12 @@ public record class FaceDistance : Properties.IFaceDistance
|
||||
NormalizedPixelPercentage = normalizedPixelPercentage;
|
||||
}
|
||||
|
||||
public FaceDistance(double? confidence, object? encoding, int id, bool? isWrongYear, DateTime? minimumDateTime, int? normalizedPixelPercentage) :
|
||||
this(confidence, encoding, id, isWrongYear, null, minimumDateTime, normalizedPixelPercentage)
|
||||
public FaceDistance(int? confidencePercent, object? encoding, int id, bool? isWrongYear, DateTime? minimumDateTime, int? normalizedPixelPercentage) :
|
||||
this(confidencePercent, encoding, id, isWrongYear, null, minimumDateTime, normalizedPixelPercentage)
|
||||
{ }
|
||||
|
||||
public FaceDistance(FaceDistance faceDistance, double length) :
|
||||
this(faceDistance.Confidence, null, faceDistance.Id, faceDistance.IsWrongYear, length, faceDistance.MinimumDateTime, faceDistance.NormalizedPixelPercentage)
|
||||
this(faceDistance.ConfidencePercent, null, faceDistance.Id, faceDistance.IsWrongYear, length, faceDistance.MinimumDateTime, faceDistance.NormalizedPixelPercentage)
|
||||
{ }
|
||||
|
||||
public FaceDistance(object encoding) => Encoding = encoding;
|
||||
|
@ -35,16 +35,16 @@ public class MappingFromItem : Properties.IMappingFromItem
|
||||
public class MappingFromLocation : Properties.IMappingFromLocation
|
||||
{
|
||||
|
||||
public double AreaPermille { init; get; }
|
||||
public double Confidence { init; get; }
|
||||
public int AreaPermille { init; get; }
|
||||
public int ConfidencePercent { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int NormalizedPixelPercentage { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromLocation(int areaPermille, double confidence, string deterministicHashCodeKey, int normalizedPixelPercentage)
|
||||
public MappingFromLocation(int areaPermille, int confidencePercent, string deterministicHashCodeKey, int normalizedPixelPercentage)
|
||||
{
|
||||
AreaPermille = areaPermille;
|
||||
Confidence = confidence;
|
||||
ConfidencePercent = confidencePercent;
|
||||
DeterministicHashCodeKey = deterministicHashCodeKey;
|
||||
NormalizedPixelPercentage = normalizedPixelPercentage;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ namespace View_by_Distance.Shared.Models.Methods;
|
||||
public interface IMapLogicSupport
|
||||
{
|
||||
|
||||
string GetCounts();
|
||||
void SavePossiblyNewPersonContainers(Properties.IPropertyConfiguration propertyConfiguration, string personBirthdayFormat, string facesFileNameExtension, string? a2PeopleContentDirectory, Dictionary<long, PersonContainer> personKeyToPersonContainer, List<(string[], PersonContainer)> possiblyNewPersonDisplayDirectoryNamesAndPersonContainer);
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ namespace View_by_Distance.Shared.Models.Properties;
|
||||
public interface IFaceDistance
|
||||
{
|
||||
|
||||
public double? Confidence { init; get; }
|
||||
public int? ConfidencePercent { init; get; }
|
||||
public object? Encoding { init; get; }
|
||||
public int Id { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
|
@ -15,8 +15,8 @@ public interface IMappingFromItem
|
||||
public interface IMappingFromLocation
|
||||
{
|
||||
|
||||
public double AreaPermille { init; get; }
|
||||
public double Confidence { init; get; }
|
||||
public int AreaPermille { init; get; }
|
||||
public int ConfidencePercent { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int NormalizedPixelPercentage { init; get; }
|
||||
|
||||
|
@ -11,31 +11,41 @@ public class SaveContainer
|
||||
public FileHolder? FaceFileHolder { init; get; }
|
||||
public FileHolder? HiddenFaceFileHolder { init; get; }
|
||||
public FileHolder? FacePartsFileHolder { init; get; }
|
||||
public bool MakeAllHidden { init; get; }
|
||||
public FileHolder? ResizedFileHolder { init; get; }
|
||||
public string ShortcutFile { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public SaveContainer(string checkFile, string directory, FileHolder? faceFileHolder, FileHolder? hiddenFaceFileHolder, FileHolder? facePartsFileHolder, FileHolder? resizedFileHolder, string shortcutFile)
|
||||
public SaveContainer(string checkFile, string directory, FileHolder? faceFileHolder, FileHolder? hiddenFaceFileHolder, FileHolder? facePartsFileHolder, bool makeAllHidden, FileHolder? resizedFileHolder, string shortcutFile)
|
||||
{
|
||||
CheckFile = checkFile;
|
||||
Directory = directory;
|
||||
FaceFileHolder = faceFileHolder;
|
||||
HiddenFaceFileHolder = hiddenFaceFileHolder;
|
||||
FacePartsFileHolder = facePartsFileHolder;
|
||||
MakeAllHidden = makeAllHidden;
|
||||
ResizedFileHolder = resizedFileHolder;
|
||||
ShortcutFile = shortcutFile;
|
||||
}
|
||||
|
||||
public SaveContainer(string directory) :
|
||||
this(string.Empty, directory, null, null, null, null, string.Empty)
|
||||
this(string.Empty, directory, null, null, null, false, null, string.Empty)
|
||||
{ }
|
||||
|
||||
public SaveContainer(string directory, FileHolder? resizedFileHolder, string shortcutFile) :
|
||||
this(string.Empty, directory, null, null, null, true, resizedFileHolder, shortcutFile)
|
||||
{ }
|
||||
|
||||
public SaveContainer(string checkFile, string directory, FileHolder faceFileHolder) :
|
||||
this(checkFile, directory, faceFileHolder, null, null, null, string.Empty)
|
||||
this(checkFile, directory, faceFileHolder, null, null, false, null, string.Empty)
|
||||
{ }
|
||||
|
||||
public SaveContainer(FileHolder resizedFileHolder, string checkFile, string directory) :
|
||||
this(checkFile, directory, null, null, null, resizedFileHolder, string.Empty)
|
||||
this(checkFile, directory, null, null, null, false, resizedFileHolder, string.Empty)
|
||||
{ }
|
||||
|
||||
public SaveContainer(string checkFile, string directory, FileHolder? faceFileHolder, FileHolder? hiddenFaceFileHolder, FileHolder? facePartsFileHolder, FileHolder? resizedFileHolder, string shortcutFile) :
|
||||
this(checkFile, directory, faceFileHolder, hiddenFaceFileHolder, facePartsFileHolder, false, resizedFileHolder, shortcutFile)
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
|
@ -8,6 +8,11 @@ public interface ILocation
|
||||
static string GetLeftPadded(int locationDigits, string value) =>
|
||||
Location.GetLeftPadded(locationDigits, value);
|
||||
|
||||
int TestStatic_GetConfidencePercent(int faceConfidencePercent, double[] rangeFaceConfidence, double confidence) =>
|
||||
GetConfidencePercent(faceConfidencePercent, rangeFaceConfidence, confidence);
|
||||
static int GetConfidencePercent(int faceConfidencePercent, double[] rangeFaceConfidence, double confidence) =>
|
||||
Location.GetConfidencePercent(faceConfidencePercent, rangeFaceConfidence, confidence);
|
||||
|
||||
string TestStatic_GetLeftPadded(int locationDigits, int value) =>
|
||||
GetLeftPadded(locationDigits, value);
|
||||
static string GetLeftPadded(int locationDigits, int value) =>
|
||||
|
@ -8,20 +8,20 @@ public interface IMapping
|
||||
static (string?, string?, string?, bool?) GetSegments(string facesFileNameExtension, string fileName)
|
||||
=> Mapping.GetSegments(facesFileNameExtension, fileName);
|
||||
|
||||
int TestStatic_GetAreaPermille(int height, Models.Location location, int width)
|
||||
=> GetAreaPermille(height, location, width);
|
||||
static int GetAreaPermille(int height, Models.Location location, int width)
|
||||
=> Mapping.GetAreaPermille(location.Bottom, height, location.Left, location.Right, location.Top, width);
|
||||
int TestStatic_GetAreaPermille(int faceAreaPermille, int height, Models.Location location, int width)
|
||||
=> GetAreaPermille(faceAreaPermille, height, location, width);
|
||||
static int GetAreaPermille(int faceAreaPermille, int height, Models.Location location, int width)
|
||||
=> Mapping.GetAreaPermille(faceAreaPermille, location.Bottom, height, location.Left, location.Right, location.Top, width);
|
||||
|
||||
int TestStatic_GetAreaPermille(int bottom, int height, int left, int right, int top, int width)
|
||||
=> GetAreaPermille(bottom, height, left, right, top, width);
|
||||
static int GetAreaPermille(int bottom, int height, int left, int right, int top, int width)
|
||||
=> Mapping.GetAreaPermille(bottom, height, left, right, top, width);
|
||||
int TestStatic_GetAreaPermille(int faceAreaPermille, int bottom, int height, int left, int right, int top, int width)
|
||||
=> GetAreaPermille(faceAreaPermille, bottom, height, left, right, top, width);
|
||||
static int GetAreaPermille(int faceAreaPermille, int bottom, int height, int left, int right, int top, int width)
|
||||
=> Mapping.GetAreaPermille(faceAreaPermille, bottom, height, left, right, top, width);
|
||||
|
||||
int TestStatic_GetAreaPermille(Models.Location location, OutputResolution outputResolution)
|
||||
=> GetAreaPermille(location, outputResolution);
|
||||
static int GetAreaPermille(Models.Location location, OutputResolution outputResolution)
|
||||
=> Mapping.GetAreaPermille(location.Bottom, outputResolution.Height, location.Left, location.Right, location.Top, outputResolution.Width);
|
||||
int TestStatic_GetAreaPermille(int faceAreaPermille, Models.Location location, OutputResolution outputResolution)
|
||||
=> GetAreaPermille(faceAreaPermille, location, outputResolution);
|
||||
static int GetAreaPermille(int faceAreaPermille, Models.Location location, OutputResolution outputResolution)
|
||||
=> Mapping.GetAreaPermille(faceAreaPermille, location.Bottom, outputResolution.Height, location.Left, location.Right, location.Top, outputResolution.Width);
|
||||
|
||||
string TestStatic_GetDeterministicHashCodeKey(int id, Models.Location location, int locationDigits, int locationFactor, OutputResolution outputResolution)
|
||||
=> GetDeterministicHashCodeKey(id, location, locationDigits, locationFactor, outputResolution);
|
||||
|
@ -8,9 +8,9 @@ public interface ISorting
|
||||
static Models.Sorting[] Sort(List<Models.Sorting> collection) =>
|
||||
(from l in collection orderby l.WithinRange, l.DistancePermyriad, l.DaysDelta select l).ToArray();
|
||||
|
||||
Models.Sorting TestStatic_Get(int faceDistancePermyriad, double faceDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection) =>
|
||||
Get(faceDistancePermyriad, faceDistanceTolerance, faceDistanceEncoding, faceDistanceLength, personKeysRangesCollection);
|
||||
static Models.Sorting Get(int faceDistancePermyriad, double faceDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection) =>
|
||||
Sorting.Get(faceDistancePermyriad, faceDistanceTolerance, faceDistanceEncoding, faceDistanceLength, personKeysRangesCollection);
|
||||
Models.Sorting TestStatic_Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection) =>
|
||||
Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength, personKeysRangesCollection);
|
||||
static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection) =>
|
||||
Sorting.Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength, personKeysRangesCollection);
|
||||
|
||||
}
|
@ -111,4 +111,9 @@ internal abstract class Location
|
||||
return new(x, y);
|
||||
}
|
||||
|
||||
internal static int GetConfidencePercent(int faceConfidencePercent, double[] rangeFaceConfidence, double confidence)
|
||||
{
|
||||
int result = (int)(confidence / rangeFaceConfidence[1] * faceConfidencePercent);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -74,12 +74,12 @@ internal abstract class Mapping
|
||||
return new(id, normalizedPixelPercentage, mappingCollection);
|
||||
}
|
||||
|
||||
internal static int GetAreaPermille(int bottom, int height, int left, int right, int top, int width)
|
||||
internal static int GetAreaPermille(int faceAreaPermille, int bottom, int height, int left, int right, int top, int width)
|
||||
{
|
||||
int result;
|
||||
double area = width * height;
|
||||
double locationArea = (right - left) * (bottom - top);
|
||||
result = (int)Math.Round(locationArea / area * 1000, 0);
|
||||
result = (int)Math.Round(locationArea / area * faceAreaPermille, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
internal abstract class Sorting
|
||||
{
|
||||
|
||||
internal static Models.Sorting Get(int faceDistancePermyriad, double faceDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection)
|
||||
internal static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection)
|
||||
{
|
||||
Models.Sorting result;
|
||||
if (faceDistanceLength.Length is null)
|
||||
@ -17,7 +17,7 @@ internal abstract class Sorting
|
||||
TimeSpan timeSpan = new(faceDistanceLength.MinimumDateTime.Value.Ticks - ticks);
|
||||
bool older = timeSpan.TotalMilliseconds < 0;
|
||||
int daysDelta = (int)Math.Round(Math.Abs(timeSpan.TotalDays), 0);
|
||||
int distancePermyriad = (int)(faceDistanceLength.Length.Value / faceDistanceTolerance * faceDistancePermyriad);
|
||||
int distancePermyriad = (int)(faceDistanceLength.Length.Value / rangeDistanceTolerance * faceDistancePermyriad);
|
||||
if (!personKeysRangesCollection.Any())
|
||||
withinRanges.Add(0);
|
||||
else
|
||||
|
Reference in New Issue
Block a user