Switch to PredictorModel from string
This commit is contained in:
parent
2ebec0b7a9
commit
b3f79bd143
@ -5,6 +5,7 @@ using System.Text.Json;
|
|||||||
using View_by_Distance.Compare.Models;
|
using View_by_Distance.Compare.Models;
|
||||||
using View_by_Distance.Property.Models;
|
using View_by_Distance.Property.Models;
|
||||||
using View_by_Distance.Shared.Models.Methods;
|
using View_by_Distance.Shared.Models.Methods;
|
||||||
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
using WindowsShortcutFactory;
|
using WindowsShortcutFactory;
|
||||||
|
|
||||||
namespace View_by_Distance.Compare;
|
namespace View_by_Distance.Compare;
|
||||||
@ -52,8 +53,8 @@ public class Compare
|
|||||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||||
Verify(configuration);
|
Verify(configuration);
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
string modelName = nameof(modelName);
|
Model model = Model.Hog;
|
||||||
string predictorModelName = nameof(predictorModelName);
|
PredictorModel predictorModel = PredictorModel.Large;
|
||||||
if (propertyConfiguration.PopulatePropertyId is null)
|
if (propertyConfiguration.PopulatePropertyId is null)
|
||||||
throw new Exception($"{nameof(propertyConfiguration.PopulatePropertyId)} is null!");
|
throw new Exception($"{nameof(propertyConfiguration.PopulatePropertyId)} is null!");
|
||||||
foreach (string spelling in configuration.Spelling)
|
foreach (string spelling in configuration.Spelling)
|
||||||
@ -162,7 +163,7 @@ public class Compare
|
|||||||
PropertyLogic propertyLogic = GetPropertyLogic();
|
PropertyLogic propertyLogic = GetPropertyLogic();
|
||||||
if (_IsEnvironment.Development && propertyConfiguration.PopulatePropertyId.Value && !propertyLogic.KeyValuePairs.Any())
|
if (_IsEnvironment.Development && propertyConfiguration.PopulatePropertyId.Value && !propertyLogic.KeyValuePairs.Any())
|
||||||
throw new Exception("Copy keyValuePairs-####.json file");
|
throw new Exception("Copy keyValuePairs-####.json file");
|
||||||
List<PropertyHolder[]> propertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, modelName, predictorModelName, propertyLogic);
|
List<PropertyHolder[]> propertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, model, predictorModel, propertyLogic);
|
||||||
if (!isSilent)
|
if (!isSilent)
|
||||||
{
|
{
|
||||||
_Log.Information("First pass completed");
|
_Log.Information("First pass completed");
|
||||||
@ -204,7 +205,7 @@ public class Compare
|
|||||||
_Log.Information(". . .");
|
_Log.Information(". . .");
|
||||||
}
|
}
|
||||||
string aPropertyContentCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(propertyConfiguration, nameof(A_Property), "[()]");
|
string aPropertyContentCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(propertyConfiguration, nameof(A_Property), "[()]");
|
||||||
ThirdPassToMove(propertyConfiguration, modelName, predictorModelName, propertyLogic, propertyHolderCollections, aPropertyContentCollectionDirectory);
|
ThirdPassToMove(propertyConfiguration, model, predictorModel, propertyLogic, propertyHolderCollections, aPropertyContentCollectionDirectory);
|
||||||
if (!isSilent)
|
if (!isSilent)
|
||||||
{
|
{
|
||||||
_Log.Information("Third pass completed");
|
_Log.Information("Third pass completed");
|
||||||
@ -216,7 +217,7 @@ public class Compare
|
|||||||
}
|
}
|
||||||
_Log.Information(". . .");
|
_Log.Information(". . .");
|
||||||
}
|
}
|
||||||
FourthPassCreateWindowsShortcuts(propertyConfiguration, modelName, predictorModelName, propertyLogic, propertyHolderCollections, saveToCollection: false, keepAll: false);
|
FourthPassCreateWindowsShortcuts(propertyConfiguration, model, predictorModel, propertyLogic, propertyHolderCollections, saveToCollection: false, keepAll: false);
|
||||||
if (!isSilent)
|
if (!isSilent)
|
||||||
{
|
{
|
||||||
_Log.Information("Fourth pass completed");
|
_Log.Information("Fourth pass completed");
|
||||||
@ -749,7 +750,7 @@ public class Compare
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThirdPassToMove(Property.Models.Configuration configuration, string modelName, string predictorModelName, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, string aPropertyContentCollectionDirectory)
|
private void ThirdPassToMove(Property.Models.Configuration configuration, Model model, PredictorModel predictorModel, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, string aPropertyContentCollectionDirectory)
|
||||||
{
|
{
|
||||||
if (_Log is null)
|
if (_Log is null)
|
||||||
throw new Exception($"{nameof(_Log)} is null!");
|
throw new Exception($"{nameof(_Log)} is null!");
|
||||||
@ -768,7 +769,7 @@ public class Compare
|
|||||||
List<string> distinctDirectories = new();
|
List<string> distinctDirectories = new();
|
||||||
List<KeyValuePair<int, int[]>> valueCollection = new();
|
List<KeyValuePair<int, int[]>> valueCollection = new();
|
||||||
List<Property.Models.DirectoryInfo> directoryInfoCollection = new();
|
List<Property.Models.DirectoryInfo> directoryInfoCollection = new();
|
||||||
propertyLogic.ParallelWork(configuration, modelName, predictorModelName, ticks, propertyHolderCollections, firstPass: false);
|
propertyLogic.ParallelWork(configuration, model, predictorModel, ticks, propertyHolderCollections, firstPass: false);
|
||||||
if (propertyLogic.ExceptionsDirectories.Any())
|
if (propertyLogic.ExceptionsDirectories.Any())
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
foreach (Property.Models.DirectoryInfo group in directoryInfoCollection)
|
foreach (Property.Models.DirectoryInfo group in directoryInfoCollection)
|
||||||
@ -827,7 +828,7 @@ public class Compare
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, string modelName, string predictorModelName, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, bool saveToCollection, bool keepAll)
|
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, Model model, PredictorModel predictorModel, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, bool saveToCollection, bool keepAll)
|
||||||
{
|
{
|
||||||
if (_Log is null)
|
if (_Log is null)
|
||||||
throw new Exception($"{nameof(_Log)} is null!");
|
throw new Exception($"{nameof(_Log)} is null!");
|
||||||
@ -840,7 +841,7 @@ public class Compare
|
|||||||
List<KeyValuePair<int, int[]>> valueCollection = new();
|
List<KeyValuePair<int, int[]>> valueCollection = new();
|
||||||
(long Ticks, string FilteredSourceDirectoryFile, string PropertyDirectory, int PropertyId)[] collection;
|
(long Ticks, string FilteredSourceDirectoryFile, string PropertyDirectory, int PropertyId)[] collection;
|
||||||
List<Property.Models.DirectoryInfo> directoryInfoCollection = new();
|
List<Property.Models.DirectoryInfo> directoryInfoCollection = new();
|
||||||
propertyLogic.ParallelWork(configuration, modelName, predictorModelName, ticks, propertyHolderCollections, firstPass: false);
|
propertyLogic.ParallelWork(configuration, model, predictorModel, ticks, propertyHolderCollections, firstPass: false);
|
||||||
if (propertyLogic.ExceptionsDirectories.Any())
|
if (propertyLogic.ExceptionsDirectories.Any())
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
foreach (Property.Models.DirectoryInfo group in directoryInfoCollection)
|
foreach (Property.Models.DirectoryInfo group in directoryInfoCollection)
|
||||||
@ -858,7 +859,7 @@ public class Compare
|
|||||||
fileMoveCollection.Add(filteredSourceDirectoryFile);
|
fileMoveCollection.Add(filteredSourceDirectoryFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
collection = propertyLogic.GetPropertyIds(configuration, modelName, predictorModelName, directoryInfoCollection, saveToCollection);
|
collection = propertyLogic.GetPropertyIds(configuration, model, predictorModel, directoryInfoCollection, saveToCollection);
|
||||||
_Log.Information($"{stay} file(s) are staying and {fileMoveCollection.Count} file(s) will be moved");
|
_Log.Information($"{stay} file(s) are staying and {fileMoveCollection.Count} file(s) will be moved");
|
||||||
for (int x = 0; x < int.MaxValue; x++)
|
for (int x = 0; x < int.MaxValue; x++)
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using View_by_Distance.Date.Group.Models;
|
using View_by_Distance.Date.Group.Models;
|
||||||
using View_by_Distance.Property.Models;
|
using View_by_Distance.Property.Models;
|
||||||
using View_by_Distance.Shared.Models.Methods;
|
using View_by_Distance.Shared.Models.Methods;
|
||||||
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
using WindowsShortcutFactory;
|
using WindowsShortcutFactory;
|
||||||
|
|
||||||
namespace View_by_Distance.Date.Group;
|
namespace View_by_Distance.Date.Group;
|
||||||
@ -41,8 +42,8 @@ public class DateGroup
|
|||||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||||
Verify(configuration);
|
Verify(configuration);
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
string modelName = nameof(modelName);
|
Model model = Model.Hog;
|
||||||
string predictorModelName = nameof(predictorModelName);
|
PredictorModel predictorModel = PredictorModel.Large;
|
||||||
_Configuration = configuration;
|
_Configuration = configuration;
|
||||||
if (configuration.ByHash is null)
|
if (configuration.ByHash is null)
|
||||||
throw new Exception($"{nameof(configuration.ByHash)} is null!");
|
throw new Exception($"{nameof(configuration.ByHash)} is null!");
|
||||||
@ -63,14 +64,14 @@ public class DateGroup
|
|||||||
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
|
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
|
||||||
if (true || appSettings.MaxDegreeOfParallelism.Value < 2)
|
if (true || appSettings.MaxDegreeOfParallelism.Value < 2)
|
||||||
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.IPath.DeleteEmptyDirectories));
|
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.IPath.DeleteEmptyDirectories));
|
||||||
List<PropertyHolder[]> propertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, modelName, predictorModelName, propertyLogic);
|
List<PropertyHolder[]> propertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, model, predictorModel, propertyLogic);
|
||||||
if (configuration.ByCreateDateShortcut.HasValue && configuration.ByCreateDateShortcut.Value)
|
if (configuration.ByCreateDateShortcut.HasValue && configuration.ByCreateDateShortcut.Value)
|
||||||
CreateDateShortcut(propertyConfiguration, propertyHolderCollections);
|
CreateDateShortcut(propertyConfiguration, propertyHolderCollections);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<string> topDirectories = new();
|
List<string> topDirectories = new();
|
||||||
List<Property.Models.DirectoryInfo> directoryInfoCollection = new();
|
List<Property.Models.DirectoryInfo> directoryInfoCollection = new();
|
||||||
propertyLogic.ParallelWork(propertyConfiguration, modelName, predictorModelName, ticks, propertyHolderCollections, firstPass: true);
|
propertyLogic.ParallelWork(propertyConfiguration, model, predictorModel, ticks, propertyHolderCollections, firstPass: true);
|
||||||
if (appSettings.MaxDegreeOfParallelism.Value < 2)
|
if (appSettings.MaxDegreeOfParallelism.Value < 2)
|
||||||
ticks = LogDelta(ticks, nameof(PropertyLogic.ParallelWork));
|
ticks = LogDelta(ticks, nameof(PropertyLogic.ParallelWork));
|
||||||
if (propertyLogic.ExceptionsDirectories.Any())
|
if (propertyLogic.ExceptionsDirectories.Any())
|
||||||
@ -78,7 +79,7 @@ public class DateGroup
|
|||||||
if (propertyConfiguration.PopulatePropertyId.Value && (configuration.ByCreateDateShortcut.Value || configuration.ByHash.Value))
|
if (propertyConfiguration.PopulatePropertyId.Value && (configuration.ByCreateDateShortcut.Value || configuration.ByHash.Value))
|
||||||
{
|
{
|
||||||
if (Property.Models.Stateless.A_Property.Any(propertyHolderCollections))
|
if (Property.Models.Stateless.A_Property.Any(propertyHolderCollections))
|
||||||
propertyLogic.ParallelWork(propertyConfiguration, modelName, predictorModelName, ticks, propertyHolderCollections, firstPass: false);
|
propertyLogic.ParallelWork(propertyConfiguration, model, predictorModel, ticks, propertyHolderCollections, firstPass: false);
|
||||||
if (appSettings.MaxDegreeOfParallelism.Value < 2)
|
if (appSettings.MaxDegreeOfParallelism.Value < 2)
|
||||||
ticks = LogDelta(ticks, nameof(PropertyLogic.ParallelWork));
|
ticks = LogDelta(ticks, nameof(PropertyLogic.ParallelWork));
|
||||||
if (propertyLogic.ExceptionsDirectories.Any())
|
if (propertyLogic.ExceptionsDirectories.Any())
|
||||||
|
@ -606,8 +606,8 @@ public class DlibDotNet
|
|||||||
_FaceLandmarks.AngleBracketCollection.Clear();
|
_FaceLandmarks.AngleBracketCollection.Clear();
|
||||||
sourceDirectory = filteredPropertyHolderCollection[0].SourceDirectory;
|
sourceDirectory = filteredPropertyHolderCollection[0].SourceDirectory;
|
||||||
propertyLogic.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
propertyLogic.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(A_Property),
|
nameof(A_Property),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
@ -618,8 +618,8 @@ public class DlibDotNet
|
|||||||
singletonDescription: "Properties for each image",
|
singletonDescription: "Properties for each image",
|
||||||
collectionDescription: string.Empty));
|
collectionDescription: string.Empty));
|
||||||
_Metadata.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
_Metadata.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(B_Metadata),
|
nameof(B_Metadata),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
@ -630,8 +630,8 @@ public class DlibDotNet
|
|||||||
singletonDescription: "Metadata as key value pairs",
|
singletonDescription: "Metadata as key value pairs",
|
||||||
collectionDescription: string.Empty));
|
collectionDescription: string.Empty));
|
||||||
_Resize.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
_Resize.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(C_Resize),
|
nameof(C_Resize),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
@ -643,8 +643,8 @@ public class DlibDotNet
|
|||||||
collectionDescription: string.Empty));
|
collectionDescription: string.Empty));
|
||||||
if (_Configuration.LoadOrCreateThenSaveImageFacesResults.HasValue && _Configuration.LoadOrCreateThenSaveImageFacesResults.Value)
|
if (_Configuration.LoadOrCreateThenSaveImageFacesResults.HasValue && _Configuration.LoadOrCreateThenSaveImageFacesResults.Value)
|
||||||
_Faces.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
_Faces.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(D_Face),
|
nameof(D_Face),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
@ -656,8 +656,8 @@ public class DlibDotNet
|
|||||||
collectionDescription: "For each image a json file with all faces found"));
|
collectionDescription: "For each image a json file with all faces found"));
|
||||||
if (_Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution))
|
if (_Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution))
|
||||||
_FaceLandmarks.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
_FaceLandmarks.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(D2_FaceLandmarks),
|
nameof(D2_FaceLandmarks),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
@ -734,7 +734,7 @@ public class DlibDotNet
|
|||||||
{
|
{
|
||||||
PropertyLogic propertyLogic = GetPropertyLogic();
|
PropertyLogic propertyLogic = GetPropertyLogic();
|
||||||
Dictionary<string, List<Person>> peopleCollection = A2_People.Convert(people);
|
Dictionary<string, List<Person>> peopleCollection = A2_People.Convert(people);
|
||||||
List<PropertyHolder[]> propertyHolderCollections = Property.Models.Stateless.A_Property.Get(configuration, reverse, model.ToString(), predictorModel.ToString(), propertyLogic);
|
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, juliePhares, model, predictorModel, argZero, peopleCollection, propertyLogic, propertyHolderCollections);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
private readonly Model _Model;
|
private readonly Model _Model;
|
||||||
private readonly string _ArgZero;
|
private readonly string _ArgZero;
|
||||||
private readonly Serilog.ILogger? _Log;
|
private readonly Serilog.ILogger? _Log;
|
||||||
|
private readonly Configuration _Configuration;
|
||||||
private readonly ModelParameter _ModelParameter;
|
private readonly ModelParameter _ModelParameter;
|
||||||
private readonly PredictorModel _PredictorModel;
|
private readonly PredictorModel _PredictorModel;
|
||||||
private readonly Configuration _Configuration;
|
|
||||||
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
|
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
|
||||||
|
|
||||||
protected double? _Α;
|
protected double? _Α;
|
||||||
@ -291,11 +291,11 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
D_Face? face = null;
|
D_Face? face = null;
|
||||||
Rectangle rectangle;
|
Rectangle rectangle;
|
||||||
double[] rawEncoding;
|
double[] rawEncoding;
|
||||||
|
IEnumerable<FacePoint> facePoints;
|
||||||
|
Shared.Models.FaceEncoding faceEncoding;
|
||||||
FaceRecognitionDotNet.Image? knownImage;
|
FaceRecognitionDotNet.Image? knownImage;
|
||||||
FaceRecognitionDotNet.Image? rotatedImage;
|
FaceRecognitionDotNet.Image? rotatedImage;
|
||||||
Shared.Models.FaceEncoding faceEncoding;
|
|
||||||
FaceRecognitionDotNet.FaceEncoding[] faceEncodings;
|
FaceRecognitionDotNet.FaceEncoding[] faceEncodings;
|
||||||
IEnumerable<FacePoint> facePoints;
|
|
||||||
IDictionary<FacePart, IEnumerable<FacePoint>>[] faceLandmarks;
|
IDictionary<FacePart, IEnumerable<FacePoint>>[] faceLandmarks;
|
||||||
using Bitmap source = unknownImage.ToBitmap();
|
using Bitmap source = unknownImage.ToBitmap();
|
||||||
padding = (int)((source.Width + source.Height) / 2 * .01);
|
padding = (int)((source.Width + source.Height) / 2 * .01);
|
||||||
@ -303,7 +303,6 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
{
|
{
|
||||||
for (int p = 0; p <= _Configuration.PaddingLoops.Value; p++)
|
for (int p = 0; p <= _Configuration.PaddingLoops.Value; p++)
|
||||||
{
|
{
|
||||||
//Location(double confidence, int bottom, int left, int right, int top)
|
|
||||||
location = new(locations[i].Confidence,
|
location = new(locations[i].Confidence,
|
||||||
locations[i].Bottom + (padding * p),
|
locations[i].Bottom + (padding * p),
|
||||||
locations[i].Left - (padding * p),
|
locations[i].Left - (padding * p),
|
||||||
@ -320,9 +319,11 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
// source.Save(Path.Combine(_Configuration.RootDirectory, "source.jpg"));
|
// source.Save(Path.Combine(_Configuration.RootDirectory, "source.jpg"));
|
||||||
// preRotated.Save(Path.Combine(_Configuration.RootDirectory, $"{p} - preRotated.jpg"));
|
// preRotated.Save(Path.Combine(_Configuration.RootDirectory, $"{p} - preRotated.jpg"));
|
||||||
using (knownImage = FaceRecognition.LoadImage(preRotated))
|
using (knownImage = FaceRecognition.LoadImage(preRotated))
|
||||||
if (knownImage is null)
|
{
|
||||||
|
if (knownImage is null || knownImage.IsDisposed)
|
||||||
throw new Exception($"{nameof(knownImage)} is null");
|
throw new Exception($"{nameof(knownImage)} is null");
|
||||||
faceLandmarks = faceRecognition.FaceLandmark(knownImage, faceLocations: null, _PredictorModel, _Model).ToArray();
|
faceLandmarks = faceRecognition.FaceLandmark(knownImage, faceLocations: null, _PredictorModel, _Model).ToArray();
|
||||||
|
}
|
||||||
if (faceLandmarks.Length == 0 && p < _Configuration.PaddingLoops.Value)
|
if (faceLandmarks.Length == 0 && p < _Configuration.PaddingLoops.Value)
|
||||||
continue;
|
continue;
|
||||||
else if (faceLandmarks.Length != 1)
|
else if (faceLandmarks.Length != 1)
|
||||||
@ -342,9 +343,11 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
{
|
{
|
||||||
// rotated.Save(Path.Combine(_Configuration.RootDirectory, $"{p} - rotated.jpg"));
|
// rotated.Save(Path.Combine(_Configuration.RootDirectory, $"{p} - rotated.jpg"));
|
||||||
using (rotatedImage = FaceRecognition.LoadImage(rotated))
|
using (rotatedImage = FaceRecognition.LoadImage(rotated))
|
||||||
if (rotatedImage is null)
|
{
|
||||||
|
if (rotatedImage is null || rotatedImage.IsDisposed)
|
||||||
throw new Exception($"{nameof(rotatedImage)} is null");
|
throw new Exception($"{nameof(rotatedImage)} is null");
|
||||||
faceEncodings = faceRecognition.FaceEncodings(rotatedImage, knownFaceLocation: null, _Configuration.NumJitters.Value, _PredictorModel, _Model).ToArray();
|
faceEncodings = faceRecognition.FaceEncodings(rotatedImage, knownFaceLocation: null, _Configuration.NumJitters.Value, _PredictorModel, _Model).ToArray();
|
||||||
|
}
|
||||||
if (faceEncodings.Length == 0 && p < _Configuration.PaddingLoops.Value)
|
if (faceEncodings.Length == 0 && p < _Configuration.PaddingLoops.Value)
|
||||||
continue;
|
continue;
|
||||||
else if (faceEncodings.Length != 1)
|
else if (faceEncodings.Length != 1)
|
||||||
@ -520,7 +523,7 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
PropertyHolder propertyHolder;
|
PropertyHolder propertyHolder;
|
||||||
WindowsShortcut windowsShortcut;
|
WindowsShortcut windowsShortcut;
|
||||||
const string pattern = @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]";
|
const string pattern = @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]";
|
||||||
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model.ToString(), predictorModel.ToString(), nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "(_)");
|
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "(_)");
|
||||||
for (int i = 0; i < filteredPropertyHolderCollection.Length; i++)
|
for (int i = 0; i < filteredPropertyHolderCollection.Length; i++)
|
||||||
{
|
{
|
||||||
personKey = string.Empty;
|
personKey = string.Empty;
|
||||||
|
@ -48,9 +48,9 @@ internal class E2_Navigate
|
|||||||
string modelName = model.ToString();
|
string modelName = model.ToString();
|
||||||
string predictorModelName = predictorModel.ToString();
|
string predictorModelName = predictorModel.ToString();
|
||||||
string rootResultsDirectoryAbsoluteUri = new Uri(rootResultsDirectory).AbsoluteUri;
|
string rootResultsDirectoryAbsoluteUri = new Uri(rootResultsDirectory).AbsoluteUri;
|
||||||
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||||
string cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
string cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
(string RootResultsDirectoryAbsoluteUri, string C_ResizeContentDirectory, string D_FacesContentDirectory, string E_DistanceCollectionDirectory) tuple = new(rootResultsDirectoryAbsoluteUri, cResizeContentDirectory, dFacesContentDirectory, eDistanceCollectionDirectory);
|
(string RootResultsDirectoryAbsoluteUri, string C_ResizeContentDirectory, string D_FacesContentDirectory, string E_DistanceCollectionDirectory) tuple = new(rootResultsDirectoryAbsoluteUri, cResizeContentDirectory, dFacesContentDirectory, eDistanceCollectionDirectory);
|
||||||
List<FileSystem> fileSystemCollection = Shared.Models.Stateless.Methods.IFileSystem.GetFileSystemCollection(requestPath, tuple, directories, files, all);
|
List<FileSystem> fileSystemCollection = Shared.Models.Stateless.Methods.IFileSystem.GetFileSystemCollection(requestPath, tuple, directories, files, all);
|
||||||
Queue<FileSystem> queue = new(fileSystemCollection);
|
Queue<FileSystem> queue = new(fileSystemCollection);
|
||||||
@ -81,9 +81,9 @@ internal class E2_Navigate
|
|||||||
string modelName = model.ToString();
|
string modelName = model.ToString();
|
||||||
string predictorModelName = predictorModel.ToString();
|
string predictorModelName = predictorModel.ToString();
|
||||||
string rootResultsDirectoryAbsoluteUri = new Uri(rootResultsDirectory).AbsoluteUri;
|
string rootResultsDirectoryAbsoluteUri = new Uri(rootResultsDirectory).AbsoluteUri;
|
||||||
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||||
string cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
string cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
(string RootResultsDirectoryAbsoluteUri, string C_ResizeContentDirectory, string D_FacesContentDirectory, string E_DistanceCollectionDirectory) tuple = new(rootResultsDirectoryAbsoluteUri, cResizeContentDirectory, dFacesContentDirectory, eDistanceCollectionDirectory);
|
(string RootResultsDirectoryAbsoluteUri, string C_ResizeContentDirectory, string D_FacesContentDirectory, string E_DistanceCollectionDirectory) tuple = new(rootResultsDirectoryAbsoluteUri, cResizeContentDirectory, dFacesContentDirectory, eDistanceCollectionDirectory);
|
||||||
FaceFileSystem[] faceFileSystemCollection = Shared.Models.Stateless.Methods.IFaceFileSystem.GetFaceFileSystemCollection(requestPath, tuple, selectedFileFullName);
|
FaceFileSystem[] faceFileSystemCollection = Shared.Models.Stateless.Methods.IFaceFileSystem.GetFaceFileSystemCollection(requestPath, tuple, selectedFileFullName);
|
||||||
for (int i = 0; i < faceFileSystemCollection.Length; i++)
|
for (int i = 0; i < faceFileSystemCollection.Length; i++)
|
||||||
@ -114,7 +114,7 @@ internal class E2_Navigate
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_Log.Warn(string.Empty);
|
_Log.Warn(string.Empty);
|
||||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model.ToString(), predictorModel.ToString(), nameof(E_Distance), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
string relativePath = Property.Models.Stateless.IPath.GetRelativePath(subSourceDirectory, eDistanceCollectionDirectory.Length);
|
string relativePath = Property.Models.Stateless.IPath.GetRelativePath(subSourceDirectory, eDistanceCollectionDirectory.Length);
|
||||||
if (relativePath.Length == 1)
|
if (relativePath.Length == 1)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
@ -148,7 +148,7 @@ internal class E2_Navigate
|
|||||||
string? subSourceDirectory = string.Empty;
|
string? subSourceDirectory = string.Empty;
|
||||||
Dictionary<ConsoleKey, int> fileKeyValuePairs = new();
|
Dictionary<ConsoleKey, int> fileKeyValuePairs = new();
|
||||||
Dictionary<ConsoleKey, int> directoryKeyValuePairs = new();
|
Dictionary<ConsoleKey, int> directoryKeyValuePairs = new();
|
||||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model.ToString(), predictorModel.ToString(), nameof(E_Distance), _Configuration.OutputResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), _Configuration.OutputResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
if (!Directory.Exists(eDistanceCollectionDirectory))
|
if (!Directory.Exists(eDistanceCollectionDirectory))
|
||||||
_ = Directory.CreateDirectory(eDistanceCollectionDirectory);
|
_ = Directory.CreateDirectory(eDistanceCollectionDirectory);
|
||||||
for (int z = 0; z < int.MaxValue; z++)
|
for (int z = 0; z < int.MaxValue; z++)
|
||||||
|
@ -46,7 +46,7 @@ internal class E3_Rename
|
|||||||
string g2IdentifyCollectionDirectory;
|
string g2IdentifyCollectionDirectory;
|
||||||
string d2FaceLandmarksContentDirectory;
|
string d2FaceLandmarksContentDirectory;
|
||||||
string predictorModelName = predictorModel.ToString();
|
string predictorModelName = predictorModel.ToString();
|
||||||
add = Directory.Exists(string.Concat(Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()"), relativePath));
|
add = Directory.Exists(string.Concat(Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()"), relativePath));
|
||||||
bMetadataSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(B_Metadata), "{}");
|
bMetadataSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(B_Metadata), "{}");
|
||||||
if (Directory.Exists(bMetadataSingletonDirectory))
|
if (Directory.Exists(bMetadataSingletonDirectory))
|
||||||
{
|
{
|
||||||
@ -59,7 +59,7 @@ internal class E3_Rename
|
|||||||
to = Path.Combine(string.Concat(aPropertySingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(aPropertySingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(to);
|
results.Add(to);
|
||||||
}
|
}
|
||||||
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||||
if (Directory.Exists(cResizeContentDirectory))
|
if (Directory.Exists(cResizeContentDirectory))
|
||||||
{
|
{
|
||||||
to = Path.Combine(string.Concat(cResizeContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(cResizeContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
@ -67,37 +67,37 @@ internal class E3_Rename
|
|||||||
}
|
}
|
||||||
foreach (string outputResolution in _Configuration.ValidResolutions)
|
foreach (string outputResolution in _Configuration.ValidResolutions)
|
||||||
{
|
{
|
||||||
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||||
if (Directory.Exists(cResizeSingletonDirectory))
|
if (Directory.Exists(cResizeSingletonDirectory))
|
||||||
{
|
{
|
||||||
to = Path.Combine(string.Concat(cResizeSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(cResizeSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(to);
|
results.Add(to);
|
||||||
}
|
}
|
||||||
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||||
if (Directory.Exists(dFacesContentDirectory))
|
if (Directory.Exists(dFacesContentDirectory))
|
||||||
{
|
{
|
||||||
to = Path.Combine(string.Concat(dFacesContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(dFacesContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(to);
|
results.Add(to);
|
||||||
}
|
}
|
||||||
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
if (Directory.Exists(dFacesCollectionDirectory))
|
if (Directory.Exists(dFacesCollectionDirectory))
|
||||||
{
|
{
|
||||||
to = Path.Combine(string.Concat(dFacesCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(dFacesCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(to);
|
results.Add(to);
|
||||||
}
|
}
|
||||||
d2FaceLandmarksContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(D2_FaceLandmarks), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
d2FaceLandmarksContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D2_FaceLandmarks), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||||
if (add && _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution) && Directory.Exists(d2FaceLandmarksContentDirectory))
|
if (add && _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution) && Directory.Exists(d2FaceLandmarksContentDirectory))
|
||||||
{
|
{
|
||||||
to = Path.Combine(string.Concat(d2FaceLandmarksContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(d2FaceLandmarksContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(to);
|
results.Add(to);
|
||||||
}
|
}
|
||||||
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||||
if (Directory.Exists(eDistanceContentDirectory))
|
if (Directory.Exists(eDistanceContentDirectory))
|
||||||
{
|
{
|
||||||
to = Path.Combine(string.Concat(eDistanceContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(eDistanceContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(to);
|
results.Add(to);
|
||||||
}
|
}
|
||||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
if (Directory.Exists(eDistanceCollectionDirectory))
|
if (Directory.Exists(eDistanceCollectionDirectory))
|
||||||
{
|
{
|
||||||
to = Path.Combine(string.Concat(eDistanceCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(eDistanceCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
@ -142,7 +142,7 @@ internal class E3_Rename
|
|||||||
}
|
}
|
||||||
foreach (string outputResolution in _Configuration.ValidResolutions)
|
foreach (string outputResolution in _Configuration.ValidResolutions)
|
||||||
{
|
{
|
||||||
add = Directory.Exists(string.Concat(Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()"), relativePath));
|
add = Directory.Exists(string.Concat(Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()"), relativePath));
|
||||||
bMetadataSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(B_Metadata), "{}");
|
bMetadataSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(B_Metadata), "{}");
|
||||||
from = string.Concat(bMetadataSingletonDirectory, relativePath);
|
from = string.Concat(bMetadataSingletonDirectory, relativePath);
|
||||||
exists = Directory.Exists(bMetadataSingletonDirectory);
|
exists = Directory.Exists(bMetadataSingletonDirectory);
|
||||||
@ -159,7 +159,7 @@ internal class E3_Rename
|
|||||||
to = Path.Combine(string.Concat(aPropertySingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(aPropertySingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(new string[] { from, to });
|
results.Add(new string[] { from, to });
|
||||||
}
|
}
|
||||||
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||||
from = string.Concat(cResizeContentDirectory, relativePath);
|
from = string.Concat(cResizeContentDirectory, relativePath);
|
||||||
exists = Directory.Exists(cResizeContentDirectory);
|
exists = Directory.Exists(cResizeContentDirectory);
|
||||||
if (exists)
|
if (exists)
|
||||||
@ -167,7 +167,7 @@ internal class E3_Rename
|
|||||||
to = Path.Combine(string.Concat(cResizeContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(cResizeContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(new string[] { from, to });
|
results.Add(new string[] { from, to });
|
||||||
}
|
}
|
||||||
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||||
from = string.Concat(cResizeSingletonDirectory, relativePath);
|
from = string.Concat(cResizeSingletonDirectory, relativePath);
|
||||||
exists = Directory.Exists(cResizeSingletonDirectory);
|
exists = Directory.Exists(cResizeSingletonDirectory);
|
||||||
if (exists)
|
if (exists)
|
||||||
@ -175,7 +175,7 @@ internal class E3_Rename
|
|||||||
to = Path.Combine(string.Concat(cResizeSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(cResizeSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(new string[] { from, to });
|
results.Add(new string[] { from, to });
|
||||||
}
|
}
|
||||||
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||||
from = string.Concat(dFacesContentDirectory, relativePath);
|
from = string.Concat(dFacesContentDirectory, relativePath);
|
||||||
exists = Directory.Exists(dFacesContentDirectory);
|
exists = Directory.Exists(dFacesContentDirectory);
|
||||||
if (exists)
|
if (exists)
|
||||||
@ -183,7 +183,7 @@ internal class E3_Rename
|
|||||||
to = Path.Combine(string.Concat(dFacesContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(dFacesContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(new string[] { from, to });
|
results.Add(new string[] { from, to });
|
||||||
}
|
}
|
||||||
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
from = string.Concat(dFacesCollectionDirectory, relativePath);
|
from = string.Concat(dFacesCollectionDirectory, relativePath);
|
||||||
exists = Directory.Exists(dFacesCollectionDirectory);
|
exists = Directory.Exists(dFacesCollectionDirectory);
|
||||||
if (exists)
|
if (exists)
|
||||||
@ -191,7 +191,7 @@ internal class E3_Rename
|
|||||||
to = Path.Combine(string.Concat(dFacesCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(dFacesCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(new string[] { from, to });
|
results.Add(new string[] { from, to });
|
||||||
}
|
}
|
||||||
d2FaceLandmarksContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(D2_FaceLandmarks), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
d2FaceLandmarksContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D2_FaceLandmarks), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||||
from = string.Concat(d2FaceLandmarksContentDirectory, relativePath);
|
from = string.Concat(d2FaceLandmarksContentDirectory, relativePath);
|
||||||
exists = Directory.Exists(d2FaceLandmarksContentDirectory);
|
exists = Directory.Exists(d2FaceLandmarksContentDirectory);
|
||||||
if (!exists && add && _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution))
|
if (!exists && add && _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution))
|
||||||
@ -201,7 +201,7 @@ internal class E3_Rename
|
|||||||
to = Path.Combine(string.Concat(d2FaceLandmarksContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(d2FaceLandmarksContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(new string[] { from, to });
|
results.Add(new string[] { from, to });
|
||||||
}
|
}
|
||||||
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||||
from = string.Concat(eDistanceContentDirectory, relativePath);
|
from = string.Concat(eDistanceContentDirectory, relativePath);
|
||||||
exists = Directory.Exists(eDistanceContentDirectory);
|
exists = Directory.Exists(eDistanceContentDirectory);
|
||||||
if (exists)
|
if (exists)
|
||||||
@ -209,7 +209,7 @@ internal class E3_Rename
|
|||||||
to = Path.Combine(string.Concat(eDistanceContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
to = Path.Combine(string.Concat(eDistanceContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||||
results.Add(new string[] { from, to });
|
results.Add(new string[] { from, to });
|
||||||
}
|
}
|
||||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
from = string.Concat(eDistanceCollectionDirectory, relativePath);
|
from = string.Concat(eDistanceCollectionDirectory, relativePath);
|
||||||
exists = Directory.Exists(eDistanceCollectionDirectory);
|
exists = Directory.Exists(eDistanceCollectionDirectory);
|
||||||
if (exists)
|
if (exists)
|
||||||
|
@ -211,8 +211,8 @@ internal class E_Distance
|
|||||||
string[] changesFrom = new string[] { nameof(A_Property), nameof(B_Metadata), nameof(C_Resize), nameof(D_Face) };
|
string[] changesFrom = new string[] { nameof(A_Property), nameof(B_Metadata), nameof(C_Resize), nameof(D_Face) };
|
||||||
List<DateTime> dateTimes = (from l in sourceDirectoryChanges where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in sourceDirectoryChanges where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
List<string> directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
List<string> directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration,
|
||||||
model.ToString(),
|
model,
|
||||||
predictorModel.ToString(),
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(E_Distance),
|
nameof(E_Distance),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
@ -274,7 +274,7 @@ internal class E_Distance
|
|||||||
string json;
|
string json;
|
||||||
List<KeyValuePair<string, Shared.Models.Face[]>>? facesKeyValuePairCollection;
|
List<KeyValuePair<string, Shared.Models.Face[]>>? facesKeyValuePairCollection;
|
||||||
List<(string, List<KeyValuePair<string, Shared.Models.Face[]>>)> results = new();
|
List<(string, List<KeyValuePair<string, Shared.Models.Face[]>>)> results = new();
|
||||||
string dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model.ToString(), predictorModel.ToString(), nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[[]]");
|
string dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[[]]");
|
||||||
string[] dFacesCollectionFiles = Directory.GetFiles(dFacesCollectionDirectory, "*.json", SearchOption.TopDirectoryOnly);
|
string[] dFacesCollectionFiles = Directory.GetFiles(dFacesCollectionDirectory, "*.json", SearchOption.TopDirectoryOnly);
|
||||||
foreach (string dFacesCollectionFile in dFacesCollectionFiles)
|
foreach (string dFacesCollectionFile in dFacesCollectionFiles)
|
||||||
{
|
{
|
||||||
@ -327,7 +327,7 @@ internal class E_Distance
|
|||||||
private void Save(Property.Models.Configuration configuration, Model model, PredictorModel predictorModel, string outputResolution, string eDistanceCollectionDirectory, int k, string relativePath, Shared.Models.Face face, List<Tuple<Shared.Models.Face, string>> faceAndFaceDistanceCollection)
|
private void Save(Property.Models.Configuration configuration, Model model, PredictorModel predictorModel, string outputResolution, string eDistanceCollectionDirectory, int k, string relativePath, Shared.Models.Face face, List<Tuple<Shared.Models.Face, string>> faceAndFaceDistanceCollection)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(eDistanceCollectionDirectory))
|
if (string.IsNullOrEmpty(eDistanceCollectionDirectory))
|
||||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model.ToString(), predictorModel.ToString(), nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(face.RelativePath);
|
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(face.RelativePath);
|
||||||
string jsonDirectory = string.Concat(eDistanceCollectionDirectory, Path.Combine(relativePath, fileNameWithoutExtension));
|
string jsonDirectory = string.Concat(eDistanceCollectionDirectory, Path.Combine(relativePath, fileNameWithoutExtension));
|
||||||
if (!Directory.Exists(jsonDirectory))
|
if (!Directory.Exists(jsonDirectory))
|
||||||
|
@ -112,7 +112,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
|||||||
foreach (Tuple<string, Dictionary<int, G_Index>> tuple in indexInfoTuples)
|
foreach (Tuple<string, Dictionary<int, G_Index>> tuple in indexInfoTuples)
|
||||||
{
|
{
|
||||||
indices = (from l in tuple.Item2 select l.Value).ToArray();
|
indices = (from l in tuple.Item2 select l.Value).ToArray();
|
||||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, model.ToString(), predictorModel.ToString(), tuple.Item1, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: string.Empty, collectionDescription: "Unknown A");
|
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, model, predictorModel, tuple.Item1, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: string.Empty, collectionDescription: "Unknown A");
|
||||||
json = JsonSerializer.Serialize(indices, _WriteIndentedJsonSerializerOptions);
|
json = JsonSerializer.Serialize(indices, _WriteIndentedJsonSerializerOptions);
|
||||||
if (!Property.Models.Stateless.IPath.WriteAllText(string.Concat(directoryInfoCollection[0].Replace("<>", "[]"), ".json"), json, compareBeforeWrite: true))
|
if (!Property.Models.Stateless.IPath.WriteAllText(string.Concat(directoryInfoCollection[0].Replace("<>", "[]"), ".json"), json, compareBeforeWrite: true))
|
||||||
continue;
|
continue;
|
||||||
@ -138,7 +138,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
|||||||
maximumDateTime = (from l in dateTimes where l.HasValue select l.Value).Max();
|
maximumDateTime = (from l in dateTimes where l.HasValue select l.Value).Max();
|
||||||
minimumDateTime = (from l in dateTimes where l.HasValue select l.Value).Min();
|
minimumDateTime = (from l in dateTimes where l.HasValue select l.Value).Min();
|
||||||
}
|
}
|
||||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, model.ToString(), predictorModel.ToString(), tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unkown B", collectionDescription: string.Empty);
|
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, model, predictorModel, tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unkown B", collectionDescription: string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
|||||||
foreach (KeyValuePair<string, List<Tuple<string, A_Property>>> tuples in filePropertiesKeyValuePairs)
|
foreach (KeyValuePair<string, List<Tuple<string, A_Property>>> tuples in filePropertiesKeyValuePairs)
|
||||||
{
|
{
|
||||||
valuePairs = new Dictionary<int, G_Index>();
|
valuePairs = new Dictionary<int, G_Index>();
|
||||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, model.ToString(), predictorModel.ToString(), tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unknown C", collectionDescription: string.Empty);
|
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, model, predictorModel, tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unknown C", collectionDescription: string.Empty);
|
||||||
foreach (Tuple<string, A_Property> tuple in tuples.Value)
|
foreach (Tuple<string, A_Property> tuple in tuples.Value)
|
||||||
{
|
{
|
||||||
fileInfo = new FileInfo(Path.Combine(directoryInfoCollection[0].Replace("<>", "{}"), string.Concat(Path.GetFileNameWithoutExtension(tuple.Item1), ".json")));
|
fileInfo = new FileInfo(Path.Combine(directoryInfoCollection[0].Replace("<>", "{}"), string.Concat(Path.GetFileNameWithoutExtension(tuple.Item1), ".json")));
|
||||||
|
@ -3,6 +3,7 @@ using Phares.Shared;
|
|||||||
using View_by_Distance.Not.Copy.Copy.Models;
|
using View_by_Distance.Not.Copy.Copy.Models;
|
||||||
using View_by_Distance.Property.Models;
|
using View_by_Distance.Property.Models;
|
||||||
using View_by_Distance.Shared.Models.Methods;
|
using View_by_Distance.Shared.Models.Methods;
|
||||||
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
|
|
||||||
namespace View_by_Distance.Not.Copy.Copy;
|
namespace View_by_Distance.Not.Copy.Copy;
|
||||||
|
|
||||||
@ -38,8 +39,8 @@ public class NotCopyCopy
|
|||||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||||
Verify(configuration);
|
Verify(configuration);
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
string modelName = nameof(modelName);
|
Model model = Model.Hog;
|
||||||
string predictorModelName = nameof(predictorModelName);
|
PredictorModel predictorModel = PredictorModel.Large;
|
||||||
_Configuration = configuration;
|
_Configuration = configuration;
|
||||||
if (propertyConfiguration.PopulatePropertyId is null)
|
if (propertyConfiguration.PopulatePropertyId is null)
|
||||||
throw new Exception($"{nameof(propertyConfiguration.PopulatePropertyId)} is null!");
|
throw new Exception($"{nameof(propertyConfiguration.PopulatePropertyId)} is null!");
|
||||||
@ -47,9 +48,9 @@ public class NotCopyCopy
|
|||||||
throw new Exception("This program only allows development environments!");
|
throw new Exception("This program only allows development environments!");
|
||||||
PropertyLogic propertyLogic = GetPropertyLogic();
|
PropertyLogic propertyLogic = GetPropertyLogic();
|
||||||
propertyConfiguration.ChangeRootDirectory(configuration.CompareSource);
|
propertyConfiguration.ChangeRootDirectory(configuration.CompareSource);
|
||||||
List<PropertyHolder[]> comparePropertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, modelName, predictorModelName, propertyLogic);
|
List<PropertyHolder[]> comparePropertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, model, predictorModel, propertyLogic);
|
||||||
propertyConfiguration.ChangeRootDirectory(configuration.SelectedSource);
|
propertyConfiguration.ChangeRootDirectory(configuration.SelectedSource);
|
||||||
List<PropertyHolder[]> selectedPropertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, modelName, predictorModelName, propertyLogic);
|
List<PropertyHolder[]> selectedPropertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, model, predictorModel, propertyLogic);
|
||||||
if (comparePropertyHolderCollections.Count == selectedPropertyHolderCollections.Count)
|
if (comparePropertyHolderCollections.Count == selectedPropertyHolderCollections.Count)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
string directoryName;
|
string directoryName;
|
||||||
|
@ -41,8 +41,6 @@ public class PrepareForOld
|
|||||||
Property.Models.Configuration.Verify(propertyConfiguration);
|
Property.Models.Configuration.Verify(propertyConfiguration);
|
||||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||||
Verify(configuration);
|
Verify(configuration);
|
||||||
string modelName = nameof(modelName);
|
|
||||||
string predictorModelName = nameof(predictorModelName);
|
|
||||||
if (propertyConfiguration.IgnoreExtensions is null)
|
if (propertyConfiguration.IgnoreExtensions is null)
|
||||||
throw new Exception($"{nameof(propertyConfiguration.IgnoreExtensions)} is null!");
|
throw new Exception($"{nameof(propertyConfiguration.IgnoreExtensions)} is null!");
|
||||||
for (int i = 0; i < configuration.Spelling.Length; i++)
|
for (int i = 0; i < configuration.Spelling.Length; i++)
|
||||||
|
@ -691,13 +691,13 @@ public class PropertyLogic
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private string SetAngleBracketCollectionAndGetZero(Configuration configuration, string modelName, string predictorModelName, string sourceDirectory)
|
private string SetAngleBracketCollectionAndGetZero(Configuration configuration, Model model, PredictorModel predictorModel, string sourceDirectory)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
AngleBracketCollection.Clear();
|
AngleBracketCollection.Clear();
|
||||||
AngleBracketCollection.AddRange(IResult.GetDirectoryInfoCollection(configuration,
|
AngleBracketCollection.AddRange(IResult.GetDirectoryInfoCollection(configuration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(A_Property),
|
nameof(A_Property),
|
||||||
string.Empty,
|
string.Empty,
|
||||||
@ -711,7 +711,7 @@ public class PropertyLogic
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ParallelWork(Configuration configuration, string modelName, string predictorModelName, long ticks, List<PropertyHolder[]> propertyHolderCollections, bool firstPass)
|
public void ParallelWork(Configuration configuration, Model model, PredictorModel predictorModel, long ticks, List<PropertyHolder[]> propertyHolderCollections, bool firstPass)
|
||||||
{
|
{
|
||||||
if (_Log is null)
|
if (_Log is null)
|
||||||
throw new Exception($"{nameof(_Log)} is null!");
|
throw new Exception($"{nameof(_Log)} is null!");
|
||||||
@ -743,7 +743,7 @@ public class PropertyLogic
|
|||||||
r = filteredPropertyHolderCollection[0].R;
|
r = filteredPropertyHolderCollection[0].R;
|
||||||
sourceDirectory = filteredPropertyHolderCollection[0].SourceDirectory;
|
sourceDirectory = filteredPropertyHolderCollection[0].SourceDirectory;
|
||||||
totalSeconds = (int)Math.Truncate(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
totalSeconds = (int)Math.Truncate(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||||
angleBracket = SetAngleBracketCollectionAndGetZero(configuration, modelName, predictorModelName, sourceDirectory);
|
angleBracket = SetAngleBracketCollectionAndGetZero(configuration, model, predictorModel, sourceDirectory);
|
||||||
ParallelWork(firstPass, exceptions, sourceDirectoryChanges, propertyHolderCollectionsCount, g, sourceDirectory, r, filteredPropertyHolderCollection, totalSeconds, angleBracket);
|
ParallelWork(firstPass, exceptions, sourceDirectoryChanges, propertyHolderCollectionsCount, g, sourceDirectory, r, filteredPropertyHolderCollection, totalSeconds, angleBracket);
|
||||||
foreach (Exception exception in exceptions)
|
foreach (Exception exception in exceptions)
|
||||||
_Log.Error(string.Concat(sourceDirectory, Environment.NewLine, exception.Message, Environment.NewLine, exception.StackTrace), exception);
|
_Log.Error(string.Concat(sourceDirectory, Environment.NewLine, exception.Message, Environment.NewLine, exception.StackTrace), exception);
|
||||||
@ -786,7 +786,7 @@ public class PropertyLogic
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (long Ticks, string FilteredSourceDirectoryFile, string PropertyDirectory, int PropertyId)[] GetPropertyIds(Configuration configuration, string modelName, string predictorModelName, List<DirectoryInfo> groupCollection, bool saveToCollection)
|
public (long Ticks, string FilteredSourceDirectoryFile, string PropertyDirectory, int PropertyId)[] GetPropertyIds(Configuration configuration, Model model, PredictorModel predictorModel, List<DirectoryInfo> groupCollection, bool saveToCollection)
|
||||||
{
|
{
|
||||||
List<(long Ticks, string FilteredSourceDirectoryFile, string PropertyDirectory, int PropertyId)> results = new();
|
List<(long Ticks, string FilteredSourceDirectoryFile, string PropertyDirectory, int PropertyId)> results = new();
|
||||||
int level;
|
int level;
|
||||||
@ -797,7 +797,7 @@ public class PropertyLogic
|
|||||||
string propertyDirectory;
|
string propertyDirectory;
|
||||||
foreach (DirectoryInfo group in groupCollection)
|
foreach (DirectoryInfo group in groupCollection)
|
||||||
{
|
{
|
||||||
angleBracket = SetAngleBracketCollectionAndGetZero(configuration, modelName, predictorModelName, group.SourceDirectory);
|
angleBracket = SetAngleBracketCollectionAndGetZero(configuration, model, predictorModel, group.SourceDirectory);
|
||||||
if (string.IsNullOrEmpty(group.SourceDirectory))
|
if (string.IsNullOrEmpty(group.SourceDirectory))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
if (!saveToCollection)
|
if (!saveToCollection)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
|
|
||||||
namespace View_by_Distance.Property.Models.Stateless;
|
namespace View_by_Distance.Property.Models.Stateless;
|
||||||
|
|
||||||
@ -235,7 +236,7 @@ public static class A_Property
|
|||||||
results.Add(new(g, sourceDirectory, collection, r));
|
results.Add(new(g, sourceDirectory, collection, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<PropertyHolder[]> Get(Models.Configuration configuration, bool reverse, string modelName, string predictorModelName, PropertyLogic propertyLogic)
|
public static List<PropertyHolder[]> Get(Models.Configuration configuration, bool reverse, Model model, PredictorModel predictorModel, PropertyLogic propertyLogic)
|
||||||
{
|
{
|
||||||
List<PropertyHolder[]> results;
|
List<PropertyHolder[]> results;
|
||||||
string searchPattern = "*";
|
string searchPattern = "*";
|
||||||
@ -249,7 +250,7 @@ public static class A_Property
|
|||||||
fileInfoGroupCollection = GetFileInfoGroupCollection(configuration, reverse, searchPattern, topDirectories);
|
fileInfoGroupCollection = GetFileInfoGroupCollection(configuration, reverse, searchPattern, topDirectories);
|
||||||
collectionFromJson = GetCollection(aPropertySingletonDirectory, jsonCollection);
|
collectionFromJson = GetCollection(aPropertySingletonDirectory, jsonCollection);
|
||||||
results = Populate(configuration, aPropertySingletonDirectory, fileInfoGroupCollection, collectionFromJson);
|
results = Populate(configuration, aPropertySingletonDirectory, fileInfoGroupCollection, collectionFromJson);
|
||||||
propertyLogic.ParallelWork(configuration, modelName, predictorModelName, ticks, results, firstPass: false);
|
propertyLogic.ParallelWork(configuration, model, predictorModel, ticks, results, firstPass: false);
|
||||||
if (propertyLogic.ExceptionsDirectories.Any())
|
if (propertyLogic.ExceptionsDirectories.Any())
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
return results;
|
return results;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
|
|
||||||
namespace View_by_Distance.Property.Models.Stateless;
|
namespace View_by_Distance.Property.Models.Stateless;
|
||||||
|
|
||||||
public interface IResult
|
public interface IResult
|
||||||
@ -15,10 +17,10 @@ public interface IResult
|
|||||||
string TestStatic_GetResultsDateGroupDirectory(Models.Configuration configuration, string description, string jsonGroup);
|
string TestStatic_GetResultsDateGroupDirectory(Models.Configuration configuration, string description, string jsonGroup);
|
||||||
static string GetResultsDateGroupDirectory(Models.Configuration configuration, string description, string jsonGroup) => Result.GetResultsDateGroupDirectory(configuration, description, jsonGroup);
|
static string GetResultsDateGroupDirectory(Models.Configuration configuration, string description, string jsonGroup) => Result.GetResultsDateGroupDirectory(configuration, description, jsonGroup);
|
||||||
|
|
||||||
string TestStatic_GetResultsFullGroupDirectory(Models.Configuration configuration, string modelName, string predictorModelName, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel);
|
string TestStatic_GetResultsFullGroupDirectory(Models.Configuration configuration, Model model, PredictorModel predictorModel, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel);
|
||||||
static string GetResultsFullGroupDirectory(Models.Configuration configuration, string modelName, string predictorModelName, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel) => Result.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
static string GetResultsFullGroupDirectory(Models.Configuration configuration, Model model, PredictorModel predictorModel, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel) => Result.GetResultsFullGroupDirectory(configuration, model, predictorModel, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||||
|
|
||||||
List<string> TestStatic_GetDirectoryInfoCollection(Models.Configuration configuration, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription);
|
List<string> TestStatic_GetDirectoryInfoCollection(Models.Configuration configuration, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription);
|
||||||
static List<string> GetDirectoryInfoCollection(Models.Configuration configuration, string modelName, string predictorModelName, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription) => Result.GetDirectoryInfoCollection(configuration, modelName, predictorModelName, sourceDirectory, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel, contentDescription, singletonDescription, collectionDescription);
|
static List<string> GetDirectoryInfoCollection(Models.Configuration configuration, Model model, PredictorModel predictorModel, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription) => Result.GetDirectoryInfoCollection(configuration, model, predictorModel, sourceDirectory, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel, contentDescription, singletonDescription, collectionDescription);
|
||||||
|
|
||||||
}
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
|
|
||||||
namespace View_by_Distance.Property.Models.Stateless;
|
namespace View_by_Distance.Property.Models.Stateless;
|
||||||
|
|
||||||
internal class Result
|
internal class Result
|
||||||
@ -33,14 +35,14 @@ internal class Result
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetResultsFullGroupDirectory(Models.Configuration configuration, string modelName, string predictorModelName, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel)
|
internal static string GetResultsFullGroupDirectory(Models.Configuration configuration, Model model, PredictorModel predictorModel, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel)
|
||||||
{
|
{
|
||||||
string result = GetResultsDateGroupDirectory(configuration, description);
|
string result = GetResultsDateGroupDirectory(configuration, description);
|
||||||
if (includeResizeGroup)
|
if (includeResizeGroup)
|
||||||
result = Path.Combine(result, outputResolution);
|
result = Path.Combine(result, outputResolution);
|
||||||
if (includeModel && includePredictorModel)
|
if (includeModel && includePredictorModel)
|
||||||
{
|
{
|
||||||
string dateGroupDirectory = string.Concat(outputResolution.Replace(" ", string.Empty), " - ", modelName, " - ", predictorModelName);
|
string dateGroupDirectory = string.Concat(outputResolution.Replace(" ", string.Empty), " - ", model, " - ", predictorModel.ToString());
|
||||||
result = Path.Combine(result, dateGroupDirectory);
|
result = Path.Combine(result, dateGroupDirectory);
|
||||||
}
|
}
|
||||||
else if (includeModel)
|
else if (includeModel)
|
||||||
@ -52,13 +54,13 @@ internal class Result
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static List<string> GetDirectoryInfoCollection(Models.Configuration configuration, string modelName, string predictorModelName, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription)
|
internal static List<string> GetDirectoryInfoCollection(Models.Configuration configuration, Model model, PredictorModel predictorModel, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription)
|
||||||
{
|
{
|
||||||
List<string> results = new();
|
List<string> results = new();
|
||||||
string result = string.Empty;
|
string result = string.Empty;
|
||||||
string checkDirectory;
|
string checkDirectory;
|
||||||
string sourceDirectorySegment = GetRelativePath(configuration, sourceDirectory);
|
string sourceDirectorySegment = GetRelativePath(configuration, sourceDirectory);
|
||||||
string dateGroupDirectory = IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
string dateGroupDirectory = IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||||
if (!string.IsNullOrEmpty(contentDescription))
|
if (!string.IsNullOrEmpty(contentDescription))
|
||||||
{
|
{
|
||||||
result = string.Concat(Path.Combine(dateGroupDirectory, "<>"), sourceDirectorySegment);
|
result = string.Concat(Path.Combine(dateGroupDirectory, "<>"), sourceDirectorySegment);
|
||||||
|
@ -7,6 +7,7 @@ using System.Drawing.Imaging;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using View_by_Distance.Metadata.Models;
|
using View_by_Distance.Metadata.Models;
|
||||||
using View_by_Distance.Resize.Models;
|
using View_by_Distance.Resize.Models;
|
||||||
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
using View_by_Distance.Shared.Models.Stateless.Methods;
|
using View_by_Distance.Shared.Models.Stateless.Methods;
|
||||||
using View_by_Distance.Tests.Models;
|
using View_by_Distance.Tests.Models;
|
||||||
|
|
||||||
@ -103,15 +104,15 @@ public class UnitTestResize
|
|||||||
throw new Exception($"{nameof(_Configuration.PropertiesChangedForResize)} is null!");
|
throw new Exception($"{nameof(_Configuration.PropertiesChangedForResize)} is null!");
|
||||||
int g = 1;
|
int g = 1;
|
||||||
int r = 1;
|
int r = 1;
|
||||||
|
Model model = Model.Hog;
|
||||||
string original = "Original";
|
string original = "Original";
|
||||||
List<string> parseExceptions = new();
|
List<string> parseExceptions = new();
|
||||||
string modelName = "model.ToString()";
|
|
||||||
Property.Models.A_Property? property = null;
|
Property.Models.A_Property? property = null;
|
||||||
Property.Models.PropertyHolder propertyHolder;
|
Property.Models.PropertyHolder propertyHolder;
|
||||||
Dictionary<string, int[]> imageResizeKeyValuePairs;
|
Dictionary<string, int[]> imageResizeKeyValuePairs;
|
||||||
List<Tuple<string, DateTime>> subFileTuples = new();
|
List<Tuple<string, DateTime>> subFileTuples = new();
|
||||||
|
PredictorModel predictorModel = PredictorModel.Large;
|
||||||
List<KeyValuePair<string, string>> metadataCollection;
|
List<KeyValuePair<string, string>> metadataCollection;
|
||||||
string predictorModelName = "predictorModel.ToString()";
|
|
||||||
int length = _PropertyConfiguration.RootDirectory.Length;
|
int length = _PropertyConfiguration.RootDirectory.Length;
|
||||||
string outputResolution = _Configuration.OutputResolutions[0];
|
string outputResolution = _Configuration.OutputResolutions[0];
|
||||||
Property.Models.PropertyLogic propertyLogic = GetPropertyLogic();
|
Property.Models.PropertyLogic propertyLogic = GetPropertyLogic();
|
||||||
@ -121,8 +122,8 @@ public class UnitTestResize
|
|||||||
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality.Value);
|
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality.Value);
|
||||||
C_Resize resize = new(_Configuration.ForceResizeLastWriteTimeToCreationTime.Value, _Configuration.OverrideForResizeImages.Value, _Configuration.PropertiesChangedForResize.Value, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters);
|
C_Resize resize = new(_Configuration.ForceResizeLastWriteTimeToCreationTime.Value, _Configuration.OverrideForResizeImages.Value, _Configuration.PropertiesChangedForResize.Value, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters);
|
||||||
propertyLogic.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(_PropertyConfiguration,
|
propertyLogic.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(_PropertyConfiguration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(Property.Models.A_Property),
|
nameof(Property.Models.A_Property),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
@ -133,8 +134,8 @@ public class UnitTestResize
|
|||||||
singletonDescription: "Properties for each image",
|
singletonDescription: "Properties for each image",
|
||||||
collectionDescription: string.Empty));
|
collectionDescription: string.Empty));
|
||||||
metadata.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(_PropertyConfiguration,
|
metadata.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(_PropertyConfiguration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(B_Metadata),
|
nameof(B_Metadata),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
@ -145,8 +146,8 @@ public class UnitTestResize
|
|||||||
singletonDescription: "Metadata as key value pairs",
|
singletonDescription: "Metadata as key value pairs",
|
||||||
collectionDescription: string.Empty));
|
collectionDescription: string.Empty));
|
||||||
resize.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(_PropertyConfiguration,
|
resize.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(_PropertyConfiguration,
|
||||||
modelName,
|
model,
|
||||||
predictorModelName,
|
predictorModel,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(C_Resize),
|
nameof(C_Resize),
|
||||||
outputResolution,
|
outputResolution,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user