Range
This commit is contained in:
@ -23,7 +23,6 @@ public class Configuration
|
||||
[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; }
|
||||
[Display(Name = "Location Confidence Factor"), Required] public int? LocationConfidenceFactor { get; set; }
|
||||
[Display(Name = "Mapped Max Index"), Required] public int? MappedMaxIndex { get; set; }
|
||||
[Display(Name = "Mixed Year Relative Paths"), Required] public string[] MixedYearRelativePaths { get; set; }
|
||||
[Display(Name = "Model Directory"), Required] public string ModelDirectory { get; set; }
|
||||
@ -88,8 +87,6 @@ public class Configuration
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = Array.Empty<string>();
|
||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||
if (configuration.LocationConfidenceFactor is null)
|
||||
throw new NullReferenceException(nameof(configuration.LocationConfidenceFactor));
|
||||
if (configuration.MixedYearRelativePaths is null)
|
||||
throw new NullReferenceException(nameof(configuration.MixedYearRelativePaths));
|
||||
if (configuration.NumberOfJitters is null)
|
||||
@ -148,7 +145,6 @@ public class Configuration
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveIndex.Value,
|
||||
configuration.LocationConfidenceFactor.Value,
|
||||
configuration.MappedMaxIndex,
|
||||
configuration.MixedYearRelativePaths,
|
||||
configuration.ModelDirectory,
|
||||
|
@ -22,7 +22,6 @@ public class Configuration
|
||||
public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { init; get; }
|
||||
public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { init; get; }
|
||||
public bool LoadOrCreateThenSaveIndex { init; get; }
|
||||
public int LocationConfidenceFactor { init; get; }
|
||||
public int? MappedMaxIndex { init; get; }
|
||||
public string[] MixedYearRelativePaths { init; get; }
|
||||
public string ModelDirectory { init; get; }
|
||||
@ -66,7 +65,6 @@ public class Configuration
|
||||
string[] loadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
string[] loadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
bool loadOrCreateThenSaveIndex,
|
||||
int locationConfidenceFactor,
|
||||
int? mappedMaxIndex,
|
||||
string[] mixedYearRelativePaths,
|
||||
string modelDirectory,
|
||||
@ -109,7 +107,6 @@ public class Configuration
|
||||
LoadOrCreateThenSaveDistanceResultsForOutputResolutions = loadOrCreateThenSaveDistanceResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = loadOrCreateThenSaveImageFacesResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveIndex = loadOrCreateThenSaveIndex;
|
||||
LocationConfidenceFactor = locationConfidenceFactor;
|
||||
MappedMaxIndex = mappedMaxIndex;
|
||||
MixedYearRelativePaths = mixedYearRelativePaths;
|
||||
ModelDirectory = modelDirectory;
|
||||
|
@ -206,6 +206,7 @@ public class UnitTestCalculations
|
||||
[TestMethod]
|
||||
public void TestAreaPermille()
|
||||
{
|
||||
int faceAreaPermille=1000;
|
||||
Location location;
|
||||
double confidence = 0.1D;
|
||||
int areaPermille, left, top, right, bottom, width, height;
|
||||
@ -215,7 +216,7 @@ public class UnitTestCalculations
|
||||
bottom = 100;
|
||||
width = 100;
|
||||
height = 100;
|
||||
areaPermille = IMapping.GetAreaPermille(bottom, height, left, right, top, width);
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, bottom, height, left, right, top, width);
|
||||
Assert.IsTrue(areaPermille == 1000);
|
||||
left = 0;
|
||||
right = 50;
|
||||
@ -224,7 +225,7 @@ public class UnitTestCalculations
|
||||
width = 100;
|
||||
height = 100;
|
||||
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
areaPermille = IMapping.GetAreaPermille(height, location, width);
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, height, location, width);
|
||||
Assert.IsTrue(areaPermille == 250);
|
||||
left = 0;
|
||||
right = 25;
|
||||
@ -234,7 +235,7 @@ public class UnitTestCalculations
|
||||
height = 100;
|
||||
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
OutputResolution outputResolution = new(height, 0, width);
|
||||
areaPermille = IMapping.GetAreaPermille(location, outputResolution);
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, location, outputResolution);
|
||||
Assert.IsTrue(areaPermille == 62);
|
||||
}
|
||||
|
||||
@ -541,4 +542,29 @@ public class UnitTestCalculations
|
||||
Assert.IsNotNull(lines);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGetConfidencePercent()
|
||||
{
|
||||
int faceConfidencePercent = 100;
|
||||
double minimum, target, maximum, value, check;
|
||||
minimum = 0.8f;
|
||||
target = 0.8f;
|
||||
maximum = int.MaxValue;
|
||||
value = 0f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 0);
|
||||
target = 0.8f;
|
||||
value = 0.4f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 50);
|
||||
target = 0.8f;
|
||||
value = 0.8f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 100);
|
||||
target = 0.8f;
|
||||
value = 1.6f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 200);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user