Commit Graph

7913 Commits

Author SHA1 Message Date
Adrià Arrufat
ded445f3bb rename 2021-01-19 21:29:15 +09:00
Adrià Arrufat
a027f0bd95 fix typo 2021-01-19 21:23:20 +09:00
Adrià Arrufat
f8409457ba add github actions from "ptheywood/cuda-cmake-github-actions" 2021-01-19 21:21:16 +09: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
Adrià Arrufat
d3b0213118
Add CIFAR-10 dataset loader (#2245)
* fix typos

* add cifar-10

* open files in binary mode

* print messages with file name only, like mnist loader

* some fixes

* add mnist.cpp to CMakeLists.txt

* fix test index

* do not use iterator in cast

* add cifar.cpp to all

* Add Davis' suggestions

* no need to use namespace std and clean up empty lines
2020-11-29 14:47:34 -05:00
pfeatherstone
d9e58d66cf
Fixes bug when (de)serializing vector<complex<float>> (#2244)
* [SERIALIZATION] fixed bug when (de)serializing vector<complex<float>>. DLIB_DEFINE... macro uses __out and __in variables names for ostream and istream objects respectively to avoid member variable name conflicts.

* Refactoring objects in DLIB_DEFINE_DEFAULT_SERIALIZATION to avoid name conflicts with user types

* Refactoring objects in DLIB_DEFINE_DEFAULT_SERIALIZATION to avoid name conflicts with user types

* removed tabs

* removed more tabs

Co-authored-by: pf <pf@pf-ubuntu-dev>
2020-11-24 22:09:38 -05:00
Adrià Arrufat
a7627cbd07
Rename function to disable_duplicative_biases (#2246)
* Rename function to disable_duplicative_biases

* rename also the functions in the tests... oops
2020-11-24 22:07:04 -05:00
Adrià Arrufat
b6bf8aefee
Add support for matrix serialization to python API (#2241)
* Add support for matrix serialization to python API

* add double to function names
2020-11-21 17:09:06 -05:00
Frankie Robertson
d7644ef2b7
Expose get_face_chip_details to Python (#2238) 2020-11-21 17:07:28 -05:00
Adrià Arrufat
96a75568be
fix unused parameter warning in visitor_net_to_xml (#2240) 2020-11-18 08:26:12 -05:00
Adrià Arrufat
820fd353d2
Make dnn_trainer print the minibatch size to ostream (#2236) 2020-11-16 22:17:29 -05:00
Adrià Arrufat
375f117222
Add custom ostream to console progress indicator (#2234) 2020-11-15 07:55:54 -05:00
Adrià Arrufat
2ef8e3ac14
Update to pybind11 v2.2.4 (closes #1806) (#2229)
* Update to  PyBind11 v2.2.4

* re-add custom changes

* fix indentation

* remove blank line
2020-11-12 22:39:15 -05:00
Davis King
93b992d790 slightly improve tests 2020-11-08 10:25:01 -05:00
Davis King
3f163bd433 Fix pixels being rounded to int values in some cases (#2228) 2020-11-08 10:22:40 -05:00
Adrià Arrufat
83921b390e
Remove an unused variable and old commented code (#2217) 2020-10-21 09:15:08 -04:00
Adrià Arrufat
3c82c2259c
Add Layer Normalization (#2213)
* wip: layer normalization on cpu

* wip: add cuda implementation, nor working yet

* wip: try to fix cuda implementation

* swap grid_strid_range and grid_strid_range_y: does not work yet

* fix CUDA implementation

* implement cuda gradient

* add documentation, move layer_norm, update bn_visitor

* add tests

* use stddev instead of variance in test (they are both 1, anyway)

* add test for means and invstds on CPU and CUDA

* rename visitor to disable_duplicative_bias

* handle more cases in the visitor_disable_input_bias

* Add tests for visitor_disable_input_bias
2020-10-20 07:56:55 -04:00
Adrià Arrufat
5074850356
fix backtracking when losses stay at inf (fixes #2206) (#2209)
* fix backtracking when losses stay at inf

* always backtrack when there is an inf value
2020-10-14 08:17:30 -04:00
Adrià Arrufat
a1f158379e
Do not use sqrt_2 in device code (fixes #2208) (#2210)
* do not use sqrt_2 in device code

* use CUDART_SQRT_2PI

* better sort includes
2020-10-10 08:42:10 -04:00
Adrià Arrufat
3ba004f875
Add GELU activation layer (#2204)
* Add GELU activation layer

* fix some copy-paste leftovers

* fix comment

* use exact faster implementation

* do not use cmath constants
2020-10-08 22:45:23 -04:00
Davis King
f4f8bff95e fix cmake not finding openblas 2020-10-08 22:34:03 -04:00
Adrià Arrufat
c45d166a25
Test cuda losses (#2199)
* add cuda test for loss_binary_log_per_pixel and some needed refactoring

* add cuda test for loss_multiclass_log_per_pixel

* forgot to add cpu version in loss

* remove a line I added by mistake

* fix typos

* declare label_to_ignore as static

* use tensor_index function instead of index method

* test cuda and cpu gradients values

* use DLIB_TEST instead of DLIB_CASSERT
2020-10-05 21:20:37 -04:00
Adrià Arrufat
d78d273a45
Add loss multiclass log per pixel weighted cuda (#2194)
* add cuda implementation for loss_multiclass_log_per_pixel_weighted

* add test for cuda and cpu implementations

* fix comment

* move weighted label to its own file

* Update path in doc

Co-authored-by: Davis E. King <davis685@gmail.com>
2020-09-30 08:04:28 -04:00
pfeatherstone
4125a7bb1f
DLIB (de)serialization : enhanced STL container support (#2185)
* [DLIB]  STL containers

* [DLIB]  STL containers

* [DLIB] applied code corrections suggested by code review

* [DLIB] applied code corrections suggested by code review

* [DLIB] applied code corrections suggested by code review
2020-09-25 08:27:30 -04:00
aviezab
5408b17f74
Linux Distro Detection to fix issue number #2159 #154 (#2169)
Check if the blas found by pkgconfig is valid before using it.
2020-09-25 07:48:48 -04:00
Davis King
0419b81689 Let python users give up to 35 parameters when using the global optimizer. 2020-09-25 07:41:57 -04:00