Save Grouped Face Encodings
This commit is contained in:
@ -48,6 +48,7 @@ public class DlibDotNet
|
||||
_FileKeyValuePairs = new List<KeyValuePair<string, string>>();
|
||||
_FilePropertiesKeyValuePairs = new Dictionary<string, List<Tuple<string, A_Property>>>();
|
||||
Property.Models.Configuration propertyConfiguration = Property.Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory);
|
||||
_Log.Information(propertyConfiguration.RootDirectory);
|
||||
Property.Models.Configuration.Verify(propertyConfiguration);
|
||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||
Verify(configuration);
|
||||
@ -101,9 +102,10 @@ public class DlibDotNet
|
||||
{
|
||||
E2_Navigate e2Navigate = new(console, configuration, argZero);
|
||||
e2Navigate.Navigate(propertyConfiguration, model, predictorModel, configuration.OutputResolutions[0]);
|
||||
_Log.Information(propertyConfiguration.RootDirectory);
|
||||
}
|
||||
if (!configuration.SkipSearch.Value)
|
||||
Search(propertyConfiguration, configuration.JuliePhares, configuration.Reverse.Value, model, predictorModel, argZero, people);
|
||||
Search(propertyConfiguration, configuration.Reverse.Value, model, predictorModel, argZero, people);
|
||||
if (_Exceptions.Count == 0 && _ArgZeroIsConfigurationRootDirectory)
|
||||
{
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
@ -549,7 +551,7 @@ public class DlibDotNet
|
||||
}
|
||||
}
|
||||
|
||||
private void FullDoWork(Property.Models.Configuration configuration, string[] juliePhares, Model model, PredictorModel predictorModel, string argZero, Dictionary<string, List<Person>> peopleCollection, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections)
|
||||
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!");
|
||||
@ -561,12 +563,10 @@ public class DlibDotNet
|
||||
object @lock = new();
|
||||
string sourceDirectory;
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
string modelName = model.ToString();
|
||||
List<List<D_Face>> faceCollections = new();
|
||||
List<A_Property> propertyCollection = new();
|
||||
PropertyHolder[] filteredPropertyHolderCollection;
|
||||
List<FileInfo?> propertyFileInfoCollection = new();
|
||||
string predictorModelName = predictorModel.ToString();
|
||||
List<Dictionary<string, int[]>> resizeKeyValuePairs = new();
|
||||
List<Tuple<string, DateTime>> sourceDirectoryChanges = new();
|
||||
List<List<KeyValuePair<string, string>>> metadataCollection = new();
|
||||
@ -668,10 +668,29 @@ public class DlibDotNet
|
||||
_Exceptions.Add(sourceDirectory);
|
||||
if (_ArgZeroIsConfigurationRootDirectory && exceptionCount == 0)
|
||||
WriteGroup(configuration, propertyLogic, propertyCollection, metadataCollection, faceCollections, resizeKeyValuePairs, sourceDirectory, outputResolution, filteredPropertyHolderCollection);
|
||||
if (_ArgZeroIsConfigurationRootDirectory && outputResolution == _Configuration.OutputResolutions[0] && exceptionCount == 0)
|
||||
if (_ArgZeroIsConfigurationRootDirectory && exceptionCount == 0 && outputResolution == _Configuration.OutputResolutions[0])
|
||||
propertyLogic.AddToPropertyLogicAllCollection(filteredPropertyHolderCollection);
|
||||
if (exceptionCount == 0 && _Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution) && propertyLogic.NamedFaceInfoDeterministicHashCodeIndices.Any())
|
||||
_Faces.SaveShortcuts(configuration, juliePhares, model, predictorModel, propertyLogic, peopleCollection, outputResolution, filteredPropertyHolderCollection, propertyCollection, faceCollections);
|
||||
if (_ArgZeroIsConfigurationRootDirectory && exceptionCount == 0 && propertyLogic.NamedFaceInfoDeterministicHashCodeIndices.Any())
|
||||
{
|
||||
if (outputResolution == _Configuration.OutputResolutions[0] || _Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
||||
{
|
||||
List<(PropertyHolder, (string, D_Face?, (string, string, string, string))[])> collections = D_Face.GetCollection(configuration, model, predictorModel, propertyLogic, peopleCollection, outputResolution, filteredPropertyHolderCollection, faceCollections);
|
||||
if (outputResolution == _Configuration.OutputResolutions[0])
|
||||
{
|
||||
foreach ((PropertyHolder propertyHolder, (string, D_Face?, (string, string, string, string))[] collection) in collections)
|
||||
{
|
||||
foreach ((string personKey, D_Face? face, (string directory, string copyDirectory, string copyFileName, string shortcutFileName)) in collection)
|
||||
{
|
||||
if (string.IsNullOrEmpty(personKey) || face is null || string.IsNullOrEmpty(directory))
|
||||
continue;
|
||||
propertyHolder.AddNamed(directory, personKey, face);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
||||
D_Face.SaveShortcuts(_Configuration.JuliePhares, peopleCollection, collections);
|
||||
}
|
||||
}
|
||||
if (exceptionCount == 0 && _Configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions.Contains(outputResolution))
|
||||
_Distance.LoadOrCreateThenSaveDistanceResultsForOutputResolutions(configuration, model, predictorModel, sourceDirectory, outputResolution, sourceDirectoryChanges, filteredPropertyHolderCollection, faceCollections);
|
||||
if (_Resize.AngleBracketCollection.Any())
|
||||
@ -690,14 +709,12 @@ public class DlibDotNet
|
||||
}
|
||||
_Log.Information(". . .");
|
||||
}
|
||||
}
|
||||
if (_ArgZeroIsConfigurationRootDirectory && _Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
||||
{
|
||||
|
||||
}
|
||||
if (_ArgZeroIsConfigurationRootDirectory && outputResolution == _Configuration.OutputResolutions[0])
|
||||
{
|
||||
propertyLogic.SaveAllCollection();
|
||||
if (propertyLogic.NamedFaceInfoDeterministicHashCodeIndices.Any())
|
||||
E_Distance.SaveGroupedFaceEncodings(configuration, model, predictorModel, argZero, peopleCollection, outputResolution, propertyHolderCollections);
|
||||
if (!_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Any())
|
||||
break;
|
||||
if (_Exceptions.Count == 0)
|
||||
@ -728,12 +745,12 @@ public class DlibDotNet
|
||||
return result;
|
||||
}
|
||||
|
||||
private void Search(Property.Models.Configuration configuration, string[] juliePhares, bool reverse, Model model, PredictorModel predictorModel, string argZero, Person[] people)
|
||||
private void Search(Property.Models.Configuration configuration, bool reverse, Model model, PredictorModel predictorModel, string argZero, Person[] people)
|
||||
{
|
||||
PropertyLogic propertyLogic = GetPropertyLogic();
|
||||
Dictionary<string, List<Person>> peopleCollection = A2_People.Convert(people);
|
||||
List<PropertyHolder[]> propertyHolderCollections = Property.Models.Stateless.A_Property.Get(configuration, reverse, model, predictorModel, propertyLogic);
|
||||
FullDoWork(configuration, juliePhares, model, predictorModel, argZero, peopleCollection, propertyLogic, propertyHolderCollections);
|
||||
FullDoWork(configuration, model, predictorModel, argZero, peopleCollection, propertyLogic, propertyHolderCollections);
|
||||
}
|
||||
|
||||
internal void RenameQueue(Property.Models.Configuration configuration, Model model, PredictorModel predictorModel) => _Rename.RenameQueue(configuration, model, predictorModel);
|
||||
|
Reference in New Issue
Block a user