NullReferenceException
This commit is contained in:
@ -74,14 +74,14 @@ public class UnitTestFace
|
||||
Assert.IsFalse(_PropertyConfiguration is null);
|
||||
}
|
||||
|
||||
private Property.Models.PropertyLogic GetPropertyLogic()
|
||||
private Property.Models.PropertyLogic GetPropertyLogic(bool reverse, Model? model, PredictorModel? predictorModel)
|
||||
{
|
||||
Property.Models.PropertyLogic result;
|
||||
if (_AppSettings.MaxDegreeOfParallelism is null)
|
||||
throw new ArgumentNullException(nameof(_AppSettings.MaxDegreeOfParallelism));
|
||||
throw new NullReferenceException(nameof(_AppSettings.MaxDegreeOfParallelism));
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration);
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration, reverse, model, predictorModel);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -150,34 +150,34 @@ public class UnitTestFace
|
||||
// string sourceFileName = "Logan Michael Sept 08 (193).jpg";
|
||||
// string sourceDirectoryName = "=2008.2 Summer Logan Michael";
|
||||
if (_Configuration.ForceMetadataLastWriteTimeToCreationTime is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.ForceMetadataLastWriteTimeToCreationTime));
|
||||
throw new NullReferenceException(nameof(_Configuration.ForceMetadataLastWriteTimeToCreationTime));
|
||||
if (_Configuration.ForceResizeLastWriteTimeToCreationTime is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.ForceResizeLastWriteTimeToCreationTime));
|
||||
throw new NullReferenceException(nameof(_Configuration.ForceResizeLastWriteTimeToCreationTime));
|
||||
if (_Configuration.OutputQuality is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.OutputQuality));
|
||||
throw new NullReferenceException(nameof(_Configuration.OutputQuality));
|
||||
if (_Configuration.OverrideForResizeImages is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.OverrideForResizeImages));
|
||||
throw new NullReferenceException(nameof(_Configuration.OverrideForResizeImages));
|
||||
if (_Configuration.PropertiesChangedForMetadata is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertiesChangedForMetadata));
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertiesChangedForMetadata));
|
||||
if (_Configuration.PropertiesChangedForResize is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.PropertiesChangedForResize));
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertiesChangedForResize));
|
||||
if (_Configuration.NumberOfJitters is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.NumberOfJitters));
|
||||
throw new NullReferenceException(nameof(_Configuration.NumberOfJitters));
|
||||
if (_Configuration.NumberOfTimesToUpsample is null)
|
||||
throw new ArgumentNullException(nameof(_Configuration.NumberOfTimesToUpsample));
|
||||
int g = 1;
|
||||
int r = 1;
|
||||
throw new NullReferenceException(nameof(_Configuration.NumberOfTimesToUpsample));
|
||||
bool reverse = false;
|
||||
Property.Models.Item item;
|
||||
string original = "Original";
|
||||
List<string> parseExceptions = new();
|
||||
bool isValidImageFormatExtension = true;
|
||||
Property.Models.A_Property? property = null;
|
||||
Property.Models.PropertyHolder propertyHolder;
|
||||
Dictionary<string, int[]> imageResizeKeyValuePairs;
|
||||
List<Tuple<string, DateTime>> subFileTuples = new();
|
||||
List<KeyValuePair<string, string>> metadataCollection;
|
||||
int length = _PropertyConfiguration.RootDirectory.Length;
|
||||
string outputResolution = _Configuration.OutputResolutions[0];
|
||||
Property.Models.PropertyLogic propertyLogic = GetPropertyLogic();
|
||||
(Model model, PredictorModel predictorModel, ModelParameter modelParameter) = GetModel(_Configuration);
|
||||
Property.Models.PropertyLogic propertyLogic = GetPropertyLogic(reverse, model, predictorModel);
|
||||
string sourceDirectory = Path.Combine(_PropertyConfiguration.RootDirectory, sourceDirectoryName);
|
||||
_Logger.Information(_Configuration.ModelDirectory);
|
||||
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_PropertyConfiguration, nameof(Property.Models.A_Property), "{}");
|
||||
@ -224,17 +224,17 @@ public class UnitTestFace
|
||||
Property.Models.FileHolder fileHolder = new(Path.Combine(sourceDirectory, sourceFileName));
|
||||
string relativePath = Property.Models.Stateless.IPath.GetRelativePath(fileHolder.FullName, length);
|
||||
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
|
||||
propertyHolder = new(g, sourceDirectory, sourceDirectoryFile, relativePath, r, fileHolder, property, false, false, null, null);
|
||||
Assert.IsNotNull(propertyHolder.ImageFileHolder);
|
||||
property = propertyLogic.GetProperty(propertyLogic.AngleBracketCollection[0], propertyHolder, subFileTuples, parseExceptions);
|
||||
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, propertyHolder);
|
||||
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(subFileTuples, parseExceptions, original, metadataCollection, property, propertyHolder);
|
||||
Property.Models.FileHolder resizedFileHolder = new(Path.Combine(resize.AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(propertyHolder.ImageFileHolder.FullName)));
|
||||
propertyHolder.SetResizedFileHolder(resizedFileHolder);
|
||||
resize.SaveResizedSubfile(outputResolution, subFileTuples, propertyHolder, original, property, imageResizeKeyValuePairs);
|
||||
propertyHolder.SetResizedFileHolder(Property.Models.FileHolder.Refresh(resizedFileHolder));
|
||||
Assert.IsNotNull(propertyHolder.ResizedFileHolder);
|
||||
Image? image = FaceRecognition.LoadImageFile(propertyHolder.ResizedFileHolder.FullName);
|
||||
item = new(sourceDirectoryFile, relativePath, fileHolder, isValidImageFormatExtension, property, false, false);
|
||||
Assert.IsNotNull(item.ImageFileHolder);
|
||||
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
||||
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, item);
|
||||
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(subFileTuples, parseExceptions, original, metadataCollection, property, item);
|
||||
Property.Models.FileHolder resizedFileHolder = new(Path.Combine(resize.AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(item.ImageFileHolder.FullName)));
|
||||
item.SetResizedFileHolder(resizedFileHolder);
|
||||
resize.SaveResizedSubfile(outputResolution, subFileTuples, item, original, property, imageResizeKeyValuePairs);
|
||||
item.SetResizedFileHolder(Property.Models.FileHolder.Refresh(resizedFileHolder));
|
||||
Assert.IsNotNull(item.ResizedFileHolder);
|
||||
Image? image = FaceRecognition.LoadImageFile(item.ResizedFileHolder.FullName);
|
||||
Assert.IsNotNull(image);
|
||||
FaceRecognition faceRecognition = FaceRecognition.Create(modelParameter);
|
||||
List<Location> locations = faceRecognition.FaceLocations(model, image, _Configuration.NumberOfTimesToUpsample.Value, sortByPixelPercentage: true);
|
||||
|
Reference in New Issue
Block a user