-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/1.3.0' into develop
- Loading branch information
Showing
49 changed files
with
1,338 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "src/DlibDotNet"] | ||
path = src/DlibDotNet | ||
url = https://github.com/takuya-takeuchi/DlibDotNet | ||
url = https://github.com/takuya-takeuchi/DlibDotNet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System.Collections.Generic; | ||
using DlibDotNet; | ||
|
||
namespace FaceRecognitionDotNet.Extensions | ||
{ | ||
|
||
/// <summary> | ||
/// An abstract base class that provides functionality to estimate human age from face image. | ||
/// </summary> | ||
public abstract class AgeEstimator : DisposableObject | ||
{ | ||
|
||
#region Properties | ||
|
||
/// <summary> | ||
/// Gets the collection of age group this estimator returns in derived classes. | ||
/// </summary> | ||
public abstract AgeRange[] Groups | ||
{ | ||
get; | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
internal uint Predict(Image image, Location location) | ||
{ | ||
return this.RawPredict(image.Matrix, location); | ||
} | ||
|
||
internal IDictionary<uint, float> PredictProbability(Image image, Location location) | ||
{ | ||
return this.RawPredictProbability(image.Matrix, location); | ||
} | ||
|
||
/// <summary> | ||
/// Returns an index of age group of face image correspond to specified location in specified image. | ||
/// </summary> | ||
/// <param name="matrix">The matrix contains a face.</param> | ||
/// <param name="location">The location rectangle for a face.</param> | ||
/// <returns>An index of age group of face image correspond to specified location in specified image.</returns> | ||
public abstract uint RawPredict(MatrixBase matrix, Location location); | ||
|
||
/// <summary> | ||
/// Returns probabilities of age group of face image correspond to specified location in specified image. | ||
/// </summary> | ||
/// <param name="matrix">The matrix contains a face.</param> | ||
/// <param name="location">The location rectangle for a face.</param> | ||
/// <returns>Probabilities of age group of face image correspond to specified location in specified image.</returns> | ||
public abstract IDictionary<uint, float> RawPredictProbability(MatrixBase matrix, Location location); | ||
|
||
#endregion | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
namespace FaceRecognitionDotNet.Extensions | ||
{ | ||
|
||
/// <summary> | ||
/// Represents a range that has start and end age. | ||
/// </summary> | ||
public struct AgeRange | ||
{ | ||
|
||
#region Constructors | ||
|
||
/// <summary> | ||
/// Instantiates a new <see cref="AgeRange"/> instance with the specified starting and ending ages. | ||
/// </summary> | ||
/// <param name="start">The inclusive age index of the range.</param> | ||
/// <param name="end">The exclusive end age of the range.</param> | ||
public AgeRange(int start, int end) | ||
{ | ||
this.Start = start; | ||
this.End = end; | ||
} | ||
|
||
#endregion | ||
|
||
#region Properties | ||
|
||
/// <summary> | ||
/// Gets an age that represents the exclusive end of the range. | ||
/// </summary> | ||
public int End | ||
{ | ||
get; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the inclusive start of the <see cref="T:FaceRecognitionDotNet.Extensions.AgeRange"/>. | ||
/// </summary> | ||
public int Start | ||
{ | ||
get; | ||
} | ||
|
||
#endregion | ||
|
||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
src/FaceRecognitionDotNet/Extensions/FaceLandmarkDetector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Collections.Generic; | ||
using DlibDotNet; | ||
|
||
namespace FaceRecognitionDotNet.Extensions | ||
{ | ||
|
||
/// <summary> | ||
/// An abstract base class that provides functionality to detect face parts locations from face image. | ||
/// </summary> | ||
public abstract class FaceLandmarkDetector : DisposableObject | ||
{ | ||
|
||
#region Methods | ||
|
||
internal FullObjectDetection Detect(Image image, Location location) | ||
{ | ||
return this.RawDetect(image.Matrix, location); | ||
} | ||
|
||
internal IEnumerable<Dictionary<FacePart, IEnumerable<Point>>> GetLandmarks(IEnumerable<Point[]> landmarkTuples) | ||
{ | ||
return this.RawGetLandmarks(landmarkTuples); | ||
} | ||
|
||
/// <summary> | ||
/// Returns an object contains information of face parts corresponds to specified location in specified image. | ||
/// </summary> | ||
/// <param name="matrix">The matrix contains a face.</param> | ||
/// <param name="location">The location rectangle for a face.</param> | ||
/// <returns>An object contains information of face parts.</returns> | ||
protected abstract FullObjectDetection RawDetect(MatrixBase matrix, Location location); | ||
|
||
/// <summary> | ||
/// Returns an enumerable collection of dictionary of face parts locations (eyes, nose, etc). | ||
/// </summary> | ||
/// <param name="landmarkTuples">The enumerable collection of face parts location.</param> | ||
/// <returns>An enumerable collection of dictionary of face parts locations (eyes, nose, etc).</returns> | ||
protected abstract IEnumerable<Dictionary<FacePart, IEnumerable<Point>>> RawGetLandmarks(IEnumerable<Point[]> landmarkTuples); | ||
|
||
#endregion | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System.Collections.Generic; | ||
using DlibDotNet; | ||
|
||
namespace FaceRecognitionDotNet.Extensions | ||
{ | ||
|
||
/// <summary> | ||
/// An abstract base class that provides functionality to estimate human gender from face image. | ||
/// </summary> | ||
public abstract class GenderEstimator : DisposableObject | ||
{ | ||
|
||
#region Properties | ||
|
||
/// <summary> | ||
/// Gets the collection of gender label this estimator returns in derived classes. | ||
/// </summary> | ||
public abstract Gender[] Labels | ||
{ | ||
get; | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
internal Gender Predict(Image image, Location location) | ||
{ | ||
return this.RawPredict(image.Matrix, location); | ||
} | ||
|
||
internal IDictionary<Gender, float> PredictProbability(Image image, Location location) | ||
{ | ||
return this.RawPredictProbability(image.Matrix, location); | ||
} | ||
|
||
/// <summary> | ||
/// Returns an gender of face image correspond to specified location in specified image. | ||
/// </summary> | ||
/// <param name="matrix">The matrix contains a face.</param> | ||
/// <param name="location">The location rectangle for a face.</param> | ||
/// <returns>An gender of face image correspond to specified location in specified image.</returns> | ||
public abstract Gender RawPredict(MatrixBase matrix, Location location); | ||
|
||
/// <summary> | ||
/// Returns probabilities of gender of face image correspond to specified location in specified image. | ||
/// </summary> | ||
/// <param name="matrix">The matrix contains a face.</param> | ||
/// <param name="location">The location rectangle for a face.</param> | ||
/// <returns>Probabilities of gender of face image correspond to specified location in specified image.</returns> | ||
public abstract IDictionary<Gender, float> RawPredictProbability(MatrixBase matrix, Location location); | ||
|
||
#endregion | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.