Re-Write without checking mapped

This commit is contained in:
2022-09-14 19:00:57 -07:00
parent 73de1070b8
commit ad28ab2d38
70 changed files with 1596 additions and 2342 deletions

View File

@ -19,7 +19,6 @@ public class Configuration
[Display(Name = "Ignore Extensions"), Required] public string[] IgnoreExtensions { get; set; }
[Display(Name = "Ignore Relative Paths"), Required] public string[] IgnoreRelativePaths { get; set; }
[Display(Name = "Julie Phares Copy Birthdays"), Required] public string[] JuliePhares { get; set; }
[Display(Name = "Load Or Create Then Save Directory Distance Results"), Required] public string[] LoadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions { get; set; }
[Display(Name = "Load Or Create Then Save Distance Results"), Required] public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { get; set; }
[Display(Name = "Load Or Create Then Save Image Faces Results"), Required] public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { get; set; }
[Display(Name = "Load Or Create Then Save Index"), Required] public bool? LoadOrCreateThenSaveIndex { get; set; }
@ -129,8 +128,6 @@ public class Configuration
throw new NullReferenceException(nameof(configuration.TestDistanceResults));
if (configuration.ValidResolutions is null)
throw new NullReferenceException(nameof(configuration.ValidResolutions));
if (configuration.LoadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions is null)
configuration.LoadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions = Array.Empty<string>();
if (configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions is null)
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions = Array.Empty<string>();
if (configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions is null)
@ -149,7 +146,6 @@ public class Configuration
configuration.IgnoreExtensions,
configuration.IgnoreRelativePaths,
configuration.JuliePhares,
configuration.LoadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions,
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions,
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions,
configuration.LoadOrCreateThenSaveIndex.Value,

View File

