Skip to content

Instantly share code, notes, and snippets.

@mdfarragher
Last active July 19, 2019 11:28
Show Gist options
  • Save mdfarragher/1855d38b359ddecbd54ba4c88ca04b54 to your computer and use it in GitHub Desktop.
Save mdfarragher/1855d38b359ddecbd54ba4c88ca04b54 to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using System;
using DlibDotNet;
namespace FaceClustering
{
/// <summary>
/// The program class.
/// </summary>
class Program
{
// file paths
private const string inputFilePath = "./selfie.jpg";
/// <summary>
/// The program entry point.
/// </summary>
/// <param name="args">The command line arguments</param>
static void Main(string[] args)
{
Console.WriteLine("Loading detectors...");
// set up a face detector
using (var detector = Dlib.GetFrontalFaceDetector())
// set up a 5-point landmark detector
using (var predictor = ShapePredictor.Deserialize("shape_predictor_5_face_landmarks.dat"))
// set up a neural network for face recognition
using (var dnn = DlibDotNet.Dnn.LossMetric.Deserialize("dlib_face_recognition_resnet_model_v1.dat"))
// load the image
using (var img = Dlib.LoadImage<RgbPixel>(inputFilePath))
{
// the rest of the code goes here...
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment