Skip to content

Commit 75658ae

Browse files
Merge branch 'release/1.3.0.4'
2 parents e6666f7 + 6367383 commit 75658ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+591
-89
lines changed

.github/workflows/docfx.xml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: DocFX
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: windows-2019
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 1
17+
18+
- name: DocFX
19+
shell: cmd
20+
run: |
21+
choco install docfx -y
22+
docfx docs\docfx.json
23+
24+
- name: Upload DocFX packages
25+
uses: actions/upload-artifact@v2
26+
with:
27+
name: docfx_site
28+
path: ${{ github.workspace }}\docs\_site
29+
30+
- name: Publish Documentation on GitHub Pages
31+
uses: peaceiris/actions-gh-pages@v3
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: docfx/_site

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ __pycache__/
305305
*.odx.cs
306306
*.xsd.cs
307307

308+
### DocFx ###
309+
.cache
310+
/**/_site/
311+
308312
# Custom
309313
src/DlibDotNet.Native/*.bat
310314
src/DlibDotNet.Native.Dnn/*.bat

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ This package supports cross platform, Windows, Linux and MacOSX!!
2828
|FaceRecognitionDotNet for CUDA 11.1|Windows|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA111.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA111)|
2929
||Linux|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA111.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA111)|
3030
||OSX|-|-|-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA111.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA111)|
31+
|FaceRecognitionDotNet for CUDA 11.2|Windows|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA112.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA112)|
32+
||Linux|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA112.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA112)|
33+
||OSX|-|-|-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.CUDA112.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.CUDA112)|
3134
|FaceRecognitionDotNet for Intel MKL|Windows|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.MKL.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.MKL)|
3235
||Linux|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.MKL.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.MKL)|
3336
||OSX|-||-|-|[![NuGet version](https://img.shields.io/nuget/v/FaceRecognitionDotNet.MKL.svg)](https://www.nuget.org/packages/FaceRecognitionDotNet.MKL)|
@@ -80,6 +83,12 @@ You can check the following examples to train dataset.
8083
|---|---|---|
8184
|<img src="images/3.jpg" width="240"/>|<img src="examples/CustomClassificationDemo/images/result.png" width="240"/>|<img src="images/4.png" width="240"/>|
8285

86+
## Document
87+
88+
FaceRecognitionDotNet support full xml document for Visual Studio.
89+
A xml document is written English and Japanese.
90+
And you can check online document at [FaceRecognitionDotNet API Document](https://taktak.jp/FaceRecognitionDotNet/)
91+
8392
## Dependencies Libraries and Products
8493

8594
#### [face_recognition](https://github.com/ageitgey/face_recognition/)

docs/.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
###############
2+
# folder #
3+
###############
4+
/**/DROP/
5+
/**/TEMP/
6+
/**/packages/
7+
/**/bin/
8+
/**/obj/
9+
_site
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$Current = $PSScriptRoot
2+
3+
$FaceRecognitionDotNetRoot = Split-Path $Current -Parent
4+
$SourceRoot = Join-Path $FaceRecognitionDotNetRoot src
5+
$FaceRecognitionDotNetProjectRoot = Join-Path $SourceRoot FaceRecognitionDotNet
6+
7+
docfx init -q -o docs
8+
Set-Location $Current

docs/RunDocumentServer.ps1

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$Current = $PSScriptRoot
2+
3+
$FaceRecognitionDotNetRoot = Split-Path $Current -Parent
4+
$SourceRoot = Join-Path $FaceRecognitionDotNetRoot src
5+
$FaceRecognitionDotNetProjectRoot = Join-Path $SourceRoot FaceRecognitionDotNet
6+
$DocumentDir = Join-Path $FaceRecognitionDotNetProjectRoot docfx
7+
$Json = Join-Path $Current docfx.json
8+
9+
docfx "${Json}" --serve
10+
Set-Location $Current

docs/api/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
###############
2+
# temp file #
3+
###############
4+
*.yml
5+
.manifest

