diff --git a/LICENSE.txt b/LICENSE.txt index 6baedb6..00c1d26 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-2021 Takuya Takeuchi +Copyright (c) 2018-2022 Takuya Takeuchi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/nuget/Makefile b/nuget/Makefile new file mode 100644 index 0000000..c793c5d --- /dev/null +++ b/nuget/Makefile @@ -0,0 +1,77 @@ +.DEFAULT_GOAL := help + +help: ## print this message + @echo "Example operations by makefile." + @echo "" + @echo "Usage: make SUB_COMMAND argument_name=argument_value" + @echo "" + @echo "Command list:" + @echo "" + @printf "\033[36m%-40s\033[0m %-50s %s\n" "[Sub command]" "[Description]" "[Example]" + @grep -E '^[/a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | perl -pe 's%^([/a-zA-Z0-9_-]+):.*?(##)%$$1 $$2%' | awk -F " *?## *?" '{printf "\033[36m%-40s\033[0m %-50s %s\n", $$1, $$2, $$3}' + +run-build-centos7-cpu-x64-desktop: ## run build container for centos7 cpu x64 on desktop + @pwsh RunBuildContainer.ps1 cpu 64 desktop centos 7 "/x64" + +run-build-centos7-mkl-x64-desktop: ## run build container for centos7 mkl x64 on desktop + @pwsh RunBuildContainer.ps1 mkl 64 desktop centos 7 "/x64" + +run-build-ubuntu16-cpu-x64-desktop: ## run build container for ubuntu16 cpu x64 on desktop + @pwsh RunBuildContainer.ps1 cpu 64 desktop ubuntu 16 "/x64" + +run-build-ubuntu16-mkl-x64-desktop: ## run build container for ubuntu16 mkl x64 on desktop + @pwsh RunBuildContainer.ps1 mkl 64 desktop ubuntu 16 "/x64" + +run-test-centos7-cpu-x64-desktop: ## run build container for centos7 cpu x64 on desktop + @pwsh RunTestContainer.ps1 cpu 64 desktop centos 7 "/x64" + +run-test-centos7-mkl-x64-desktop: ## run build container for centos7 mkl x64 on desktop + @pwsh RunTestContainer.ps1 mkl 64 desktop centos 7 "/x64" + +run-test-centos7-cu92-x64-desktop: ## run build container for centos7 cuda-92 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop centos 7 "92" + +run-test-centos7-cu100-x64-desktop: ## run build container for centos7 cuda-100 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop centos 7 "100" + +run-test-centos7-cu101-x64-desktop: ## run build container for centos7 cuda-101 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop centos 7 "101" + +run-test-centos7-cu102-x64-desktop: ## run build container for centos7 cuda-102 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop centos 7 "102" + +run-test-centos7-cu110-x64-desktop: ## run build container for centos7 cuda-110 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop centos 7 "110" + +run-test-centos7-cu111-x64-desktop: ## run build container for centos7 cuda-111 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop centos 7 "111" + +run-test-centos7-cu112-x64-desktop: ## run build container for centos7 cuda-112 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop centos 7 "112" + +run-test-centos7-cpu-x64-desktop: ## run build container for centos7 cpu x64 on desktop + @pwsh RunTestContainer.ps1 cpu 64 desktop ubuntu 16 "/x64" + +run-test-ubuntu16-mkl-x64-desktop: ## run build container for ubuntu16 mkl x64 on desktop + @pwsh RunTestContainer.ps1 mkl 64 desktop ubuntu 16 "/x64" + +run-test-ubuntu16-cu92-x64-desktop: ## run build container for ubuntu16 cuda-92 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop ubuntu 16 "92" + +run-test-ubuntu16-cu100-x64-desktop: ## run build container for ubuntu16 cuda-100 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop ubuntu 16 "100" + +run-test-ubuntu16-cu101-x64-desktop: ## run build container for ubuntu16 cuda-101 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop ubuntu 16 "101" + +run-test-ubuntu16-cu102-x64-desktop: ## run build container for ubuntu16 cuda-102 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop ubuntu 16 "102" + +run-test-ubuntu16-cu110-x64-desktop: ## run build container for ubuntu16 cuda-110 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop ubuntu 16 "110" + +run-test-ubuntu16-cu111-x64-desktop: ## run build container for ubuntu16 cuda-111 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop ubuntu 16 "111" + +run-test-ubuntu16-cu112-x64-desktop: ## run build container for ubuntu16 cuda-112 x64 on desktop + @pwsh RunTestContainer.ps1 cuda 64 desktop ubuntu 16 "112" \ No newline at end of file diff --git a/nuget/RunTestContainer.ps1 b/nuget/RunTestContainer.ps1 new file mode 100644 index 0000000..883975f --- /dev/null +++ b/nuget/RunTestContainer.ps1 @@ -0,0 +1,113 @@ +#*************************************** +#Arguments +#%1: Target (cpu/cuda/mkl/arm) +#%2: Architecture (32/64) +#%3: Platform (desktop,android/ios/uwp) +#%4: Optional Argument +# if Target is cuda, CUDA version if Target is cuda [90/91/92/100/101/102/110/111] +# if Target is mkl and Windows, IntelMKL directory path +#*************************************** +Param +( + [Parameter( + Mandatory=$True, + Position = 1 + )][string] + $Target, + + [Parameter( + Mandatory=$True, + Position = 2 + )][int] + $Architecture, + + [Parameter( + Mandatory=$True, + Position = 3 + )][string] + $Platform, + + [Parameter( + Mandatory=$True, + Position = 4 + )][string] + $Distribution, + + [Parameter( + Mandatory=$True, + Position = 5 + )][string] + $DistributionVersion, + + [Parameter( + Mandatory=$False, + Position = 6 + )][string] + $Option +) + +$ScriptPath = $PSScriptRoot +$FaceRecognitionDotNetRoot = Split-Path $ScriptPath -Parent +$BuildUtilsPath = Join-Path $FaceRecognitionDotNetRoot "nuget" | ` + Join-Path -ChildPath "BuildUtils.ps1" +import-module $BuildUtilsPath -function * +$Config = [Config]::new($FaceRecognitionDotNetRoot, "Release", $Target, $Architecture, $Platform, $Option) + +$DataSetRoot = $env:DataSetDir +if (!(Test-Path($DataSetRoot))) +{ + Write-Host "${DataSetRoot} is missing. You can specify DataSetDir environmental variable" -ForegroundColor Yellow + $DataSetRoot = $FaceRecognitionDotNetRoot +} + +if ($Target -ne "cuda") +{ + $postfix = $Option + $cuda = 0 + $dockername = "facerecognition/test/$Distribution/$DistributionVersion/$Target" + $postfix +} +else +{ + $cudaVersion = ($Option / 10).ToString("0.0") + $cuda = 1 + $dockername = "facerecognition/test/$Distribution/$DistributionVersion/$Target/$cudaVersion" +} + +if ($cuda -ne 0) +{ + $dockerAPIVersion = docker version --format '{{.Server.APIVersion}}' + Write-Host "Docker API Version: $dockerAPIVersion" -ForegroundColor Yellow + if ($dockerAPIVersion -ge 1.40) + { + docker run --gpus all --rm ` + --entrypoint="/bin/bash" ` + -v "$($FaceRecognitionDotNetRoot):/opt/data/FaceRecognitionDotNet" ` + -v "$($DataSetRoot):/opt/data/Dataset" ` + -e "LOCAL_UID=$(id -u $env:USER)" ` + -e "LOCAL_GID=$(id -g $env:USER)" ` + -w /opt/data/FaceRecognitionDotNet ` + -it "$dockername" + } + else + { + docker run --runtime=nvidia --rm ` + --entrypoint="/bin/bash" ` + -v "$($FaceRecognitionDotNetRoot):/opt/data/FaceRecognitionDotNet" ` + -v "$($DataSetRoot):/opt/data/Dataset" ` + -e "LOCAL_UID=$(id -u $env:USER)" ` + -e "LOCAL_GID=$(id -g $env:USER)" ` + -w /opt/data/FaceRecognitionDotNet ` + -it "$dockername" + } +} +else +{ + docker run --rm ` + --entrypoint="/bin/bash" ` + -v "$($FaceRecognitionDotNetRoot):/opt/data/FaceRecognitionDotNet" ` + -v "$($DataSetRoot):/opt/data/Dataset" ` + -e "LOCAL_UID=$(id -u $env:USER)" ` + -e "LOCAL_GID=$(id -g $env:USER)" ` + -w /opt/data/FaceRecognitionDotNet ` + -it "$dockername" +} \ No newline at end of file diff --git a/nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec index 7f0c291..c269590 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CPU.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec index 94c75f5..a220c5d 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA100.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet.CUDA100 - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet for CUDA 10.0 Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec index 1d71123..9db0dc8 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA101.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet.CUDA101 - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet for CUDA 10.1 Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec index 85061b9..7a7c0d2 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA102.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet.CUDA102 - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet for CUDA 10.2 Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec index d44e248..21c09ea 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA110.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet.CUDA110 - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet for CUDA 11.0 Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec index 7fba825..2135613 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA111.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet.CUDA111 - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet for CUDA 11.1 Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA112.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA112.nuspec index 851e12a..b203c2f 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA112.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA112.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet.CUDA112 - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet for CUDA 11.2 Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec b/nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec index 6a3b87a..e5a505e 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.CUDA92.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet.CUDA92 - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet for CUDA 9.2 Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec b/nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec index d44ce43..3381801 100644 --- a/nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec +++ b/nuget/nuspec/FaceRecognitionDotNet.MKL.nuspec @@ -2,7 +2,7 @@ FaceRecognitionDotNet.MKL - 1.3.0.6 + 1.3.0.7 FaceRecognitionDotNet for MKL Takuya Takeuchi Takuya Takeuchi @@ -14,17 +14,17 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#. - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 .net machinelearning face-recognition true - + - + diff --git a/src/AgeClassification/CMakeLists.txt b/src/AgeClassification/CMakeLists.txt index 1ad807f..9f25133 100644 --- a/src/AgeClassification/CMakeLists.txt +++ b/src/AgeClassification/CMakeLists.txt @@ -24,7 +24,7 @@ message("-------------------------------------------------------") set(VERSION_MAJOR 1) set(VERSION_MINOR 3) set(VERSION_PATCH 0) -set(VERSION_DATE 6) +set(VERSION_DATE 7) # Only GCC requires -fPIC if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") diff --git a/src/AgeClassification/dlib/dnn/loss/multiclass_log/age/Age.h b/src/AgeClassification/dlib/dnn/loss/multiclass_log/age/Age.h index 4caaae1..dbadeed 100644 --- a/src/AgeClassification/dlib/dnn/loss/multiclass_log/age/Age.h +++ b/src/AgeClassification/dlib/dnn/loss/multiclass_log/age/Age.h @@ -9,8 +9,8 @@ #include "defines.h" #include "DlibDotNet.Native.Dnn/dlib/dnn/loss/multiclass_log/template.h" -typedef unsigned long age_out_type; -typedef unsigned long age_train_label_type; +typedef uint32_t age_out_type; +typedef uint32_t age_train_label_type; MAKE_LOSSMULTICLASSLOG_FUNC(age_train_type, matrix_element_type::RgbPixel, dlib::rgb_pixel, matrix_element_type::UInt32, age_train_label_type, 200) diff --git a/src/DlibDotNet b/src/DlibDotNet index a03d925..19c1a91 160000 --- a/src/DlibDotNet +++ b/src/DlibDotNet @@ -1 +1 @@ -Subproject commit a03d925e9d9007d1a4e8a17ee0b039e6dbbe814d +Subproject commit 19c1a91a7743eca966da5633e327875372e5ebe4 diff --git a/src/EmotionClassification/CMakeLists.txt b/src/EmotionClassification/CMakeLists.txt index 5aace0d..e299b96 100644 --- a/src/EmotionClassification/CMakeLists.txt +++ b/src/EmotionClassification/CMakeLists.txt @@ -24,7 +24,7 @@ message("-------------------------------------------------------") set(VERSION_MAJOR 1) set(VERSION_MINOR 3) set(VERSION_PATCH 0) -set(VERSION_DATE 6) +set(VERSION_DATE 7) # Only GCC requires -fPIC if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") diff --git a/src/EmotionClassification/dlib/dnn/loss/multiclass_log/emotion/Emotion.h b/src/EmotionClassification/dlib/dnn/loss/multiclass_log/emotion/Emotion.h index 4689b30..d05500d 100644 --- a/src/EmotionClassification/dlib/dnn/loss/multiclass_log/emotion/Emotion.h +++ b/src/EmotionClassification/dlib/dnn/loss/multiclass_log/emotion/Emotion.h @@ -9,8 +9,8 @@ #include "defines.h" #include "DlibDotNet.Native.Dnn/dlib/dnn/loss/multiclass_log/template.h" -typedef unsigned long emotion_out_type; -typedef unsigned long emotion_train_label_type; +typedef uint32_t emotion_out_type; +typedef uint32_t emotion_train_label_type; MAKE_LOSSMULTICLASSLOG_FUNC(emotion_train_type, matrix_element_type::Double, double, matrix_element_type::UInt32, emotion_train_label_type, 200) MAKE_LOSSMULTICLASSLOG_FUNC(emotion_train_type2, matrix_element_type::RgbPixel, dlib::rgb_pixel, matrix_element_type::UInt32, emotion_train_label_type, 201) diff --git a/src/FaceRecognitionDotNet/FaceRecognition.cs b/src/FaceRecognitionDotNet/FaceRecognition.cs index 9d89965..3294ca7 100644 --- a/src/FaceRecognitionDotNet/FaceRecognition.cs +++ b/src/FaceRecognitionDotNet/FaceRecognition.cs @@ -365,7 +365,7 @@ public static IEnumerable CropFaces(Image image, IEnumerable lo case Mode.Greyscale: var gray = image.Matrix as Matrix; results.Add(new Image(DlibDotNet.Dlib.ExtractImage4Points(gray, dPoint, width, height), - Mode.Rgb)); + Mode.Greyscale)); break; } } diff --git a/src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj b/src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj index 747f478..870b3c8 100644 --- a/src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj +++ b/src/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj @@ -3,10 +3,10 @@ net461;netstandard2.0 Takuya Takeuchi - © Takuya Takeuchi 2018-2021 + © Takuya Takeuchi 2018-2022 Porting face_recognition (by Adam Geitgey) by C# - 1.3.0.6 + 1.3.0.7 https://github.com/takuya-takeuchi/FaceRecognitionDotNet .net machinelearning face-recognition diff --git a/src/GenderClassification/CMakeLists.txt b/src/GenderClassification/CMakeLists.txt index bd9c28c..0d364a4 100644 --- a/src/GenderClassification/CMakeLists.txt +++ b/src/GenderClassification/CMakeLists.txt @@ -24,7 +24,7 @@ message("-------------------------------------------------------") set(VERSION_MAJOR 1) set(VERSION_MINOR 3) set(VERSION_PATCH 0) -set(VERSION_DATE 6) +set(VERSION_DATE 7) # Only GCC requires -fPIC if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") diff --git a/src/GenderClassification/dlib/dnn/loss/multiclass_log/gender/Gender.h b/src/GenderClassification/dlib/dnn/loss/multiclass_log/gender/Gender.h index a9daf2d..e779c16 100644 --- a/src/GenderClassification/dlib/dnn/loss/multiclass_log/gender/Gender.h +++ b/src/GenderClassification/dlib/dnn/loss/multiclass_log/gender/Gender.h @@ -9,8 +9,8 @@ #include "defines.h" #include "DlibDotNet.Native.Dnn/dlib/dnn/loss/multiclass_log/template.h" -typedef unsigned long gender_out_type; -typedef unsigned long gender_train_label_type; +typedef uint32_t gender_out_type; +typedef uint32_t gender_train_label_type; MAKE_LOSSMULTICLASSLOG_FUNC(gender_train_type, matrix_element_type::RgbPixel, dlib::rgb_pixel, matrix_element_type::UInt32, gender_train_label_type, 100) diff --git a/tools/GenderTraining/README.md b/tools/GenderTraining/README.md index 43ce8f7..c570a31 100644 --- a/tools/GenderTraining/README.md +++ b/tools/GenderTraining/README.md @@ -59,7 +59,7 @@ python tools\gender-hist.py UTKFaceDataset ```` cd -dotnet run -c Release -- -d=UTKFaceDataset -b=400 -e=600 -v=20 +dotnet run -c Release -- train -d=UTKFaceDataset -b=400 -e=600 -v=20 Epoch: 600 Learning Rate: 0.001 Min Learning Rate: 1E-05