Model changes for Unit Test Face

This commit is contained in:
2022-08-01 20:06:07 -07:00
parent 022d9904da
commit 62bdc17f7a
20 changed files with 194 additions and 158 deletions

View File

@ -43,7 +43,7 @@ public class Configuration
protected readonly string[] _SaveFaceLandmarkForOutputResolutions;
protected readonly bool? _SaveFullYearOfRandomFiles;
protected readonly bool? _SaveResizedSubfiles;
protected readonly string _SaveShortcutsForOutputResolutions;
protected readonly string[] _SaveShortcutsForOutputResolutions;
protected readonly bool? _SkipSearch;
protected readonly bool? _TestDistanceResults;
protected readonly string[] _ValidResolutions;
@ -84,13 +84,13 @@ public class Configuration
public string[] SaveFaceLandmarkForOutputResolutions => _SaveFaceLandmarkForOutputResolutions;
public bool? SaveFullYearOfRandomFiles => _SaveFullYearOfRandomFiles;
public bool? SaveResizedSubfiles => _SaveResizedSubfiles;
public string SaveShortcutsForOutputResolutions => _SaveShortcutsForOutputResolutions;
public string[] SaveShortcutsForOutputResolutions => _SaveShortcutsForOutputResolutions;
public bool? SkipSearch => _SkipSearch;
public bool? TestDistanceResults => _TestDistanceResults;
public string[] ValidResolutions => _ValidResolutions;
[JsonConstructor]
public Configuration(bool? checkJsonForDistanceResults, int? crossDirectoryMaxItemsInDistanceCollection, int? distanceFactor, 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? numJitters, 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, Property.Models.Configuration? propertyConfiguration, bool? reverse, string[] saveFaceLandmarkForOutputResolutions, bool? saveFullYearOfRandomFiles, bool? saveResizedSubfiles, string saveShortcutsForOutputResolutions, bool? skipSearch, bool? testDistanceResults, string[] validResolutions)
public Configuration(bool? checkJsonForDistanceResults, int? crossDirectoryMaxItemsInDistanceCollection, int? distanceFactor, 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? numJitters, 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, Property.Models.Configuration? propertyConfiguration, bool? reverse, string[] saveFaceLandmarkForOutputResolutions, bool? saveFullYearOfRandomFiles, bool? saveResizedSubfiles, string[] saveShortcutsForOutputResolutions, bool? skipSearch, bool? testDistanceResults, string[] validResolutions)
{
_CheckJsonForDistanceResults = checkJsonForDistanceResults;
_CrossDirectoryMaxItemsInDistanceCollection = crossDirectoryMaxItemsInDistanceCollection;

View File

@ -104,14 +104,14 @@ public class UnitTestResize
throw new Exception($"{nameof(_Configuration.PropertiesChangedForResize)} is null!");
int g = 1;
int r = 1;
Model model = Model.Hog;
Model? model = null;
string original = "Original";
List<string> parseExceptions = new();
Property.Models.A_Property? property = null;
Property.Models.PropertyHolder propertyHolder;
Dictionary<string, int[]> imageResizeKeyValuePairs;
List<Tuple<string, DateTime>> subFileTuples = new();
PredictorModel predictorModel = PredictorModel.Large;
PredictorModel? predictorModel = null;
List<KeyValuePair<string, string>> metadataCollection;
int length = _PropertyConfiguration.RootDirectory.Length;
string outputResolution = _Configuration.OutputResolutions[0];
@ -162,14 +162,14 @@ public class UnitTestResize
string relativePath = Property.Models.Stateless.IPath.GetRelativePath(fileInfo.FullName, length);
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
propertyHolder = new(g, sourceDirectory, sourceDirectoryFile, relativePath, r, fileInfo, property, false, false, null, null, null);
if (propertyHolder.ImageFileInfo is null)
throw new Exception($"{nameof(propertyHolder.ImageFileInfo)} is null!");
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(propertyHolder.ImageFileInfo.FullName);
Assert.IsNotNull(propertyHolder.ImageFileInfo);
property = propertyLogic.GetProperty(propertyLogic.AngleBracketCollection[0], propertyHolder, subFileTuples, parseExceptions);
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, propertyHolder.ImageFileInfo.FullName, propertyHolder.RelativePath, fileNameWithoutExtension);
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(subFileTuples, parseExceptions, original, metadataCollection, property, propertyHolder.ImageFileInfo.FullName, propertyHolder.RelativePath, fileNameWithoutExtension);
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, propertyHolder);
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(subFileTuples, parseExceptions, original, metadataCollection, property, propertyHolder);
FileInfo resizedFileInfo = new(Path.Combine(resize.AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(propertyHolder.ImageFileInfo.FullName)));
resize.SaveResizedSubfile(outputResolution, subFileTuples, propertyHolder.ImageFileInfo.FullName, original, property, imageResizeKeyValuePairs, resizedFileInfo);
propertyHolder.SetResizedFileInfo(resizedFileInfo);
resize.SaveResizedSubfile(outputResolution, subFileTuples, propertyHolder, original, property, imageResizeKeyValuePairs);
resizedFileInfo.Refresh();
}
}