Skip to content

Commit

Permalink
Disable Dropout for inference (#153)
Browse files Browse the repository at this point in the history
* test: add unit test
* fix: disable libjpeg
* fix: deploy targets and prop
* fix: change test directory
* fix: call _eval method to reset dropout ratio
  • Loading branch information
takuya-takeuchi authored Feb 21, 2021
1 parent 8c53569 commit e8a60ed
Show file tree
Hide file tree
Showing 30 changed files with 381 additions and 78 deletions.
13 changes: 13 additions & 0 deletions nuget/BuildUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ function ConfigCPU([Config]$Config, [string]$CMakefileDir)
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
elseif ($IsMacOS)
Expand Down Expand Up @@ -537,6 +538,7 @@ function ConfigCPU([Config]$Config, [string]$CMakefileDir)
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
}
Expand Down Expand Up @@ -568,6 +570,7 @@ function ConfigCUDA([Config]$Config, [string]$CMakefileDir)
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
-D CUDA_NVCC_FLAGS="--expt-relaxed-constexpr" `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
else
Expand All @@ -588,6 +591,7 @@ function ConfigCUDA([Config]$Config, [string]$CMakefileDir)
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
-D CUDA_NVCC_FLAGS="--expt-relaxed-constexpr" `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
}
Expand Down Expand Up @@ -653,6 +657,7 @@ function ConfigMKL([Config]$Config, [string]$CMakefileDir)
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
64
Expand Down Expand Up @@ -697,6 +702,7 @@ function ConfigMKL([Config]$Config, [string]$CMakefileDir)
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
}
Expand All @@ -720,6 +726,7 @@ function ConfigMKL([Config]$Config, [string]$CMakefileDir)
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
}
Expand All @@ -739,6 +746,7 @@ function ConfigARM([Config]$Config, [string]$CMakefileDir)
-D PNG_LIBRARY_RELEASE="" `
-D PNG_LIBRARY_DEBUG="" `
-D PNG_PNG_INCLUDE_DIR="" `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
else
Expand All @@ -754,6 +762,7 @@ function ConfigARM([Config]$Config, [string]$CMakefileDir)
-D PNG_LIBRARY_RELEASE="" `
-D PNG_LIBRARY_DEBUG="" `
-D PNG_PNG_INCLUDE_DIR="" `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
}
Expand Down Expand Up @@ -789,6 +798,7 @@ function ConfigUWP([Config]$Config, [string]$CMakefileDir)
-D DLIB_USE_BLAS=OFF `
-D DLIB_USE_LAPACK=OFF `
-D DLIB_NO_GUI_SUPPORT=ON `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
else
Expand All @@ -810,6 +820,7 @@ function ConfigUWP([Config]$Config, [string]$CMakefileDir)
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}

Expand Down Expand Up @@ -856,6 +867,7 @@ function ConfigANDROID([Config]$Config, [string]$CMakefileDir)
-D PNG_LIBRARY_DEBUG="" `
-D PNG_PNG_INCLUDE_DIR="" `
-D DLIB_NO_GUI_SUPPORT=ON `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
else
Expand Down Expand Up @@ -886,6 +898,7 @@ function ConfigIOS([Config]$Config, [string]$CMakefileDir)
-D PNG_LIBRARY_DEBUG="" `
-D PNG_PNG_INCLUDE_DIR="" `
-D DLIB_NO_GUI_SUPPORT=ON `
-D JPEG_FOUND=OFF `
${CMakefileDir}
}
else
Expand Down
11 changes: 10 additions & 1 deletion nuget/CreatePackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ if (!(Test-Path ${nugetPath}))
}

Write-Host "${nuspec}" -ForegroundColor Green
Invoke-Expression "${nugetPath} pack ${nuspec}"

if ($global:IsWindows)
{
Invoke-Expression "${nugetPath} pack ${nuspec}"
}
else
{
Invoke-Expression "mono ${nugetPath} pack ${nuspec}"
}

