Finished Testing Infineon Pictures
This commit is contained in:
@ -319,8 +319,9 @@ public class MapLogic
|
||||
}
|
||||
}
|
||||
|
||||
public void AddToMapping(List<Item> items)
|
||||
public int AddToMapping(List<Item> items)
|
||||
{
|
||||
int result = 0;
|
||||
long ticks;
|
||||
Mapping mapping;
|
||||
bool forced = false;
|
||||
@ -343,7 +344,10 @@ public class MapLogic
|
||||
continue;
|
||||
deterministicHashCodeKey = Shared.Models.Stateless.Methods.IMapping.GetDeterministicHashCodeKey(item, face);
|
||||
if (!_DeterministicHashCodeKeyValuePairs.ContainsKey(deterministicHashCodeKey))
|
||||
{
|
||||
result += 1;
|
||||
continue;
|
||||
}
|
||||
personBirthdays.AddRange(_DeterministicHashCodeKeyValuePairs[deterministicHashCodeKey]);
|
||||
for (int i = 0; i < personBirthdays.Count; i++)
|
||||
{
|
||||
@ -377,6 +381,7 @@ public class MapLogic
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void SaveContainers(List<SaveContainer> saveContainers)
|
||||
@ -677,10 +682,10 @@ public class MapLogic
|
||||
key = string.Concat(personKey, dateKey);
|
||||
if (match.Filtered is null)
|
||||
directory = Path.Combine(_ZPropertyHolderContentTicksDirectory, $"{facePopulatedKey}Null", personKey, dateKey);
|
||||
else if (!match.Filtered.Value)
|
||||
directory = Path.Combine(_ZPropertyHolderContentTicksDirectory, $"{facePopulatedKey}Okay", personKey, dateKey);
|
||||
else
|
||||
else if (match.Filtered.Value)
|
||||
directory = Path.Combine(_ZPropertyHolderContentTicksDirectory, $"{facePopulatedKey}OutOfControl", personKey, dateKey);
|
||||
else
|
||||
continue;
|
||||
personDirectory = Path.Combine(directory, match.DisplayDirectoryName[..1], "lnk");
|
||||
saveContainer = new(personDirectory);
|
||||
results.Add(saveContainer);
|
||||
@ -744,9 +749,9 @@ public class MapLogic
|
||||
if (match.Filtered is null)
|
||||
directory = Path.Combine(_ZPropertyHolderContentTicksDirectory, $"{facePopulatedKey}WithButNull", personKey, dateKey);
|
||||
else if (!match.Filtered.Value)
|
||||
directory = Path.Combine(_ZPropertyHolderContentTicksDirectory, $"{facePopulatedKey}WithAndOkay", personKey, dateKey);
|
||||
else
|
||||
directory = Path.Combine(_ZPropertyHolderContentTicksDirectory, $"{facePopulatedKey}WithButOutOfControl", personKey, dateKey);
|
||||
else
|
||||
continue;
|
||||
personDirectory = Path.Combine(directory, match.DisplayDirectoryName[..1], "lnk");
|
||||
saveContainer = new(personDirectory);
|
||||
results.Add(saveContainer);
|
||||
@ -755,7 +760,7 @@ public class MapLogic
|
||||
deterministicHashCodeKey = Shared.Models.Stateless.Methods.IMapping.GetDeterministicHashCodeKey(item, face);
|
||||
checkFile = Path.Combine(directory, $"{deterministicHashCodeKey}{item.ImageFileHolder.ExtensionLowered}");
|
||||
faceFileHolder = new(Path.Combine(facesDirectory, $"{deterministicHashCodeKey}{item.ImageFileHolder.ExtensionLowered}{_FacesFilenameExtension}"));
|
||||
facePartsFileHolder = new(Path.Combine(facesDirectory, $"{deterministicHashCodeKey}{item.ImageFileHolder.ExtensionLowered}{_FacesHiddenFilenameExtension}"));
|
||||
hiddenFaceFileHolder = new(Path.Combine(facesDirectory, $"{deterministicHashCodeKey}{item.ImageFileHolder.ExtensionLowered}{_FacesHiddenFilenameExtension}"));
|
||||
facePartsFileHolder = new(Path.Combine(facePartsDirectory, $"{deterministicHashCodeKey}{item.ImageFileHolder.ExtensionLowered}{_FacePartsFilenameExtension}"));
|
||||
if (string.IsNullOrEmpty(personDirectory))
|
||||
shortcutFile = string.Empty;
|
||||
@ -925,54 +930,70 @@ public class MapLogic
|
||||
SaveContainers(saveContainers);
|
||||
}
|
||||
|
||||
public void ForceSingleImage(string[] ignoreRelativePaths, string argZero, Container[] containers)
|
||||
public void ForceSingleImage(string[] ignoreRelativePaths, string argZero, Container[] containers, int totalNotMapped, Random random)
|
||||
{
|
||||
int count = 0;
|
||||
Closest closest;
|
||||
Mapping mapping;
|
||||
bool? isWrongYear;
|
||||
long? ticks = null;
|
||||
const int zero = 0;
|
||||
bool forced = true;
|
||||
int randomSelection;
|
||||
DateTime minimumDateTime;
|
||||
bool aboveTolerance = false;
|
||||
int? approximateYears = null;
|
||||
PersonBirthday personBirthday;
|
||||
const string displayDirectoryName = Property.Models.Stateless.IResult.AllInOne;
|
||||
foreach (Container container in containers)
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
if (!_NotMappedTicks.Any())
|
||||
break;
|
||||
if (!container.Items.Any())
|
||||
continue;
|
||||
if (!container.SourceDirectory.StartsWith(argZero))
|
||||
continue;
|
||||
if (ignoreRelativePaths.Contains(Path.GetFileName(container.SourceDirectory)))
|
||||
continue;
|
||||
foreach (Item item in container.Items)
|
||||
count = 0;
|
||||
randomSelection = random.Next(0, totalNotMapped);
|
||||
foreach (Container container in containers)
|
||||
{
|
||||
if (item.ImageFileHolder is null || item.Property?.Id is null || item.Mapping.Any())
|
||||
if (!_NotMappedTicks.Any())
|
||||
break;
|
||||
if (!container.Items.Any())
|
||||
continue;
|
||||
foreach (Face face in item.Faces)
|
||||
if (!container.SourceDirectory.StartsWith(argZero))
|
||||
continue;
|
||||
if (ignoreRelativePaths.Contains(Path.GetFileName(container.SourceDirectory)))
|
||||
continue;
|
||||
foreach (Item item in container.Items)
|
||||
{
|
||||
if (face.FaceEncoding is null || face.Location?.NormalizedPixelPercentage is null)
|
||||
if (item.ImageFileHolder is null || item.Property?.Id is null || item.Mapping.Any())
|
||||
continue;
|
||||
ticks = _NotMappedTicks[zero];
|
||||
minimumDateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
||||
(isWrongYear, _) = item.Property.IsWrongYear(item.ImageFileHolder.FullName, minimumDateTime);
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(ticks.Value);
|
||||
mapping = new(approximateYears, displayDirectoryName, forced, face.Location.NormalizedPixelPercentage, personBirthday);
|
||||
closest = new(aboveTolerance, zero, face.Location.NormalizedPixelPercentage.Value, isWrongYear, mapping, zero, minimumDateTime, null);
|
||||
item.Closest.Add(closest);
|
||||
item.Mapping.Add(mapping);
|
||||
foreach (Face face in item.Faces)
|
||||
{
|
||||
if (face.FaceEncoding is null || face.Location?.NormalizedPixelPercentage is null)
|
||||
continue;
|
||||
if (face.Location.Confidence < ILocation.MinimumConfidence)
|
||||
continue;
|
||||
count += 1;
|
||||
if (count < randomSelection)
|
||||
continue;
|
||||
ticks = _NotMappedTicks[zero];
|
||||
minimumDateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
||||
(isWrongYear, _) = item.Property.IsWrongYear(item.ImageFileHolder.FullName, minimumDateTime);
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(ticks.Value);
|
||||
mapping = new(approximateYears, displayDirectoryName, forced, face.Location.NormalizedPixelPercentage, personBirthday);
|
||||
closest = new(aboveTolerance, zero, face.Location.NormalizedPixelPercentage.Value, isWrongYear, mapping, zero, minimumDateTime, null);
|
||||
item.Closest.Add(closest);
|
||||
item.Mapping.Add(mapping);
|
||||
if (ticks is not null)
|
||||
break;
|
||||
}
|
||||
if (ticks is not null)
|
||||
break;
|
||||
}
|
||||
if (ticks is not null)
|
||||
break;
|
||||
}
|
||||
if (ticks is not null)
|
||||
if (ticks is not null || count == 0)
|
||||
break;
|
||||
}
|
||||
if (ticks is null && count != 0)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public void SavePropertyHolders(string argZero, Container[] containers)
|
||||
|
Reference in New Issue
Block a user