Model changes for Unit Test Face
This commit is contained in:
@ -329,7 +329,7 @@ public sealed class FaceRecognition : DisposableObject
|
||||
/// <returns>The enumerable collection of euclidean distance for comparison face. If 0, faces are completely equal.</returns>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="faceEncodings"/> or <paramref name="faceToCompare"/> is null.</exception>
|
||||
/// <exception cref="ObjectDisposedException"><paramref name="faceToCompare"/> is disposed. Or <paramref name="faceEncodings"/> contains disposed object.</exception>
|
||||
public static IEnumerable<double> FaceDistances(IEnumerable<FaceEncoding> faceEncodings, FaceEncoding faceToCompare)
|
||||
public static List<double> FaceDistances(IEnumerable<FaceEncoding> faceEncodings, FaceEncoding faceToCompare)
|
||||
{
|
||||
if (faceEncodings == null)
|
||||
throw new ArgumentNullException(nameof(faceEncodings));
|
||||
@ -366,7 +366,7 @@ public sealed class FaceRecognition : DisposableObject
|
||||
/// <exception cref="InvalidOperationException"><paramref name="knownFaceLocation"/> contains no elements.</exception>
|
||||
/// <exception cref="ObjectDisposedException"><paramref name="image"/> or this object or custom face landmark detector is disposed.</exception>
|
||||
/// <exception cref="NotSupportedException"><see cref="PredictorModel.Custom"/> is not supported.</exception>
|
||||
public IEnumerable<FaceEncoding> FaceEncodings(Image image,
|
||||
public List<FaceEncoding> FaceEncodings(Image image,
|
||||
IEnumerable<Location>? knownFaceLocation = null,
|
||||
int numJitters = 1,
|
||||
PredictorModel predictorModel = PredictorModel.Small,
|
||||
@ -385,7 +385,7 @@ public sealed class FaceRecognition : DisposableObject
|
||||
|
||||
IEnumerable<FullObjectDetection>? rawLandmarks = RawFaceLandmarks(image, knownFaceLocation, predictorModel, model);
|
||||
|
||||
List<FaceEncoding>? results = new();
|
||||
List<FaceEncoding> results = new();
|
||||
foreach (FullObjectDetection? landmark in rawLandmarks)
|
||||
{
|
||||
FaceEncoding? ret = new(FaceRecognitionModelV1.ComputeFaceDescriptor(_FaceEncoder, image, landmark, numJitters));
|
||||
@ -408,7 +408,7 @@ public sealed class FaceRecognition : DisposableObject
|
||||
/// <exception cref="InvalidOperationException"><paramref name="faceLocations"/> contains no elements.</exception>
|
||||
/// <exception cref="ObjectDisposedException"><paramref name="faceImage"/> or this object or custom face landmark detector is disposed.</exception>
|
||||
/// <exception cref="NotSupportedException">The custom face landmark detector is not ready.</exception>
|
||||
public IEnumerable<IDictionary<FacePart, IEnumerable<FacePoint>>> FaceLandmark(Image faceImage,
|
||||
public List<Dictionary<FacePart, IEnumerable<FacePoint>>> FaceLandmark(Image faceImage,
|
||||
IEnumerable<Location>? faceLocations = null,
|
||||
PredictorModel predictorModel = PredictorModel.Large,
|
||||
Model model = Model.Hog)
|
||||
@ -435,7 +435,7 @@ public sealed class FaceRecognition : DisposableObject
|
||||
IEnumerable<FacePoint[]>? landmarkTuples = landmarks.Select(landmark => Enumerable.Range(0, (int)landmark.Parts)
|
||||
.Select(index => new FacePoint(index, landmark.GetPart((uint)index).X, landmark.GetPart((uint)index).Y)).ToArray());
|
||||
|
||||
List<Dictionary<FacePart, IEnumerable<FacePoint>>>? results = new();
|
||||
List<Dictionary<FacePart, IEnumerable<FacePoint>>> results = new();
|
||||
|
||||
try
|
||||
{
|
||||
@ -491,7 +491,7 @@ public sealed class FaceRecognition : DisposableObject
|
||||
landmark.Dispose();
|
||||
}
|
||||
|
||||
return results.ToArray();
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -503,7 +503,7 @@ public sealed class FaceRecognition : DisposableObject
|
||||
/// <returns>An enumerable collection of face location correspond to all faces in specified image.</returns>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="image"/> is null.</exception>
|
||||
/// <exception cref="ObjectDisposedException"><paramref name="image"/> or this object is disposed.</exception>
|
||||
public IEnumerable<Location> FaceLocations(Image image, int numberOfTimesToUpsample = 1, Model model = Model.Hog)
|
||||
public List<Location> FaceLocations(Image image, int numberOfTimesToUpsample = 1, Model model = Model.Hog)
|
||||
{
|
||||
if (image == null)
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
@ -511,7 +511,7 @@ public sealed class FaceRecognition : DisposableObject
|
||||
image.ThrowIfDisposed();
|
||||
ThrowIfDisposed();
|
||||
|
||||
List<Location>? results = new();
|
||||
List<Location> results = new();
|
||||
foreach (MModRect? face in RawFaceLocations(image, numberOfTimesToUpsample, model))
|
||||
{
|
||||
Location? ret = TrimBound(face.Rect, image.Width, image.Height);
|
||||
|
Reference in New Issue
Block a user