Skip to content

Commit e8a60ed

Browse files
Disable Dropout for inference (#153)
* test: add unit test * fix: disable libjpeg * fix: deploy targets and prop * fix: change test directory * fix: call _eval method to reset dropout ratio
1 parent 8c53569 commit e8a60ed

30 files changed

+381
-78
lines changed

nuget/BuildUtils.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ function ConfigCPU([Config]$Config, [string]$CMakefileDir)
485485
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
486486
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
487487
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
488+
-D JPEG_FOUND=OFF `
488489
${CMakefileDir}
489490
}
490491
elseif ($IsMacOS)
@@ -537,6 +538,7 @@ function ConfigCPU([Config]$Config, [string]$CMakefileDir)
537538
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
538539
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
539540
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
541+
-D JPEG_FOUND=OFF `
540542
${CMakefileDir}
541543
}
542544
}
@@ -568,6 +570,7 @@ function ConfigCUDA([Config]$Config, [string]$CMakefileDir)
568570
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
569571
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
570572
-D CUDA_NVCC_FLAGS="--expt-relaxed-constexpr" `
573+
-D JPEG_FOUND=OFF `
571574
${CMakefileDir}
572575
}
573576
else
@@ -588,6 +591,7 @@ function ConfigCUDA([Config]$Config, [string]$CMakefileDir)
588591
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
589592
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
590593
-D CUDA_NVCC_FLAGS="--expt-relaxed-constexpr" `
594+
-D JPEG_FOUND=OFF `
591595
${CMakefileDir}
592596
}
593597
}
@@ -653,6 +657,7 @@ function ConfigMKL([Config]$Config, [string]$CMakefileDir)
653657
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
654658
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
655659
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
660+
-D JPEG_FOUND=OFF `
656661
${CMakefileDir}
657662
}
658663
64
@@ -697,6 +702,7 @@ function ConfigMKL([Config]$Config, [string]$CMakefileDir)
697702
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
698703
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
699704
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
705+
-D JPEG_FOUND=OFF `
700706
${CMakefileDir}
701707
}
702708
}
@@ -720,6 +726,7 @@ function ConfigMKL([Config]$Config, [string]$CMakefileDir)
720726
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
721727
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
722728
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
729+
-D JPEG_FOUND=OFF `
723730
${CMakefileDir}
724731
}
725732
}
@@ -739,6 +746,7 @@ function ConfigARM([Config]$Config, [string]$CMakefileDir)
739746
-D PNG_LIBRARY_RELEASE="" `
740747
-D PNG_LIBRARY_DEBUG="" `
741748
-D PNG_PNG_INCLUDE_DIR="" `
749+
-D JPEG_FOUND=OFF `
742750
${CMakefileDir}
743751
}
744752
else
@@ -754,6 +762,7 @@ function ConfigARM([Config]$Config, [string]$CMakefileDir)
754762
-D PNG_LIBRARY_RELEASE="" `
755763
-D PNG_LIBRARY_DEBUG="" `
756764
-D PNG_PNG_INCLUDE_DIR="" `
765+
-D JPEG_FOUND=OFF `
757766
${CMakefileDir}
758767
}
759768
}
@@ -789,6 +798,7 @@ function ConfigUWP([Config]$Config, [string]$CMakefileDir)
789798
-D DLIB_USE_BLAS=OFF `
790799
-D DLIB_USE_LAPACK=OFF `
791800
-D DLIB_NO_GUI_SUPPORT=ON `
801+
-D JPEG_FOUND=OFF `
792802
${CMakefileDir}
793803
}
794804
else
@@ -810,6 +820,7 @@ function ConfigUWP([Config]$Config, [string]$CMakefileDir)
810820
-D USE_AVX_INSTRUCTIONS=$USE_AVX_INSTRUCTIONS `
811821
-D USE_SSE4_INSTRUCTIONS=$USE_SSE4_INSTRUCTIONS `
812822
-D USE_SSE2_INSTRUCTIONS=$USE_SSE2_INSTRUCTIONS `
823+
-D JPEG_FOUND=OFF `
813824
${CMakefileDir}
814825
}
815826

@@ -856,6 +867,7 @@ function ConfigANDROID([Config]$Config, [string]$CMakefileDir)
856867
-D PNG_LIBRARY_DEBUG="" `
857868
-D PNG_PNG_INCLUDE_DIR="" `
858869
-D DLIB_NO_GUI_SUPPORT=ON `
870+
-D JPEG_FOUND=OFF `
859871
${CMakefileDir}
860872
}
861873
else
@@ -886,6 +898,7 @@ function ConfigIOS([Config]$Config, [string]$CMakefileDir)
886898
-D PNG_LIBRARY_DEBUG="" `
887899
-D PNG_PNG_INCLUDE_DIR="" `
888900
-D DLIB_NO_GUI_SUPPORT=ON `
901+
-D JPEG_FOUND=OFF `
889902
${CMakefileDir}
890903
}
891904
else

nuget/CreatePackage.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@ if (!(Test-Path ${nugetPath}))
2626
}
2727

2828
Write-Host "${nuspec}" -ForegroundColor Green
29-
Invoke-Expression "${nugetPath} pack ${nuspec}"
29+
30+
if ($global:IsWindows)
31+
{
32+
Invoke-Expression "${nugetPath} pack ${nuspec}"
33+
}
34+
else
35+
{
36+
Invoke-Expression "mono ${nugetPath} pack ${nuspec}"
37+
}
38+
3039
if ($lastexitcode -ne 0)
3140
{
3241
Write-Host "Failed '${nugetPath} pack ${nuspec}" -ForegroundColor Red

nuget/TestPackage.ps1

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,22 @@ function RunTest($BuildTargets, $DependencyHash)
112112
dotnet add package $package -v $VERSION --source "$NugetDir" > $null
113113

114114
# Copy Dependencies
115-
$OutDir = Join-Path $TargetDir bin | `
116-
Join-Path -ChildPath Release | `
117-
Join-Path -ChildPath netcoreapp2.0
118-
if (!(Test-Path "$OutDir")) {
119-
New-Item "$OutDir" -ItemType Directory > $null
120-
}
121-
122-
if ($IsWindows)
115+
if ($global:IsWindows)
123116
{
117+
$OutDir = Join-Path $TargetDir bin | `
118+
Join-Path -ChildPath x64 | `
119+
Join-Path -ChildPath Release | `
120+
Join-Path -ChildPath netcoreapp2.0
121+
if (!(Test-Path "$OutDir")) {
122+
New-Item "$OutDir" -ItemType Directory > $null
123+
}
124+
124125
if ($DependencyHash.Contains($package))
125126
{
126127
foreach($Dependency in $DependencyHash[$package])
127128
{
128-
Copy-Item "$Dependency" "$OutDir"
129+
$FileName = [System.IO.Path]::GetFileName("$Dependency")
130+
New-Item -Value "$Dependency" -Path "$OutDir" -Name "$FileName" -ItemType SymbolicLink > $null
129131
}
130132
}
131133
}

nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
2020

2121
<dependencies>
2222
<group targetFramework="net461">
23-
<dependency id="DlibDotNet" version="19.21.0.20210228" />
23+
<dependency id="DlibDotNet" version="19.21.0.20210230" />
2424
</group>
2525
<group targetFramework="netstandard2.0">
2626
<dependency id="System.Drawing.Common" version="4.7.0" />
27-
<dependency id="DlibDotNet" version="19.21.0.20210228" />
27+
<dependency id="DlibDotNet" version="19.21.0.20210230" />
2828
</group>
2929
</dependencies>
3030
<frameworkAssemblies>
@@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
3434
<files>
3535
<file src="..\face128.png" target="images\" />
3636

37+
<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.props" />
38+
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.targets" />
39+
3740
<file src="ref\**\*" target="ref" />
3841
<file src="..\artifacts\cpu\runtimes\**\*" target="runtimes" />
3942

nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
2020

2121
<dependencies>
2222
<group targetFramework="net461">
23-
<dependency id="DlibDotNet.CUDA100" version="19.21.0.20210227" />
23+
<dependency id="DlibDotNet.CUDA100" version="19.21.0.20210230" />
2424
</group>
2525
<group targetFramework="netstandard2.0">
2626
<dependency id="System.Drawing.Common" version="4.7.0" />
27-
<dependency id="DlibDotNet.CUDA100" version="19.21.0.20210227" />
27+
<dependency id="DlibDotNet.CUDA100" version="19.21.0.20210230" />
2828
</group>
2929
</dependencies>
3030
<frameworkAssemblies>
@@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
3434
<files>
3535
<file src="..\face128.png" target="images\" />
3636

37+
<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA100.props" />
38+
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA100.targets" />
39+
3740
<file src="ref\**\*" target="ref" />
3841
<file src="..\artifacts\cuda-100\runtimes\**\*" target="runtimes" />
3942

nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
2020

2121
<dependencies>
2222
<group targetFramework="net461">
23-
<dependency id="DlibDotNet.CUDA101" version="19.21.0.20210227" />
23+
<dependency id="DlibDotNet.CUDA101" version="19.21.0.20210230" />
2424
</group>
2525
<group targetFramework="netstandard2.0">
2626
<dependency id="System.Drawing.Common" version="4.7.0" />
27-
<dependency id="DlibDotNet.CUDA101" version="19.21.0.20210227" />
27+
<dependency id="DlibDotNet.CUDA101" version="19.21.0.20210230" />
2828
</group>
2929
</dependencies>
3030
<frameworkAssemblies>
@@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
3434
<files>
3535
<file src="..\face128.png" target="images\" />
3636