docs/api/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# PLACEHOLDER
2+
TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*!

docs/articles/intro.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Add your introductions here!

docs/articles/toc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- name: Introduction
2+
href: intro.md

docs/docfx.json

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"metadata": [
3+
{
4+
"src": [
5+
{
6+
"files": [
7+
"**/FaceRecognitionDotNet.csproj"
8+
],
9+
"src": "../src/FaceRecognitionDotNet"
10+
}
11+
],
12+
"dest": "api",
13+
"disableGitFeatures": false,
14+
"disableDefaultFilter": false
15+
}
16+
],
17+
"build": {
18+
"content": [
19+
{
20+
"files": [
21+
"api/**.yml",
22+
"api/index.md"
23+
]
24+
},
25+
{
26+
"files": [
27+
"articles/**.md",
28+
"articles/**/toc.yml",
29+
"toc.yml",
30+
"*.md"
31+
]
32+
}
33+
],
34+
"resource": [
35+
{
36+
"files": [
37+
"images/**"
38+
]
39+
}
40+
],
41+
"overwrite": [
42+
{
43+
"files": [
44+
"apidoc/**.md"
45+
],
46+
"exclude": [
47+
"obj/**",
48+
"_site/**"
49+
]
50+
}
51+
],
52+
"dest": "_site",
53+
"globalMetadataFiles": [],
54+
"globalMetadata": {
55+
"_appTitle": "FaceRecognitionDotNet API Document",
56+
"_appLogoPath": "images/logo.png"
57+
},
58+
"fileMetadataFiles": [],
59+
"template": [
60+
"default"
61+
],
62+
"postProcessors": [],
63+
"markdownEngineName": "markdig",
64+
"noLangKeyword": false,
65+
"keepFileLink": false,
66+
"cleanupCacheHistory": false,
67+
"disableGitFeatures": false
68+
}
69+
}

docs/images/logo.png

1.92 KB
Loading

docs/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# FaceRecognitionDotNet API Document
2+
3+
FaceRecognitionDotNet provides simplest facial recognition api for .NET on Windows, MacOS and Linux.

docs/toc.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# - name: Articles
2+
# href: articles/
3+
- name: Api Documentation
4+
href: api/
5+
# homepage: api/index.md

examples/CustomClassificationDemo/CustomClassificationDemo.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
11+
<PackageReference Include="System.Drawing.Common" Version="5.0.1" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

examples/Encoding/Encoding.csproj

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
6+
<Authors>Takuya Takeuchi</Authors>
7+
<Description>Example of FaceRecognitionDotNet</Description>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\..\src\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
16+
</ItemGroup>
17+
18+
</Project>

