Moved Model Name and Predictor Model Name to
Property Configuration
This commit is contained in:
parent
a6168f5976
commit
d951ad6696
@ -5,7 +5,6 @@ using System.Text.Json;
|
||||
using View_by_Distance.Compare.Models;
|
||||
using View_by_Distance.Property.Models;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
using View_by_Distance.Shared.Models.Stateless;
|
||||
using WindowsShortcutFactory;
|
||||
|
||||
namespace View_by_Distance.Compare;
|
||||
@ -50,16 +49,14 @@ public class Compare
|
||||
Property.Models.Configuration.Verify(propertyConfiguration, requireExist: true);
|
||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||
Verify(configuration);
|
||||
Model? model = null;
|
||||
bool reverse = false;
|
||||
string outputExtension = ".jpg";
|
||||
PredictorModel? predictorModel = null;
|
||||
string eResultsFullGroupDirectory = string.Empty;
|
||||
string a2PeopleSingletonDirectory = string.Empty;
|
||||
Map.Models.Configuration? mapConfiguration = null;
|
||||
Shared.Models.PersonContainer[] personContainers = Array.Empty<Shared.Models.PersonContainer>();
|
||||
Map.Models.MapLogic mapLogic = new(_AppSettings.MaxDegreeOfParallelism, propertyConfiguration, mapConfiguration, ticks, personContainers, a2PeopleSingletonDirectory, eResultsFullGroupDirectory);
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, model, outputExtension, predictorModel, mapLogic);
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, outputExtension, mapLogic);
|
||||
foreach (string spelling in configuration.Spelling)
|
||||
{
|
||||
segments = spelling.Split('|');
|
||||
@ -207,7 +204,7 @@ public class Compare
|
||||
_Log.Information(". . .");
|
||||
}
|
||||
string aPropertyContentCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(propertyConfiguration, nameof(A_Property), "[()]");
|
||||
ThirdPassToMove(propertyConfiguration, model, predictorModel, mapLogic, propertyLogic, containers, aPropertyContentCollectionDirectory);
|
||||
ThirdPassToMove(propertyConfiguration, mapLogic, propertyLogic, containers, aPropertyContentCollectionDirectory);
|
||||
if (!isSilent)
|
||||
{
|
||||
_Log.Information("Third pass completed");
|
||||
@ -219,7 +216,7 @@ public class Compare
|
||||
}
|
||||
_Log.Information(". . .");
|
||||
}
|
||||
FourthPassCreateWindowsShortcuts(propertyConfiguration, model, predictorModel, mapLogic, propertyLogic, containers, saveToCollection: false, keepAll: false);
|
||||
FourthPassCreateWindowsShortcuts(propertyConfiguration, mapLogic, propertyLogic, containers, saveToCollection: false, keepAll: false);
|
||||
if (!isSilent)
|
||||
{
|
||||
_Log.Information("Fourth pass completed");
|
||||
@ -388,12 +385,12 @@ public class Compare
|
||||
return result;
|
||||
}
|
||||
|
||||
private A_Property GetPropertyLogic(bool reverse, Model? model, string outputExtension, PredictorModel? predictorModel, Map.Models.MapLogic mapLogic)
|
||||
private A_Property GetPropertyLogic(bool reverse, string outputExtension, Map.Models.MapLogic mapLogic)
|
||||
{
|
||||
A_Property result;
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse, model, predictorModel);
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse);
|
||||
string fromPrepareForOld = "34720-637858334555170379.tsv";
|
||||
string fromPrepareForOldFile = Path.Combine(_Configuration.PropertyConfiguration.RootDirectory, fromPrepareForOld);
|
||||
if (File.Exists(fromPrepareForOldFile))
|
||||
@ -746,7 +743,7 @@ public class Compare
|
||||
}
|
||||
}
|
||||
|
||||
private void ThirdPassToMove(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, Map.Models.MapLogic mapLogic, A_Property propertyLogic, Shared.Models.Container[] containers, string aPropertyContentCollectionDirectory)
|
||||
private void ThirdPassToMove(Property.Models.Configuration configuration, Map.Models.MapLogic mapLogic, A_Property propertyLogic, Shared.Models.Container[] containers, string aPropertyContentCollectionDirectory)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
@ -824,7 +821,7 @@ public class Compare
|
||||
}
|
||||
}
|
||||
|
||||
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, Map.Models.MapLogic mapLogic, A_Property propertyLogic, Shared.Models.Container[] containers, bool saveToCollection, bool keepAll)
|
||||
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, Map.Models.MapLogic mapLogic, A_Property propertyLogic, Shared.Models.Container[] containers, bool saveToCollection, bool keepAll)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
|
@ -6,7 +6,7 @@ namespace View_by_Distance.Compare.Models.Binder;
|
||||
public class Configuration
|
||||
{
|
||||
[Display(Name = "Diff Property Directory"), Required] public string DiffPropertyDirectory { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration? PropertyConfiguration { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
|
||||
[Display(Name = "Rename"), Required] public string[] Rename { get; set; }
|
||||
[Display(Name = "Rename B"), Required] public string[] RenameB { get; set; }
|
||||
[Display(Name = "Rename C"), Required] public string[] RenameC { get; set; }
|
||||
|
@ -7,20 +7,20 @@ public class Configuration
|
||||
{
|
||||
|
||||
protected readonly string _DiffPropertyDirectory;
|
||||
protected Property.Models.Configuration? _PropertyConfiguration;
|
||||
protected Property.Models.Configuration _PropertyConfiguration;
|
||||
protected readonly string[] _Rename;
|
||||
protected readonly string[] _RenameB;
|
||||
protected readonly string[] _RenameC;
|
||||
protected readonly string[] _Spelling;
|
||||
public string DiffPropertyDirectory => _DiffPropertyDirectory;
|
||||
public Property.Models.Configuration? PropertyConfiguration => _PropertyConfiguration;
|
||||
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
||||
public string[] Rename => _Rename;
|
||||
public string[] RenameB => _RenameB;
|
||||
public string[] RenameC => _RenameC;
|
||||
public string[] Spelling => _Spelling;
|
||||
|
||||
[JsonConstructor]
|
||||
public Configuration(string diffPropertyDirectory, Property.Models.Configuration? propertyConfiguration, string[] rename, string[] renameB, string[] renameC, string[] spelling)
|
||||
public Configuration(string diffPropertyDirectory, Property.Models.Configuration propertyConfiguration, string[] rename, string[] renameB, string[] renameC, string[] spelling)
|
||||
{
|
||||
_DiffPropertyDirectory = diffPropertyDirectory;
|
||||
_PropertyConfiguration = propertyConfiguration;
|
||||
@ -36,8 +36,10 @@ public class Configuration
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
|
||||
|
||||
public void Update() => _PropertyConfiguration?.Update();
|
||||
public void SetAndUpdate(Property.Models.Configuration configuration, int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
|
||||
{
|
||||
_PropertyConfiguration = configuration;
|
||||
_PropertyConfiguration.Update(numberOfJitters, numberOfTimesToUpsample, modelName, predictorModelName);
|
||||
}
|
||||
|
||||
}
|
@ -19,8 +19,7 @@ public abstract class Configuration
|
||||
if (result is null)
|
||||
throw new Exception(json);
|
||||
string jsonThis = result.ToString();
|
||||
result.Set(propertyConfiguration);
|
||||
result.Update();
|
||||
result.SetAndUpdate(propertyConfiguration, null, null, null, null);
|
||||
if (jsonThis != json)
|
||||
{
|
||||
int? check = null;
|
||||
|
@ -5,7 +5,6 @@ using System.Text;
|
||||
using View_by_Distance.Date.Group.Models;
|
||||
using View_by_Distance.Property.Models;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
using View_by_Distance.Shared.Models.Stateless;
|
||||
using WindowsShortcutFactory;
|
||||
|
||||
namespace View_by_Distance.Date.Group;
|
||||
@ -40,10 +39,8 @@ public class DateGroup
|
||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||
Verify(configuration);
|
||||
bool reverse = false;
|
||||
Model? model = null;
|
||||
_Configuration = configuration;
|
||||
string outputExtension = ".jpg";
|
||||
PredictorModel? predictorModel = null;
|
||||
if (configuration.ByHash is null)
|
||||
throw new NullReferenceException(nameof(configuration.ByHash));
|
||||
if (configuration.ByCreateDateShortcut is null)
|
||||
@ -51,7 +48,7 @@ public class DateGroup
|
||||
if (!_IsEnvironment.Development)
|
||||
throw new Exception("This program only allows development environments!");
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, model, outputExtension, predictorModel);
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, outputExtension);
|
||||
string[] dbFiles = Directory.GetFiles(propertyConfiguration.RootDirectory, "*.db", SearchOption.AllDirectories);
|
||||
foreach (string dbFile in dbFiles)
|
||||
File.Delete(dbFile);
|
||||
@ -325,12 +322,12 @@ public class DateGroup
|
||||
return results;
|
||||
}
|
||||
|
||||
private A_Property GetPropertyLogic(bool reverse, Model? model, string outputExtension, PredictorModel? predictorModel)
|
||||
private A_Property GetPropertyLogic(bool reverse, string outputExtension)
|
||||
{
|
||||
A_Property result;
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse, model, predictorModel);
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ public class Configuration
|
||||
[Display(Name = "By Season"), Required] public bool? BySeason { get; set; }
|
||||
[Display(Name = "By Week"), Required] public bool? ByWeek { get; set; }
|
||||
[Display(Name = "Ignore Subdirectories for Rename"), Required] public bool? KeepFullPath { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration? PropertyConfiguration { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
|
||||
|
||||
public Configuration()
|
||||
{
|
||||
|
@ -12,17 +12,17 @@ public class Configuration
|
||||
protected readonly bool? _BySeason;
|
||||
protected readonly bool? _ByWeek;
|
||||
protected readonly bool? _KeepFullPath;
|
||||
protected Property.Models.Configuration? _PropertyConfiguration;
|
||||
protected Property.Models.Configuration _PropertyConfiguration;
|
||||
public bool? ByCreateDateShortcut => _ByCreateDateShortcut;
|
||||
public bool? ByDay => _ByDay;
|
||||
public bool? ByHash => _ByHash;
|
||||
public bool? BySeason => _BySeason;
|
||||
public bool? ByWeek => _ByWeek;
|
||||
public bool? KeepFullPath => _KeepFullPath;
|
||||
public Property.Models.Configuration? PropertyConfiguration => _PropertyConfiguration;
|
||||
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
||||
|
||||
[JsonConstructor]
|
||||
public Configuration(bool? byCreateDateShortcut, bool? byDay, bool? byHash, bool? bySeason, bool? byWeek, bool? keepFullPath, Property.Models.Configuration? propertyConfiguration)
|
||||
public Configuration(bool? byCreateDateShortcut, bool? byDay, bool? byHash, bool? bySeason, bool? byWeek, bool? keepFullPath, Property.Models.Configuration propertyConfiguration)
|
||||
{
|
||||
_ByCreateDateShortcut = byCreateDateShortcut;
|
||||
_ByDay = byDay;
|
||||
@ -39,8 +39,10 @@ public class Configuration
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
|
||||
|
||||
public void Update() => _PropertyConfiguration?.Update();
|
||||
public void SetAndUpdate(Property.Models.Configuration configuration, int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
|
||||
{
|
||||
_PropertyConfiguration = configuration;
|
||||
_PropertyConfiguration.Update(numberOfJitters, numberOfTimesToUpsample, modelName, predictorModelName);
|
||||
}
|
||||
|
||||
}
|
@ -19,8 +19,7 @@ public abstract class Configuration
|
||||
if (result is null)
|
||||
throw new Exception(json);
|
||||
string jsonThis = result.ToString();
|
||||
result.Set(propertyConfiguration);
|
||||
result.Update();
|
||||
result.SetAndUpdate(propertyConfiguration, null, null, null, null);
|
||||
if (jsonThis != json)
|
||||
{
|
||||
int? check = null;
|
||||
|
@ -370,6 +370,8 @@ public partial class E_Distance
|
||||
checkFaces.Clear();
|
||||
foreach ((string mappedFaceFile, int normalizedPixelPercentage) in collection)
|
||||
{
|
||||
if (!filteredFaces.Any())
|
||||
break;
|
||||
mappedFaceFileName = Path.GetFileName(mappedFaceFile);
|
||||
if (_DuplicateMappedFaceFiles.Contains(mappedFaceFileName))
|
||||
continue;
|
||||
|
@ -337,10 +337,10 @@ public class D_Face
|
||||
return results;
|
||||
}
|
||||
|
||||
public void SaveFaces(string dResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, MappingFromItem mappingFromItem, List<Shared.Models.Face> faces)
|
||||
public bool SaveFaces(string dResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, MappingFromItem mappingFromItem, List<Shared.Models.Face> faces)
|
||||
{
|
||||
FileInfo fileInfo;
|
||||
bool check = false;
|
||||
bool result = false;
|
||||
string parentCheck;
|
||||
string deterministicHashCodeKey;
|
||||
List<(Shared.Models.Face, FileInfo?, string)> collection = new();
|
||||
@ -368,14 +368,15 @@ public class D_Face
|
||||
}
|
||||
collection.Add(new(face, fileInfo, Path.Combine(facesDirectory, $"{deterministicHashCodeKey}{mappingFromItem.ImageFileHolder.ExtensionLowered}{_HiddenFileNameExtension}")));
|
||||
if (_OverrideForFaceImages)
|
||||
check = true;
|
||||
result = true;
|
||||
else if (!fileInfo.Exists)
|
||||
check = true;
|
||||
result = true;
|
||||
else if (_CheckDFaceAndUpWriteDates && dateTimes.Any() && dateTimes.Max() > fileInfo.LastWriteTime)
|
||||
check = true;
|
||||
result = true;
|
||||
}
|
||||
if (check)
|
||||
if (result)
|
||||
SaveFaces(mappingFromItem.ResizedFileHolder, collection);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -135,7 +135,7 @@ public partial class DlibDotNet
|
||||
if (!isSilent && configuration.TestDistanceResults)
|
||||
{
|
||||
E2_Navigate e2Navigate = new(console, configuration, argZero);
|
||||
e2Navigate.Navigate(propertyConfiguration, model, predictorModel, configuration.OutputResolutions[0]);
|
||||
e2Navigate.Navigate(propertyConfiguration, configuration.OutputResolutions[0]);
|
||||
_Log.Information(propertyConfiguration.RootDirectory);
|
||||
}
|
||||
{
|
||||
@ -157,8 +157,6 @@ public partial class DlibDotNet
|
||||
{
|
||||
List<string[]> directoryCollections = _Rename.GetDirectoryRenameCollections(
|
||||
propertyConfiguration,
|
||||
model,
|
||||
predictorModel,
|
||||
relativePath: string.Empty,
|
||||
newDirectoryName: string.Empty,
|
||||
jsonFiles4InfoAny: false);
|
||||
@ -412,10 +410,10 @@ public partial class DlibDotNet
|
||||
faces = _Faces.GetFaces(dResultsFullGroupDirectory, subFileTuples, parseExceptions, property, mappingFromItem, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation);
|
||||
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||
ticks = LogDelta(ticks, nameof(D_Face.GetFaces));
|
||||
_Faces.SaveFaces(dResultsFullGroupDirectory, subFileTuples, parseExceptions, mappingFromItem, faces);
|
||||
bool anyFacesSaved = _Faces.SaveFaces(dResultsFullGroupDirectory, subFileTuples, parseExceptions, mappingFromItem, faces);
|
||||
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||
ticks = LogDelta(ticks, nameof(D_Face.SaveFaces));
|
||||
if (item.Property?.Id is not null
|
||||
if (!anyFacesSaved && item.Property?.Id is not null
|
||||
&& idToMappedFaceFilesCollection.TryGetValue(item.Property.Id.Value, out List<(string, int)>? collection))
|
||||
_Distance.LookForMatchFacesAndPossiblyRename(_Faces.FileNameExtension, eDistanceContentDirectory, mappingFromItem, faces, collection);
|
||||
if (_Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution))
|
||||
@ -634,8 +632,6 @@ public partial class DlibDotNet
|
||||
{
|
||||
string aResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_Configuration.PropertyConfiguration,
|
||||
model,
|
||||
predictorModel,
|
||||
nameof(A_Property),
|
||||
outputResolution,
|
||||
includeResizeGroup: false,
|
||||
@ -643,8 +639,6 @@ public partial class DlibDotNet
|
||||
includePredictorModel: false);
|
||||
string bResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_Configuration.PropertyConfiguration,
|
||||
model,
|
||||
predictorModel,
|
||||
nameof(B_Metadata),
|
||||
outputResolution,
|
||||
includeResizeGroup: false,
|
||||
@ -652,8 +646,6 @@ public partial class DlibDotNet
|
||||
includePredictorModel: false);
|
||||
string cResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_Configuration.PropertyConfiguration,
|
||||
model,
|
||||
predictorModel,
|
||||
nameof(C_Resize),
|
||||
outputResolution,
|
||||
includeResizeGroup: true,
|
||||
@ -661,8 +653,6 @@ public partial class DlibDotNet
|
||||
includePredictorModel: false);
|
||||
string dResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_Configuration.PropertyConfiguration,
|
||||
model,
|
||||
predictorModel,
|
||||
nameof(D_Face),
|
||||
outputResolution,
|
||||
includeResizeGroup: true,
|
||||
@ -795,7 +785,10 @@ public partial class DlibDotNet
|
||||
if (metadataCollection.Count != filteredItems.Length || nullablePropertyCollection.Count != filteredItems.Length || resizeKeyValuePairs.Count != filteredItems.Length || imageFaceCollections.Count != filteredItems.Length)
|
||||
throw new Exception("Counts don't match!");
|
||||
if (exceptionCount != 0)
|
||||
{
|
||||
_Exceptions.Add(container.SourceDirectory);
|
||||
continue;
|
||||
}
|
||||
for (int f = 0; f < imageFaceCollections.Count; f++)
|
||||
filteredItems[f].Faces.AddRange(from l in imageFaceCollections[f] select l);
|
||||
propertyCollection = (from l in nullablePropertyCollection where l is not null select l).ToArray();
|
||||
@ -1029,7 +1022,7 @@ public partial class DlibDotNet
|
||||
string d2FacePartsContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(D2_FaceParts), "()");
|
||||
int totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||
string message = $") Building Container(s) - {totalSeconds} total second(s)";
|
||||
A_Property propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Resize.FileNameExtension, _Configuration.Reverse, model, predictorModel);
|
||||
A_Property propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Resize.FileNameExtension, _Configuration.Reverse);
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
using (ProgressBar progressBar = new(1, message, options))
|
||||
{
|
||||
@ -1052,7 +1045,7 @@ public partial class DlibDotNet
|
||||
argZero = newRootDirectory;
|
||||
_Configuration.PropertyConfiguration.ChangeRootDirectory(newRootDirectory);
|
||||
propertyRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(_Configuration.PropertyConfiguration, nameof(A_Property), create: false);
|
||||
propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Resize.FileNameExtension, _Configuration.Reverse, model, predictorModel);
|
||||
propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Resize.FileNameExtension, _Configuration.Reverse);
|
||||
}
|
||||
Dictionary<int, List<(string, int)>> idToMappedFaceFilesCollection = Map.Models.Stateless.Methods.IMapLogic.DeleteEmptyDirectoriesAndGetMappedFaceFiles(_MapConfiguration, ticks, a2PeopleContentDirectory, eDistanceContentDirectory, personContainers);
|
||||
FullDoWork(argZero, model, predictorModel, propertyRoot, ticks, propertyLogic, t, containers, eDistanceContentDirectory, idToMappedFaceFilesCollection);
|
||||
@ -1080,7 +1073,7 @@ public partial class DlibDotNet
|
||||
List<G2_Identify> identifiedCollection = identify.GetIdentifiedCollection(_IsEnvironment, _Configuration.PropertyConfiguration, _Faces.FileNameExtension);
|
||||
identify.WriteAllText(_Configuration.PropertyConfiguration, _Configuration.OutputResolutions[0], identifiedCollection);
|
||||
if (_Configuration.LoadOrCreateThenSaveIndex && _FilePropertiesKeyValuePairs.Any())
|
||||
_Index.SetIndex(_Configuration.PropertyConfiguration, model, predictorModel, _Configuration.OutputResolutions[0], _FilePropertiesKeyValuePairs);
|
||||
_Index.SetIndex(_Configuration.PropertyConfiguration, _Configuration.OutputResolutions[0], _FilePropertiesKeyValuePairs);
|
||||
}
|
||||
if (!_IsEnvironment.Development)
|
||||
{
|
||||
@ -1093,9 +1086,6 @@ public partial class DlibDotNet
|
||||
}
|
||||
}
|
||||
|
||||
internal void RenameQueue(Model? model, PredictorModel? predictorModel) => _Rename.RenameQueue(
|
||||
_Configuration.PropertyConfiguration,
|
||||
model,
|
||||
predictorModel);
|
||||
internal void RenameQueue() => _Rename.RenameQueue(_Configuration.PropertyConfiguration);
|
||||
|
||||
}
|
@ -300,8 +300,7 @@ public class Configuration
|
||||
configuration = configurationSection.Get<Configuration>();
|
||||
}
|
||||
result = Get(configuration);
|
||||
result.Set(propertyConfiguration);
|
||||
result.Update();
|
||||
result.SetAndUpdate(propertyConfiguration, configuration.NumberOfJitters, configuration.NumberOfTimesToUpsample, configuration.ModelName, configuration.PredictorModelName);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -217,8 +217,10 @@ public class Configuration
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
|
||||
|
||||
public void Update() => _PropertyConfiguration.Update();
|
||||
public void SetAndUpdate(Property.Models.Configuration configuration, int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
|
||||
{
|
||||
_PropertyConfiguration = configuration;
|
||||
_PropertyConfiguration.Update(numberOfJitters, numberOfTimesToUpsample, modelName, predictorModelName);
|
||||
}
|
||||
|
||||
}
|
@ -37,7 +37,7 @@ internal class E2_Navigate
|
||||
return result;
|
||||
}
|
||||
|
||||
private void DisplayTags(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, string[] directories, Dictionary<ConsoleKey, int> directoryKeyValuePairs, string[] files, Dictionary<ConsoleKey, int> fileKeyValuePairs)
|
||||
private void DisplayTags(Property.Models.Configuration configuration, string outputResolution, string[] directories, Dictionary<ConsoleKey, int> directoryKeyValuePairs, string[] files, Dictionary<ConsoleKey, int> fileKeyValuePairs)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
@ -48,9 +48,9 @@ internal class E2_Navigate
|
||||
if (string.IsNullOrEmpty(rootResultsDirectory))
|
||||
throw new Exception();
|
||||
string rootResultsDirectoryAbsoluteUri = new Uri(rootResultsDirectory).AbsoluteUri;
|
||||
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, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
string cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, 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);
|
||||
List<FileSystem> fileSystemCollection = Shared.Models.Stateless.Methods.IFileSystem.GetFileSystemCollection(requestPath, tuple, directories, files, all);
|
||||
Queue<FileSystem> queue = new(fileSystemCollection);
|
||||
@ -70,7 +70,7 @@ internal class E2_Navigate
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayFaces(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, string selectedFileFullName)
|
||||
private void DisplayFaces(Property.Models.Configuration configuration, string outputResolution, string selectedFileFullName)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
@ -79,9 +79,9 @@ internal class E2_Navigate
|
||||
if (string.IsNullOrEmpty(rootResultsDirectory))
|
||||
throw new Exception();
|
||||
string rootResultsDirectoryAbsoluteUri = new Uri(rootResultsDirectory).AbsoluteUri;
|
||||
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, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
string cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, 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);
|
||||
FaceFileSystem[] faceFileSystemCollection = Shared.Models.Stateless.Methods.IFaceFileSystem.GetFaceFileSystemCollection(requestPath, tuple, selectedFileFullName);
|
||||
for (int i = 0; i < faceFileSystemCollection.Length; i++)
|
||||
@ -93,7 +93,7 @@ internal class E2_Navigate
|
||||
// }
|
||||
}
|
||||
|
||||
private string Rename(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string subSourceDirectory)
|
||||
private string Rename(Property.Models.Configuration configuration, string subSourceDirectory)
|
||||
{
|
||||
string result;
|
||||
if (_Log is null)
|
||||
@ -110,7 +110,7 @@ internal class E2_Navigate
|
||||
else
|
||||
{
|
||||
_Log.Warn(string.Empty);
|
||||
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 eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
string relativePath = Shared.Models.Stateless.Methods.IPath.GetRelativePath(subSourceDirectory, eDistanceCollectionDirectory.Length);
|
||||
if (relativePath.Length == 1)
|
||||
throw new Exception();
|
||||
@ -121,7 +121,7 @@ internal class E2_Navigate
|
||||
}
|
||||
else
|
||||
{
|
||||
_Rename.DirectoryRename(configuration, model, predictorModel, relativePath, newDirectoryName);
|
||||
_Rename.DirectoryRename(configuration, relativePath, newDirectoryName);
|
||||
_Log.Warn("Renamed...");
|
||||
string? directoryName = Path.GetDirectoryName(subSourceDirectory);
|
||||
if (string.IsNullOrEmpty(directoryName))
|
||||
@ -132,7 +132,7 @@ internal class E2_Navigate
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void Navigate(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution)
|
||||
internal void Navigate(Property.Models.Configuration configuration, string outputResolution)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
@ -144,7 +144,7 @@ internal class E2_Navigate
|
||||
string? subSourceDirectory = string.Empty;
|
||||
Dictionary<ConsoleKey, int> fileKeyValuePairs = new();
|
||||
Dictionary<ConsoleKey, int> directoryKeyValuePairs = new();
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), _Configuration.OutputResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), _Configuration.OutputResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
if (!Directory.Exists(eDistanceCollectionDirectory))
|
||||
_ = Directory.CreateDirectory(eDistanceCollectionDirectory);
|
||||
for (int z = 0; z < int.MaxValue; z++)
|
||||
@ -165,7 +165,7 @@ internal class E2_Navigate
|
||||
if (!directoryKeyValuePairs.Any() && !fileKeyValuePairs.Any())
|
||||
break;
|
||||
_Log.Warn("");
|
||||
DisplayTags(configuration, model, predictorModel, outputResolution, subDirectories, directoryKeyValuePairs, subFiles, fileKeyValuePairs);
|
||||
DisplayTags(configuration, outputResolution, subDirectories, directoryKeyValuePairs, subFiles, fileKeyValuePairs);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn(string.Empty);
|
||||
@ -183,7 +183,7 @@ internal class E2_Navigate
|
||||
}
|
||||
else
|
||||
{
|
||||
subSourceDirectory = Rename(configuration, model, predictorModel, subSourceDirectory);
|
||||
subSourceDirectory = Rename(configuration, subSourceDirectory);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,7 @@ internal class E2_Navigate
|
||||
{
|
||||
selectedFileFullName = subFiles[fileKeyValuePairs[consoleKey]];
|
||||
_Log.Warn(string.Concat(">>> [", Path.GetFileName(selectedFileFullName), "]<", selectedFileFullName, ">?"));
|
||||
DisplayFaces(configuration, model, predictorModel, outputResolution, selectedFileFullName);
|
||||
DisplayFaces(configuration, outputResolution, selectedFileFullName);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn(string.Empty);
|
||||
|
@ -31,7 +31,7 @@ internal class E3_Rename
|
||||
return result;
|
||||
}
|
||||
|
||||
internal string[] GetDirectoryRenameCollection(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string relativePath, string newDirectoryName, bool jsonFiles4InfoAny)
|
||||
internal string[] GetDirectoryRenameCollection(Property.Models.Configuration configuration, string relativePath, string newDirectoryName, bool jsonFiles4InfoAny)
|
||||
{
|
||||
List<string> results = new();
|
||||
bool add;
|
||||
@ -46,7 +46,7 @@ internal class E3_Rename
|
||||
string bMetadataSingletonDirectory;
|
||||
string eDistanceCollectionDirectory;
|
||||
string g2IdentifyCollectionDirectory;
|
||||
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));
|
||||
add = Directory.Exists(string.Concat(Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()"), relativePath));
|
||||
bMetadataSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(B_Metadata), "{}");
|
||||
if (Directory.Exists(bMetadataSingletonDirectory))
|
||||
{
|
||||
@ -59,7 +59,7 @@ internal class E3_Rename
|
||||
to = Path.Combine(string.Concat(aPropertySingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
if (Directory.Exists(cResizeContentDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(cResizeContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
@ -67,37 +67,37 @@ internal class E3_Rename
|
||||
}
|
||||
foreach (string outputResolution in _Configuration.ValidResolutions)
|
||||
{
|
||||
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||
if (Directory.Exists(cResizeSingletonDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(cResizeSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
if (Directory.Exists(dFacesContentDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(dFacesContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
if (Directory.Exists(dFacesCollectionDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(dFacesCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
d2FacePartsContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D2_FaceParts), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
d2FacePartsContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D2_FaceParts), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
if (add && _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution) && Directory.Exists(d2FacePartsContentDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(d2FacePartsContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
if (Directory.Exists(eDistanceContentDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(eDistanceContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
if (Directory.Exists(eDistanceCollectionDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(eDistanceCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
@ -113,7 +113,7 @@ internal class E3_Rename
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
internal List<string[]> GetDirectoryRenameCollections(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string relativePath, string newDirectoryName, bool jsonFiles4InfoAny)
|
||||
internal List<string[]> GetDirectoryRenameCollections(Property.Models.Configuration configuration, string relativePath, string newDirectoryName, bool jsonFiles4InfoAny)
|
||||
{
|
||||
List<string[]> results = new();
|
||||
bool add;
|
||||
@ -138,7 +138,7 @@ internal class E3_Rename
|
||||
}
|
||||
foreach (string outputResolution in _Configuration.ValidResolutions)
|
||||
{
|
||||
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));
|
||||
add = Directory.Exists(string.Concat(Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()"), relativePath));
|
||||
bMetadataSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(B_Metadata), "{}");
|
||||
from = string.Concat(bMetadataSingletonDirectory, relativePath);
|
||||
exists = Directory.Exists(bMetadataSingletonDirectory);
|
||||
@ -155,7 +155,7 @@ internal class E3_Rename
|
||||
to = Path.Combine(string.Concat(aPropertySingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
from = string.Concat(cResizeContentDirectory, relativePath);
|
||||
exists = Directory.Exists(cResizeContentDirectory);
|
||||
if (exists)
|
||||
@ -163,7 +163,7 @@ internal class E3_Rename
|
||||
to = Path.Combine(string.Concat(cResizeContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||
from = string.Concat(cResizeSingletonDirectory, relativePath);
|
||||
exists = Directory.Exists(cResizeSingletonDirectory);
|
||||
if (exists)
|
||||
@ -171,7 +171,7 @@ internal class E3_Rename
|
||||
to = Path.Combine(string.Concat(cResizeSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
from = string.Concat(dFacesContentDirectory, relativePath);
|
||||
exists = Directory.Exists(dFacesContentDirectory);
|
||||
if (exists)
|
||||
@ -179,7 +179,7 @@ internal class E3_Rename
|
||||
to = Path.Combine(string.Concat(dFacesContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
from = string.Concat(dFacesCollectionDirectory, relativePath);
|
||||
exists = Directory.Exists(dFacesCollectionDirectory);
|
||||
if (exists)
|
||||
@ -187,7 +187,7 @@ internal class E3_Rename
|
||||
to = Path.Combine(string.Concat(dFacesCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
d2FacePartsContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(D2_FaceParts), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
d2FacePartsContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D2_FaceParts), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
from = string.Concat(d2FacePartsContentDirectory, relativePath);
|
||||
exists = Directory.Exists(d2FacePartsContentDirectory);
|
||||
if (!exists && add && _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution))
|
||||
@ -197,7 +197,7 @@ internal class E3_Rename
|
||||
to = Path.Combine(string.Concat(d2FacePartsContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
from = string.Concat(eDistanceContentDirectory, relativePath);
|
||||
exists = Directory.Exists(eDistanceContentDirectory);
|
||||
if (exists)
|
||||
@ -205,7 +205,7 @@ internal class E3_Rename
|
||||
to = Path.Combine(string.Concat(eDistanceContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
from = string.Concat(eDistanceCollectionDirectory, relativePath);
|
||||
exists = Directory.Exists(eDistanceCollectionDirectory);
|
||||
if (exists)
|
||||
@ -227,7 +227,7 @@ internal class E3_Rename
|
||||
return results;
|
||||
}
|
||||
|
||||
internal void DirectoryRename(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string relativePath, string newDirectoryName)
|
||||
internal void DirectoryRename(Property.Models.Configuration configuration, string relativePath, string newDirectoryName)
|
||||
{
|
||||
string json;
|
||||
FileInfo current;
|
||||
@ -256,7 +256,7 @@ internal class E3_Rename
|
||||
current = new(string.Empty);
|
||||
else
|
||||
current = fileInfoCollection4.Current;
|
||||
List<string[]> directoryCollections = GetDirectoryRenameCollections(configuration, model, predictorModel, relativePath, newDirectoryName, fileInfoCollection4MoveNext);
|
||||
List<string[]> directoryCollections = GetDirectoryRenameCollections(configuration, relativePath, newDirectoryName, fileInfoCollection4MoveNext);
|
||||
if ((from l in directoryCollections where l.Length != 2 select true).Any())
|
||||
throw new Exception();
|
||||
if (!Directory.Exists(e3RenameContentDirectory))
|
||||
@ -313,7 +313,7 @@ internal class E3_Rename
|
||||
}
|
||||
}
|
||||
|
||||
internal void RenameQueue(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel)
|
||||
internal void RenameQueue(Property.Models.Configuration configuration)
|
||||
{
|
||||
string[] lines;
|
||||
string[] segments;
|
||||
@ -329,7 +329,7 @@ internal class E3_Rename
|
||||
segments = line.Split('\t');
|
||||
if (segments.Length != 2)
|
||||
throw new Exception();
|
||||
DirectoryRename(configuration, model, predictorModel, segments[0], segments[1]);
|
||||
DirectoryRename(configuration, segments[0], segments[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
using View_by_Distance.Shared.Models.Stateless;
|
||||
|
||||
namespace View_by_Distance.Instance.Models;
|
||||
|
||||
@ -103,7 +102,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteGroup(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, List<Tuple<string, Dictionary<int, G_Index>>> indexInfoTuples)
|
||||
private void WriteGroup(Property.Models.Configuration configuration, string outputResolution, List<Tuple<string, Dictionary<int, G_Index>>> indexInfoTuples)
|
||||
{
|
||||
string json;
|
||||
G_Index[] indices;
|
||||
@ -111,14 +110,14 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
||||
foreach (Tuple<string, Dictionary<int, G_Index>> tuple in indexInfoTuples)
|
||||
{
|
||||
indices = (from l in tuple.Item2 select l.Value).ToArray();
|
||||
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");
|
||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, 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);
|
||||
if (!Shared.Models.Stateless.Methods.IPath.WriteAllText(string.Concat(directoryInfoCollection[0].Replace("<>", "[]"), ".json"), json, updateDateWhenMatches: true, compareBeforeWrite: true))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
private void AppendTSV(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, Dictionary<string, List<Tuple<string, Shared.Models.Property>>> filePropertiesKeyValuePairs)
|
||||
private void AppendTSV(Property.Models.Configuration configuration, string outputResolution, Dictionary<string, List<Tuple<string, Shared.Models.Property>>> filePropertiesKeyValuePairs)
|
||||
{
|
||||
Shared.Models.Property property;
|
||||
DateTime?[] dateTimes;
|
||||
@ -137,11 +136,11 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
||||
maximumDateTime = (from l in dateTimes where l.HasValue select l.Value).Max();
|
||||
minimumDateTime = (from l in dateTimes where l.HasValue select l.Value).Min();
|
||||
}
|
||||
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);
|
||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unkown B", collectionDescription: string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetIndex(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, Dictionary<string, List<Tuple<string, Shared.Models.Property>>> filePropertiesKeyValuePairs)
|
||||
internal void SetIndex(Property.Models.Configuration configuration, string outputResolution, Dictionary<string, List<Tuple<string, Shared.Models.Property>>> filePropertiesKeyValuePairs)
|
||||
{
|
||||
FileInfo fileInfo;
|
||||
G_Index indexInfo;
|
||||
@ -166,7 +165,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
||||
foreach (KeyValuePair<string, List<Tuple<string, Shared.Models.Property>>> tuples in filePropertiesKeyValuePairs)
|
||||
{
|
||||
valuePairs = new Dictionary<int, G_Index>();
|
||||
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);
|
||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unknown C", collectionDescription: string.Empty);
|
||||
foreach (Tuple<string, Shared.Models.Property> tuple in tuples.Value)
|
||||
{
|
||||
fileInfo = new FileInfo(Path.Combine(directoryInfoCollection[0].Replace("<>", "{}"), string.Concat(Path.GetFileNameWithoutExtension(tuple.Item1), ".json")));
|
||||
@ -202,8 +201,8 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
||||
throw new Exception(string.Join(Environment.NewLine, parseExceptions));
|
||||
if (neededTuples.Any())
|
||||
throw new Exception();
|
||||
WriteGroup(configuration, model, predictorModel, outputResolution, indexInfoTuples);
|
||||
AppendTSV(configuration, model, predictorModel, outputResolution, filePropertiesKeyValuePairs);
|
||||
WriteGroup(configuration, outputResolution, indexInfoTuples);
|
||||
AppendTSV(configuration, outputResolution, filePropertiesKeyValuePairs);
|
||||
}
|
||||
|
||||
string Shared.Models.Stateless.Methods.IIndex.TestStatic_GetJson(string jsonFileFullName, FileInfo fileInfo) => throw new NotImplementedException();
|
||||
|
@ -8,7 +8,7 @@ public class Configuration
|
||||
|
||||
[Display(Name = "Compare Source"), Required] public string CompareSource { get; set; }
|
||||
[Display(Name = "Empty Destination"), Required] public string EmptyDestination { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration? PropertyConfiguration { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
|
||||
[Display(Name = "Selected Source"), Required] public string SelectedSource { get; set; }
|
||||
|
||||
public Configuration()
|
||||
|
@ -8,15 +8,15 @@ public class Configuration
|
||||
|
||||
protected string _CompareSource;
|
||||
protected string _EmptyDestination;
|
||||
protected Property.Models.Configuration? _PropertyConfiguration;
|
||||
protected Property.Models.Configuration _PropertyConfiguration;
|
||||
protected string _SelectedSource;
|
||||
public string CompareSource => _CompareSource;
|
||||
public string EmptyDestination => _EmptyDestination;
|
||||
public Property.Models.Configuration? PropertyConfiguration => _PropertyConfiguration;
|
||||
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
||||
public string SelectedSource => _SelectedSource;
|
||||
|
||||
[JsonConstructor]
|
||||
public Configuration(string compareSource, string emptyDestination, Property.Models.Configuration? propertyConfiguration, string selectedSource)
|
||||
public Configuration(string compareSource, string emptyDestination, Property.Models.Configuration propertyConfiguration, string selectedSource)
|
||||
{
|
||||
_CompareSource = compareSource;
|
||||
_EmptyDestination = emptyDestination;
|
||||
@ -32,9 +32,9 @@ public class Configuration
|
||||
|
||||
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
|
||||
|
||||
public void Update()
|
||||
public void SetAndUpdate(Property.Models.Configuration configuration, int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
|
||||
{
|
||||
_PropertyConfiguration?.Update();
|
||||
_PropertyConfiguration.Update(numberOfJitters, numberOfTimesToUpsample, modelName, predictorModelName);
|
||||
_CompareSource = Path.GetFullPath(_CompareSource);
|
||||
_SelectedSource = Path.GetFullPath(_SelectedSource);
|
||||
_EmptyDestination = Path.GetFullPath(_EmptyDestination);
|
||||
|
@ -19,8 +19,7 @@ public abstract class Configuration
|
||||
if (result is null)
|
||||
throw new Exception(json);
|
||||
string jsonThis = result.ToString();
|
||||
result.Set(propertyConfiguration);
|
||||
result.Update();
|
||||
result.SetAndUpdate(propertyConfiguration, null, null, null, null);
|
||||
if (jsonThis != json)
|
||||
{
|
||||
int? check = null;
|
||||
|
@ -3,7 +3,6 @@ using Phares.Shared;
|
||||
using View_by_Distance.Not.Copy.Copy.Models;
|
||||
using View_by_Distance.Property.Models;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
using View_by_Distance.Shared.Models.Stateless;
|
||||
|
||||
namespace View_by_Distance.Not.Copy.Copy;
|
||||
|
||||
@ -31,13 +30,11 @@ public class NotCopyCopy
|
||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||
Verify(configuration);
|
||||
bool reverse = false;
|
||||
Model? model = null;
|
||||
string outputExtension = ".jpg";
|
||||
_Configuration = configuration;
|
||||
PredictorModel? predictorModel = null;
|
||||
if (!_IsEnvironment.Development)
|
||||
throw new Exception("This program only allows development environments!");
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, model, outputExtension, predictorModel);
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, outputExtension);
|
||||
propertyConfiguration.ChangeRootDirectory(configuration.CompareSource);
|
||||
(_, _, _, Shared.Models.Container[] compareContainers) = A_Property.Get(propertyConfiguration, propertyLogic);
|
||||
propertyConfiguration.ChangeRootDirectory(configuration.SelectedSource);
|
||||
@ -102,12 +99,12 @@ public class NotCopyCopy
|
||||
throw new NullReferenceException(nameof(configuration.SelectedSource));
|
||||
}
|
||||
|
||||
private A_Property GetPropertyLogic(bool reverse, Model? model, string outputExtension, PredictorModel? predictorModel)
|
||||
private A_Property GetPropertyLogic(bool reverse, string outputExtension)
|
||||
{
|
||||
A_Property result;
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse, model, predictorModel);
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace View_by_Distance.PrepareForOld.Models.Binder;
|
||||
public class Configuration
|
||||
{
|
||||
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration? PropertyConfiguration { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
|
||||
[Display(Name = "Spelling"), Required] public string[] Spelling { get; set; }
|
||||
|
||||
public Configuration() => Spelling = Array.Empty<string>();
|
||||
|
@ -6,13 +6,13 @@ namespace View_by_Distance.PrepareForOld.Models;
|
||||
public class Configuration
|
||||
{
|
||||
|
||||
protected Property.Models.Configuration? _PropertyConfiguration;
|
||||
protected Property.Models.Configuration _PropertyConfiguration;
|
||||
protected readonly string[] _Spelling;
|
||||
public Property.Models.Configuration? PropertyConfiguration => _PropertyConfiguration;
|
||||
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
||||
public string[] Spelling => _Spelling;
|
||||
|
||||
[JsonConstructor]
|
||||
public Configuration(Property.Models.Configuration? propertyConfiguration, string[] spelling)
|
||||
public Configuration(Property.Models.Configuration propertyConfiguration, string[] spelling)
|
||||
{
|
||||
_PropertyConfiguration = propertyConfiguration;
|
||||
_Spelling = spelling;
|
||||
@ -24,8 +24,10 @@ public class Configuration
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
|
||||
|
||||
public void Update() => _PropertyConfiguration?.Update();
|
||||
public void SetAndUpdate(Property.Models.Configuration configuration, int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
|
||||
{
|
||||
_PropertyConfiguration = configuration;
|
||||
_PropertyConfiguration.Update(numberOfJitters, numberOfTimesToUpsample, modelName, predictorModelName);
|
||||
}
|
||||
|
||||
}
|
@ -19,8 +19,7 @@ public abstract class Configuration
|
||||
if (result is null)
|
||||
throw new Exception(json);
|
||||
string jsonThis = result.ToString();
|
||||
result.Set(propertyConfiguration);
|
||||
result.Update();
|
||||
result.SetAndUpdate(propertyConfiguration, null, null, null, null);
|
||||
if (jsonThis != json)
|
||||
{
|
||||
int? check = null;
|
||||
|
@ -22,23 +22,19 @@ public class A_Property
|
||||
public List<string> AngleBracketCollection { get; }
|
||||
public List<string> ExceptionsDirectories => _ExceptionsDirectories;
|
||||
|
||||
private readonly Model? _Model;
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly string _OutputExtension;
|
||||
private readonly string[] _VerifyToSeason;
|
||||
private readonly int _MaxDegreeOfParallelism;
|
||||
private readonly ASCIIEncoding _ASCIIEncoding;
|
||||
private readonly Configuration _Configuration;
|
||||
private readonly PredictorModel? _PredictorModel;
|
||||
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
|
||||
|
||||
public A_Property(int maxDegreeOfParallelism, Configuration configuration, string outputExtension, bool reverse, Model? model, PredictorModel? predictorModel)
|
||||
public A_Property(int maxDegreeOfParallelism, Configuration configuration, string outputExtension, bool reverse)
|
||||
{
|
||||
_Model = model;
|
||||
Reverse = reverse;
|
||||
_Configuration = configuration;
|
||||
_ExceptionsDirectories = new();
|
||||
_PredictorModel = predictorModel;
|
||||
_OutputExtension = outputExtension;
|
||||
_ASCIIEncoding = new ASCIIEncoding();
|
||||
AngleBracketCollection = new List<string>();
|
||||
@ -582,8 +578,6 @@ public class A_Property
|
||||
{
|
||||
AngleBracketCollection.Clear();
|
||||
AngleBracketCollection.AddRange(IResult.GetDirectoryInfoCollection(_Configuration,
|
||||
_Model,
|
||||
_PredictorModel,
|
||||
sourceDirectory,
|
||||
nameof(A_Property),
|
||||
string.Empty,
|
||||
|
@ -6,7 +6,15 @@ namespace View_by_Distance.Property.Models;
|
||||
public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
||||
{
|
||||
|
||||
protected string? _ModelName;
|
||||
protected int? _NumberOfJitters;
|
||||
protected int? _NumberOfTimesToUpsample;
|
||||
protected string? _PredictorModelName;
|
||||
protected string _RootDirectory;
|
||||
public string? ModelName => _ModelName;
|
||||
public int? NumberOfJitters => _NumberOfJitters;
|
||||
public int? NumberOfTimesToUpsample => _NumberOfTimesToUpsample;
|
||||
public string? PredictorModelName => _PredictorModelName;
|
||||
public string RootDirectory => _RootDirectory;
|
||||
|
||||
public string DateGroup { init; get; }
|
||||
@ -73,10 +81,17 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Update() => _RootDirectory = Path.GetFullPath(_RootDirectory);
|
||||
|
||||
public void ChangeRootDirectory(string rootDirectory) => _RootDirectory = rootDirectory;
|
||||
|
||||
public void Update(int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
|
||||
{
|
||||
_NumberOfJitters = numberOfJitters;
|
||||
_NumberOfTimesToUpsample = numberOfTimesToUpsample;
|
||||
_ModelName = modelName;
|
||||
_PredictorModelName = predictorModelName;
|
||||
_RootDirectory = Path.GetFullPath(_RootDirectory);
|
||||
}
|
||||
|
||||
public static void Verify(Configuration propertyConfiguration, bool requireExist)
|
||||
{
|
||||
if (propertyConfiguration is null)
|
||||
|
@ -1,5 +1,3 @@
|
||||
using View_by_Distance.Shared.Models.Stateless;
|
||||
|
||||
namespace View_by_Distance.Property.Models.Stateless;
|
||||
|
||||
public interface IResult
|
||||
@ -29,12 +27,12 @@ public interface IResult
|
||||
static List<string> GetDirectoryInfoCollection(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, string sourceDirectory, string dateGroupDirectory, string contentDescription, string singletonDescription, string collectionDescription, bool converted)
|
||||
=> Result.GetDirectoryInfoCollection(propertyConfiguration, sourceDirectory, dateGroupDirectory, contentDescription, singletonDescription, collectionDescription, converted);
|
||||
|
||||
string TestStatic_GetResultsFullGroupDirectory(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Model? model, PredictorModel? predictorModel, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel);
|
||||
static string GetResultsFullGroupDirectory(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Model? model, PredictorModel? predictorModel, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel)
|
||||
=> Result.GetResultsFullGroupDirectory(propertyConfiguration, model, predictorModel, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||
string TestStatic_GetResultsFullGroupDirectory(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel);
|
||||
static string GetResultsFullGroupDirectory(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel)
|
||||
=> Result.GetResultsFullGroupDirectory(propertyConfiguration, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||
|
||||
List<string> TestStatic_GetDirectoryInfoCollection(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Model? model, PredictorModel? predictorModel, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription);
|
||||
static List<string> GetDirectoryInfoCollection(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Model? model, PredictorModel? predictorModel, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription)
|
||||
=> Result.GetDirectoryInfoCollection(propertyConfiguration, model, predictorModel, sourceDirectory, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel, contentDescription, singletonDescription, collectionDescription);
|
||||
List<string> TestStatic_GetDirectoryInfoCollection(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription);
|
||||
static List<string> GetDirectoryInfoCollection(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription)
|
||||
=> Result.GetDirectoryInfoCollection(propertyConfiguration, sourceDirectory, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel, contentDescription, singletonDescription, collectionDescription);
|
||||
|
||||
}
|
@ -35,7 +35,7 @@ internal class Result
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetResultsFullGroupDirectory(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Model? model, PredictorModel? predictorModel, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel)
|
||||
internal static string GetResultsFullGroupDirectory(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel)
|
||||
{
|
||||
string result = GetResultsDateGroupDirectory(propertyConfiguration, description);
|
||||
if (includeResizeGroup)
|
||||
@ -44,14 +44,14 @@ internal class Result
|
||||
{
|
||||
string modelName;
|
||||
string predictorModelName;
|
||||
if (model is null)
|
||||
if (propertyConfiguration.ModelName is null)
|
||||
modelName = Model.Hog.ToString();
|
||||
else
|
||||
modelName = model.Value.ToString();
|
||||
if (predictorModel is null)
|
||||
modelName = propertyConfiguration.ModelName;
|
||||
if (propertyConfiguration.PredictorModelName is null)
|
||||
predictorModelName = PredictorModel.Large.ToString();
|
||||
else
|
||||
predictorModelName = predictorModel.Value.ToString();
|
||||
predictorModelName = propertyConfiguration.PredictorModelName;
|
||||
string dateGroupDirectory = string.Concat(outputResolution.Replace(" ", string.Empty), " - ", modelName, " - ", predictorModelName);
|
||||
result = Path.Combine(result, dateGroupDirectory);
|
||||
}
|
||||
@ -126,11 +126,11 @@ internal class Result
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<string> GetDirectoryInfoCollection(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Model? model, PredictorModel? predictorModel, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription)
|
||||
internal static List<string> GetDirectoryInfoCollection(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription)
|
||||
{
|
||||
List<string> results;
|
||||
bool converted = false;
|
||||
string dateGroupDirectory = GetResultsFullGroupDirectory(propertyConfiguration, model, predictorModel, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||
string dateGroupDirectory = GetResultsFullGroupDirectory(propertyConfiguration, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||
results = GetDirectoryInfoCollection(propertyConfiguration, sourceDirectory, dateGroupDirectory, contentDescription, singletonDescription, collectionDescription, converted);
|
||||
return results;
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ public interface IPropertyConfiguration
|
||||
{
|
||||
|
||||
public string DateGroup { init; get; }
|
||||
public string? ModelName { get; }
|
||||
public int? NumberOfJitters { get; }
|
||||
public int? NumberOfTimesToUpsample { get; }
|
||||
public string? PredictorModelName { get; }
|
||||
public string[] PropertyContentCollectionFiles { init; get; }
|
||||
public string ResultAllInOne { init; get; }
|
||||
public string ResultCollection { init; get; }
|
||||
|
@ -199,8 +199,7 @@ public class Configuration
|
||||
configuration = configurationSection.Get<Configuration>();
|
||||
}
|
||||
result = Get(configuration);
|
||||
result.Set(propertyConfiguration);
|
||||
result.Update();
|
||||
result.SetAndUpdate(propertyConfiguration, null, null, null, null);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,10 @@ public class Configuration
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
|
||||
|
||||
public void Update() => _PropertyConfiguration.Update();
|
||||
public void SetAndUpdate(Property.Models.Configuration configuration, int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
|
||||
{
|
||||
_PropertyConfiguration = configuration;
|
||||
_PropertyConfiguration.Update(numberOfJitters, numberOfTimesToUpsample, modelName, predictorModelName);
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,6 @@ using System.Reflection;
|
||||
using View_by_Distance.Metadata.Models;
|
||||
using View_by_Distance.Resize.Models;
|
||||
using View_by_Distance.Shared.Models;
|
||||
using View_by_Distance.Shared.Models.Stateless;
|
||||
using View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
using View_by_Distance.Tests.Models;
|
||||
|
||||
@ -73,12 +72,12 @@ public class UnitTestResize
|
||||
Assert.IsFalse(_PropertyConfiguration is null);
|
||||
}
|
||||
|
||||
private Property.Models.A_Property GetPropertyLogic(bool reverse, Model? model, PredictorModel? predictorModel)
|
||||
private Property.Models.A_Property GetPropertyLogic(bool reverse)
|
||||
{
|
||||
Property.Models.A_Property result;
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Configuration.OutputExtension, reverse, model, predictorModel);
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Configuration.OutputExtension, reverse);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -92,14 +91,12 @@ public class UnitTestResize
|
||||
string sourceFileName = "12314542_10208270578946392_3555034423896018896_o.jpg";
|
||||
string sourceDirectoryName = "Other";
|
||||
Item item;
|
||||
Model? model = null;
|
||||
bool reverse = false;
|
||||
string original = "Original";
|
||||
string aResultsFullGroupDirectory;
|
||||
string bResultsFullGroupDirectory;
|
||||
string cResultsFullGroupDirectory;
|
||||
List<string> parseExceptions = new();
|
||||
PredictorModel? predictorModel = null;
|
||||
bool isValidImageFormatExtension = true;
|
||||
Shared.Models.Property? property = null;
|
||||
Dictionary<string, int[]> imageResizeKeyValuePairs;
|
||||
@ -107,15 +104,15 @@ public class UnitTestResize
|
||||
List<KeyValuePair<string, string>> metadataCollection;
|
||||
int length = _PropertyConfiguration.RootDirectory.Length;
|
||||
string outputResolution = _Configuration.OutputResolutions[0];
|
||||
Property.Models.A_Property propertyLogic = GetPropertyLogic(reverse, model, predictorModel);
|
||||
Property.Models.A_Property propertyLogic = GetPropertyLogic(reverse);
|
||||
string sourceDirectory = Path.Combine(_PropertyConfiguration.RootDirectory, sourceDirectoryName);
|
||||
_Logger.Information(_Configuration.ModelDirectory);
|
||||
aResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_PropertyConfiguration, model, predictorModel, nameof(Property.Models.A_Property), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false);
|
||||
_PropertyConfiguration, nameof(Property.Models.A_Property), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false);
|
||||
bResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_PropertyConfiguration, model, predictorModel, nameof(B_Metadata), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false);
|
||||
_PropertyConfiguration, nameof(B_Metadata), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false);
|
||||
cResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_PropertyConfiguration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false);
|
||||
_PropertyConfiguration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false);
|
||||
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_PropertyConfiguration, nameof(Property.Models.A_Property), "{}");
|
||||
B_Metadata metadata = new(_Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata);
|
||||
_ = metadata.ToString();
|
||||
|
@ -300,8 +300,7 @@ public class Configuration
|
||||
configuration = configurationSection.Get<Configuration>();
|
||||
}
|
||||
result = Get(configuration);
|
||||
result.Set(propertyConfiguration);
|
||||
result.Update();
|
||||
result.SetAndUpdate(propertyConfiguration, null, null, null, null);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -217,8 +217,10 @@ public class Configuration
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
|
||||
|
||||
public void Update() => _PropertyConfiguration.Update();
|
||||
public void SetAndUpdate(Property.Models.Configuration configuration, int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
|
||||
{
|
||||
_PropertyConfiguration = configuration;
|
||||
_PropertyConfiguration.Update(numberOfJitters, numberOfTimesToUpsample, modelName, predictorModelName);
|
||||
}
|
||||
|
||||
}
|
@ -83,12 +83,12 @@ public class UnitTestFace
|
||||
Assert.IsFalse(_PropertyConfiguration is null);
|
||||
}
|
||||
|
||||
private Property.Models.A_Property GetPropertyLogic(bool reverse, Model? model, PredictorModel? predictorModel)
|
||||
private Property.Models.A_Property GetPropertyLogic(bool reverse)
|
||||
{
|
||||
Property.Models.A_Property result;
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Configuration.OutputExtension, reverse, model, predictorModel);
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Configuration.OutputExtension, reverse);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -183,16 +183,16 @@ public class UnitTestFace
|
||||
List<KeyValuePair<string, string>> metadataCollection;
|
||||
int length = _PropertyConfiguration.RootDirectory.Length;
|
||||
string outputResolution = _Configuration.OutputResolutions[0];
|
||||
(Model model, PredictorModel predictorModel, ModelParameter modelParameter) = GetModel(_Configuration);
|
||||
Property.Models.A_Property propertyLogic = GetPropertyLogic(reverse, model, predictorModel);
|
||||
Property.Models.A_Property propertyLogic = GetPropertyLogic(reverse);
|
||||
string sourceDirectory = Path.Combine(_PropertyConfiguration.RootDirectory, sourceDirectoryName);
|
||||
(Model model, PredictorModel predictorModel, ModelParameter modelParameter) = GetModel(_Configuration);
|
||||
_Logger.Information(_Configuration.ModelDirectory);
|
||||
aResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_PropertyConfiguration, model, predictorModel, nameof(Property.Models.A_Property), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false);
|
||||
_PropertyConfiguration, nameof(Property.Models.A_Property), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false);
|
||||
bResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_PropertyConfiguration, model, predictorModel, nameof(B_Metadata), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false);
|
||||
_PropertyConfiguration, nameof(B_Metadata), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false);
|
||||
cResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_PropertyConfiguration, model, predictorModel, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false);
|
||||
_PropertyConfiguration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false);
|
||||
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_PropertyConfiguration, nameof(Property.Models.A_Property), "{}");
|
||||
B_Metadata metadata = new(_Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata);
|
||||
_ = metadata.ToString();
|
||||
|
Loading…
x
Reference in New Issue
Block a user