Commit Graph

7985 Commits

Author SHA1 Message Date
Davis King
ded68b9af7 Cleanup gcc version checking code a little.
Also fix this error from cmake 3.5.1:

```
CMake Error at CMakeLists.txt:62 (if):
  if given arguments:

    "CMAKE_COMPILER_IS_GNUCXX" "AND" "CMAKE_CXX_COMPILER_VERSION" "VERSION_LESS_EQUAL" "4.8.5"

  Unknown arguments specified
```
2021-04-28 08:05:22 -04:00
Adrià Arrufat
8e9755ab0f
do not attempt to build with gcc 4.8.5 or older (#2357)
* do not attempt to build with gcc 4.8.5 or older

* add comment
2021-04-27 07:03:32 -04:00
Davis King
9b502d29a4 Merge branch 'pfeatherstone-allocator_traits' 2021-04-24 10:16:44 -04:00
pfeatherstone
a051a65420 std_vector.h : making traits compatible with C++20 2021-04-24 10:16:26 -04:00
pfeatherstone
d6d1a9e879
[TYPE_SAFE_UNION] use std::aligned_union instead of stack_based_memory_block (#2349)
* [TYPE_SAFE_UNION] use std::aligned_union instead of stack_based_memory_block. std::aligned_union was specifically designed to do this kind of stuff and we are better off trusting the standard library deciding what the correct storage type should be and what the appropriate alignment should be

* [TYPE_SAFE_UNION] as per Davis' suggestion, std::aligned_union can take Len parameter 0. Also, the content's of validate_type() has been bugging me for ages, so i created is_any which is based on std::is_same. I've also replaced is_same_type with std::is_same

Co-authored-by: Peter Featherstone <peter@grampus-server.com>
2021-04-21 21:57:35 -04:00
chokomancarr
8d4df7c0b3
remove a unicode character (#2347) 2021-04-14 06:51:49 -04:00
Davis King
269a3ed1e6 fix incorrect docs about what gradient is computed 2021-04-13 23:00:44 -04:00
Adrià Arrufat
92106718bf
Make ELU an inplace layer and fix Clipped ReLU implementation (#2346)
* Make ELU an inplace layer

* Fix CUDA implementation of clipped_relu and update tests
2021-04-13 22:58:30 -04:00
Adrià Arrufat
7f53d7feb6
Make clipped-relu inplace and fix docs for elu (#2345) 2021-04-12 21:49:49 -04:00
Adrià Arrufat
1b7c7a6411
Add Clipped ReLU and ELU activations (#2285)
* wip: add apis for clipped_relu and elu, and layer implementation for clipped_relu

* add tensor_tools documentation

* add cpu implementations for new activations

* add elu layer

* use upperbound and lowerbound for clipped_relu

* fix clipped_relu gradient due to wrong variable naming

* fix elu_gradient due to wrong variable naming

* fix elu_gradient documentation

* add documentation

* WIP: add test_layer cases for clipped_relu and elu

For some reason that I can't see, ELU is failing...

* add clipped_relu and elu tests... cuda elu layer still does not work

* fix spacing

* add custom cuda implementation for elu_gradient (this one works)

* Revert "add custom cuda implementation for elu_gradient (this one works)"

This reverts commit 446dd80396.

* Revert "Revert "add custom cuda implementation for elu_gradient (this one works)""

This reverts commit 0b615f5008.

* add comment about custom elu gradient implementation

* add gradient tests, restore cudnn elu gradient

* re add custom elu gradient implementation

* update docs

* use own cuda implementation for clipped_relu and elu

Co-authored-by: Davis E. King <davis@dlib.net>
2021-04-12 07:59:06 -04:00
Adrià Arrufat
0ffe9c4c40
Fix input/output mappings with repeat layers (#2337)
* Fix input/output mappings with repeat layers

* add test for input/output tensor mappers

* fix output to input order
2021-04-04 13:31:08 -04:00
Adrià Arrufat
a4713b591f
Add letterbox image (#2335)
* Add letterbox image

* use && instead of and

* make function adhere to the generic image interface

* avoid extra copy

* add some overloads and a simple test

* add documentation

* use zero_border_pixels and remove superfluous temporary image

* allow different input and out images and update docs

* remove empty line

* be more explicit about output image size
2021-04-04 13:27:32 -04:00
Davis King
01e6fd51f9 Record last changeset and set PATCH version to 99 2021-03-28 09:22:07 -04:00
Davis King
70ea028f12 Created release v19.22 2021-03-28 09:17:49 -04:00
Davis King
f152a78a56 updated docs 2021-03-28 09:17:30 -04:00
Adrià Arrufat
a44ddd7452
Add matrix pointwise_pow (#2329) 2021-03-22 07:37:54 -04:00
Adrià Arrufat
092fa3037f
Add softmax function for matrix type (#2320)
* Add softmax function for matrix type

* make softmax inherit from basic_op_m

* fix comment

* add test for matrix softmax

* remove include

* take inspiration from op_normalize

* use multiplication instead of division

* fix typo in documentation
2021-03-07 22:59:53 -05:00
Davis King
3162f93c5d Revert "Add cmake back as a pip dependency."
This reverts commit 8b9d04390c.

Reverting this because the cmake pip pakage is still busted.  I've been
getting messages from many people about how it's breaking their
systems/installs.
2021-02-20 07:22:58 -05:00
Davis King
0697527acc fix invalid assert 2021-02-16 20:31:55 -05:00
Davis King
8b9d04390c Add cmake back as a pip dependency.
This dependency was explicitly removed two years ago because pip was
installing a broken cmake on some systems.  I'm adding the dependency
back in the hope that the pip copy of cmake has been fixed on all
systems by this point.
2021-02-15 19:57:57 -05:00
pfeatherstone
1b58bdc205
[SERIALIZATION] updated _abstract file (#2306)
Co-authored-by: pf <pf@pf-ubuntu-dev>
2021-02-12 23:42:47 -05:00
pfeatherstone
479b69e688
Serialization to and from vector<int8_t> and vector<uint8_t> (#2301)
* [SERIALIZATION]	- vectorstream can now be used with vector<int8_t> and vector<uint8_t>

* [SERIALIZATION]	- update proxy_serialize and proxy_deserialize to work with vector<int8_t> and vector<uint8_t>

* [SERIALIZATION]	- updated vectorstream tests

* [SERIALIZATION]	- updated serialize tests. check you can go to and from any of vector<char>, vector<int8_t> and vector<uint8_t>

* [SERIALIZATION]	- updated matrix tests. check you can go to and from any of vector<char>, vector<int8_t> and vector<uint8_t>

* [SERIALIZATION]	- updated dnn tests. check you can go to and from any of vector<char>, vector<int8_t> and vector<uint8_t>

* [SERIALIZATION] improved and possibly safer

* [SERIALIZATION] use placement new. best of all worlds i think. we have least object overhead. but code looks a tad uglier. oh well, user doesn't have to care

* [SERIALIZATION] i hope this is easier on the eyes.

Co-authored-by: pf <pf@pf-ubuntu-dev>
2021-02-11 22:13:05 -05:00
Adrià Arrufat
04a3534af1
fix set_learning_rate_multipliers_range not working (#2304)
* fix set_learning_rate_multipliers not working

* add tests for set_learning_rate_multipliers
2021-02-10 21:55:54 -05:00
Adrià Arrufat
42e6ace845
Minor fix in the network size format (#2303)
Since we are dividing by 1024, the unit should be MiB instead of MB.
I also added a space between the number and the unit
2021-02-09 08:07:24 -05:00
Davis King
9f6aefc0db Add missing .get_final_data_gradient() for repeat layer 2021-01-28 08:35:17 -05:00
pfeatherstone
1516cf31c3
[MATRIX] bug fix. If you #include <dlib/matrix.h> in a header file you might get a compiler error saying ambiguous call to max(). This commit fixes that. (#2287)
Co-authored-by: pf <pf@pf-ubuntu-dev>
2021-01-18 08:58:30 -05:00
Davis King
22007f6665 work around bug in visual studio 2021-01-18 08:56:34 -05:00
pfeatherstone
b8807922dd
FFT: added std::vector overloads for fft, ifft, fft_inplace and ifft_inplace (#2286)
* [FFT] added fft, ifft, fft_inplace and ifft_inplace overloads for std::vector

* [FFT] 	- static_assert T is a floating point type. There are static asserts in mkl_fft and kiss_fft, but it doesn't hurt adding them in the matrix API too so users get helpful warnings higher up in the API.

* [FFT] 	- added documentation for std::vector overloads in matrix_fft_abstract.h file

Co-authored-by: pf <pf@pf-ubuntu-dev>
2021-01-17 13:22:06 -05:00
Davis King
044ff91b79 I'm finding there are other issues with gcc 4.8 now and it's old enough that we can just drop support for gcc 4.8. 2021-01-17 13:18:15 -05:00
Robert Underwood
95271cfe43
Early termination for find_{min,max}_global (#2281)
* Early termination for find_{min,max}_global

This patch adds a callback to allow the user to request cancellation of a
search using find_{min,max}_global.  This enables users to cancel
searches when they are no-longer relevent, or when the user has some
special knowledge of the solution that they can use the stop the search
early.

closes  #2250

* Moved default stopping condition into find_max_global.h since that's the code it relates to and did some minor cleanup.

Co-authored-by: Davis King <davis@dlib.net>
2021-01-17 12:59:57 -05:00
Davis King
600e036552 work around bug in gcc 4.8 2021-01-16 10:13:52 -05:00
Davis King
869097c809 Make setup.py errors about cmake not being installed more readable 2021-01-16 10:13:19 -05:00
Davis King
df46c516b9 Greatly simplify how all the overloads of find_*_global() are setup.
This also makes it so the num and max_runtime arguments can now appear
in any order.

This does include a minor backwards compatibility break.  Which is
someone passing in initial function evaluations by directly supplying an
initializer list like {function_evaluation({1.1, 0.9}, rosen({1.1, 0.9}))} may have
to do std::vector<function_evaluation>{function_evaluation({1.1, 0.9},
rosen({1.1, 0.9}))} instead or make it a variable.  This is due to C++
not supporting direct use of initializer lists with variadic templates in this
context.  But in any case, I doubt many users do this and it is not hard
for those that do to update as described above.
2021-01-16 00:52:24 -05:00
Davis King
4c0b8b9690 Fix compiler warning 2021-01-16 00:41:30 -05:00
Robert Underwood
0871081a23
fix find_min_global finding wrong answers (#2284)
* fix find_min_global finding wrong answers

Previously, find_min_global would produce wrong output when passed
a collection of initial evaluations because the solver expected the
y-values to be multiplied by -1.  This fix does that when minimizing.

closes #2283

* fixed tabbing

Co-authored-by: Davis King <davis@dlib.net>
2021-01-14 22:05:15 -05:00
pkubaj
4a53742f8f
Fix build with clang on ppc64le (#2278)
* Fix build with clang on ppc64le

Clang doesn't implement vec_rsqrt. Code taken from https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/vsx_utils.hpp#L360

* Define vec_rsqrt only if we use VSX
2021-01-12 19:55:28 -05:00
Davis King
9e5c556740 Fix build errors in gcc 4.8 2021-01-06 07:48:16 -05:00
pfeatherstone
39eec294b0
Arbitrary sized FFTs using modified kissFFT as default backend and MKL otherwise (#2253)
* [FFT] added kissfft wrappers, moved kiss and mkl wrappers into separate files, call the right functions in matrix_fft.h

Co-authored-by: pf <pf@pf-ubuntu-dev>
Co-authored-by: Davis King <davis@dlib.net>
2021-01-05 22:19:05 -05:00
Adrià Arrufat
71dd9a6cd7
Remove GUI dependency from fonts (#2273)
* Remove GUI dependency from fonts

* use #ifndef

* Updated docs more

Co-authored-by: Davis King <davis@dlib.net>
2021-01-03 08:29:09 -05:00
Adrià Arrufat
187b73f7dc
Draw string on images (#2270)
* add function to draw string on images

* add documentation

* formatting

* add semicolon

* add test for draw_string on images
2020-12-30 12:28:53 -05:00
stoperro
74baff132a
Fixed CUDA 11.1 compilation. (#2271) 2020-12-28 10:37:17 -05:00
Davis King
20378b0819 make test run faster 2020-12-18 20:12:12 -05:00
Davis King
0fede57ed7 Make the mmod loss not spam messages in the unit tests 2020-12-16 20:37:22 -05:00
Davis King
c5c761b5ad Fix build error from ambiguous calls to call_if_valid() 2020-12-13 20:36:06 -05:00
Akshay Naresh Modi
286ca71e1a
Release GIL before detecting faces (#2252)
* Allow the face detector to be run concurrently.

* Use img_view instead of numpy_image

Co-authored-by: Akshay Modi <amodi@netflix.com>
2020-12-13 14:57:41 -05:00
Abdolkarim Saeedi
7b5b375026
Update dnn_inception_ex.cpp (#2256)
Simple typo in the inception training
2020-12-09 07:37:45 -05:00
yuriio
eb1f08ce6a
Removed redundant calls that сause compilation nodiscard warnings. (#2251) 2020-12-06 19:05:07 -05:00
Davis King
f42a6d23cc Some systems manage to install cuda in a way that causes cmake to claim
that cuda is available even though it knows it didn't find cublas, which
is part of the standard cuda install.  So we need to add a check to see
if cmake *really for realz* found cuda.
2020-12-04 14:18:21 -05:00
pfeatherstone
0ff61299b7
Adding exponential and weibull distributions (#2247)
* Added exponential distribution

* tab problem removed?

* forgot std::

* Also added Weibull distribution. Very useful indeed.

* Simple Weibull distribution unit test

* don't forget std::

* sorry, typo

* [RAND] 	- seed the random number generators for consistency and no nasty surprises
		- added parameter for tolerance
		- added unit test for exponential distribution

* [RAND] print the spinner more often

* [RAND] up the tolerance for kurtosis a bit

* [RAND] refactored parameters to reflect documentation on wikipedia.

* [RAND] added documentation to _abstract

* [RAND] i switched the order of the arguments to get_random_weibull and didn't update the unit tests. oops

Co-authored-by: pf <pf@pf-ubuntu-dev>
2020-12-03 22:05:39 -05:00
Davis King
e58da5135c minor cleanup 2020-11-29 14:53:08 -05:00