examples/Encoding/Program.cs

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* This sample program is ported by C# from https://github.com/ageitgey/face_recognition/blob/master/examples/benchmark.py.
3+
*/
4+
5+
using System;
6+
using System.Diagnostics;
7+
using System.IO;
8+
using System.Linq;
9+
using FaceRecognitionDotNet;
10+
using Microsoft.Extensions.CommandLineUtils;
11+
12+
namespace Benchmark
13+
{
14+
15+
internal class Program
16+
{
17+
18+
#region Methods
19+
20+
private static void Main(string[] args)
21+
{
22+
var app = new CommandLineApplication(false);
23+
app.Name = nameof(Benchmark);
24+
app.Description = "The program for measure face encoding performance";
25+
app.HelpOption("-h|--help");
26+
27+
var modelsOption = app.Option("-m|--model", "model files directory path", CommandOptionType.SingleValue);
28+
var imageOption = app.Option("-i|--image", "target image", CommandOptionType.SingleValue);
29+
30+
app.OnExecute(() =>
31+
{
32+
if (!modelsOption.HasValue())
33+
{
34+
Console.WriteLine("--model is not specified");
35+
app.ShowHelp();
36+
return -1;
37+
}
38+
39+
var directory = modelsOption.Value();
40+
if (!Directory.Exists(directory))
41+
{
42+
Console.WriteLine($"{directory} does not exist");
43+
app.ShowHelp();
44+
return -1;
45+
}
46+
47+
var image = imageOption.Value();
48+
if (!File.Exists(image))
49+
{
50+
Console.WriteLine($"{image} does not exist");
51+
app.ShowHelp();
52+
return -1;
53+
}
54+
55+
using (var fr = FaceRecognition.Create(directory))
56+
using (var im = FaceRecognition.LoadImageFile(image))
57+
{
58+
var locations = fr.FaceLocations(im);
59+
foreach (var l in locations)
60+
Console.WriteLine($"l: {l.Left}, t: {l.Top}, r: {l.Right}, b: {l.Bottom}");
61+
62+
foreach (var l in locations)
63+
{
64+
var encodings = fr.FaceEncodings(im, new [] {l});
65+
foreach (var e in encodings)
66+
{
67+
Console.WriteLine($"{string.Join(", ", e.GetRawEncoding().Select(s => s.ToString()))}");
68+
e.Dispose();
69+
}
70+
}
71+
}
72+
73+
return 0;
74+
});
75+
76+
app.Execute(args);
77+
}
78+
79+
#endregion
80+
81+
}
82+
83+
}

examples/Encoding/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Encoding
2+
3+
This example extract face encoding and show binary data on console.
4+
5+
## How to use?
6+
7+
## 1. Preparation
8+
9+
This sample requires test image and model files.
10+
11+
## 2. Build
12+
13+
1. Open command prompt and change to &lt;Encoding_dir&gt;
14+
1. Type the following command
15+
````
16+
$ dotnet remove reference ../../src/FaceRecognitionDotNet/DlibDotNet.csproj
17+
$ dotnet remove reference ../../src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj
18+
$ dotnet add package FaceRecognitionDotNet
19+
$ dotnet build -c Release
20+
````
21+
22+
## 3. Run
23+
24+
1. Open command prompt and change to &lt;Encoding_dir&gt;
25+
1. Type the following sample command
26+
````
27+
$ dotnet run -c Release -- --model models --image obama-240p.jpg
28+
l: 190, t: 32, r: 252, b: 94
29+
-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
30+
````

examples/Encoding/Test.ps1

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
$targets = @(
2+
"",
3+
".CUDA111",
4+
".MKL"
5+
)
6+
7+
$ScriptPath = $PSScriptRoot
8+
Set-Location $ScriptPath
9+
10+
foreach ($target in $targets)
11+
{
12+
dotnet remove reference ..\..\src\DlibDotNet\src\DlibDotNet\DlibDotNet.csproj > $null
13+
dotnet remove reference ..\..\src\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj > $null
14+
dotnet add package "FaceRecognitionDotNet${target}"
15+
$image = Join-Path $ScriptPath "obama-240p.jpg"
16+
dotnet run -c Release -- --model ${env:FaceRecognitionDotNetModelDir} --image "${image}" > "FaceRecognitionDotNet${target}.log"
17+
git checkout .
18+
}

examples/Encoding/obama-240p.jpg

36.4 KB
Loading

nuget/BuildCentOS7.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target =
3838
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 102 }
3939
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 110 }
4040
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 111 }
41+
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 112 }
4142
#$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 64; Postfix = "64"; RID = "$OperatingSystem-arm64"; CUDA = 0 }
4243
#$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 32; Postfix = ""; RID = "$OperatingSystem-arm"; CUDA = 0 }
4344

nuget/BuildUbuntu16.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target =
3838
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 102 }
3939
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 110 }
4040
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 111 }
41+
$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 112 }
4142
#$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 64; Postfix = "64"; RID = "$OperatingSystem-arm64"; CUDA = 0 }
4243
#$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 32; Postfix = ""; RID = "$OperatingSystem-arm"; CUDA = 0 }
4344

0 commit comments

Comments
 (0)