Closest is usable with
NamedDeterministicHashCodeIdAndFaceLocationIndex
This commit is contained in:
@ -418,7 +418,7 @@ public class DlibDotNet
|
||||
}
|
||||
}
|
||||
int totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||
string message = $"{container.R + 1:000}.{container.G} / {containersCount:000}) {filteredItems.Length:000} file(s) - {totalSeconds} total second(s) - {outputResolution} - {container.SourceDirectory}";
|
||||
string message = $"{container.R:000}.{container.G} / {containersCount:000}) {filteredItems.Length:000} file(s) - {totalSeconds} total second(s) - {outputResolution} - {container.SourceDirectory}";
|
||||
using (ProgressBar progressBar = new(filteredItems.Length, message, options))
|
||||
{
|
||||
_ = Parallel.For(0, filteredItems.Length, parallelOptions, i =>
|
||||
@ -438,15 +438,6 @@ public class DlibDotNet
|
||||
}
|
||||
});
|
||||
}
|
||||
#pragma warning disable
|
||||
int[] ids = (from l in filteredItems where l.Property?.Id is not null select l.Property.Id.Value).ToArray();
|
||||
#pragma warning restore
|
||||
bool hasDuplicateId = ids.Length != ids.Distinct().Count();
|
||||
if (hasDuplicateId)
|
||||
{
|
||||
if (hasDuplicateId)
|
||||
{ }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -575,6 +566,10 @@ public class DlibDotNet
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
if (_AppSettings.MaxDegreeOfParallelism is null)
|
||||
throw new NullReferenceException(nameof(_AppSettings.MaxDegreeOfParallelism));
|
||||
if (_Configuration.SaveResizedSubfiles is null)
|
||||
throw new NullReferenceException(nameof(_Configuration.SaveResizedSubfiles));
|
||||
int[] ids;
|
||||
int distinctCount;
|
||||
int exceptionCount;
|
||||
Item[] filteredItems;
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
@ -617,7 +612,7 @@ public class DlibDotNet
|
||||
continue;
|
||||
if (!_ArgZeroIsConfigurationRootDirectory && !container.SourceDirectory.StartsWith(argZero))
|
||||
continue;
|
||||
filteredItems = (from l in container.Items where l.ImageFileHolder is not null && l.ValidImageFormatExtension && !_Configuration.IgnoreExtensions.Contains(l.ImageFileHolder.ExtensionLowered) select l).ToArray();
|
||||
filteredItems = (from l in container.Items where l.ImageFileHolder is not null && (l.Abandoned is null || !l.Abandoned.Value) && l.ValidImageFormatExtension && !_Configuration.IgnoreExtensions.Contains(l.ImageFileHolder.ExtensionLowered) select l).ToArray();
|
||||
if (!filteredItems.Any())
|
||||
continue;
|
||||
faceCollections.Clear();
|
||||
@ -635,27 +630,37 @@ public class DlibDotNet
|
||||
aResultsFullGroupDirectory,
|
||||
contentDescription: string.Empty,
|
||||
singletonDescription: "Properties for each image",
|
||||
collectionDescription: string.Empty));
|
||||
collectionDescription: string.Empty,
|
||||
converted: false));
|
||||
_Metadata.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||
container.SourceDirectory,
|
||||
bResultsFullGroupDirectory,
|
||||
contentDescription: string.Empty,
|
||||
singletonDescription: "Metadata as key value pairs",
|
||||
collectionDescription: string.Empty));
|
||||
collectionDescription: string.Empty,
|
||||
converted: true));
|
||||
_Resize.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||
container.SourceDirectory,
|
||||
cResultsFullGroupDirectory,
|
||||
contentDescription: "Resized image",
|
||||
singletonDescription: "Resize dimensions for each resolution",
|
||||
collectionDescription: string.Empty));
|
||||
collectionDescription: string.Empty,
|
||||
converted: true));
|
||||
if (_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution))
|
||||
_Faces.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||
container.SourceDirectory,
|
||||
dResultsFullGroupDirectory,
|
||||
contentDescription: "n png file(s) for each face found",
|
||||
singletonDescription: string.Empty,
|
||||
collectionDescription: "For each image a json file with all faces found"));
|
||||
collectionDescription: "For each image a json file with all faces found",
|
||||
converted: true));
|
||||
exceptionCount = FullParallelWork(ticks, propertyLogic, outputResolution, bResultsFullGroupDirectory, cResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory, sourceDirectoryChanges, propertyFileHolderCollection, propertyCollection, metadataCollection, resizeKeyValuePairs, faceCollections, containers.Count, container, filteredItems);
|
||||
#pragma warning disable
|
||||
ids = (from l in filteredItems where l.Property?.Id is not null select l.Property.Id.Value).ToArray();
|
||||
#pragma warning restore
|
||||
distinctCount = ids.Distinct().Count();
|
||||
if (ids.Length != distinctCount)
|
||||
_Log.Information($"{ids.Length} != {distinctCount} <{container.SourceDirectory}>");
|
||||
if (metadataCollection.Count != filteredItems.Length || propertyCollection.Count != filteredItems.Length || resizeKeyValuePairs.Count != filteredItems.Length || faceCollections.Count != filteredItems.Length)
|
||||
throw new Exception("Counts don't match!");
|
||||
if (exceptionCount != 0)
|
||||
@ -664,7 +669,7 @@ public class DlibDotNet
|
||||
WriteGroup(configuration, propertyLogic, propertyCollection, metadataCollection, faceCollections, resizeKeyValuePairs, container.SourceDirectory, outputResolution, filteredItems);
|
||||
if (_ArgZeroIsConfigurationRootDirectory && exceptionCount == 0 && outputResolution == _Configuration.OutputResolutions[0])
|
||||
propertyLogic.AddToPropertyLogicAllCollection(filteredItems);
|
||||
if (_ArgZeroIsConfigurationRootDirectory && exceptionCount == 0 && propertyLogic.NamedFaceInfoDeterministicHashCodeIndices.Any())
|
||||
if (_ArgZeroIsConfigurationRootDirectory && exceptionCount == 0 && propertyLogic.NamedFaceInfoDeterministicHashCodeIds.Any())
|
||||
{
|
||||
if (outputResolution == _Configuration.OutputResolutions[0] || _Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
||||
{
|
||||
@ -674,6 +679,10 @@ public class DlibDotNet
|
||||
// break;
|
||||
// if (isSilent && container.SourceDirectory.EndsWith("zzz =2014.4 Winter Tracy Pictures")) // 30#.2
|
||||
// break;
|
||||
// if (isSilent && container.SourceDirectory.EndsWith("=2009.0 Winter Logan Michael")) //34#.2
|
||||
// break;
|
||||
// if (isSilent && container.SourceDirectory.EndsWith("Animal Kingdom")) //35#.3
|
||||
// break;
|
||||
// if (isSilent && container.SourceDirectory.EndsWith("Texas 2015")) //46#.4
|
||||
// break;
|
||||
for (int i = 0; i < faceCollections.Count; i++)
|
||||
@ -685,10 +694,6 @@ public class DlibDotNet
|
||||
}
|
||||
if (exceptionCount == 0 && _Configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions.Contains(outputResolution))
|
||||
_Distance.LoadOrCreateThenSaveDistanceResultsForOutputResolutions(configuration, eResultsFullGroupDirectory, container.SourceDirectory, outputResolution, sourceDirectoryChanges, filteredItems, faceCollections);
|
||||
if (_Resize.AngleBracketCollection.Any())
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(_Resize.AngleBracketCollection[0].Replace("<>", "()"));
|
||||
if (_Faces.AngleBracketCollection.Any())
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(_Faces.AngleBracketCollection[0].Replace("<>", "()"));
|
||||
if (Directory.GetFiles(propertyRoot, "*.txt", SearchOption.TopDirectoryOnly).Any())
|
||||
{
|
||||
for (int y = 0; y < int.MaxValue; y++)
|
||||
@ -700,10 +705,21 @@ public class DlibDotNet
|
||||
_Log.Information(". . .");
|
||||
}
|
||||
}
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(Path.Combine(aResultsFullGroupDirectory, "{}"));
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(Path.Combine(bResultsFullGroupDirectory, "{}"));
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(Path.Combine(cResultsFullGroupDirectory, "{}"));
|
||||
if (_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution))
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(Path.Combine(dResultsFullGroupDirectory, "[]"));
|
||||
if (_Configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions.Contains(outputResolution))
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(Path.Combine(eResultsFullGroupDirectory, "[]"));
|
||||
if (_Configuration.LoadOrCreateThenSaveDirectoryDistanceResultsForOutputResolutions.Contains(outputResolution))
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(Path.Combine(eResultsFullGroupDirectory, "[]"));
|
||||
if (_Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution))
|
||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(Path.Combine(d2ResultsFullGroupDirectory, "[]"));
|
||||
if (_ArgZeroIsConfigurationRootDirectory && outputResolution == _Configuration.OutputResolutions[0])
|
||||
{
|
||||
propertyLogic.SaveAllCollection();
|
||||
if (propertyLogic.NamedFaceInfoDeterministicHashCodeIndices.Any())
|
||||
if (_Configuration.SaveResizedSubfiles.Value && propertyLogic.NamedFaceInfoDeterministicHashCodeIds.Any())
|
||||
{
|
||||
string dFacesContentDirectory;
|
||||
string eDistanceContentDirectory;
|
||||
@ -715,9 +731,13 @@ public class DlibDotNet
|
||||
eDistanceCollectionDirectory = Path.Combine(eResultsFullGroupDirectory, $"[{ticks}]");
|
||||
List<(DateTime, bool?, PersonBirthday, FaceRecognitionDotNet.FaceEncoding[])> collection;
|
||||
collection = E_Distance.ParallelWork(_AppSettings.MaxDegreeOfParallelism.Value, argZero, containers);
|
||||
_ = LogDelta(ticks, nameof(E_Distance.ParallelWork));
|
||||
E_Distance.SavePropertyHolders(argZero, containers, zPropertyHolderSingletonDirectory);
|
||||
_ = LogDelta(ticks, nameof(E_Distance.SavePropertyHolders));
|
||||
E_Distance.SaveThreeSigmaFaceEncodings(collection, peopleCollection, eDistanceCollectionDirectory);
|
||||
E_Distance.SaveClosest(argZero, containers, peopleCollection, eDistanceContentDirectory, dFacesContentDirectory);
|
||||
_ = LogDelta(ticks, nameof(E_Distance.SaveThreeSigmaFaceEncodings));
|
||||
E_Distance.SaveClosest(argZero, containers, peopleCollection, propertyLogic, eDistanceContentDirectory, dFacesContentDirectory);
|
||||
_ = LogDelta(ticks, nameof(E_Distance.SaveClosest));
|
||||
}
|
||||
if (!_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Any())
|
||||
break;
|
||||
|
Reference in New Issue
Block a user