Skip to content

Commit

Permalink
Merge branch 'release/19.20.0.20200725'
Browse files Browse the repository at this point in the history
  • Loading branch information
takuya-takeuchi committed Jul 25, 2020
2 parents 8866b7f + ee3f289 commit cee0ba5
Show file tree
Hide file tree
Showing 106 changed files with 2,987 additions and 632 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,6 @@ src/DlibDotNet.Native.Dnn/build*
!nuget/ref/.keepfolder
!nuget/lib/.keepfolder

nuget/*.nupkg
nuget/*.nupkg

work
28 changes: 28 additions & 0 deletions Licenses/Intel Math Kernel Library.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Intel Simplified Software License (Version February 2020)

---------------------------------------------

Use and Redistribution. You may use and redistribute the software (the “Software”), without modification, provided the following conditions are met:

Redistributions must reproduce the above copyright notice and the following terms of use in the Software and in the documentation and/or other materials provided with the distribution.
Neither the name of Intel nor the names of its suppliers may be used to endorse or promote products derived from this Software without specific prior written permission.
No reverse engineering, decompilation, or disassembly of this Software is permitted.
Limited patent license. Intel grants you a world-wide, royalty-free, non-exclusive license under patents it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell (“Utilize”) this Software, but solely to the extent that any such patent is necessary to Utilize the Software alone. The patent license shall not apply to any combinations which include this software. No hardware per se is licensed hereunder.

Third party programs. The Software may contain Third Party Programs. “Third Party Programs” are third party software, open source software or other Intel software listed in the “third-party-programs.txt” or other similarly named text file that is included with the Software. Third Party Programs, even if included with the distribution of the Software, may be governed by separate license terms, including without limitation, third party license terms, open source software notices and terms, and/or other Intel software license terms. These separate license terms may govern your use of the Third Party Programs.

DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE THAT YOU ARE FULLY RESPONSIBLE FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND ATTORNEYS’ FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM ALLEGES THAT INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE MATERIALS.

LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU AGREE TO INDEMNIFY AND HOLD INTEL HARMLESS AGAINST ANY CLAIMS AND EXPENSES RESULTING FROM YOUR USE OR UNAUTHORIZED USE OF THE SOFTWARE.

No support. Intel may make changes to the Software, at any time without notice, and is not obligated to support, update or provide training for the Software.

Termination. Intel may terminate your right to use the Software in the event of your breach of this Agreement and you fail to cure the breach within a reasonable period of time.

Feedback. Should you provide Intel with comments, modifications, corrections, enhancements or other input (“Feedback”) related to the Software Intel will be free to use, disclose, reproduce, license or otherwise distribute or exploit the Feedback in its sole discretion without any obligations or restrictions of any kind, including without limitation, intellectual property rights or licensing obligations.

Compliance with laws. You agree to comply with all relevant laws and regulations governing your use, transfer, import or export (or prohibition thereof) of the Software.

Governing law. All disputes will be governed by the laws of the United States of America and the State of Delaware without reference to conflict of law principles and subject to the exclusive jurisdiction of the state or federal courts sitting in the State of Delaware, and each party agrees that it submits to the personal jurisdiction and venue of those courts and waives any objections. The United Nations Convention on Contracts for the International Sale of Goods (1980) is specifically excluded and will not apply to the Software.

*Other names and brands may be claimed as the property of others.
2 changes: 1 addition & 1 deletion examples/HoughTransform/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private static void Main()
var l = Point.Rotate(arc, tmp2, angle2 * 180 / Math.PI);
var r = Point.Rotate(arc, tmp3, angle2 * 180 / Math.PI);

Dlib.AssignAllPpixels(img, 0);
Dlib.AssignAllPixels(img, 0);
Dlib.DrawLine(img, l, r, 255);

using (var himg = new Array2D<int>())
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions examples/MultiThreadFaceDetectionCpp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
boost_*
build_*
75 changes: 75 additions & 0 deletions examples/MultiThreadFaceDetectionCpp/Build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
$current = Get-Location

$boost_version = "1.73.0"
$boost_version2 = "1_73_0"
$boost_source_dir = "boost_${boost_version2}"

if ($IsWindows)
{
$boost_dir = Join-Path $current "boost_win"

$taget_dir = "build_win"
New-Item -ItemType Directory $taget_dir -Force > $Null

Set-Location $taget_dir
$env:BOOST_DIR = "${boost_dir}/${boost_source_dir}/win64/cmake/boost-${boost_version}"
cmake -G "Visual Studio 15 2017" -A x64 -T host=x64 `
-D DLIB_USE_CUDA=ON `
-D DLIB_USE_BLAS=OFF `
-D DLIB_USE_LAPACK=OFF `
-D BOOST_DIR="$env:BOOST_DIR" `
..
}
elseif ($IsLinux)
{
$boost_dir = Join-Path $current "boost_linux"

$taget_dir = "build_linux"
New-Item -ItemType Directory $taget_dir -Force > $Null

Set-Location $taget_dir
$env:Boost_DIR = "${boost_dir}/${boost_source_dir}/linux/cmake/Boost-${boost_version}"
cmake -D DLIB_USE_CUDA=ON `
-D DLIB_USE_BLAS=OFF `
-D DLIB_USE_LAPACK=OFF `
-D LIBPNG_IS_GOOD=OFF `
-D PNG_FOUND=OFF `
-D PNG_LIBRARY_RELEASE="" `
-D PNG_LIBRARY_DEBUG="" `
-D PNG_PNG_INCLUDE_DIR="" `
-D JPEG_FOUND=OFF `
-D JPEG_LIBRARY_RELEASE="" `
-D JPEG_LIBRARY_DEBUG="" `
-D JPEG_PNG_INCLUDE_DIR="" `
-D Boost_DIR="$env:Boost_DIR" `
..
}
elseif ($IsMacOS)
{
$boost_dir = Join-Path $current "boost_osx"

$taget_dir = "build_osx"
New-Item -ItemType Directory $taget_dir -Force > $Null

Set-Location $taget_dir
$env:BOOST_DIR = "${boost_dir}/${boost_source_dir}/osx/cmake/boost-${boost_version}"
cmake -D DLIB_USE_CUDA=OFF `
-D DLIB_USE_BLAS=OFF `
-D DLIB_USE_LAPACK=OFF `
-D LIBPNG_IS_GOOD=OFF `
-D PNG_FOUND=OFF `
-D PNG_LIBRARY_RELEASE="" `
-D PNG_LIBRARY_DEBUG="" `
-D PNG_PNG_INCLUDE_DIR="" `
-D JPEG_FOUND=OFF `
-D JPEG_LIBRARY_RELEASE="" `
-D JPEG_LIBRARY_DEBUG="" `
-D JPEG_PNG_INCLUDE_DIR="" `
-D BOOST_DIR="$env:BOOST_DIR" `
..
}

cmake --build . --config Release
cmake --build . --config Debug

Set-Location $current
82 changes: 82 additions & 0 deletions examples/MultiThreadFaceDetectionCpp/BuildBoost.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
$current = Get-Location

$boost_version = "1.73.0"
$boost_version2 = "1_73_0"
$boost_source_dir = "boost_${boost_version2}"
$boost_base_url = "https://dl.bintray.com/boostorg/release/${boost_version}/source/boost_${boost_version2}"

if ($IsWindows)
{
$boost_file = "boost_win.zip"
$boost_dir = "boost_win"
if (!(Test-Path $boost_file))
{
Invoke-WebRequest -Uri "${boost_base_url}.zip" -OutFile $boost_file
}
if (!(Test-Path $boost_dir))
{
Expand-Archive -Path $boost_file -DestinationPath $boost_dir
}

# build boost
Set-Location "${boost_dir}/${boost_source_dir}"
cmd.exe /c "bootstrap.bat"
cmd.exe /c b2.exe install address-model=64 toolset=msvc-14.1 `
link=static runtime-link=static,shared `
--libdir="win64" `
--with-system `
--with-thread `
--with-filesystem
}
elseif ($IsLinux)
{
$boost_file = "boost_linux.tar.gz"
$boost_dir = "boost_linux"
if (!(Test-Path $boost_file))
{
Invoke-WebRequest -Uri "${boost_base_url}.tar.gz" -OutFile $boost_file
}
if (!(Test-Path $boost_dir))
{
New-Item -ItemType Directory $boost_dir -Force > $Null
tar -zxvf $boost_file -C $boost_dir
}

# build boost
Set-Location "${boost_dir}/${boost_source_dir}"
/bin/bash "bootstrap.sh"
./b2 install address-model=64 `
link=static runtime-link=static,shared `
--prefix="install" `
--libdir="linux" `
--with-system `
--with-thread `
--with-filesystem
}
elseif ($IsMacOS)
{
$boost_file = "boost_osx.tar.gz"
$boost_dir = "boost_osx"
if (!(Test-Path $boost_file))
{
Invoke-WebRequest -Uri "${boost_base_url}.tar.gz" -OutFile $boost_file
}
if (!(Test-Path $boost_dir))
{
New-Item -ItemType Directory $boost_dir -Force > $Null
tar -zxvf $boost_file -C $boost_dir
}

# build boost
Set-Location "${boost_dir}/${boost_source_dir}"
/bin/bash "bootstrap.sh"
./b2 install address-model=64 `
link=static runtime-link=static,shared `
--prefix="install" `
--libdir="osx" `
--with-system `
--with-thread `
--with-filesystem
}

Set-Location $current
107 changes: 107 additions & 0 deletions examples/MultiThreadFaceDetectionCpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
cmake_minimum_required(VERSION 3.0.0)
cmake_policy(SET CMP0053 NEW)
cmake_policy(SET CMP0054 NEW)

set(PROJ_NAME MultiThreadFaceDetection)

project(${PROJ_NAME} VERSION 19.18.0)

# OS info
message("-------------------------------------------------------")
message("-- CMAKE_SYSTEM_INFO_FILE: ${CMAKE_SYSTEM_INFO_FILE}")
message("-- CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
message("-- CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
message("-- CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
message("-- CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
message("-- CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
string (REGEX MATCH "\\.el[1-9]" os_version_suffix ${CMAKE_SYSTEM})
message("-- os_version_suffix: ${os_version_suffix}")
message("-- Project: ${CMAKE_CURRENT_SOURCE_DIR}")
message("-- Binaries: ${CMAKE_CURRENT_BINARY_DIR}")
message("-------------------------------------------------------")

# Version info
set(VERSION_MAJOR 19)
set(VERSION_MINOR 18)
set(VERSION_PATCH 0)
set(VERSION_DATE 20200525)

set(Boost_USE_STATIC_RUNTIME ON)
find_package(Boost 1.73.0 REQUIRED COMPONENTS filesystem thread system)

# libjpeg-dev, libpng-dev
set(DLIB_JPEG_SUPPORT True)
set(DLIB_PNG_SUPPORT True)

# Only GCC requires -fPIC
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "-fPIC")
set(CMAKE_CXX_FLAGS "-fPIC")
endif()

# set architecture
if (NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio")
if ("${ARCH_TYPE}" STREQUAL "32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
elseif ("${ARCH_TYPE}" STREQUAL "64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
endif()
endif()

# Select the release build type by default
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
message("-- CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()

# Set /bigobj for MSVC
if (${CMAKE_GENERATOR} MATCHES "Visual Studio")
# C4819: The file contains a character that cannot be represented in the current code page
# C4503: identifier' : decorated name length exceeded, name was truncated
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819 /wd4503 /bigobj")

# C4146: unary minus operator applied to unsigned type, result still unsigned
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4146 /wd4996 /ZW /EHsc")
endif()
endif()

# set parallel build
if (${CMAKE_GENERATOR} MATCHES "Visual Studio")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()


# dlib project submodule
set(DLIB_IN_PROJECT_BUILD True)
add_subdirectory(${PROJECT_SOURCE_DIR}/../../src/dlib/dlib ${CMAKE_CURRENT_BINARY_DIR}/dlib_build)

add_executable(${PROJ_NAME} ${PROJECT_SOURCE_DIR}/main.cpp)

if (${DLIB_USE_CUDA})
# disable cuda static link
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)

target_include_directories(${PROJ_NAME} PRIVATE ${Boost_INCLUDE_DIRS}
"$ENV{CUDA_PATH}/include")
else()
target_include_directories(${PROJ_NAME} PRIVATE ${Boost_INCLUDE_DIRS})
endif()

target_link_libraries(${PROJ_NAME} dlib::dlib
${Boost_LIBRARIES})

set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
51 changes: 51 additions & 0 deletions examples/MultiThreadFaceDetectionCpp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# MultiThread Face Detection C++

This program show dnn face detection does NOT work on multi-thread.

## How to use?

## 1. Build

1. Type the following command
````
$ pwsh BuildBoost.ps1
$ pwsh Build.ps1
````

## 2. Run

### Single Thread

````
$ git lfs pull
$ pwsh .\Run.ps1 1
deserialize: mmod_human_face_detector.dat
thread_num: 1
load_image: 2007_007763.jpg
prepare thread
wait all thread
start thread_id: 0
[(2488, 1899) (2828, 2239)]
[(737, 1543) (1020, 1826)]
[(3107, 695) (3447, 1035)]
[(2371, 683) (2654, 966)]
[(1450, 1742) (1686, 1978)]
[(1597, 740) (1880, 1023)]
[(1306, 954) (1542, 1190)]
finish thread_id: 0
finish all thread
````

### Multi Thread

````
$ git lfs pull
$ pwsh .\Run.ps1 2
deserialize: mmod_human_face_detector.dat
thread_num: 2
load_image: 2007_007763.jpg
prepare thread
wait all thread
start thread_id: 0
start thread_id: 1
````
Loading

0 comments on commit cee0ba5

Please sign in to comment.