37+
<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA101.props" />
38+
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA101.targets" />
39+
3740
<file src="ref\**\*" target="ref" />
3841
<file src="..\artifacts\cuda-101\runtimes\**\*" target="runtimes" />
3942

nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
2020

2121
<dependencies>
2222
<group targetFramework="net461">
23-
<dependency id="DlibDotNet.CUDA102" version="19.21.0.20210227" />
23+
<dependency id="DlibDotNet.CUDA102" version="19.21.0.20210230" />
2424
</group>
2525
<group targetFramework="netstandard2.0">
2626
<dependency id="System.Drawing.Common" version="4.7.0" />
27-
<dependency id="DlibDotNet.CUDA102" version="19.21.0.20210227" />
27+
<dependency id="DlibDotNet.CUDA102" version="19.21.0.20210230" />
2828
</group>
2929
</dependencies>
3030
<frameworkAssemblies>
@@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
3434
<files>
3535
<file src="..\face128.png" target="images\" />
3636

37+
<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA102.props" />
38+
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA102.targets" />
39+
3740
<file src="ref\**\*" target="ref" />
3841
<file src="..\artifacts\cuda-102\runtimes\**\*" target="runtimes" />
3942

nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
2020

2121
<dependencies>
2222
<group targetFramework="net461">
23-
<dependency id="DlibDotNet.CUDA110" version="19.21.0.20210227" />
23+
<dependency id="DlibDotNet.CUDA110" version="19.21.0.20210230" />
2424
</group>
2525
<group targetFramework="netstandard2.0">
2626
<dependency id="System.Drawing.Common" version="4.7.0" />
27-
<dependency id="DlibDotNet.CUDA110" version="19.21.0.20210227" />
27+
<dependency id="DlibDotNet.CUDA110" version="19.21.0.20210230" />
2828
</group>
2929
</dependencies>
3030
<frameworkAssemblies>
@@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
3434
<files>
3535
<file src="..\face128.png" target="images\" />
3636

37+
<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA110.props" />
38+
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA110.targets" />
39+
3740
<file src="ref\**\*" target="ref" />
3841
<file src="..\artifacts\cuda-110\runtimes\**\*" target="runtimes" />
3942

nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
2020

2121
<dependencies>
2222
<group targetFramework="net461">
23-
<dependency id="DlibDotNet.CUDA111" version="19.21.0.20210227" />
23+
<dependency id="DlibDotNet.CUDA111" version="19.21.0.20210230" />
2424
</group>
2525
<group targetFramework="netstandard2.0">
2626
<dependency id="System.Drawing.Common" version="4.7.0" />
27-
<dependency id="DlibDotNet.CUDA111" version="19.21.0.20210227" />
27+
<dependency id="DlibDotNet.CUDA111" version="19.21.0.20210230" />
2828
</group>
2929
</dependencies>
3030
<frameworkAssemblies>
@@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
3434
<files>
3535
<file src="..\face128.png" target="images\" />
3636

37+
<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA111.props" />
38+
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA111.targets" />
39+
3740
<file src="ref\**\*" target="ref" />
3841
<file src="..\artifacts\cuda-111\runtimes\**\*" target="runtimes" />
3942

nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
2020

2121
<dependencies>
2222
<group targetFramework="net461">
23-
<dependency id="DlibDotNet.CUDA92" version="19.21.0.20210227" />
23+
<dependency id="DlibDotNet.CUDA92" version="19.21.0.20210230" />
2424
</group>
2525
<group targetFramework="netstandard2.0">
2626
<dependency id="System.Drawing.Common" version="4.7.0" />
27-
<dependency id="DlibDotNet.CUDA92" version="19.21.0.20210227" />
27+
<dependency id="DlibDotNet.CUDA92" version="19.21.0.20210230" />
2828
</group>
2929
</dependencies>
3030
<frameworkAssemblies>
@@ -34,6 +34,9 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
3434
<files>
3535
<file src="..\face128.png" target="images\" />
3636

37+
<file src="build\FaceRecognitionDotNet.Native.props" target="build\FaceRecognitionDotNet.CUDA92.props" />
38+
<file src="build\FaceRecognitionDotNet.targets" target="build\FaceRecognitionDotNet.CUDA92.targets" />
39+
3740
<file src="ref\**\*" target="ref" />
3841
<file src="..\artifacts\cuda-92\runtimes\**\*" target="runtimes" />
3942

0 commit comments

Comments
 (0)