After testing E_Distance.SaveGroupedFaceEncodings
This commit is contained in:
@ -41,7 +41,7 @@ public class DlibDotNet
|
||||
Person[] people;
|
||||
_AppSettings = appSettings;
|
||||
if (appSettings.MaxDegreeOfParallelism is null)
|
||||
throw new Exception($"{nameof(appSettings.MaxDegreeOfParallelism)} is null!");
|
||||
throw new ArgumentNullException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||
_IsEnvironment = isEnvironment;
|
||||
_Exceptions = new List<string>();
|
||||
_Log = Serilog.Log.ForContext<DlibDotNet>();
|
||||
@ -61,21 +61,21 @@ public class DlibDotNet
|
||||
_Distance = new E_Distance(configuration);
|
||||
_FaceLandmarks = new D2_FaceLandmarks(configuration);
|
||||
if (configuration.ForceMetadataLastWriteTimeToCreationTime is null)
|
||||
throw new Exception($"{nameof(configuration.ForceMetadataLastWriteTimeToCreationTime)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.ForceMetadataLastWriteTimeToCreationTime));
|
||||
if (configuration.ForceResizeLastWriteTimeToCreationTime is null)
|
||||
throw new Exception($"{nameof(configuration.ForceResizeLastWriteTimeToCreationTime)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.ForceResizeLastWriteTimeToCreationTime));
|
||||
if (configuration.IgnoreExtensions is null)
|
||||
throw new Exception($"{nameof(configuration.IgnoreExtensions)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.IgnoreExtensions));
|
||||
if (configuration.OutputQuality is null)
|
||||
throw new Exception($"{nameof(configuration.OutputQuality)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.OutputQuality));
|
||||
if (configuration.OverrideForResizeImages is null)
|
||||
throw new Exception($"{nameof(configuration.OverrideForResizeImages)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.OverrideForResizeImages));
|
||||
if (configuration.PropertiesChangedForMetadata is null)
|
||||
throw new Exception($"{nameof(configuration.PropertiesChangedForMetadata)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.PropertiesChangedForMetadata));
|
||||
if (configuration.PropertiesChangedForResize is null)
|
||||
throw new Exception($"{nameof(configuration.PropertiesChangedForResize)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.PropertiesChangedForResize));
|
||||
if (configuration.Reverse is null)
|
||||
throw new Exception($"{nameof(configuration.Reverse)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.Reverse));
|
||||
_Metadata = new(configuration.ForceMetadataLastWriteTimeToCreationTime.Value, configuration.PropertiesChangedForMetadata.Value);
|
||||
if (args.Count > 0)
|
||||
argZero = Path.GetFullPath(args[0]);
|
||||
@ -88,7 +88,7 @@ public class DlibDotNet
|
||||
(Model model, PredictorModel predictorModel, ModelParameter modelParameter) = GetModel(configuration);
|
||||
_Faces = new D_Face(configuration, argZero, model, modelParameter, predictorModel);
|
||||
if (configuration.SkipSearch is null)
|
||||
throw new Exception($"{nameof(configuration.SkipSearch)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.SkipSearch));
|
||||
if (!_ArgZeroIsConfigurationRootDirectory)
|
||||
people = Array.Empty<Person>();
|
||||
else
|
||||
@ -134,7 +134,7 @@ public class DlibDotNet
|
||||
{
|
||||
long result;
|
||||
if (_Log is null)
|
||||
throw new Exception($"{nameof(_Log)} is null!");
|
||||
throw new ArgumentNullException(nameof(_Log));
|
||||
double delta = new TimeSpan(DateTime.Now.Ticks - ticks).TotalMilliseconds;
|
||||
_Log.Debug($"{methodName} took {Math.Floor(delta)} millisecond(s)");
|
||||
result = DateTime.Now.Ticks;
|
||||
@ -188,7 +188,7 @@ public class DlibDotNet
|
||||
private void Verify(Models.Configuration configuration)
|
||||
{
|
||||
if (!configuration.OutputResolutions.Any() || string.IsNullOrEmpty(configuration.OutputResolutions[0]) || !configuration.ValidResolutions.Contains(configuration.OutputResolutions[0]))
|
||||
throw new Exception($"{nameof(configuration.OutputResolutions)} must be a valid outputResolution!");
|
||||
throw new ArgumentNullException(nameof(configuration.OutputResolutions), "must be a valid outputResolution!");
|
||||
if ((from l in configuration.OutputResolutions where !configuration.ValidResolutions.Contains(l) select false).Any())
|
||||
throw new Exception($"One or more {nameof(configuration.OutputResolutions)} are not in the ValidResolutions list!");
|
||||
if ((from l in configuration.LoadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions where !configuration.ValidResolutions.Contains(l) select false).Any())
|
||||
@ -202,79 +202,81 @@ public class DlibDotNet
|
||||
if ((from l in configuration.SaveFaceLandmarkForOutputResolutions where !configuration.ValidResolutions.Contains(l) select false).Any())
|
||||
throw new Exception($"One or more {nameof(configuration.SaveFaceLandmarkForOutputResolutions)} are not in the ValidResolutions list!");
|
||||
if (configuration.CheckJsonForDistanceResults is null)
|
||||
throw new Exception($"{nameof(configuration.CheckJsonForDistanceResults)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.CheckJsonForDistanceResults));
|
||||
if (configuration.CrossDirectoryMaxItemsInDistanceCollection is null)
|
||||
throw new Exception($"{nameof(configuration.CrossDirectoryMaxItemsInDistanceCollection)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.CrossDirectoryMaxItemsInDistanceCollection));
|
||||
if (configuration.DistanceFactor is null)
|
||||
throw new Exception($"{nameof(configuration.DistanceFactor)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.DistanceFactor));
|
||||
if (configuration.ForceMetadataLastWriteTimeToCreationTime is null)
|
||||
throw new Exception($"{nameof(configuration.ForceMetadataLastWriteTimeToCreationTime)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.ForceMetadataLastWriteTimeToCreationTime));
|
||||
if (configuration.ForceResizeLastWriteTimeToCreationTime is null)
|
||||
throw new Exception($"{nameof(configuration.ForceResizeLastWriteTimeToCreationTime)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.ForceResizeLastWriteTimeToCreationTime));
|
||||
if (configuration.IgnoreExtensions is null)
|
||||
throw new Exception($"{nameof(configuration.IgnoreExtensions)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.IgnoreExtensions));
|
||||
if (configuration.IgnoreRelativePaths is null)
|
||||
throw new Exception($"{nameof(configuration.IgnoreRelativePaths)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.IgnoreRelativePaths));
|
||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||
throw new Exception($"{nameof(configuration.LoadOrCreateThenSaveIndex)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||
if (configuration.LocationConfidenceFactor is null)
|
||||
throw new Exception($"{nameof(configuration.LocationConfidenceFactor)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.LocationConfidenceFactor));
|
||||
if (configuration.MappedMaxIndex is null)
|
||||
throw new Exception($"{nameof(configuration.MappedMaxIndex)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.MappedMaxIndex));
|
||||
if (configuration.MappedMaxIndex.HasValue && configuration.LoadOrCreateThenSaveIndex.Value && !_IsEnvironment.DebuggerWasAttachedDuringConstructor)
|
||||
throw new Exception($"{nameof(configuration.MappedMaxIndex)} only allowed when debugger is attached!");
|
||||
throw new ArgumentNullException(nameof(configuration.MappedMaxIndex));
|
||||
if (configuration.MaxItemsInDistanceCollection is null)
|
||||
throw new Exception($"{nameof(configuration.MaxItemsInDistanceCollection)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.MaxItemsInDistanceCollection));
|
||||
if (configuration.MixedYearRelativePaths is null)
|
||||
throw new Exception($"{nameof(configuration.MixedYearRelativePaths)} must be set!");
|
||||
if (configuration.NumJitters is null)
|
||||
throw new Exception($"{nameof(configuration.NumJitters)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.MixedYearRelativePaths));
|
||||
if (configuration.NumberOfJitters is null)
|
||||
throw new ArgumentNullException(nameof(configuration.NumberOfJitters));
|
||||
if (configuration.NumberOfTimesToUpsample is null)
|
||||
throw new ArgumentNullException(nameof(configuration.NumberOfTimesToUpsample));
|
||||
if (configuration.OutputQuality is null)
|
||||
throw new Exception($"{nameof(configuration.OutputQuality)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.OutputQuality));
|
||||
if (configuration.OutputResolutions is null)
|
||||
throw new Exception($"{nameof(configuration.OutputResolutions)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.OutputResolutions));
|
||||
if (configuration.OverrideForFaceImages is null)
|
||||
throw new Exception($"{nameof(configuration.OverrideForFaceImages)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.OverrideForFaceImages));
|
||||
if (configuration.OverrideForFaceLandmarkImages is null)
|
||||
throw new Exception($"{nameof(configuration.OverrideForFaceLandmarkImages)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.OverrideForFaceLandmarkImages));
|
||||
if (configuration.OverrideForResizeImages is null)
|
||||
throw new Exception($"{nameof(configuration.OverrideForResizeImages)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.OverrideForResizeImages));
|
||||
if (configuration.PaddingLoops is null)
|
||||
throw new Exception($"{nameof(configuration.PaddingLoops)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.PaddingLoops));
|
||||
if (configuration.PropertiesChangedForDistance is null)
|
||||
throw new Exception($"{nameof(configuration.PropertiesChangedForDistance)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.PropertiesChangedForDistance));
|
||||
if (configuration.PropertiesChangedForFaces is null)
|
||||
throw new Exception($"{nameof(configuration.PropertiesChangedForFaces)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.PropertiesChangedForFaces));
|
||||
if (configuration.PropertiesChangedForIndex is null)
|
||||
throw new Exception($"{nameof(configuration.PropertiesChangedForIndex)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.PropertiesChangedForIndex));
|
||||
if (configuration.PropertiesChangedForMetadata is null)
|
||||
throw new Exception($"{nameof(configuration.PropertiesChangedForMetadata)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.PropertiesChangedForMetadata));
|
||||
if (configuration.PropertiesChangedForResize is null)
|
||||
throw new Exception($"{nameof(configuration.PropertiesChangedForResize)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.PropertiesChangedForResize));
|
||||
if (configuration.Reverse is null)
|
||||
throw new Exception($"{nameof(configuration.Reverse)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.Reverse));
|
||||
if (configuration.SaveFaceLandmarkForOutputResolutions is null)
|
||||
throw new Exception($"{nameof(configuration.SaveFaceLandmarkForOutputResolutions)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.SaveFaceLandmarkForOutputResolutions));
|
||||
if (configuration.SaveFullYearOfRandomFiles is null)
|
||||
throw new Exception($"{nameof(configuration.SaveFullYearOfRandomFiles)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.SaveFullYearOfRandomFiles));
|
||||
if (configuration.SaveResizedSubfiles is null)
|
||||
throw new Exception($"{nameof(configuration.SaveResizedSubfiles)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.SaveResizedSubfiles));
|
||||
if (configuration.SkipSearch is null)
|
||||
throw new Exception($"{nameof(configuration.SkipSearch)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.SkipSearch));
|
||||
if (configuration.TestDistanceResults is null)
|
||||
throw new Exception($"{nameof(configuration.TestDistanceResults)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.TestDistanceResults));
|
||||
if (configuration.ValidResolutions is null)
|
||||
throw new Exception($"{nameof(configuration.ValidResolutions)} must be set!");
|
||||
throw new ArgumentNullException(nameof(configuration.ValidResolutions));
|
||||
if (string.IsNullOrEmpty(configuration.ModelDirectory) || !Directory.Exists(configuration.ModelDirectory))
|
||||
throw new Exception($"{nameof(configuration.ModelDirectory)} must have a value and exits!");
|
||||
throw new ArgumentNullException(nameof(configuration.ModelDirectory));
|
||||
if (string.IsNullOrEmpty(configuration.ModelName))
|
||||
throw new Exception($"{nameof(configuration.ModelName)} must have a value!");
|
||||
throw new ArgumentNullException(nameof(configuration.ModelName));
|
||||
if (string.IsNullOrEmpty(configuration.OutputExtension))
|
||||
throw new Exception($"{nameof(configuration.OutputExtension)} must have a value!");
|
||||
throw new ArgumentNullException(nameof(configuration.OutputExtension));
|
||||
if (string.IsNullOrEmpty(configuration.PredictorModelName))
|
||||
throw new Exception($"{nameof(configuration.PredictorModelName)} must have a value!");
|
||||
throw new ArgumentNullException(nameof(configuration.PredictorModelName));
|
||||
if (configuration.DistanceFactor.Value + configuration.LocationConfidenceFactor.Value != 10)
|
||||
throw new Exception($"{nameof(configuration.DistanceFactor)} and {nameof(configuration.LocationConfidenceFactor)} must add up to 10!");
|
||||
throw new ArgumentNullException(nameof(configuration.DistanceFactor));
|
||||
}
|
||||
|
||||
private void VerifyExtra(List<string> args, Property.Models.Configuration propertyConfiguration, Models.Configuration configuration)
|
||||
@ -306,15 +308,15 @@ public class DlibDotNet
|
||||
private void FullParallelForWork(PropertyLogic propertyLogic, object @lock, string outputResolution, List<Tuple<string, DateTime>> sourceDirectoryChanges, List<FileInfo?> propertyFileInfoCollection, List<A_Property> propertyCollection, List<List<KeyValuePair<string, string>>> metadataCollections, List<Dictionary<string, int[]>> resizeKeyValuePairs, List<List<D_Face>> imageFaceCollections, string sourceDirectory, int index, PropertyHolder propertyHolder)
|
||||
{
|
||||
if (propertyHolder.ImageFileInfo is null)
|
||||
throw new Exception($"{nameof(propertyHolder.ImageFileInfo)} is null!");
|
||||
throw new ArgumentNullException(nameof(propertyHolder.ImageFileInfo));
|
||||
if (_AppSettings.MaxDegreeOfParallelism is null)
|
||||
throw new Exception($"{nameof(_AppSettings.MaxDegreeOfParallelism)} is null!");
|
||||
throw new ArgumentNullException(nameof(_AppSettings.MaxDegreeOfParallelism));
|
||||
if (_Configuration.SaveResizedSubfiles is null)
|
||||
throw new Exception($"{nameof(_Configuration.SaveResizedSubfiles)} is null!");
|
||||
throw new ArgumentNullException(nameof(_Configuration.SaveResizedSubfiles));
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
|
||||
if (_Configuration.PropertyConfiguration.WriteBitmapDataBytes is null)
|
||||
throw new Exception($"{nameof(_Configuration.PropertyConfiguration.WriteBitmapDataBytes)} is null!");
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration.WriteBitmapDataBytes));
|
||||
A_Property property;
|
||||
List<D_Face> faceCollection;
|
||||
string original = "Original";
|
||||
@ -395,9 +397,9 @@ public class DlibDotNet
|
||||
{
|
||||
int result = 0;
|
||||
if (_Log is null)
|
||||
throw new Exception($"{nameof(_Log)} is null!");
|
||||
throw new ArgumentNullException(nameof(_Log));
|
||||
if (_AppSettings.MaxDegreeOfParallelism is null)
|
||||
throw new Exception($"{nameof(AppSettings.MaxDegreeOfParallelism)} is null!");
|
||||
throw new ArgumentNullException(nameof(AppSettings.MaxDegreeOfParallelism));
|
||||
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = _AppSettings.MaxDegreeOfParallelism.Value };
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
if (faceCollections.Count != filteredPropertyHolderCollection.Length || metadataCollection.Count != filteredPropertyHolderCollection.Length || resizeKeyValuePairs.Count != filteredPropertyHolderCollection.Length || propertyCollection.Count != filteredPropertyHolderCollection.Length)
|
||||
@ -460,7 +462,7 @@ public class DlibDotNet
|
||||
if (metadataIdLines.Any())
|
||||
{
|
||||
text = string.Join(Environment.NewLine, from l in metadataIdLines orderby l.Id select l.Line);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(fileInfo.FullName, text, compareBeforeWrite: true);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(fileInfo.FullName, text, updateDateWhenMatches: true, compareBeforeWrite: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -472,19 +474,18 @@ public class DlibDotNet
|
||||
private void WriteGroup(Property.Models.Configuration configuration, PropertyLogic propertyLogic, List<A_Property> propertyCollection, List<List<KeyValuePair<string, string>>> metadataCollection, List<List<D_Face>> faceCollections, List<Dictionary<string, int[]>> resizeKeyValuePairs, string sourceDirectory, string outputResolution, PropertyHolder[] filteredPropertyHolderCollection)
|
||||
{
|
||||
if (_Configuration.PropertiesChangedForMetadata is null)
|
||||
throw new Exception($"{nameof(_Configuration.PropertiesChangedForMetadata)} is null!");
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertiesChangedForMetadata));
|
||||
if (configuration.PropertiesChangedForProperty is null)
|
||||
throw new Exception($"{nameof(configuration.PropertiesChangedForProperty)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.PropertiesChangedForProperty));
|
||||
if (_Configuration.PropertiesChangedForResize is null)
|
||||
throw new Exception($"{nameof(_Configuration.PropertiesChangedForResize)} is null!");
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertiesChangedForResize));
|
||||
if (_Configuration.PropertiesChangedForFaces is null)
|
||||
throw new Exception($"{nameof(_Configuration.PropertiesChangedForFaces)} is null!");
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertiesChangedForFaces));
|
||||
string key;
|
||||
string json;
|
||||
string checkFile;
|
||||
PropertyHolder propertyHolder;
|
||||
int sourceDirectoryLength = sourceDirectory.Length;
|
||||
int rootDirectoryLength = configuration.RootDirectory.Length;
|
||||
_FilePropertiesKeyValuePairs.Add(sourceDirectory, new List<Tuple<string, A_Property>>());
|
||||
JsonSerializerOptions writeIndentedJsonSerializerOptions = new() { WriteIndented = false };
|
||||
if (!(from l in propertyCollection where l?.Width is null select true).Any())
|
||||
@ -511,16 +512,6 @@ public class DlibDotNet
|
||||
resizeKeyValuePairsCollections.Add(new KeyValuePair<string, Dictionary<string, int[]>>(key, resizeKeyValuePairs[i]));
|
||||
metadataCollectionKeyValuePairs.Add(new KeyValuePair<string, List<KeyValuePair<string, string>>>(key, metadataCollection[i]));
|
||||
}
|
||||
if (_Metadata.AngleBracketCollection.Any())
|
||||
{
|
||||
checkDirectory = Property.Models.Stateless.IPath.GetDirectory(_Metadata.AngleBracketCollection[0], level, "[{}]");
|
||||
checkFile = Path.Combine(checkDirectory, fileName);
|
||||
if (File.Exists(checkFile))
|
||||
File.Move(checkFile, Path.Combine(checkDirectory, fileName));
|
||||
checkFile = Path.Combine(checkDirectory, fileName);
|
||||
json = JsonSerializer.Serialize(metadataCollectionKeyValuePairs, writeIndentedJsonSerializerOptions);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(checkFile, json, compareBeforeWrite: true);
|
||||
}
|
||||
if (propertyLogic.AngleBracketCollection.Any())
|
||||
{
|
||||
checkDirectory = Property.Models.Stateless.IPath.GetDirectory(propertyLogic.AngleBracketCollection[0], level, "[{}]");
|
||||
@ -529,7 +520,17 @@ public class DlibDotNet
|
||||
File.Move(checkFile, Path.Combine(checkDirectory, fileName));
|
||||
checkFile = Path.Combine(checkDirectory, fileName);
|
||||
json = JsonSerializer.Serialize(propertyCollectionKeyValuePairs, writeIndentedJsonSerializerOptions);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(checkFile, json, compareBeforeWrite: true);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(checkFile, json, updateDateWhenMatches: false, compareBeforeWrite: true);
|
||||
}
|
||||
if (_Metadata.AngleBracketCollection.Any())
|
||||
{
|
||||
checkDirectory = Property.Models.Stateless.IPath.GetDirectory(_Metadata.AngleBracketCollection[0], level, "[{}]");
|
||||
checkFile = Path.Combine(checkDirectory, fileName);
|
||||
if (File.Exists(checkFile))
|
||||
File.Move(checkFile, Path.Combine(checkDirectory, fileName));
|
||||
checkFile = Path.Combine(checkDirectory, fileName);
|
||||
json = JsonSerializer.Serialize(metadataCollectionKeyValuePairs, writeIndentedJsonSerializerOptions);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(checkFile, json, updateDateWhenMatches: false, compareBeforeWrite: true);
|
||||
}
|
||||
if (_Resize.AngleBracketCollection.Any())
|
||||
{
|
||||
@ -539,7 +540,7 @@ public class DlibDotNet
|
||||
File.Move(checkFile, Path.Combine(checkDirectory, fileName));
|
||||
checkFile = Path.Combine(checkDirectory, fileName);
|
||||
json = JsonSerializer.Serialize(resizeKeyValuePairsCollections, writeIndentedJsonSerializerOptions);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(checkFile, json, compareBeforeWrite: true);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(checkFile, json, updateDateWhenMatches: false, compareBeforeWrite: true);
|
||||
}
|
||||
if (_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution) && _Faces.AngleBracketCollection.Any())
|
||||
{
|
||||
@ -549,7 +550,7 @@ public class DlibDotNet
|
||||
File.Move(checkFile, Path.Combine(checkDirectory, fileName));
|
||||
checkFile = Path.Combine(checkDirectory, fileName);
|
||||
json = JsonSerializer.Serialize(faceCollectionsKeyValuePairs, writeIndentedJsonSerializerOptions);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(checkFile, json, compareBeforeWrite: true);
|
||||
_ = Property.Models.Stateless.IPath.WriteAllText(checkFile, json, updateDateWhenMatches: false, compareBeforeWrite: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -557,9 +558,9 @@ public class DlibDotNet
|
||||
private void FullDoWork(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string argZero, Dictionary<string, List<Person>> peopleCollection, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new Exception($"{nameof(_Log)} is null!");
|
||||
throw new ArgumentNullException(nameof(_Log));
|
||||
if (_AppSettings.MaxDegreeOfParallelism is null)
|
||||
throw new Exception($"{nameof(_AppSettings.MaxDegreeOfParallelism)} is null!");
|
||||
throw new ArgumentNullException(nameof(_AppSettings.MaxDegreeOfParallelism));
|
||||
int g;
|
||||
int r;
|
||||
int exceptionCount;
|
||||
@ -677,11 +678,11 @@ public class DlibDotNet
|
||||
{
|
||||
if (outputResolution == _Configuration.OutputResolutions[0] || _Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
||||
{
|
||||
PropertyHolder.AddToNamed(propertyLogic, filteredPropertyHolderCollection);
|
||||
for (int i = 0; i < faceCollections.Count; i++)
|
||||
PropertyHolder.AddToFaces(filteredPropertyHolderCollection, (from l in faceCollections[i] select (object)l).ToArray());
|
||||
filteredPropertyHolderCollection[i].Faces.AddRange(from l in faceCollections[i] select l);
|
||||
PropertyHolder.AddToNamed(propertyLogic, filteredPropertyHolderCollection);
|
||||
if (_Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
||||
D_Face.SaveShortcuts(configuration, model, predictorModel, _Configuration.JuliePhares, peopleCollection, propertyLogic, outputResolution, filteredPropertyHolderCollection, faceCollections);
|
||||
D_Face.SaveShortcuts(configuration, model, predictorModel, _Configuration.JuliePhares, ticks, peopleCollection, propertyLogic, outputResolution, filteredPropertyHolderCollection);
|
||||
}
|
||||
}
|
||||
if (exceptionCount == 0 && _Configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions.Contains(outputResolution))
|
||||
@ -707,7 +708,7 @@ public class DlibDotNet
|
||||
{
|
||||
propertyLogic.SaveAllCollection();
|
||||
if (propertyLogic.NamedFaceInfoDeterministicHashCodeIndices.Any())
|
||||
E_Distance.SaveGroupedFaceEncodings(configuration, model, predictorModel, argZero, peopleCollection, outputResolution, propertyHolderCollections);
|
||||
E_Distance.SaveGroupedFaceEncodings(configuration, model, predictorModel, argZero, ticks, peopleCollection, outputResolution, propertyHolderCollections);
|
||||
if (!_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Any())
|
||||
break;
|
||||
if (_Exceptions.Count == 0)
|
||||
@ -731,9 +732,9 @@ public class DlibDotNet
|
||||
{
|
||||
PropertyLogic result;
|
||||
if (_AppSettings.MaxDegreeOfParallelism is null)
|
||||
throw new Exception($"{nameof(_AppSettings.MaxDegreeOfParallelism)} is null!");
|
||||
throw new ArgumentNullException(nameof(_AppSettings.MaxDegreeOfParallelism));
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration);
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user