@ -18,7 +18,6 @@ public class Configuration
public string[] IgnoreExtensions { init; get; }
public string[] IgnoreRelativePaths { init; get; }
public string[] JuliePhares { init; get; }
public string[] LoadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions { init; get; }
public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { init; get; }
public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { init; get; }
public bool LoadOrCreateThenSaveIndex { init; get; }
@ -53,7 +52,7 @@ public class Configuration
public string[] ValidResolutions { init; get; }
[JsonConstructor]
public Configuration(Property.Models.Configuration propertyConfiguration, bool checkJsonForDistanceResults, int crossDirectoryMaxItemsInDistanceCollection, int distanceFactor, bool forceFaceLastWriteTimeToCreationTime, bool forceMetadataLastWriteTimeToCreationTime, bool forceResizeLastWriteTimeToCreationTime, string[] ignoreExtensions, string[] ignoreRelativePaths, string[] juliePhares, string[] loadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions, string[] loadOrCreateThenSaveDistanceResultsForOutputResolutions, string[] loadOrCreateThenSaveImageFacesResultsForOutputResolutions, bool loadOrCreateThenSaveIndex, int locationConfidenceFactor, int? mappedMaxIndex, int maxItemsInDistanceCollection, string[] mixedYearRelativePaths, string modelDirectory, string modelName, int numberOfJitters, int numberOfTimesToUpsample, string outputExtension, int outputQuality, string[] outputResolutions, bool overrideForFaceImages, bool overrideForFaceLandmarkImages, bool overrideForResizeImages, int paddingLoops, string predictorModelName, bool propertiesChangedForDistance, bool propertiesChangedForFaces, bool propertiesChangedForIndex, bool propertiesChangedForMetadata, bool propertiesChangedForResize, bool reverse, string[] saveFaceLandmarkForOutputResolutions, bool saveFullYearOfRandomFiles, bool saveResizedSubfiles, string[] saveShortcutsForOutputResolutions, bool skipSearch, bool testDistanceResults, string[] validResolutions)
public Configuration(Property.Models.Configuration propertyConfiguration, bool checkJsonForDistanceResults, int crossDirectoryMaxItemsInDistanceCollection, int distanceFactor, bool forceFaceLastWriteTimeToCreationTime, bool forceMetadataLastWriteTimeToCreationTime, bool forceResizeLastWriteTimeToCreationTime, string[] ignoreExtensions, string[] ignoreRelativePaths, string[] juliePhares, string[] loadOrCreateThenSaveDistanceResultsForOutputResolutions, string[] loadOrCreateThenSaveImageFacesResultsForOutputResolutions, bool loadOrCreateThenSaveIndex, int locationConfidenceFactor, int? mappedMaxIndex, int maxItemsInDistanceCollection, string[] mixedYearRelativePaths, string modelDirectory, string modelName, int numberOfJitters, int numberOfTimesToUpsample, string outputExtension, int outputQuality, string[] outputResolutions, bool overrideForFaceImages, bool overrideForFaceLandmarkImages, bool overrideForResizeImages, int paddingLoops, string predictorModelName, bool propertiesChangedForDistance, bool propertiesChangedForFaces, bool propertiesChangedForIndex, bool propertiesChangedForMetadata, bool propertiesChangedForResize, bool reverse, string[] saveFaceLandmarkForOutputResolutions, bool saveFullYearOfRandomFiles, bool saveResizedSubfiles, string[] saveShortcutsForOutputResolutions, bool skipSearch, bool testDistanceResults, string[] validResolutions)
{
_PropertyConfiguration = propertyConfiguration;
CheckJsonForDistanceResults = checkJsonForDistanceResults;
@ -65,7 +64,6 @@ public class Configuration
IgnoreExtensions = ignoreExtensions;
IgnoreRelativePaths = ignoreRelativePaths;
JuliePhares = juliePhares;
LoadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions = loadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions;
LoadOrCreateThenSaveDistanceResultsForOutputResolutions = loadOrCreateThenSaveDistanceResultsForOutputResolutions;
LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = loadOrCreateThenSaveImageFacesResultsForOutputResolutions;
LoadOrCreateThenSaveIndex = loadOrCreateThenSaveIndex;

View File

@ -68,6 +68,9 @@ public class UnitTestCalculations
Assert.IsFalse(_PropertyConfiguration is null);
}
[TestMethod]
public void TestMethodGetSort() => Assert.IsTrue(new bool[] { true, false }.OrderByDescending(l => l).First());
[TestMethod]
public void TestMethodGetAge()
{
@ -77,4 +80,39 @@ public class UnitTestCalculations
Assert.IsTrue(age.Value > 42.6092);
}
[TestMethod]
public void TestMethodRound()
{
Assert.IsTrue(Shared.Models.Stateless.ILocation.Digits == 6);
Assert.IsTrue(Shared.Models.Stateless.ILocation.Factor == 1000000);
double valueA = 0.00001d;
int checkA = (int)(Math.Round(valueA, Shared.Models.Stateless.ILocation.Digits) * Shared.Models.Stateless.ILocation.Factor);
Assert.IsTrue(checkA == 10);
double valueB = 0.01d;
int checkB = (int)(Math.Round(valueB, Shared.Models.Stateless.ILocation.Digits) * Shared.Models.Stateless.ILocation.Factor);
Assert.IsTrue(checkB == 10000);
Assert.IsTrue(checkB > checkA);
}
[TestMethod]
public void TestMethodRoundB()
{
const int DistanceDigits = 3;
const int DistanceFactor = 1000;
const int ToleranceAfterFactor = 600;
Assert.IsTrue(DistanceDigits == 3);
Assert.IsTrue(DistanceFactor == 1000);
Assert.IsTrue(Shared.Models.Stateless.IFaceDistance.Tolerance == 0.6d);
Assert.IsTrue(ToleranceAfterFactor == 600);
double valueA = 0.00001d;
int checkA = (int)(Math.Round(valueA, Shared.Models.Stateless.ILocation.Digits) * Shared.Models.Stateless.ILocation.Factor);
Assert.IsTrue(checkA == 10);
double valueB = 0.01d;
int checkB = (int)(Math.Round(valueB, Shared.Models.Stateless.ILocation.Digits) * Shared.Models.Stateless.ILocation.Factor);
Assert.IsTrue(checkB == 10000);
Assert.IsTrue(checkB > checkA);
int checkC = (int)(Shared.Models.Stateless.IFaceDistance.Tolerance * DistanceFactor);
Assert.IsTrue(checkC == ToleranceAfterFactor);
}
}

View File

@ -100,7 +100,7 @@ public class UnitTestResize
bottom = 10;
width = 100;
height = 100;
normalizedPixelPercentage = Location.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 40500);
left = 50;
top = 50;
@ -108,7 +108,7 @@ public class UnitTestResize
bottom = 60;
width = 100;
height = 100;
normalizedPixelPercentage = Location.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 545500);
}
@ -123,7 +123,7 @@ public class UnitTestResize
bottom = 260;
width = 500;
height = 500;
normalizedPixelPercentage = Location.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 499000);
left = 490;
top = 490;
@ -131,7 +131,7 @@ public class UnitTestResize
bottom = 510;
width = 1000;
height = 1000;
normalizedPixelPercentage = Location.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 499500);
}
@ -146,7 +146,7 @@ public class UnitTestResize
bottom = 80;
width = 100;
height = 100;
normalizedPixelPercentage = Location.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 594000);
left = 20;
top = 40;
@ -154,7 +154,7 @@ public class UnitTestResize
bottom = 80;
width = 100;
height = 100;
normalizedPixelPercentage = Location.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 10);
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, right, top, width, 10);
Assert.IsTrue(normalizedPixelPercentage == 594000);
}