Skip to content

Commit

Permalink
Merge branch 'release/1.3.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
takuya-takeuchi committed Mar 13, 2021
2 parents e6666f7 + 6367383 commit 75658ae
Show file tree
Hide file tree
Showing 58 changed files with 591 additions and 89 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/docfx.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: DocFX

on:
push:
branches:
- master

jobs:
build:
runs-on: windows-2019

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: DocFX
shell: cmd
run: |
choco install docfx -y
docfx docs\docfx.json

- name: Upload DocFX packages
uses: actions/upload-artifact@v2
with:
name: docfx_site
path: ${{ github.workspace }}\docs\_site

- name: Publish Documentation on GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docfx/_site
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ __pycache__/
*.odx.cs
*.xsd.cs

### DocFx ###
.cache
/**/_site/

# Custom
src/DlibDotNet.Native/*.bat
src/DlibDotNet.Native.Dnn/*.bat
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ This package supports cross platform, Windows, Linux and MacOSX!!
|FaceRecognitionDotNet for CUDA 11.1|Windows|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA111.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA111)|
||Linux|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA111.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA111)|
||OSX|-|-|-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA111.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA111)|
|FaceRecognitionDotNet for CUDA 11.2|Windows|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA112.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA112)|
||Linux|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA112.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA112)|
||OSX|-|-|-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA112.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA112)|
|FaceRecognitionDotNet for Intel MKL|Windows|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.MKL.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.MKL)|
||Linux|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.MKL.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.MKL)|
||OSX|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.MKL.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.MKL)|
Expand Down Expand Up @@ -80,6 +83,12 @@ You can check the following examples to train dataset.
|---|---|---|
|<img src="images/3.jpg" width="240"/>|<img src="examples/CustomClassificationDemo/images/result.png" width="240"/>|<img src="images/4.png" width="240"/>|

## Document

FaceRecognitionDotNet support full xml document for Visual Studio.
A xml document is written English and Japanese.
And you can check online document at [FaceRecognitionDotNet API Document](https://taktak.jp/FaceRecognitionDotNet/)

## Dependencies Libraries and Products

#### [face_recognition](https://github.com/ageitgey/face_recognition/)
Expand Down
9 changes: 9 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
###############
# folder #
###############
/**/DROP/
/**/TEMP/
/**/packages/
/**/bin/
/**/obj/
_site
8 changes: 8 additions & 0 deletions docs/GenerateFaceRecognitionDotNetDocmenet.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$Current = $PSScriptRoot

$FaceRecognitionDotNetRoot = Split-Path $Current -Parent
$SourceRoot = Join-Path $FaceRecognitionDotNetRoot src
$FaceRecognitionDotNetProjectRoot = Join-Path $SourceRoot FaceRecognitionDotNet

docfx init -q -o docs
Set-Location $Current
10 changes: 10 additions & 0 deletions docs/RunDocumentServer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$Current = $PSScriptRoot

$FaceRecognitionDotNetRoot = Split-Path $Current -Parent
$SourceRoot = Join-Path $FaceRecognitionDotNetRoot src
$FaceRecognitionDotNetProjectRoot = Join-Path $SourceRoot FaceRecognitionDotNet
$DocumentDir = Join-Path $FaceRecognitionDotNetProjectRoot docfx
$Json = Join-Path $Current docfx.json

docfx "${Json}" --serve
Set-Location $Current
5 changes: 5 additions & 0 deletions docs/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
###############
# temp file #
###############
*.yml
.manifest
2 changes: 2 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# PLACEHOLDER
TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*!
1 change: 1 addition & 0 deletions docs/articles/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Add your introductions here!
2 changes: 2 additions & 0 deletions docs/articles/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: Introduction
href: intro.md
69 changes: 69 additions & 0 deletions docs/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"metadata": [
{
"src": [
{
"files": [
"**/FaceRecognitionDotNet.csproj"
],
"src": "../src/FaceRecognitionDotNet"
}
],
"dest": "api",
"disableGitFeatures": false,
"disableDefaultFilter": false
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"dest": "_site",
"globalMetadataFiles": [],
"globalMetadata": {
"_appTitle": "FaceRecognitionDotNet API Document",
"_appLogoPath": "images/logo.png"
},
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
}
}
Binary file added docs/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# FaceRecognitionDotNet API Document

FaceRecognitionDotNet provides simplest facial recognition api for .NET on Windows, MacOS and Linux.
5 changes: 5 additions & 0 deletions docs/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# - name: Articles
# href: articles/
- name: Api Documentation
href: api/
# homepage: api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Drawing.Common" Version="5.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 18 additions & 0 deletions examples/Encoding/Encoding.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<Authors>Takuya Takeuchi</Authors>
<Description>Example of FaceRecognitionDotNet</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
</ItemGroup>

</Project>
83 changes: 83 additions & 0 deletions examples/Encoding/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* This sample program is ported by C# from https://github.com/ageitgey/face_recognition/blob/master/examples/benchmark.py.
*/

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using FaceRecognitionDotNet;
using Microsoft.Extensions.CommandLineUtils;

namespace Benchmark
{

internal class Program
{

#region Methods

private static void Main(string[] args)
{
var app = new CommandLineApplication(false);
app.Name = nameof(Benchmark);
app.Description = "The program for measure face encoding performance";
app.HelpOption("-h|--help");

var modelsOption = app.Option("-m|--model", "model files directory path", CommandOptionType.SingleValue);
var imageOption = app.Option("-i|--image", "target image", CommandOptionType.SingleValue);

app.OnExecute(() =>
{
if (!modelsOption.HasValue())
{
Console.WriteLine("--model is not specified");
app.ShowHelp();
return -1;
}
var directory = modelsOption.Value();
if (!Directory.Exists(directory))
{
Console.WriteLine($"{directory} does not exist");
app.ShowHelp();
return -1;
}
var image = imageOption.Value();
if (!File.Exists(image))
{
Console.WriteLine($"{image} does not exist");
app.ShowHelp();
return -1;
}
using (var fr = FaceRecognition.Create(directory))
using (var im = FaceRecognition.LoadImageFile(image))
{
var locations = fr.FaceLocations(im);
foreach (var l in locations)
Console.WriteLine($"l: {l.Left}, t: {l.Top}, r: {l.Right}, b: {l.Bottom}");
foreach (var l in locations)
{
var encodings = fr.FaceEncodings(im, new [] {l});
foreach (var e in encodings)
{
Console.WriteLine($"{string.Join(", ", e.GetRawEncoding().Select(s => s.ToString()))}");
e.Dispose();
}
}
}
return 0;
});

app.Execute(args);
}

#endregion

}

}
30 changes: 30 additions & 0 deletions examples/Encoding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Encoding

This example extract face encoding and show binary data on console.

## How to use?

## 1. Preparation

This sample requires test image and model files.

## 2. Build

1. Open command prompt and change to &lt;Encoding_dir&gt;
1. Type the following command
````
$ dotnet remove reference ../../src/FaceRecognitionDotNet/DlibDotNet.csproj
$ dotnet remove reference ../../src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj
$ dotnet add package FaceRecognitionDotNet
$ dotnet build -c Release
````

## 3. Run

