diff --git a/.github/workflows/docfx.xml b/.github/workflows/docfx.xml new file mode 100644 index 0000000..eab9810 --- /dev/null +++ b/.github/workflows/docfx.xml @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 026b1b9..d70ede3 100644 --- a/.gitignore +++ b/.gitignore @@ -305,6 +305,10 @@ __pycache__/ *.odx.cs *.xsd.cs +### DocFx ### +.cache +/**/_site/ + # Custom src/DlibDotNet.Native/*.bat src/DlibDotNet.Native.Dnn/*.bat diff --git a/README.md b/README.md index 8fbb426..3a6fce2 100644 --- a/README.md +++ b/README.md @@ -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)| @@ -80,6 +83,12 @@ You can check the following examples to train dataset. |---|---|---| |||| +## 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/) diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..2781f6d --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,9 @@ +############### +# folder # +############### +/**/DROP/ +/**/TEMP/ +/**/packages/ +/**/bin/ +/**/obj/ +_site diff --git a/docs/GenerateFaceRecognitionDotNetDocmenet.ps1 b/docs/GenerateFaceRecognitionDotNetDocmenet.ps1 new file mode 100644 index 0000000..32a7ecd --- /dev/null +++ b/docs/GenerateFaceRecognitionDotNetDocmenet.ps1 @@ -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 \ No newline at end of file diff --git a/docs/RunDocumentServer.ps1 b/docs/RunDocumentServer.ps1 new file mode 100644 index 0000000..1dccbd1 --- /dev/null +++ b/docs/RunDocumentServer.ps1 @@ -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 \ No newline at end of file diff --git a/docs/api/.gitignore b/docs/api/.gitignore new file mode 100644 index 0000000..f798527 --- /dev/null +++ b/docs/api/.gitignore @@ -0,0 +1,5 @@ +############### +# temp file # +############### +*.yml +.manifest diff --git a/docs/api/index.md b/docs/api/index.md new file mode 100644 index 0000000..1cb6831 --- /dev/null +++ b/docs/api/index.md @@ -0,0 +1,2 @@ +# PLACEHOLDER +TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*! diff --git a/docs/articles/intro.md b/docs/articles/intro.md new file mode 100644 index 0000000..901a16a --- /dev/null +++ b/docs/articles/intro.md @@ -0,0 +1 @@ +# Add your introductions here! diff --git a/docs/articles/toc.yml b/docs/articles/toc.yml new file mode 100644 index 0000000..f64352c --- /dev/null +++ b/docs/articles/toc.yml @@ -0,0 +1,2 @@ +- name: Introduction + href: intro.md diff --git a/docs/docfx.json b/docs/docfx.json new file mode 100644 index 0000000..b30cd7c --- /dev/null +++ b/docs/docfx.json @@ -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 + } +} \ No newline at end of file diff --git a/docs/images/logo.png b/docs/images/logo.png new file mode 100644 index 0000000..fd4fce0 Binary files /dev/null and b/docs/images/logo.png differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..827b6a7 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,3 @@ +# FaceRecognitionDotNet API Document + +FaceRecognitionDotNet provides simplest facial recognition api for .NET on Windows, MacOS and Linux. \ No newline at end of file diff --git a/docs/toc.yml b/docs/toc.yml new file mode 100644 index 0000000..29c87cc --- /dev/null +++ b/docs/toc.yml @@ -0,0 +1,5 @@ +# - name: Articles +# href: articles/ +- name: Api Documentation + href: api/ +# homepage: api/index.md diff --git a/examples/CustomClassificationDemo/CustomClassificationDemo.csproj b/examples/CustomClassificationDemo/CustomClassificationDemo.csproj index 1a5aa07..d04f4f9 100644 --- a/examples/CustomClassificationDemo/CustomClassificationDemo.csproj +++ b/examples/CustomClassificationDemo/CustomClassificationDemo.csproj @@ -8,7 +8,7 @@ - + diff --git a/examples/Encoding/Encoding.csproj b/examples/Encoding/Encoding.csproj new file mode 100644 index 0000000..f7fe68e --- /dev/null +++ b/examples/Encoding/Encoding.csproj @@ -0,0 +1,18 @@ + + + + Exe + netcoreapp2.0 + Takuya Takeuchi + Example of FaceRecognitionDotNet + + + + + + + + + + + diff --git a/examples/Encoding/Program.cs b/examples/Encoding/Program.cs new file mode 100644 index 0000000..2231724 --- /dev/null +++ b/examples/Encoding/Program.cs @@ -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 + + } + +} diff --git a/examples/Encoding/README.md b/examples/Encoding/README.md new file mode 100644 index 0000000..92d1a97 --- /dev/null +++ b/examples/Encoding/README.md @@ -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 <Encoding_dir> +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 <Encoding_dir> +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 +```` \ No newline at end of file diff --git a/examples/Encoding/Test.ps1 b/examples/Encoding/Test.ps1 new file mode 100644 index 0000000..5ceb587 --- /dev/null +++ b/examples/Encoding/Test.ps1 @@ -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 . +} \ No newline at end of file diff --git a/examples/Encoding/obama-240p.jpg b/examples/Encoding/obama-240p.jpg new file mode 100644 index 0000000..c4a947a Binary files /dev/null and b/examples/Encoding/obama-240p.jpg differ diff --git a/nuget/BuildCentOS7.ps1 b/nuget/BuildCentOS7.ps1 index e08f646..fcf0dd4 100644 --- a/nuget/BuildCentOS7.ps1 +++ b/nuget/BuildCentOS7.ps1 @@ -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 } diff --git a/nuget/BuildUbuntu16.ps1 b/nuget/BuildUbuntu16.ps1 index 8bd068e..7fd06e6 100644 --- a/nuget/BuildUbuntu16.ps1 +++ b/nuget/BuildUbuntu16.ps1 @@ -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 } diff --git a/nuget/BuildUtils.ps1 b/nuget/BuildUtils.ps1 index a2b9385..face016 100644 --- a/nuget/BuildUtils.ps1 +++ b/nuget/BuildUtils.ps1 @@ -38,7 +38,8 @@ class Config 101, 102, 110, - 111 + 111, + 112 ) $CudaVersionHash = @@ -51,6 +52,7 @@ class Config 102 = "CUDA_PATH_V10_2"; 110 = "CUDA_PATH_V11_0"; 111 = "CUDA_PATH_V11_1"; + 112 = "CUDA_PATH_V11_2"; } $VisualStudio = "Visual Studio 15 2017" @@ -97,7 +99,7 @@ class Config # %4: Architecture (32/64) # %5: Platform (desktop/android/ios/uwp) # %6: Optional Argument - # if Target is cuda, CUDA version if Target is cuda [90/91/92/100/101/102] + # if Target is cuda, CUDA version if Target is cuda [90/91/92/100/101/102/110/111/112] # if Target is mkl and Windows, IntelMKL directory path #*************************************** Config( [string]$Root, @@ -444,12 +446,15 @@ class Config [string] GetCUDAPath() { - # CUDA_PATH_V10_0=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0 - # CUDA_PATH_V10_1=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1 - # CUDA_PATH_V10_2=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2 # CUDA_PATH_V9_0=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0 # CUDA_PATH_V9_1=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1 # CUDA_PATH_V9_2=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2 + # CUDA_PATH_V10_0=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0 + # CUDA_PATH_V10_1=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1 + # CUDA_PATH_V10_2=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2 + # CUDA_PATH_V11_0=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0 + # CUDA_PATH_V11_1=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1 + # CUDA_PATH_V11_2=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2 $version = $this.CudaVersionHash[$this._CudaVersion] return [environment]::GetEnvironmentVariable($version, 'Machine') } diff --git a/nuget/BuildWindows.ps1 b/nuget/BuildWindows.ps1 index 5a7de0a..4b10df4 100644 --- a/nuget/BuildWindows.ps1 +++ b/nuget/BuildWindows.ps1 @@ -40,6 +40,7 @@ $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 102 } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 110 } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 111 } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 112 } foreach ($BuildTarget in $BuildTargets) { diff --git a/nuget/CreateAllPackage.ps1 b/nuget/CreateAllPackage.ps1 index 00ac1f5..3222699 100644 --- a/nuget/CreateAllPackage.ps1 +++ b/nuget/CreateAllPackage.ps1 @@ -6,6 +6,7 @@ $targets = @( "CUDA102", "CUDA110", "CUDA111", + "CUDA112", "MKL" ) diff --git a/nuget/TestPackage.ps1 b/nuget/TestPackage.ps1 index b79792c..c201ee6 100644 --- a/nuget/TestPackage.ps1 +++ b/nuget/TestPackage.ps1 @@ -77,12 +77,12 @@ function RunTest($BuildTargets, $DependencyHash) New-Item "$TestDir" -ItemType Directory > $null } - $NativeTestDir = Join-Path $FaceRecognitionDotNetRoot test | ` + $UnitTestDir = Join-Path $FaceRecognitionDotNetRoot test | ` Join-Path -ChildPath FaceRecognitionDotNet.Tests $TargetDir = Join-Path $WorkDir FaceRecognitionDotNet.Tests if (Test-Path "$TargetDir") { - Remove-Item -Path "$TargetDir" -Recurse -Force + Remove-Item -Path "$TargetDir" -Recurse -Force 2> $null } $TargetDirTestImages = Join-Path $TargetDir TestImages @@ -90,12 +90,12 @@ function RunTest($BuildTargets, $DependencyHash) Remove-Item -Path "$TargetDirTestImages" -Recurse -Force } - $NativeTestDirTestImages = Join-Path $NativeTestDir TestImages - $NativeTestDirSources = Join-Path $NativeTestDir "*.cs" - $NativeTestDirProject = Join-Path $NativeTestDir "FaceRecognitionDotNet.Tests.csproj" - Copy-Item "$NativeTestDirTestImages" "$TargetDirTestImages" -Recurse - Copy-Item "$NativeTestDirSources" "$TargetDir" -Recurse - Copy-Item "$NativeTestDirProject" "$TargetDir" -Recurse + $UnitTestDirTestImages = Join-Path $UnitTestDir TestImages + $UnitTestDirSources = Join-Path $UnitTestDir "*.cs" + $UnitTestDirProject = Join-Path $UnitTestDir "FaceRecognitionDotNet.Tests.csproj" + Copy-Item "$UnitTestDirTestImages" "$TargetDirTestImages" -Recurse + Copy-Item "$UnitTestDirSources" "$TargetDir" -Recurse + Copy-Item "$UnitTestDirProject" "$TargetDir" -Recurse Set-Location -Path "$TargetDir" @@ -114,20 +114,31 @@ function RunTest($BuildTargets, $DependencyHash) # Copy Dependencies if ($global:IsWindows) { - $OutDir = Join-Path $TargetDir bin | ` - Join-Path -ChildPath x64 | ` - Join-Path -ChildPath Release | ` - Join-Path -ChildPath netcoreapp2.0 - if (!(Test-Path "$OutDir")) { - New-Item "$OutDir" -ItemType Directory > $null - } - - if ($DependencyHash.Contains($package)) + # Get framework version + $re = New-Object regex("(?[^<]+)") + $match = $re.Matches((Get-Content "${UnitTestDirProject}")) + $version = $match[0].Groups["version"] + + # Just in case, deploy symbolic link to possbile output directory + $OutDirs = @((Join-Path $TargetDir bin | Join-Path -ChildPath Release | Join-Path -ChildPath $version), + (Join-Path $TargetDir bin | Join-Path -ChildPath x64 | Join-Path -ChildPath Release | Join-Path -ChildPath $version), + (Join-Path $TargetDir bin | Join-Path -ChildPath x86 | Join-Path -ChildPath Release | Join-Path -ChildPath $version) + ) + + foreach ($OutDir in $OutDirs) { - foreach($Dependency in $DependencyHash[$package]) + if (!(Test-Path "$OutDir")) { - $FileName = [System.IO.Path]::GetFileName("$Dependency") - New-Item -Value "$Dependency" -Path "$OutDir" -Name "$FileName" -ItemType SymbolicLink > $null + New-Item "$OutDir" -ItemType Directory > $null + } + + if ($DependencyHash.Contains($package)) + { + foreach($Dependency in $DependencyHash[$package]) + { + $FileName = [System.IO.Path]::GetFileName("$Dependency") + New-Item -Value "$Dependency" -Path "$OutDir" -Name "$FileName" -ItemType SymbolicLink > $null + } } } } @@ -161,8 +172,9 @@ $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 100; Package = "FaceRecognitionDotNet.CUDA100" } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 101; Package = "FaceRecognitionDotNet.CUDA101" } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "FaceRecognitionDotNet.CUDA102" } -$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "FaceRecognitionDotNet.CUDA110" } -$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "FaceRecognitionDotNet.CUDA111" } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 110; Package = "FaceRecognitionDotNet.CUDA110" } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 111; Package = "FaceRecognitionDotNet.CUDA111" } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 112; Package = "FaceRecognitionDotNet.CUDA112" } $BuildTargets += New-Object PSObject -Property @{Target = "mkl"; Architecture = 64; CUDA = 0; Package = "FaceRecognitionDotNet.MKL" } @@ -222,6 +234,20 @@ $tmp111.Add("$env:CUDA_PATH_V11_1\bin\cudnn64_8.dll") $tmp111.Add("$env:CUDA_PATH_V11_1\bin\curand64_10.dll") $tmp111.Add("$env:CUDA_PATH_V11_1\bin\cusolver64_11.dll") +# For FaceRecognitionDotNet.CUDA111 +$tmp112 = New-Object 'System.Collections.Generic.List[string]' +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cublas64_11.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cublasLt64_11.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cudnn_adv_infer64_8.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cudnn_adv_train64_8.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cudnn_cnn_infer64_8.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cudnn_cnn_train64_8.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cudnn_ops_infer64_8.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cudnn_ops_train64_8.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cudnn64_8.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\curand64_10.dll") +$tmp112.Add("$env:CUDA_PATH_V11_2\bin\cusolver64_11.dll") + # For mkl $tmpmkl = New-Object 'System.Collections.Generic.List[string]' $tmpmkl.Add("$env:MKL_WIN\redist\intel64_win\mkl\mkl_core.dll") @@ -235,6 +261,7 @@ $DependencyHash = @{"FaceRecognitionDotNet.CUDA92" = $tmp92; "FaceRecognitionDotNet.CUDA102" = $tmp102; "FaceRecognitionDotNet.CUDA110" = $tmp110; "FaceRecognitionDotNet.CUDA111" = $tmp111; + "FaceRecognitionDotNet.CUDA112" = $tmp112; "FaceRecognitionDotNet.MKL" = $tmpmkl} # Store current directory diff --git a/nuget/TestPackageCentOS7.ps1 b/nuget/TestPackageCentOS7.ps1 index 9fc3b07..ae5c35c 100644 --- a/nuget/TestPackageCentOS7.ps1 +++ b/nuget/TestPackageCentOS7.ps1 @@ -35,6 +35,7 @@ $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "FaceRecognitionDotNet.CUDA102"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 110; Package = "FaceRecognitionDotNet.CUDA110"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 111; Package = "FaceRecognitionDotNet.CUDA111"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 112; Package = "FaceRecognitionDotNet.CUDA112"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } foreach($BuildTarget in $BuildTargets) { diff --git a/nuget/TestPackageUbuntu16.ps1 b/nuget/TestPackageUbuntu16.ps1 index c1ce4b0..af17eb4 100644 --- a/nuget/TestPackageUbuntu16.ps1 +++ b/nuget/TestPackageUbuntu16.ps1 @@ -35,6 +35,7 @@ $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "FaceRecognitionDotNet.CUDA102"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 110; Package = "FaceRecognitionDotNet.CUDA110"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 111; Package = "FaceRecognitionDotNet.CUDA111"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 112; Package = "FaceRecognitionDotNet.CUDA112"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } foreach($BuildTarget in $BuildTargets) { diff --git a/nuget/TestPackageWindows.ps1 b/nuget/TestPackageWindows.ps1 index 6581fe1..155a45c 100644 --- a/nuget/TestPackageWindows.ps1 +++ b/nuget/TestPackageWindows.ps1 @@ -26,6 +26,7 @@ $BuildTargets = ( "FaceRecognitionDotNet", "FaceRecognitionDotNet.CUDA102", "FaceRecognitionDotNet.CUDA110", "FaceRecognitionDotNet.CUDA111", + "FaceRecognitionDotNet.CUDA112", "FaceRecognitionDotNet.MKL" ) diff --git a/nuget/artifacts/cuda-112/runtimes/centos-x64/lib/.keepfolder b/nuget/artifacts/cuda-112/runtimes/centos-x64/lib/.keepfolder new file mode 100644 index 0000000..e69de29 diff --git a/nuget/artifacts/cuda-112/runtimes/centos-x64/native/.keepfolder b/nuget/artifacts/cuda-112/runtimes/centos-x64/native/.keepfolder new file mode 100644 index 0000000..e69de29 diff --git a/nuget/artifacts/cuda-112/runtimes/linux-x64/lib/.keepfolder b/nuget/artifacts/cuda-112/runtimes/linux-x64/lib/.keepfolder new file mode 100644 index 0000000..e69de29 diff --git a/nuget/artifacts/cuda-112/runtimes/linux-x64/native/.keepfolder b/nuget/artifacts/cuda-112/runtimes/linux-x64/native/.keepfolder new file mode 100644 index 0000000..e69de29 diff --git a/nuget/artifacts/cuda-112/runtimes/osx-x64/lib/.keepfolder b/nuget/artifacts/cuda-112/runtimes/osx-x64/lib/.keepfolder new file mode 100644 index 0000000..e69de29 diff --git a/nuget/artifacts/cuda-112/runtimes/osx-x64/native/.keepfolder b/nuget/artifacts/cuda-112/runtimes/osx-x64/native/.keepfolder new file mode 100644 index 0000000..e69de29 diff --git a/nuget/artifacts/cuda-112/runtimes/win-x64/lib/.keepfolder b/nuget/artifacts/cuda-112/runtimes/win-x64/lib/.keepfolder new file mode 100644 index 0000000..e69de29 diff --git a/nuget/artifacts/cuda-112/runtimes/win-x64/native/.keepfolder b/nuget/artifacts/cuda-112/runtimes/win-x64/native/.keepfolder new file mode 100644 index 0000000..e69de29 diff --git a/nuget/nuget.exe b/nuget/nuget.exe index ea492db..8e4b7af 100644 Binary files a/nuget/nuget.exe and b/nuget/nuget.exe differ diff --git a/nuget/nuspec/FaceRecognitionDotNet.ARM.nuspec b/nuget/nuspec/FaceRecognitionDotNet.ARM.nuspec index 92a66e1..3c9dcf9 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.ARM.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.ARM.nuspec @@ -1,5 +1,5 @@ - - + + FaceRecognitionDotNet.ARM 1.3.0.0 diff --git a/nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec index c5109ad..a6143c9 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec @@ -1,8 +1,8 @@ - - + + FaceRecognitionDotNet - 1.3.0.3 + 1.3.0.4 FaceRecognitionDotNet Takuya Takeuchi Takuya Takeuchi @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.< - + - - + + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec index 1a4e170..6793192 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec @@ -1,8 +1,8 @@ - - + + FaceRecognitionDotNet.CUDA100 - 1.3.0.3 + 1.3.0.4 FaceRecognitionDotNet for CUDA 10.0 Takuya Takeuchi Takuya Takeuchi @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.< - + - - + + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec index bce3aac..8abb608 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec @@ -1,8 +1,8 @@ - - + + FaceRecognitionDotNet.CUDA101 - 1.3.0.3 + 1.3.0.4 FaceRecognitionDotNet for CUDA 10.1 Takuya Takeuchi Takuya Takeuchi @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.< - + - - + + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec index a79be62..6b51ede 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec @@ -1,8 +1,8 @@ - - + + FaceRecognitionDotNet.CUDA102 - 1.3.0.3 + 1.3.0.4 FaceRecognitionDotNet for CUDA 10.2 Takuya Takeuchi Takuya Takeuchi @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.< - + - - + + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec index 57524dd..5666957 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec @@ -1,8 +1,8 @@ - - + + FaceRecognitionDotNet.CUDA110 - 1.3.0.3 + 1.3.0.4 FaceRecognitionDotNet for CUDA 11.0 Takuya Takeuchi Takuya Takeuchi @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.< - + - - + + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec index a019ffe..bda0ab5 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec @@ -1,8 +1,8 @@ - - + + FaceRecognitionDotNet.CUDA111 - 1.3.0.3 + 1.3.0.4 FaceRecognitionDotNet for CUDA 11.1 Takuya Takeuchi Takuya Takeuchi @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.< - + - - + + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA112.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA112.nuspec new file mode 100644 index 0000000..b84d271 --- /dev/null +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA112.nuspec @@ -0,0 +1,61 @@ + + + + FaceRecognitionDotNet.CUDA112 + 1.3.0.4 + FaceRecognitionDotNet for CUDA 11.2 + Takuya Takeuchi + Takuya Takeuchi + true + LICENSE.txt + https://github.com/takuya-takeuchi/FaceRecognitionDotNet + images\face128.png + The world's simplest facial recognition api for .NET + +This library is ported from https://github.com/ageitgey/face_recognition by C#. + + © Takuya Takeuchi 2018-2021 + .net machinelearning face-recognition + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec index 029dc3a..a9b9fc1 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec @@ -1,8 +1,8 @@ - - + + FaceRecognitionDotNet.CUDA92 - 1.3.0.3 + 1.3.0.4 FaceRecognitionDotNet for CUDA 9.2 Takuya Takeuchi Takuya Takeuchi @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.< - + - - + + diff --git a/nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec b/nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec index f3bccc2..32df1f7 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec @@ -1,8 +1,8 @@ - - + + FaceRecognitionDotNet.MKL - 1.3.0.3 + 1.3.0.4 FaceRecognitionDotNet for MKL Takuya Takeuchi Takuya Takeuchi @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.< - + - - + + diff --git a/src/DlibDotNet b/src/DlibDotNet index e5913f0..8c1cbab 160000 --- a/src/DlibDotNet +++ b/src/DlibDotNet @@ -1 +1 @@ -Subproject commit e5913f0d09e812288352395d0c7905145edb1ca8 +Subproject commit 8c1cbab8048e07fb74c6509401b68271a5f69bdf diff --git a/src/FaceRecognitionDotNet/FaceEncoding.cs b/src/FaceRecognitionDotNet/FaceEncoding.cs index 0e9546f..6a46861 100644 --- a/src/FaceRecognitionDotNet/FaceEncoding.cs +++ b/src/FaceRecognitionDotNet/FaceEncoding.cs @@ -46,6 +46,7 @@ private FaceEncoding(SerializationInfo info, StreamingContext context) /// /// Gets the size of feature data. /// + /// This object is disposed. public int Size { get @@ -64,6 +65,7 @@ public int Size /// /// A array that represents a feature data. /// class supports serialization. This method is for interoperability between FaceRecognitionDotNet and dlib. + /// This object is disposed. public double[] GetRawEncoding() { this.ThrowIfDisposed(); diff --git a/src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj b/src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj index 102d375..d5da946 100644 --- a/src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj +++ b/src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj @@ -6,7 +6,7 @@ © Takuya Takeuchi 2018-2021 Porting face_recognition (by Adam Geitgey) by C# - 1.3.0.3 + 1.3.0.4 https://github.com/takuya-takeuchi/FaceRecognitionDotNet .net machinelearning face-recognition @@ -45,7 +45,7 @@ - 4.7.0 + 5.0.1 @@ -56,4 +56,8 @@ + + + + diff --git a/src/FaceRecognitionDotNet/Image.cs b/src/FaceRecognitionDotNet/Image.cs index 0cd867f..b968cdc 100644 --- a/src/FaceRecognitionDotNet/Image.cs +++ b/src/FaceRecognitionDotNet/Image.cs @@ -1,6 +1,8 @@ using System; +using System.Drawing; using System.IO; using DlibDotNet; +using DlibDotNet.Extensions; namespace FaceRecognitionDotNet { @@ -34,6 +36,7 @@ internal Image(MatrixBase matrix, Mode mode) /// /// Gets the height of the image. /// + /// This object is disposed. public int Height { get @@ -50,6 +53,7 @@ public int Height /// /// Gets the width of the image. /// + /// This object is disposed. public int Width { get @@ -69,11 +73,14 @@ public int Width /// A string that contains the name of the file to which to save this . /// The for this . /// is null. + /// This object is disposed. public void Save(string filename, ImageFormat format) { - if (filename == null) + if (filename == null) throw new ArgumentNullException(nameof(filename)); + this.ThrowIfDisposed(); + var directory = Path.GetDirectoryName(filename); if (!Directory.Exists(directory) && !string.IsNullOrWhiteSpace(directory)) Directory.CreateDirectory(directory); @@ -92,6 +99,22 @@ public void Save(string filename, ImageFormat format) } } + /// + /// Converts this to a GDI+ . + /// + /// A that represents the converted . + /// This object is disposed. + /// A Greyscale image is not supported. + public Bitmap ToBitmap() + { + this.ThrowIfDisposed(); + + if (this.Mode == Mode.Greyscale) + throw new NotSupportedException(); + + return ((Matrix)this._Matrix).ToBitmap(); + } + #region Overrides /// diff --git a/src/FaceRecognitionDotNet/docs/FaceRecognitionDotNet.xml b/src/FaceRecognitionDotNet/docs/FaceRecognitionDotNet.xml index 27aeb95..949a607 100644 --- a/src/FaceRecognitionDotNet/docs/FaceRecognitionDotNet.xml +++ b/src/FaceRecognitionDotNet/docs/FaceRecognitionDotNet.xml @@ -422,6 +422,7 @@ Gets the size of feature data. + This object is disposed. @@ -429,6 +430,7 @@ A array that represents a feature data. class supports serialization. This method is for interoperability between FaceRecognitionDotNet and dlib. + This object is disposed. @@ -948,11 +950,13 @@ Gets the height of the image. + This object is disposed. Gets the width of the image. + This object is disposed. @@ -961,6 +965,15 @@ A string that contains the name of the file to which to save this . The for this . is null. + This object is disposed. + + + + Converts this to a GDI+ . + + A that represents the converted . + This object is disposed. + A Greyscale image is not supported. diff --git a/src/FaceRecognitionDotNet/docs/ja/FaceRecognitionDotNet.xml b/src/FaceRecognitionDotNet/docs/ja/FaceRecognitionDotNet.xml index ede103a..e2b541a 100644 --- a/src/FaceRecognitionDotNet/docs/ja/FaceRecognitionDotNet.xml +++ b/src/FaceRecognitionDotNet/docs/ja/FaceRecognitionDotNet.xml @@ -422,6 +422,7 @@ 特徴データのサイズを取得します。 + このオブジェクトは破棄されています。 @@ -429,6 +430,7 @@ 顔の特徴データを表現する の配列。 クラスはシリアル化をサポートしています。このメソッドは FaceRecognitionDotNet と dlib の間の相互運用性のためです。 + このオブジェクトは破棄されています。 @@ -948,11 +950,13 @@ 画像の高さを取得します。 + このオブジェクトは破棄されています。 画像の幅を取得します。 + このオブジェクトは破棄されています。 @@ -961,6 +965,15 @@ この の保存先ファイルの名前を格納している文字列。 この が null です。 + このオブジェクトは破棄されています。 + + + + この を GDI+ の に変換します。 + + 変換された を表す + このオブジェクトは破棄されています。 + グレイスケール画像はサポートされていません。 diff --git a/test/FaceRecognitionDotNet.Tests/FaceRecognitionDotNet.Tests.csproj b/test/FaceRecognitionDotNet.Tests/FaceRecognitionDotNet.Tests.csproj index 91fbb8d..732ec75 100644 --- a/test/FaceRecognitionDotNet.Tests/FaceRecognitionDotNet.Tests.csproj +++ b/test/FaceRecognitionDotNet.Tests/FaceRecognitionDotNet.Tests.csproj @@ -8,9 +8,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/FaceRecognitionDotNet.Tests/ImageTest.cs b/test/FaceRecognitionDotNet.Tests/ImageTest.cs index 70c722c..293dcf8 100644 --- a/test/FaceRecognitionDotNet.Tests/ImageTest.cs +++ b/test/FaceRecognitionDotNet.Tests/ImageTest.cs @@ -74,6 +74,40 @@ public void SaveException() } } + [Fact] + public void ToBitmap() + { + var path = Path.Combine(TestImageDirectory, "obama.jpg"); + using (var img = FaceRecognition.LoadImageFile(path)) + using (var bitmap = img.ToBitmap()) + { + Assert.Equal(img.Width, bitmap.Width); + Assert.Equal(img.Height, bitmap.Height); + } + } + + [Fact] + public void ToBitmapGrayscale() + { + var path = Path.Combine(TestImageDirectory, "obama.jpg"); + using (var img = FaceRecognition.LoadImageFile(path, Mode.Greyscale)) + { + try + { + using (var bitmap = img.ToBitmap()) + { + Assert.Equal(img.Width, bitmap.Width); + Assert.Equal(img.Height, bitmap.Height); + } + + Assert.True(false, $"{nameof(img.ToBitmap)} method should throw {nameof(NotSupportedException)}."); + } + catch (NotSupportedException) + { + } + } + } + } } \ No newline at end of file diff --git a/tools/HeadPoseTraining/HeadPoseTraining.csproj b/tools/HeadPoseTraining/HeadPoseTraining.csproj index 179e0b1..660e245 100644 --- a/tools/HeadPoseTraining/HeadPoseTraining.csproj +++ b/tools/HeadPoseTraining/HeadPoseTraining.csproj @@ -10,10 +10,10 @@ - + - - + + diff --git a/tools/HelenTraining/HelenTraining.csproj b/tools/HelenTraining/HelenTraining.csproj index ac5792f..43399c8 100644 --- a/tools/HelenTraining/HelenTraining.csproj +++ b/tools/HelenTraining/HelenTraining.csproj @@ -9,7 +9,7 @@ - +