Commit b1627bc5 authored by Fm's avatar Fm

Merge branch 'master' of https://github.com/davisking/dlib

parents 3b3a9939 5e550a26
...@@ -29,3 +29,4 @@ feaff82884ded598bde93c635eb3ded9c0933a07 v18.15 ...@@ -29,3 +29,4 @@ feaff82884ded598bde93c635eb3ded9c0933a07 v18.15
ce6f364987865b19bdb1b4730ac5403e2bb55dc4 v18.17 ce6f364987865b19bdb1b4730ac5403e2bb55dc4 v18.17
7ae1775f61a44b7f07866050b50ad3ade581f019 v18.18 7ae1775f61a44b7f07866050b50ad3ade581f019 v18.18
4d6b102506bb9e2f195c7ddf984cc2d86b8643e7 before_dnn_serialization_cleanup 4d6b102506bb9e2f195c7ddf984cc2d86b8643e7 before_dnn_serialization_cleanup
7210589728f6d83f6cb7d21cd24d114a5364d9e2 v19.0
...@@ -12,9 +12,9 @@ include(release_build_by_default) ...@@ -12,9 +12,9 @@ include(release_build_by_default)
include(use_cpp_11.cmake) include(use_cpp_11.cmake)
set(CPACK_PACKAGE_VERSION_MAJOR "18") set(CPACK_PACKAGE_VERSION_MAJOR "19")
set(CPACK_PACKAGE_VERSION_MINOR "18") set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "100") set(CPACK_PACKAGE_VERSION_PATCH "99")
set(VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) set(VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
# Set DLIB_VERSION in the including CMake file so they can use it to do whatever they want. # Set DLIB_VERSION in the including CMake file so they can use it to do whatever they want.
get_directory_property(has_parent PARENT_DIRECTORY) get_directory_property(has_parent PARENT_DIRECTORY)
......
...@@ -385,13 +385,15 @@ namespace dlib ...@@ -385,13 +385,15 @@ namespace dlib
}; };
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
void copy_tensor(
void copy_tensor(
tensor& dest, tensor& dest,
size_t dest_k_offset, size_t dest_k_offset,
const tensor& src, const tensor& src,
size_t src_k_offset, size_t src_k_offset,
size_t count_k size_t count_k
); );
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
} }
......
...@@ -208,9 +208,9 @@ namespace dlib ...@@ -208,9 +208,9 @@ namespace dlib
auto ptr = data.host(); auto ptr = data.host();
for (auto i = ibegin; i != iend; ++i) for (auto i = ibegin; i != iend; ++i)
{ {
for (long r = 0; r < NR; ++r) for (size_t r = 0; r < NR; ++r)
{ {
for (long c = 0; c < NC; ++c) for (size_t c = 0; c < NC; ++c)
{ {
rgb_pixel temp = (*i)(r,c); rgb_pixel temp = (*i)(r,c);
auto p = ptr++; auto p = ptr++;
......
...@@ -25,32 +25,42 @@ namespace dlib ...@@ -25,32 +25,42 @@ namespace dlib
); );
const full_object_detection& d = dets[i]; const full_object_detection& d = dets[i];
// Around Chin. Ear to Ear
for (unsigned long i = 1; i <= 16; ++i) for (unsigned long i = 1; i <= 16; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
// Line on top of nose
for (unsigned long i = 28; i <= 30; ++i) for (unsigned long i = 28; i <= 30; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
// left eyebrow
for (unsigned long i = 18; i <= 21; ++i) for (unsigned long i = 18; i <= 21; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
// Right eyebrow
for (unsigned long i = 23; i <= 26; ++i) for (unsigned long i = 23; i <= 26; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
// Bottom part of the nose
for (unsigned long i = 31; i <= 35; ++i) for (unsigned long i = 31; i <= 35; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
// Line from the nose to the bottom part above
lines.push_back(image_window::overlay_line(d.part(30), d.part(35), color)); lines.push_back(image_window::overlay_line(d.part(30), d.part(35), color));
// Left eye
for (unsigned long i = 37; i <= 41; ++i) for (unsigned long i = 37; i <= 41; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
lines.push_back(image_window::overlay_line(d.part(36), d.part(41), color)); lines.push_back(image_window::overlay_line(d.part(36), d.part(41), color));
// Right eye
for (unsigned long i = 43; i <= 47; ++i) for (unsigned long i = 43; i <= 47; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
lines.push_back(image_window::overlay_line(d.part(42), d.part(47), color)); lines.push_back(image_window::overlay_line(d.part(42), d.part(47), color));
// Lips outer part
for (unsigned long i = 49; i <= 59; ++i) for (unsigned long i = 49; i <= 59; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
lines.push_back(image_window::overlay_line(d.part(48), d.part(59), color)); lines.push_back(image_window::overlay_line(d.part(48), d.part(59), color));
// Lips inside part
for (unsigned long i = 61; i <= 67; ++i) for (unsigned long i = 61; i <= 67; ++i)
lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color)); lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
lines.push_back(image_window::overlay_line(d.part(60), d.part(67), color)); lines.push_back(image_window::overlay_line(d.part(60), d.part(67), color));
......
...@@ -142,8 +142,8 @@ namespace dlib ...@@ -142,8 +142,8 @@ namespace dlib
rgb_pixel temp; rgb_pixel temp;
assign_pixel(temp, img[r][c]); assign_pixel(temp, img[r][c]);
temp.red = rtable[temp.red]; temp.red = rtable[temp.red];
temp.green = rtable[temp.green]; temp.green = gtable[temp.green];
temp.blue = rtable[temp.blue]; temp.blue = btable[temp.blue];
assign_pixel(img[r][c], temp); assign_pixel(img[r][c], temp);
} }
} }
......
...@@ -42,6 +42,8 @@ namespace dlib ...@@ -42,6 +42,8 @@ namespace dlib
inline void load(const type* ptr) { x = _mm256_loadu_ps(ptr); } inline void load(const type* ptr) { x = _mm256_loadu_ps(ptr); }
inline void store(type* ptr) const { _mm256_storeu_ps(ptr, x); } inline void store(type* ptr) const { _mm256_storeu_ps(ptr, x); }
inline simd8f& operator=(const simd8i& rhs) { *this = simd8f(rhs); return *this; }
inline unsigned int size() const { return 8; } inline unsigned int size() const { return 8; }
inline float operator[](unsigned int idx) const inline float operator[](unsigned int idx) const
{ {
......
...@@ -170,10 +170,10 @@ namespace ...@@ -170,10 +170,10 @@ namespace
test_qr(3*randmat<float,2,2>()); test_qr(3*randmat<float,2,2>());
test_qr(3*randmat<float,4,3>()); test_qr(3*randmat<float,4,3>());
test_qr(3*randmat<float,4,4>()); test_qr(3*randmat<float,4,4>());
test_qr(3*randmat<float,9,4>()); test_qr(3*randmat<float,5,4>());
typedef matrix<float,0,0,default_memory_manager, column_major_layout> mat; typedef matrix<float,0,0,default_memory_manager, column_major_layout> mat;
test_qr(mat(3*randmat<float>(9,4))); test_qr(mat(3*randmat<float>(5,4)));
test_qr(mat(3*randmat<float>(9,9))); test_qr(mat(3*randmat<float>(9,9)));
} }
......
...@@ -61,6 +61,7 @@ else() ...@@ -61,6 +61,7 @@ else()
";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;" AND ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;" AND
";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_thread_local;" AND ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_thread_local;" AND
";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_constexpr;" AND ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_constexpr;" AND
";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_decltype_incomplete_return_types;" AND
";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;") ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;")
set(COMPILER_CAN_DO_CPP_11 1) set(COMPILER_CAN_DO_CPP_11 1)
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
<p> <p>
If you think you found some kind of bug or problem in dlib then feel If you think you found some kind of bug or problem in dlib then feel
free to post on <a href="https://sourceforge.net/p/dclib/discussion">sourceforge</a> free to submit a dlib issue on <a href="https://github.com/davisking/dlib/issues">github</a>.
or <a href="https://github.com/davisking/dlib/issues">github</a>.
But include the version of dlib you are using, what you But include the version of dlib you are using, what you
are trying, what happened, what you expected to have happened instead, etc. are trying, what happened, what you expected to have happened instead, etc.
</p> </p>
...@@ -26,22 +25,8 @@ ...@@ -26,22 +25,8 @@
<p> <p>
On the other hand, if you haven't found a bug or problem in dlib, but On the other hand, if you haven't found a bug or problem in dlib, but
instead are looking for machine learning/computer vision/programming instead are looking for machine learning/computer vision/programming
consulting then you can still <a href="https://sourceforge.net/p/dclib/discussion">post your question on sourceforge</a>. help then post your question to <a href="http://stackoverflow.com/questions/tagged/dlib">stack overflow with the dlib tag</a>.
But be clear that this is what you are asking for. Maybe someone will
help you or you can find someone to pay money in exchange for a
solution to your problem.
</p> </p>
<p>
However, don't try to get someone to write your code for you by
repeatedly asking a question like "ok, what do I type next to make a
program that does X?". I get this question all the time from people
who obviously don't know how to program. If you are not familiar
with C++ it's much better to learn it by
<a href="http://dlib.net/books.html">reading one of the excellent books on the topic</a>
than by an infinite sequence of questions posted in the dlib forums.
</p>
</question> </question>
<question text="How can I use dlib in Visual Studio?"> <question text="How can I use dlib in Visual Studio?">
......
...@@ -449,7 +449,7 @@ ...@@ -449,7 +449,7 @@
you take an image of a human face as input and are expected to identify the you take an image of a human face as input and are expected to identify the
locations of important facial landmarks such as the corners of the mouth locations of important facial landmarks such as the corners of the mouth
and eyes, tip of the nose, and so forth. For example, here is the output and eyes, tip of the nose, and so forth. For example, here is the output
of dlib's <a href="http://sourceforge.net/projects/dclib/files/dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2">68-face-landmark shape_predictor</a> on an image from the HELEN dataset: <br/><br/> of dlib's <a href="http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2">68-face-landmark shape_predictor</a> on an image from the HELEN dataset: <br/><br/>
<img src='face_landmarking_example.png'/> <img src='face_landmarking_example.png'/>
<br/><br/> <br/><br/>
......
...@@ -8,26 +8,19 @@ ...@@ -8,26 +8,19 @@
<body> <body>
<p> <p>
Dlib is a modern C++ toolkit containing machine learning algorithms and
Dlib is a modern C++ toolkit containing machine learning algorithms and tools tools for creating complex software in C++ to solve real world problems.
for creating complex software in C++ to solve real world problems. It is used in both industry and academia in a wide range of domains
including robotics, embedded devices, mobile phones, and large high
It is open source software and licensed performance computing environments. Dlib's <a href="license.html">open source licensing</a>
under the <a href="license.html">Boost Software License</a>. allows you to use it in any application, free of charge.
The <a href="intro.html">introduction</a> contains everything you need to know to get
started using the library. However, if after consulting the documentation, you have any questions, comments,
or complaints feel free to post in the
<a href='http://sourceforge.net/p/dclib/discussion'>forums</a>.
</p> </p>
<chm> <p>
<p> To follow or participate in the development of dlib subscribe to <a href="https://github.com/davisking/dlib">dlib on github</a>.
For updates to this project see <a href="http://dlib.net">dlib.net</a>. Also be sure to read the <a href="howto_contribute.html">how to contribute</a> page if you intend to
</p> submit code to the project.
</chm> </p>
<br/> <br/>
......
...@@ -96,10 +96,12 @@ ...@@ -96,10 +96,12 @@
<name>Dlib Blog</name> <name>Dlib Blog</name>
<link>http://blog.dlib.net</link> <link>http://blog.dlib.net</link>
</item> </item>
<!--
<item> <item>
<name>Forums</name> <name>Forums</name>
<link>https://sourceforge.net/p/dclib/discussion</link> <link>https://sourceforge.net/p/dclib/discussion</link>
</item> </item>
-->
<item> <item>
<name>Who uses dlib?</name> <name>Who uses dlib?</name>
<link>http://sourceforge.net/p/dclib/wiki/Known_users/</link> <link>http://sourceforge.net/p/dclib/wiki/Known_users/</link>
...@@ -187,17 +189,21 @@ ...@@ -187,17 +189,21 @@
<name>Examples: C++</name> <name>Examples: C++</name>
<sub> <sub>
<item> <item>
<name>Deep Learning</name> <name>Deep Learning Introduction Part 1</name>
<link>dnn_mnist_ex.cpp.html</link> <link>dnn_introduction_ex.cpp.html</link>
</item> </item>
<item> <item>
<name>Deep Learning Advanced</name> <name>Deep Learning Introduction Part 2</name>
<link>dnn_mnist_advanced_ex.cpp.html</link> <link>dnn_introduction2_ex.cpp.html</link>
</item> </item>
<item> <item>
<name>Deep Learning Imagenet Classifier </name> <name>Deep Learning Imagenet Classifier</name>
<link>dnn_imagenet_ex.cpp.html</link> <link>dnn_imagenet_ex.cpp.html</link>
</item> </item>
<item>
<name>Deep Learning Imagenet Trainer </name>
<link>dnn_imagenet_train_ex.cpp.html</link>
</item>
<item> <item>
<name>Deep Learning Inception</name> <name>Deep Learning Inception</name>
<link>dnn_inception_ex.cpp.html</link> <link>dnn_inception_ex.cpp.html</link>
......
...@@ -426,15 +426,17 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09 ...@@ -426,15 +426,17 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09
input layer or an entire network. Therefore, deep neural networks are created input layer or an entire network. Therefore, deep neural networks are created
by stacking many layers on top of each other using the add_layer class. by stacking many layers on top of each other using the add_layer class.
<p> <p>
For a tutorial showing how this is accomplished see For a tutorial showing how this is accomplished read
<a href="dnn_mnist_ex.cpp.html">this MNIST example</a>. the <a href="dnn_introduction_ex.cpp.html">DNN Introduction part 1</a> and
<a href="dnn_introduction2_ex.cpp.html">DNN Introduction part 2</a>.
</p> </p>
</description> </description>
<examples> <examples>
<example>dnn_mnist_ex.cpp.html</example> <example>dnn_introduction_ex.cpp.html</example>
<example>dnn_mnist_advanced_ex.cpp.html</example> <example>dnn_introduction2_ex.cpp.html</example>
<example>dnn_inception_ex.cpp.html</example> <example>dnn_inception_ex.cpp.html</example>
<example>dnn_imagenet_ex.cpp.html</example> <example>dnn_imagenet_ex.cpp.html</example>
<example>dnn_imagenet_train_ex.cpp.html</example>
</examples> </examples>
</component> </component>
...@@ -449,10 +451,11 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09 ...@@ -449,10 +451,11 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09
on the top of a deep neural network. on the top of a deep neural network.
</description> </description>
<examples> <examples>
<example>dnn_mnist_ex.cpp.html</example> <example>dnn_introduction_ex.cpp.html</example>
<example>dnn_mnist_advanced_ex.cpp.html</example> <example>dnn_introduction2_ex.cpp.html</example>
<example>dnn_inception_ex.cpp.html</example> <example>dnn_inception_ex.cpp.html</example>
<example>dnn_imagenet_ex.cpp.html</example> <example>dnn_imagenet_ex.cpp.html</example>
<example>dnn_imagenet_train_ex.cpp.html</example>
</examples> </examples>
</component> </component>
...@@ -468,7 +471,7 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09 ...@@ -468,7 +471,7 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09
except that it involves less typing, and for large N, will compile much faster. except that it involves less typing, and for large N, will compile much faster.
</description> </description>
<examples> <examples>
<example>dnn_mnist_advanced_ex.cpp.html</example> <example>dnn_introduction2_ex.cpp.html</example>
</examples> </examples>
</component> </component>
...@@ -490,12 +493,12 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09 ...@@ -490,12 +493,12 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09
<p> <p>
For a tutorial showing how to use tagging see the For a tutorial showing how to use tagging see the
<a href="dnn_mnist_advanced_ex.cpp.html">dnn_mnist_advanced_ex.cpp</a> <a href="dnn_introduction2_ex.cpp.html">dnn_introduction2_ex.cpp</a>
example program. example program.
</p> </p>
</description> </description>
<examples> <examples>
<example>dnn_mnist_advanced_ex.cpp.html</example> <example>dnn_introduction2_ex.cpp.html</example>
</examples> </examples>
</component> </component>
...@@ -512,7 +515,7 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09 ...@@ -512,7 +515,7 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09
<p> <p>
For a tutorial showing how to use tagging see the For a tutorial showing how to use tagging see the
<a href="dnn_mnist_advanced_ex.cpp.html">dnn_mnist_advanced_ex.cpp</a> <a href="dnn_introduction2_ex.cpp.html">dnn_introduction2_ex.cpp</a>
example program. example program.
</p> </p>
</description> </description>
...@@ -530,12 +533,12 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09 ...@@ -530,12 +533,12 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09
<p> <p>
For a tutorial showing how to use tagging see the For a tutorial showing how to use tagging see the
<a href="dnn_mnist_advanced_ex.cpp.html">dnn_mnist_advanced_ex.cpp</a> <a href="dnn_introduction2_ex.cpp.html">dnn_introduction2_ex.cpp</a>
example program. example program.
</p> </p>
</description> </description>
<examples> <examples>
<example>dnn_mnist_advanced_ex.cpp.html</example> <example>dnn_introduction2_ex.cpp.html</example>
</examples> </examples>
</component> </component>
...@@ -550,10 +553,11 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09 ...@@ -550,10 +553,11 @@ Davis E. King. <a href="http://jmlr.csail.mit.edu/papers/volume10/king09a/king09
takes some kind of image as input and loads it into a network. takes some kind of image as input and loads it into a network.
</description> </description>
<examples> <examples>
<example>dnn_mnist_ex.cpp.html</example> <example>dnn_introduction_ex.cpp.html</example>
<example>dnn_mnist_advanced_ex.cpp.html</example> <example>dnn_introduction2_ex.cpp.html</example>
<example>dnn_inception_ex.cpp.html</example> <example>dnn_inception_ex.cpp.html</example>
<example>dnn_imagenet_ex.cpp.html</example> <example>dnn_imagenet_ex.cpp.html</example>
<example>dnn_imagenet_train_ex.cpp.html</example>
</examples> </examples>
</component> </component>
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<item>find_max_bobyqa</item> <item>find_max_bobyqa</item>
<item>find_max_trust_region</item> <item>find_max_trust_region</item>
<item>find_min_trust_region</item> <item>find_min_trust_region</item>
<item>find_optimal_parameters</item>
</section> </section>
<section> <section>
...@@ -58,6 +59,7 @@ ...@@ -58,6 +59,7 @@
<item>find_max_factor_graph_potts</item> <item>find_max_factor_graph_potts</item>
<item>find_max_parse_cky</item> <item>find_max_parse_cky</item>
<item>min_cut</item> <item>min_cut</item>
<item>elastic_net</item>
</section> </section>
<section> <section>
...@@ -877,6 +879,65 @@ Or it can use the elastic net regularizer: ...@@ -877,6 +879,65 @@ Or it can use the elastic net regularizer:
</component> </component>
<!-- ************************************************************************* -->
<component cpp11="true">
<name>find_optimal_parameters</name>
<file>dlib/optimization/find_optimal_parameters.h</file>
<spec_file link="true">dlib/optimization/find_optimal_parameters_abstract.h</spec_file>
<description>
Performs a constrained minimization of a function and doesn't require derivatives from the user.
This function is similar to <a href="#find_min_bobyqa">find_min_bobyqa</a> and
<a href="#find_min_single_variable">find_min_single_variable</a> except that it
allows any number of variables and never throws exceptions when the max iteration
limit is reached (even if it didn't converge).
</description>
</component>
<!-- ************************************************************************* -->
<component cpp11="true">
<name>elastic_net</name>
<file>dlib/optimization/elastic_net.h</file>
<spec_file link="true">dlib/optimization/elastic_net_abstract.h</spec_file>
<description>
This object is a tool for solving the following optimization problem:
<pre>
min_w: length_squared(X*w - Y) + ridge_lambda*length_squared(w)
such that: sum(abs(w)) &lt;= lasso_budget
</pre>
<p>
That is, it solves the elastic net optimization problem. This object also
has the special property that you can quickly obtain different solutions
for different settings of ridge_lambda, lasso_budget, and target Y values.
</p>
<p>
This is because a large amount of work is precomputed in the constructor.
The solver will also remember the previous solution and will use that to
warm start subsequent invocations. Therefore, you can efficiently get
solutions for a wide range of regularization parameters.
</p>
The particular algorithm used to solve it is described in the paper:
<blockquote>
Zhou, Quan, et al. "A reduction of the elastic net to support vector
machines with an application to gpu computing." arXiv preprint
arXiv:1409.1976 (2014). APA
</blockquote>
And for the SVM solver sub-component we use the algorithm from:
<blockquote>
Hsieh, Cho-Jui, et al. "A dual coordinate descent method for large-scale
linear SVM." Proceedings of the 25th international conference on Machine
learning. ACM, 2008.
</blockquote>
</description>
</component>
<!-- ************************************************************************* --> <!-- ************************************************************************* -->
<component> <component>
......
...@@ -12,53 +12,61 @@ ...@@ -12,53 +12,61 @@
<current> <current>
New Features: New Features:
- Added random_color_transform and disturb_colors(). - A deep learning toolkit using CPU and/or GPU hardware. Some major elements
- Added a constructor for seeding rand with a time_t. of this are:
- Added apply_random_color_offset() - Clean and fully documented C++11 API
- Made load_image() support GIF files. - Clean tutorials: see dnn_introduction_ex.cpp and dnn_introduction2_ex.cpp
- Added subm_clipped() - Uses cuDNN v5.0
- load_mnist_dataset() - Multi-GPU support
- Added an option to solve the L2-loss version of the SVM objective function for svm_c_linear_dcd_trainer. - Automatic learning rate adjustment
- Added the option to use the elastic net regularizer to the OCA solver. - A pretrained 1000 class Imagenet classifier (see dnn_imagenet_ex.cpp)
- Added solve_qp_box_constrained() - Optimization Tools
- Added unserialize. - Added find_optimal_parameters()
- MATLAB binding stuff - Added elastic_net class
- link to MATLAB's intel MKL when used on linux - Added the option to use the elastic net regularizer to the OCA solver.
- struct support, more arguments (20 now instead of 10), - Added an option to solve the L2-loss version of the SVM objective function to svm_c_linear_dcd_trainer.
- in place operation. Made column major matrices directly wrap matlab - Added solve_qp_box_constrained()
- Image Processing
- Added random_color_transform, disturb_colors(), and apply_random_color_offset().
- load_image() now supports loading GIF files.
- Many improvements to the MATLAB binding API
- Automatically link to MATLAB's Intel MKL when used on linux.
- struct support
- mex functions can have up to 20 arguments instead of 10.
- In place operation. Made column major matrices directly wrap MATLAB
matrix objects when used inside mex files. This way, if you use matrix objects when used inside mex files. This way, if you use
matrix_colmajor or fmatrix_colmajor in a mex file it will not do any matrix_colmajor or fmatrix_colmajor in a mex file it will not do any
unnecessary copying or transposing. unnecessary copying or transposing.
- catch ctrl+c presses in MATLAB console. - Catch ctrl+c presses in MATLAB console. Allowing early termination of mex functions.
- DLIB_ASSERTS won't kill the matlab process, just throw an exception - When used inside mex files, DLIB_ASSERTS won't kill the MATLAB process,
- Made cerr print in matlab as a red warning message. just throw an exception.
- Made cerr print in MATLAB as a red warning message.
- load_mnist_dataset()
- C++11 only tools - Added a constructor for seeding rand with a time_t.
- Added log1pexp() - Added subm_clipped()
- Added running_gradient - Added unserialize.
- deep learning tools - Added running_gradient
- dnn_trainer
- cuDNN v4.0
- auto step size adjust and stopping condition.
- CUDA/tensor stuff
- gpu_data, tensor, alias tensors
Non-Backwards Compatible Changes: Non-Backwards Compatible Changes:
- Everything in dlib/matlab/call_matlab.h is now in the dlib namespace. - Everything in dlib/matlab/call_matlab.h is now in the dlib namespace.
- DLIB_TEST() and DLIB_TEST_MSG() macros now require you to terminate them with a ;
Bug fixes: Bug fixes:
- Fixed bug in 10 argument version of call_matlab() and also cleaned up a few - Fixed bug in 10 argument version of call_matlab() and also cleaned up a few
minor things. minor things.
- setup.py and cmake scripts work in a few more contexts. - setup.py and CMake scripts work in a few more contexts.
- Fixed compiler errors in visual studio 2015.
- Fixed a bug in gaussian_blur() that caused messed up outputs when big
Other: sigma values were used on some pixel types.
- Made cmake scripts uniformly require cmake version 2.8.4. - Fixed minor bugs in join_rows() and join_cols(). They didn't work when one
- C++11 of the matrices was empty.
- CMake scripts now enable C++11 by default
- Gave array2d and matrix move constructors and move assignment operators. Other:
- Made CMake scripts uniformly require CMake version 2.8.4.
- Faster fHOG feature extraction / face detection
- CMake scripts now enable C++11 by default
- Gave array2d and matrix move constructors and move assignment operators. Matrix
can also now be created from initializer lists.
</current> </current>
<!-- ************************************************************************************** --> <!-- ************************************************************************************** -->
......
...@@ -261,6 +261,8 @@ ...@@ -261,6 +261,8 @@
<term file="optimization.html" name="find_min_single_variable" include="dlib/optimization.h"/> <term file="optimization.html" name="find_min_single_variable" include="dlib/optimization.h"/>
<term file="optimization.html" name="find_min_using_approximate_derivatives" include="dlib/optimization.h"/> <term file="optimization.html" name="find_min_using_approximate_derivatives" include="dlib/optimization.h"/>
<term file="optimization.html" name="find_min_bobyqa" include="dlib/optimization.h"/> <term file="optimization.html" name="find_min_bobyqa" include="dlib/optimization.h"/>
<term file="optimization.html" name="find_optimal_parameters" include="dlib/optimization/find_optimal_parameters.h"/>
<term file="optimization.html" name="elastic_net" include="dlib/optimization/elastic_net.h"/>
<term file="optimization.html" name="solve_qp_box_constrained" include="dlib/optimization.h"/> <term file="optimization.html" name="solve_qp_box_constrained" include="dlib/optimization.h"/>
<term file="optimization.html" name="solve_qp_using_smo" include="dlib/optimization.h"/> <term file="optimization.html" name="solve_qp_using_smo" include="dlib/optimization.h"/>
<term file="optimization.html" name="solve_qp2_using_smo" include="dlib/optimization.h"/> <term file="optimization.html" name="solve_qp2_using_smo" include="dlib/optimization.h"/>
......
...@@ -76,12 +76,13 @@ bzip2 $WEBPAGE || report_failure ...@@ -76,12 +76,13 @@ bzip2 $WEBPAGE || report_failure
rm -rf $RELDIR rm -rf $RELDIR
wine ../docs/chm/htmlhelp/hhc.exe ../docs/chm/lib.hhp # Don't make the chm doc file since hhc.exe doesn't run in any copy of wine anymore :(
mv ../docs/chm/help.chm dlib_documentation-$RELEASE.chm || report_failure #wine ../docs/chm/htmlhelp/hhc.exe ../docs/chm/lib.hhp
#mv ../docs/chm/help.chm dlib_documentation-$RELEASE.chm || report_failure
mkdir v$RELEASE mkdir v$RELEASE
mv dlib_documentation-$RELEASE.chm v$RELEASE #mv dlib_documentation-$RELEASE.chm v$RELEASE
mv $SOURCE_TAR.bz2 v$RELEASE mv $SOURCE_TAR.bz2 v$RELEASE
mv $SOURCE_ZIP v$RELEASE mv $SOURCE_ZIP v$RELEASE
......
...@@ -31,10 +31,11 @@ ENDMACRO() ...@@ -31,10 +31,11 @@ ENDMACRO()
# The deep learning toolkit requires a C++11 capable compiler. # The deep learning toolkit requires a C++11 capable compiler.
if (COMPILER_CAN_DO_CPP_11) if (COMPILER_CAN_DO_CPP_11)
add_example(dnn_mnist_ex) add_example(dnn_introduction_ex)
add_example(dnn_mnist_advanced_ex) add_example(dnn_introduction2_ex)
add_example(dnn_inception_ex) add_example(dnn_inception_ex)
add_example(dnn_imagenet_ex) add_example(dnn_imagenet_ex)
add_example(dnn_imagenet_train_ex)
endif() endif()
#here we apply our macros #here we apply our macros
...@@ -121,12 +122,14 @@ add_example(video_tracking_ex) ...@@ -121,12 +122,14 @@ add_example(video_tracking_ex)
add_example(xml_parser_ex) add_example(xml_parser_ex)
find_package(OpenCV) find_package(OpenCV QUIET)
if (OpenCV_FOUND) if (OpenCV_FOUND)
include_directories(${OpenCV_INCLUDE_DIRS}) include_directories(${OpenCV_INCLUDE_DIRS})
ADD_EXECUTABLE(webcam_face_pose_ex webcam_face_pose_ex.cpp) ADD_EXECUTABLE(webcam_face_pose_ex webcam_face_pose_ex.cpp)
TARGET_LINK_LIBRARIES(webcam_face_pose_ex dlib ${OpenCV_LIBS} ) TARGET_LINK_LIBRARIES(webcam_face_pose_ex dlib ${OpenCV_LIBS} )
else()
message("OpenCV not found, so we won't build the webcam_face_pose_ex example.")
endif() endif()
......
// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt // The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
/* /*
This example shows how to classify an image into one of the 1000 imagenet clategories This example shows how to classify an image into one of the 1000 imagenet
using the deep learning tools from the dlib C++ Library. We will use the pretrained categories using the deep learning tools from the dlib C++ Library. We will
ResNet34 model available on the dlib website. use the pretrained ResNet34 model available on the dlib website.
The ResNet34 model is from Deep Residual Learning for Image Recognition by He, Zhang, The ResNet34 architecture is from the paper Deep Residual Learning for Image
Ren, and Sun. Recognition by He, Zhang, Ren, and Sun. The model file that comes with dlib
was trained using the dnn_imagenet_train_ex.cpp program on a Titan X for
about 2 weeks. This pretrained model has a top5 error of 7.572% on the 2012
imagenet validation dataset.
For an introduction to dlib's DNN module read the dnn_introduction_ex.cpp and
dnn_introduction2_ex.cpp example programs.
These tools will use CUDA and cuDNN to drastically accelerate network Finally, these tools will use CUDA and cuDNN to drastically accelerate
training and testing. CMake should automatically find them if they are network training and testing. CMake should automatically find them if they
installed and configure things appropriately. If not, the program will are installed and configure things appropriately. If not, the program will
still run but will be much slower to execute. still run but will be much slower to execute.
*/ */
...@@ -27,6 +33,7 @@ using namespace dlib; ...@@ -27,6 +33,7 @@ using namespace dlib;
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// This block of statements defines the resnet-34 network
template <template <int,template<typename>class,int,typename> class block, int N, template<typename>class BN, typename SUBNET> template <template <int,template<typename>class,int,typename> class block, int N, template<typename>class BN, typename SUBNET>
using residual = add_prev1<block<N,BN,1,tag1<SUBNET>>>; using residual = add_prev1<block<N,BN,1,tag1<SUBNET>>>;
...@@ -41,14 +48,14 @@ template <int N, typename SUBNET> using ares = relu<residual<block,N,affine ...@@ -41,14 +48,14 @@ template <int N, typename SUBNET> using ares = relu<residual<block,N,affine
template <int N, typename SUBNET> using ares_down = relu<residual_down<block,N,affine,SUBNET>>; template <int N, typename SUBNET> using ares_down = relu<residual_down<block,N,affine,SUBNET>>;
typedef loss_multiclass_log<fc<1000,avg_pool_everything< using anet_type = loss_multiclass_log<fc<1000,avg_pool_everything<
ares<512,ares<512,ares_down<512, ares<512,ares<512,ares_down<512,
ares<256,ares<256,ares<256,ares<256,ares<256,ares_down<256, ares<256,ares<256,ares<256,ares<256,ares<256,ares_down<256,
ares<128,ares<128,ares<128,ares_down<128, ares<128,ares<128,ares<128,ares_down<128,
ares<64,ares<64,ares<64, ares<64,ares<64,ares<64,
max_pool<3,3,2,2,relu<affine<con<64,7,7,2,2, max_pool<3,3,2,2,relu<affine<con<64,7,7,2,2,
input_rgb_image_sized<227> input_rgb_image_sized<227>
>>>>>>>>>>>>>>>>>>>>>>> anet_type; >>>>>>>>>>>>>>>>>>>>>>>;
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -101,14 +108,24 @@ void randomly_crop_images ( ...@@ -101,14 +108,24 @@ void randomly_crop_images (
int main(int argc, char** argv) try int main(int argc, char** argv) try
{ {
if (argc == 1)
{
cout << "Give this program image files as command line arguments.\n" << endl;
cout << "You will also need a copy of the file resnet34_1000_imagenet_classifier.dnn " << endl;
cout << "available at http://dlib.net/files/resnet34_1000_imagenet_classifier.dnn.bz2" << endl;
cout << endl;
return 1;
}
std::vector<string> labels; std::vector<string> labels;
anet_type net; anet_type net;
// Get this file from http://dlib.net/files/resnet34_1000_imagenet_classifier.dnn.bz2
// This pretrained model has a top5 error of 7.572% on the 2012 imagenet validation
// dataset.
deserialize("resnet34_1000_imagenet_classifier.dnn") >> net >> labels; deserialize("resnet34_1000_imagenet_classifier.dnn") >> net >> labels;
// Make a network with softmax as the final layer. We don't have to do this
// if we just want to output the single best prediction, since the anet_type
// already does this. But if we instead want to get the probability of each
// class as output we need to replace the last layer of the network with a
// softmax layer, which we do as follows:
softmax<anet_type::subnet_type> snet; softmax<anet_type::subnet_type> snet;
snet.subnet() = net.subnet(); snet.subnet() = net.subnet();
...@@ -118,16 +135,19 @@ int main(int argc, char** argv) try ...@@ -118,16 +135,19 @@ int main(int argc, char** argv) try
dlib::rand rnd; dlib::rand rnd;
image_window win; image_window win;
// read images from the command prompt and print the top 5 best labels. // Read images from the command prompt and print the top 5 best labels for each.
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
{ {
load_image(img, argv[i]); load_image(img, argv[i]);
const int num_crops = 16; const int num_crops = 16;
// Grab 16 random crops from the image. We will run all of them through the
// network and average the results.
randomly_crop_images(img, images, rnd, num_crops); randomly_crop_images(img, images, rnd, num_crops);
// p(i) == the probability the image contains object of class i.
matrix<float,1,1000> p = sum_rows(mat(snet(images.begin(), images.end())))/num_crops; matrix<float,1,1000> p = sum_rows(mat(snet(images.begin(), images.end())))/num_crops;
win.set_image(img); win.set_image(img);
// Print the 5 most probable labels
for (int k = 0; k < 5; ++k) for (int k = 0; k < 5; ++k)
{ {
unsigned long predicted_label = index_of_max(p); unsigned long predicted_label = index_of_max(p);
...@@ -135,6 +155,7 @@ int main(int argc, char** argv) try ...@@ -135,6 +155,7 @@ int main(int argc, char** argv) try
p(predicted_label) = 0; p(predicted_label) = 0;
} }
cout << "Hit enter to process the next image";
cin.get(); cin.get();
} }
......
This diff is collapsed.
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
/* /*
This is an example illustrating the use of the deep learning tools from the This is an example illustrating the use of the deep learning tools from the
dlib C++ Library. I'm assuming you have already read the introductory dlib C++ Library. I'm assuming you have already read the introductory
dnn_mnist_ex.cpp and dnn_mnist_advanced_ex.cpp examples. In this example we dnn_introduction_ex.cpp and dnn_introduction2_ex.cpp examples. In this
are going to show how to create inception networks. example we are going to show how to create inception networks.
An inception network is composed of inception blocks of the form: An inception network is composed of inception blocks of the form:
......
// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt // The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
/* /*
This is an example illustrating the use of the deep learning tools from the This is an example illustrating the use of the deep learning tools from the
dlib C++ Library. I'm assuming you have already read the dnn_mnist_ex.cpp dlib C++ Library. I'm assuming you have already read the dnn_introduction_ex.cpp
example. So in this example program I'm going to go over a number of more example. So in this example program I'm going to go over a number of more
advanced parts of the API, including: advanced parts of the API, including:
- Using multiple GPUs - Using multiple GPUs
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# tools. See train_shape_predictor.py to see an example. # tools. See train_shape_predictor.py to see an example.
# #
# You can get the shape_predictor_68_face_landmarks.dat file from: # You can get the shape_predictor_68_face_landmarks.dat file from:
# http://sourceforge.net/projects/dclib/files/dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2 # http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
# #
# COMPILING/INSTALLING THE DLIB PYTHON INTERFACE # COMPILING/INSTALLING THE DLIB PYTHON INTERFACE
# You can install dlib using the command: # You can install dlib using the command:
...@@ -56,7 +56,7 @@ if len(sys.argv) != 3: ...@@ -56,7 +56,7 @@ if len(sys.argv) != 3:
"execute this program by running:\n" "execute this program by running:\n"
" ./face_landmark_detection.py shape_predictor_68_face_landmarks.dat ../examples/faces\n" " ./face_landmark_detection.py shape_predictor_68_face_landmarks.dat ../examples/faces\n"
"You can download a trained facial shape predictor from:\n" "You can download a trained facial shape predictor from:\n"
" http://sourceforge.net/projects/dclib/files/dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2") " http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2")
exit() exit()
predictor_path = sys.argv[1] predictor_path = sys.argv[1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment