Force Single Image => Sorting
This commit is contained in:
@ -42,79 +42,83 @@ public class MapLogicSupport : Shared.Models.Methods.IMapLogicSupport
|
||||
List<SortingContainer> results = new();
|
||||
SortingContainer sortingContainer;
|
||||
Sorting[] collection = Shared.Models.Stateless.Methods.ISorting.Sort(sortingCollection);
|
||||
double a;
|
||||
double b;
|
||||
double c;
|
||||
double d;
|
||||
double faceDistancePermyriad;
|
||||
double sortingDaysDeltaTolerance;
|
||||
double faceDistanceMinimumConfidence;
|
||||
double faceDistanceAreaPermilleTolerance;
|
||||
if (useFiltersCounter is null)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence;
|
||||
a = 1f;
|
||||
b = 1f;
|
||||
c = 1f;
|
||||
d = 1f;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 1)
|
||||
else if (useFiltersCounter.Value < 5)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * 1.5;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence;
|
||||
a = 1.25f;
|
||||
b = 0.8f;
|
||||
c = a;
|
||||
d = b;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 2)
|
||||
else if (useFiltersCounter.Value < 9)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * 1.5;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence;
|
||||
a = 1.5f;
|
||||
b = 0.667f;
|
||||
c = a;
|
||||
d = b;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 3)
|
||||
else if (useFiltersCounter.Value < 13)
|
||||
{
|
||||
a = 1.75f;
|
||||
b = 0.571f;
|
||||
c = a;
|
||||
d = b;
|
||||
}
|
||||
else
|
||||
{
|
||||
a = 2f;
|
||||
b = 0.5f;
|
||||
c = a;
|
||||
d = b;
|
||||
}
|
||||
if (useFiltersCounter is null)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * .5;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 4)
|
||||
else if (useFiltersCounter.Value is 1 or 5 or 9 or 13)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * 2;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * 1.5;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * .5;
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * a;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * c;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * d;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance * d;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 5)
|
||||
else if (useFiltersCounter.Value is 2 or 6 or 10 or 14)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * 1.5;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * 2;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * .5;
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * c;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * a;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * d;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance * d;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 6)
|
||||
else if (useFiltersCounter.Value is 3 or 7 or 11 or 15)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * 1.5;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * 1.5;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * .25;
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * c;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * c;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * b;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance * d;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 7)
|
||||
else if (useFiltersCounter.Value is 4 or 8 or 12 or 16)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * 2.5;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * 2;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * .25;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 8)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * 2;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * 2.5;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * .25;
|
||||
}
|
||||
else if (useFiltersCounter.Value == 9)
|
||||
{
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * 2;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * 2;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance;
|
||||
faceDistanceMinimumConfidence = 0;
|
||||
sortingDaysDeltaTolerance = _SortingDaysDeltaTolerance * c;
|
||||
faceDistancePermyriad = _FaceDistancePermyriad * c;
|
||||
faceDistanceMinimumConfidence = _FaceDistanceMinimumConfidence * d;
|
||||
faceDistanceAreaPermilleTolerance = _FaceDistanceAreaPermilleTolerance * b;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -297,4 +301,20 @@ public class MapLogicSupport : Shared.Models.Methods.IMapLogicSupport
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<int, Dictionary<int, Mapping>> GetIdToNormalizedPixelPercentageToFace(Mapping[] mappingCollection)
|
||||
{
|
||||
Dictionary<int, Dictionary<int, Mapping>> results = new();
|
||||
Dictionary<int, Mapping> keyValuePairs;
|
||||
foreach (Mapping mapping in mappingCollection)
|
||||
{
|
||||
if (!results.ContainsKey(mapping.MappingFromItem.Id))
|
||||
results.Add(mapping.MappingFromItem.Id, new());
|
||||
keyValuePairs = results[mapping.MappingFromItem.Id];
|
||||
if (keyValuePairs.ContainsKey(mapping.MappingFromLocation.NormalizedPixelPercentage))
|
||||
throw new NotSupportedException();
|
||||
keyValuePairs.Add(mapping.MappingFromLocation.NormalizedPixelPercentage, mapping);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using View_by_Distance.Distance.Models.Stateless;
|
||||
using View_by_Distance.FaceRecognitionDotNet;
|
||||
using View_by_Distance.Shared.Models;
|
||||
|
||||
@ -10,6 +11,7 @@ public partial class E_Distance
|
||||
private readonly List<string> _Moved;
|
||||
private readonly List<double?> _Debug;
|
||||
private readonly List<string> _Renamed;
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly bool _DistanceRenameToMatch;
|
||||
private readonly double _FaceDistanceTolerance;
|
||||
private readonly bool _DistanceMoveUnableToMatch;
|
||||
@ -26,6 +28,7 @@ public partial class E_Distance
|
||||
_AllMappedFaceFiles = new();
|
||||
_AllMappedFaceFileNames = new();
|
||||
_DuplicateMappedFaceFiles = new();
|
||||
_Log = Serilog.Log.ForContext<E_Distance>();
|
||||
_DistanceRenameToMatch = distanceRenameToMatch;
|
||||
_FaceDistanceTolerance = faceDistanceTolerance;
|
||||
_DistanceMoveUnableToMatch = distanceMoveUnableToMatch;
|
||||
@ -438,8 +441,14 @@ public partial class E_Distance
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
double?[] debug = (from l in _Debug where l is null or not 0 select l).ToArray();
|
||||
string debugMessage = $"{_Debug.Count - debug.Length} - {debug.Min()} - {_Debug.Max()}";
|
||||
if (debug.Any())
|
||||
{
|
||||
string debugMessage = $"{_Debug.Count - debug.Length} - {debug.Min()} - {_Debug.Max()}";
|
||||
_Log.Info(debugMessage);
|
||||
}
|
||||
if (_Moved.Any() || _Renamed.Any() || _DuplicateMappedFaceFiles.Any())
|
||||
throw new NotImplementedException("Restart!");
|
||||
_Debug.Clear();
|
||||
|
Reference in New Issue
Block a user