1. Open command prompt and change to &lt;Encoding_dir&gt;
1. Type the following sample command
````
$ dotnet run -c Release -- --model models --image obama-240p.jpg
l: 190, t: 32, r: 252, b: 94
-0.0858781188726425, 0.108835116028786, 0.0365724340081215, -0.0589281246066093, 0.0132484100759029, -0.00542659685015678, -0.065446712076664, -0.110336743295193, 0.19452229142189, -0.0979864299297333, 0.2352324873209, 0.0787549242377281, -0.213130414485931, -0.163164556026459, 0.0599864907562733, 0.114194087684155, -0.174584299325943, -0.0919561088085175, -0.0930094122886658, -0.117708653211594, 0.0325165763497353, -0.00997351761907339, 0.106906838715076, 0.0505531094968319, -0.144327610731125, -0.340307205915451, -0.0607180781662464, -0.188485234975815, -0.010340285487473, -0.108085952699184, -0.0919387713074684, 0.00310934125445783, -0.180108249187469, -0.124415650963783, 0.0167518854141235, -0.0189712662249804, 0.0118233505636454, -0.00810264237225056, 0.211996838450432, 0.026537474244833, -0.130677983164787, 0.0932836830615997, 0.0186070054769516, 0.207101136445999, 0.277875900268555, 0.0787801891565323, -0.00383740104734898, -0.0775237083435059, 0.126798510551453, -0.228157266974449, 0.0655233263969421, 0.155302807688713, 0.0920143350958824, 0.0186425745487213, 0.0837418735027313, -0.191329553723335, -0.00609584245830774, 0.0760508179664612, -0.14967368543148, 0.030364228412509, 0.0180820152163506, -0.0949648693203926, -0.0386509634554386, 0.0592935085296631, 0.182954981923103, 0.107051037251949, -0.113879278302193, -0.0532004535198212, 0.131714105606079, -0.0395184531807899, 0.015960929915309, 0.0232246778905392, -0.193916633725166, -0.200455144047737, -0.232742950320244, 0.0793688371777534, 0.374781519174576, 0.173277884721756, -0.211374044418335, -9.25520434975624E-05, -0.21218629181385, 0.0490190535783768, 0.0651776567101479, 0.015591973438859, -0.0640056058764458, -0.136019349098206, -0.0460829176008701, 0.0354794897139072, 0.0894847884774208, 0.0356751903891563, -0.0501493290066719, 0.225857928395271, -0.0144199710339308, 0.0671800822019577, 0.0112739009782672, 0.0495598912239075, -0.14527502655983, -0.0147501565515995, -0.158632963895798, -0.0530679523944855, 0.0203705467283726, -0.030452735722065, 0.0460555553436279, 0.145609840750694, -0.250953495502472, 0.0573373362421989, 0.00578311737626791, -0.0420315787196159, 0.0314476825296879, 0.0746812149882317, -0.0375748537480831, -0.0473008044064045, 0.0588102079927921, -0.238515302538872, 0.237175717949867, 0.259294271469116, 0.0266373176127672, 0.170270383358002, 0.0662055835127831, 0.0214092433452606, -0.000137977302074432, -0.0245289821177721, -0.163018763065338, -0.0655205324292183, 0.0550495907664299, 0.0647143721580505, 0.0707048177719116, 0.00707003846764565
````
18 changes: 18 additions & 0 deletions examples/Encoding/Test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$targets = @(
"",
".CUDA111",
".MKL"
)

$ScriptPath = $PSScriptRoot
Set-Location $ScriptPath

foreach ($target in $targets)
{
dotnet remove reference ..\..\src\DlibDotNet\src\DlibDotNet\DlibDotNet.csproj > $null
dotnet remove reference ..\..\src\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj > $null
dotnet add package "FaceRecognitionDotNet${target}"
$image = Join-Path $ScriptPath "obama-240p.jpg"
dotnet run -c Release -- --model ${env:FaceRecognitionDotNetModelDir} --image "${image}" > "FaceRecognitionDotNet${target}.log"
git checkout .
}
Binary file added examples/Encoding/obama-240p.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions nuget/BuildCentOS7.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target =
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 102 }
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 110 }
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 111 }
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 112 }
#$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 64; Postfix = "64"; RID = "$OperatingSystem-arm64"; CUDA = 0 }
#$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 32; Postfix = ""; RID = "$OperatingSystem-arm"; CUDA = 0 }

Expand Down
1 change: 1 addition & 0 deletions nuget/BuildUbuntu16.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target =
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 102 }
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 110 }
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 111 }
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 112 }
#$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 64; Postfix = "64"; RID = "$OperatingSystem-arm64"; CUDA = 0 }
#$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 32; Postfix = ""; RID = "$OperatingSystem-arm"; CUDA = 0 }

Expand Down
Loading

0 comments on commit 75658ae

Please sign in to comment.