if ($lastexitcode -ne 0)
{
Write-Host "Failed '${nugetPath} pack ${nuspec}" -ForegroundColor Red
Expand Down
20 changes: 11 additions & 9 deletions nuget/TestPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,22 @@ function RunTest($BuildTargets, $DependencyHash)
dotnet add package $package -v $VERSION --source "$NugetDir" > $null

# Copy Dependencies
$OutDir = Join-Path $TargetDir bin | `
Join-Path -ChildPath Release | `
Join-Path -ChildPath netcoreapp2.0
if (!(Test-Path "$OutDir")) {
New-Item "$OutDir" -ItemType Directory > $null
}

if ($IsWindows)
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))
{
foreach($Dependency in $DependencyHash[$package])
{
Copy-Item "$Dependency" "$OutDir"
$FileName = [System.IO.Path]::GetFileName("$Dependency")
New-Item -Value "$Dependency" -Path "$OutDir" -Name "$FileName" -ItemType SymbolicLink > $null
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<

<dependencies>
<group targetFramework="net461">
<dependency id="DlibDotNet" version="19.21.0.20210228" />
<dependency id="DlibDotNet" version="19.21.0.20210230" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="System.Drawing.Common" version="4.7.0" />
<dependency id="DlibDotNet" version="19.21.0.20210228" />
<dependency id="DlibDotNet" version="19.21.0.20210230" />
</group>
</dependencies>
<frameworkAssemblies>
Expand All @@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
<files>
<file src="..\face128.png" target="images\" />

<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.props" />
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.targets" />

<file src="ref\**\*" target="ref" />
<file src="..\artifacts\cpu\runtimes\**\*" target="runtimes" />

Expand Down
7 changes: 5 additions & 2 deletions nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<

<dependencies>
<group targetFramework="net461">
<dependency id="DlibDotNet.CUDA100" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA100" version="19.21.0.20210230" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="System.Drawing.Common" version="4.7.0" />
<dependency id="DlibDotNet.CUDA100" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA100" version="19.21.0.20210230" />
</group>
</dependencies>
<frameworkAssemblies>
Expand All @@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
<files>
<file src="..\face128.png" target="images\" />

<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA100.props" />
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA100.targets" />

<file src="ref\**\*" target="ref" />
<file src="..\artifacts\cuda-100\runtimes\**\*" target="runtimes" />

Expand Down
7 changes: 5 additions & 2 deletions nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<

<dependencies>
<group targetFramework="net461">
<dependency id="DlibDotNet.CUDA101" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA101" version="19.21.0.20210230" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="System.Drawing.Common" version="4.7.0" />
<dependency id="DlibDotNet.CUDA101" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA101" version="19.21.0.20210230" />
</group>
</dependencies>
<frameworkAssemblies>
Expand All @@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
<files>
<file src="..\face128.png" target="images\" />

<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA101.props" />
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA101.targets" />

<file src="ref\**\*" target="ref" />
<file src="..\artifacts\cuda-101\runtimes\**\*" target="runtimes" />

Expand Down
7 changes: 5 additions & 2 deletions nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<

<dependencies>
<group targetFramework="net461">
<dependency id="DlibDotNet.CUDA102" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA102" version="19.21.0.20210230" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="System.Drawing.Common" version="4.7.0" />
<dependency id="DlibDotNet.CUDA102" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA102" version="19.21.0.20210230" />
</group>
</dependencies>
<frameworkAssemblies>
Expand All @@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
<files>
<file src="..\face128.png" target="images\" />

<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA102.props" />
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA102.targets" />

<file src="ref\**\*" target="ref" />
<file src="..\artifacts\cuda-102\runtimes\**\*" target="runtimes" />

Expand Down
7 changes: 5 additions & 2 deletions nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<

<dependencies>
<group targetFramework="net461">
<dependency id="DlibDotNet.CUDA110" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA110" version="19.21.0.20210230" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="System.Drawing.Common" version="4.7.0" />
<dependency id="DlibDotNet.CUDA110" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA110" version="19.21.0.20210230" />
</group>
</dependencies>
<frameworkAssemblies>
Expand All @@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
<files>
<file src="..\face128.png" target="images\" />

<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA110.props" />
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA110.targets" />

<file src="ref\**\*" target="ref" />
<file src="..\artifacts\cuda-110\runtimes\**\*" target="runtimes" />

Expand Down
7 changes: 5 additions & 2 deletions nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<

<dependencies>
<group targetFramework="net461">
<dependency id="DlibDotNet.CUDA111" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA111" version="19.21.0.20210230" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="System.Drawing.Common" version="4.7.0" />
<dependency id="DlibDotNet.CUDA111" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA111" version="19.21.0.20210230" />
</group>
</dependencies>
<frameworkAssemblies>
Expand All @@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
<files>
<file src="..\face128.png" target="images\" />

<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA111.props" />
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA111.targets" />

<file src="ref\**\*" target="ref" />
<file src="..\artifacts\cuda-111\runtimes\**\*" target="runtimes" />

Expand Down
7 changes: 5 additions & 2 deletions nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<

<dependencies>
<group targetFramework="net461">
<dependency id="DlibDotNet.CUDA92" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA92" version="19.21.0.20210230" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="System.Drawing.Common" version="4.7.0" />
<dependency id="DlibDotNet.CUDA92" version="19.21.0.20210227" />
<dependency id="DlibDotNet.CUDA92" version="19.21.0.20210230" />
</group>
</dependencies>
<frameworkAssemblies>
Expand All @@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
<files>
<file src="..\face128.png" target="images\" />

<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA92.props" />
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA92.targets" />

<file src="ref\**\*" target="ref" />
<file src="..\artifacts\cuda-92\runtimes\**\*" target="runtimes" />

Expand Down
7 changes: 5 additions & 2 deletions nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<

<dependencies>
<group targetFramework="net461">
<dependency id="DlibDotNet.MKL" version="19.21.0.20210228" />
<dependency id="DlibDotNet.MKL" version="19.21.0.20210230" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="System.Drawing.Common" version="4.7.0" />
<dependency id="DlibDotNet.MKL" version="19.21.0.20210228" />
<dependency id="DlibDotNet.MKL" version="19.21.0.20210230" />
</group>
</dependencies>
<frameworkAssemblies>
Expand All @@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
<files>
<file src="..\face128.png" target="images\" />

<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.MKL.props" />
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.MKL.targets" />

<file src="ref\**\*" target="ref" />
<file src="..\artifacts\mkl\runtimes\**\*" target="runtimes" />

Expand Down
Loading

0 comments on commit e8a60ed

Please sign in to comment.