Commit Graph

8135 Commits

Author SHA1 Message Date
Davis King
f932f33b10 Fix incorrect xml blocks for leaky_relu and smelu 2022-12-09 08:10:25 -05:00
mattbn
2efc172c46
removed extra '<' in fc, added '\n' in layers/inputs/losses XML strings (#2698) 2022-12-09 08:08:11 -05:00
Adria Arrufat
02330e0a15
Fix GitHub actions on Windows because of CMake 3.25.0 (#2692) 2022-11-28 20:10:47 -05:00
Julien Schueller
01c7bfe880
Fix build on ppc64/mips64 (#2689) 2022-11-27 22:25:22 -05:00
Davis E. King
4d38ffa082
Suppress incorrect warning from gcc (#2691) 2022-11-27 22:23:29 -05:00
Michał Walenciak
136b2d9e5c
Reset last cuda error (#2685)
as error is handled here (exception is being thrown), we do not
want cudaGetLastError() to return any errors.
2022-11-12 12:57:38 -05:00
Davis King
05d3f6eb17 Disable mac os x python test config since something in the environment is not working properly. 2022-11-09 22:11:57 -05:00
Adria Arrufat
e5b2cedff8
Improve the data augmentation in the SSL example (#2684)
I was using the data augmentation recommended for the ImageNet dataset, which is not well suited
for CIFAR-10.
After doing so, the test accuracy increased by 1 point.
2022-11-09 22:07:00 -05:00
Davis King
3d5fb6fc7f Add an informative comment 2022-11-08 21:50:19 -05:00
Adria Arrufat
bdb1089ae6
Fix computation of the Barlow Twins loss gradient (#2680) 2022-11-02 07:55:58 -04:00
Adria Arrufat
7f06f6e185
Fix empirical cross-correlation computation in the SSL example (#2679)
I was using the normalized features za as both matrices, instead of za and zb.
I noticed this because the empirical cross-correlation matrix was symmetrical,
which is not supposed to.  It does not affect anything, as it was computed
properly in the loss.
2022-10-31 19:52:24 -04:00
pfeatherstone
1bebccfb87
Type erasure tooling (#2666) 2022-10-08 21:36:54 -04:00
pfeatherstone
dd1ec1fcff
Miscellaneous cleanup and refresh (#2661)
* - moved for_each_in_tuple() to algs.h. Seems like a better place
- took the opportunity to deprecated the old type traits and make them aliases to things in the standard library

* - made bools() constexpr

* - removed ugly template recursion version of for_each_in_tuple(). Recursion is bad and is one of the reasons why buid times are so long.
- Use generic lambdas. Much better.

* - missing include

* - just make old deprecates stuff aliases to standard library things
- use switch_() for compile time branching. It's awesome. It means less code and less templates.

* - fixed make_compile_time_integer_range. Didn't realize it counted like Matlab. Very weird

* - nice example usage of switch_(). it will be trivially updated to if constexpr() in a couple years when dlib requires C++17

* - deduce return type
- use generic lambdas

* - for some reason these have to specify the return type. I don't understand. Will fix in a bit.

* - yet another template recursion removed. Better compile times in theory. Every little helps

* whoops

* use decay_t

* - type traits go in type_traits.h
- things found in <utility> go in utility.h
- algs.h doesn't contain any type traits. It just includes type_traits.h

* only need type_traits.h header

* use fold expressions if possible

* use is_any from type_traits.h

* - moved is_convertible to type_traits.h. Also make it an alias for std::is_convertible

* moved is_convertible

* use type traits in standard library

* - use standard library

* use standard library

* MSVC bug workaround

* missing dlib namespace

* fix typo

* - reverting back compile_time_integer_list and make_compile_time_integer_range

* - making sure nothing uses compile_time_integer_list or make_compile_time_integer_range

* - added pop_front for index_sequence
- making sure nothing uses compile_time_integer_list or make_compile_time_integer_range
- use auto

* - use integer_sequence

* - added docs for get_type_id(tag)

* - use __type_pack_element if available

* - hmm, reverting, some pre-processors break here. Don't know why.

Co-authored-by: pf <pf@me>
2022-09-19 08:18:39 -04:00
Davis King
20b6c17e7f fix typo in docs 2022-09-11 16:42:26 -04:00
kxc-waddlaw
90a8be6400
add missing palette_neon_intrinsics.c file (#2664) 2022-09-09 19:39:49 -04:00
Adrià Arrufat
19507d4a00
Modernize random_color_transform (#2665)
* Modernize random_color_transform

* Remove temporary variables

* formatting
2022-09-09 19:31:19 -04:00
Adrià Arrufat
e50987df4d
Fix visitor when tag layer is followed by skip layer (#2662) 2022-09-05 16:00:46 -04:00
Adrià Arrufat
65bce59a15
Update Pybind11 to v2.10.0 (#2660)
* Update Pybind11 to v2.10.0

* Update numpy_image to work with latest Pybind11

* I don't know why I have to do this now...

* Try to make macOS use Python3... Really?

* Try to make macOS use Python3... Again

* Try to make macOS use Python3... Once more

* Install dependencies with pip3
2022-09-05 15:59:19 -04:00
Davis King
efe46ce76a Add missing include 2022-09-01 08:52:55 -04:00
pfeatherstone
4db03ee6fd
if constexpr() for C++14 (#2654)
* - Use C++14 library stuff if possible

* Added a C++14 of if constexpr(). I think it's pretty great. Very similar to hana::if_

* - added some example usages

* - added is_detected
- added more tests

* - fix

* - fix

* - much better. thanks Davis

* - fix

* - fix

* - fix

* - Davis, I think you were wrong. Here, everything breaks without the _ function

* - Fixed but docs suck

* - use C++14 stuff

* - put function body after docs

* - docs maybe slightly better but still suck

* - badly placed brace

* - maybe slightly better English

* - better API i think

Co-authored-by: pf <pf@me>
2022-09-01 08:34:32 -04:00
Adrià Arrufat
902c70193a
Do the bias addition in the convolution in a separate call (#2656)
* Do the bias addition in the convolution in a separate call

Fixes #2655.
Somehow, doing it in a single call is slower.

* Grammar

* The change should be this, really
2022-09-01 07:39:19 -04:00
Adrià Arrufat
da2f45b2e5
Add test for libwebp at configure time (#2658) 2022-08-29 10:55:36 -04:00
Adrià Arrufat
9b8f5d88f8
Small YOLO loss improvements (#2653)
* Small YOLO loss improvements

* Refactor iou_anchor_threshold logic

* Simplify iou_anchor_threshold logic a bit more

* Be more robust in the iou_anchor_threshold check
2022-08-25 21:35:24 -04:00
Adrià Arrufat
bf273a8c2e
Add multiclass SVM trainer to svm/auto.h (#2642)
* Add multiclass SVM trainer to svm/auto.h

* Use a matrix<double> and add an overload for matrix<float>

* Replace typedef with using and use normalizer from normalized_function

* Remove extra ;

* use better names for decision function variables

* fix comments format and grammar

* remove unneeded includes

* Update dlib/svm/auto_abstract.h

* Update the assert to use 3 samples (as there is 3 fold CV)

* Remove unneeded captures in lambda

* Update dlib/svm/auto_abstract.h

* Update dlib/svm/auto_abstract.h

Co-authored-by: Davis E. King <davis685@gmail.com>
2022-08-17 19:29:04 -04:00
Adrià Arrufat
83ec371f12
Use only a fraction of labels for the multiclass SVM in SSL example (#2641)
* Use only a fraction of labels for the multiclass SVM in SSL example

This change makes the self-supervised example more close to reality:
usually, only a fraction of the dataset is labeled, but we can harness
the whole dataset by using a self-supervised method and then train the
classifier using the fraction of labeled data.

Using 10% of the labels results in a test accuracy of 87%, compared to
the 89% we got when training the multiclass SVM with all labels.

I just added an option to change the fraction of labeled data, so that
users can experiment with it.

* Update examples/dnn_self_supervised_learning_ex.cpp

Co-authored-by: Davis E. King <davis685@gmail.com>
2022-08-14 08:27:49 -04:00
pfeatherstone
a5fb8940be
- possible for fix for MSVC (#2637)
Co-authored-by: pf <pf@me>
2022-08-09 18:38:53 -04:00
pfeatherstone
e2f53a52e9
stft(), istft(), stftr() and istftr() (#2627)
* [MATH] beginnings of some special math stuff like bessel functions and so on. This will be useful for filter design and further down the line computing STFTs and who knows, maybe some DSP

* placeholder code

* copy pasted from libstdc++ pretty much

* [MATH] refactoring and unit tests

* [MATH] added constants

* [MATH] more tests

* Am i missing a namespace ? What the hell is gcc-11 complaining about

* - missing header for std::max (algorithm)
- bad brackets
- unambiguous call to cyl_bessel_(i/j)

* - added kaiser function

* - added kaiser function

* - inline

* - use dlib/numeric_constants.h
- made all the constants constexpr. Don't think it makes a difference but make things constexpr if you can
- added some decimals so it's consistent with what's in the standard library

* stripped boost

* float and double aren't constexpr-able

* - explicit implementation without frills. Not as accurate as libstdc++ or boost but much simpler, does the job and no license

* - use DLIB_ASSERT
- added documentation

* fix spelling

* - check template parameters are floating point
- added tests for kaiser using data generated from numpy

* - use strong types and function overloading

* - added more window functions

* - better docs
- don't need inline templates, just templates

* - added the Hann window. That's the default used for STFT in scipy and matlab

* - added window overloads for dlib::matrix

* - added kaiser overloads for dlib::matrix

* - suppress complaint about narrowing

* - unit tests for the matrix overloads

* - unit tests for the matrix overloads

* - you can now call windows using an enum

* - refactored Window to WindowType and Windowtype to WindowSymmetry to avoid conflicts with GUI library which also defines Window

* compute real values

* first draft at stft(), istft(), stftr() and istftr()

* Added tests for stft()

* more stft() tests

* fix mismatched signed-ness

* more tests

* - more checks
- docs

* - signed vs unsigned comparision warning

* - more tests

* - added more precision to the scipy generated data and lowered tol

* made docs a little bit more explicit

* removed new lines

* test all the windows

* reduced tol a bit

* - mods as per code review

* - mods as per code review

* - mods as per code review

* - tol is reduced

* - refactored WindowType to window_type
- added abstract file for windows

* Got rid of switch-wrapped window function

* Got rid of switch-wrapped window function

* Don't need matrix expressions for windows anymore

* Don't need matrix expressions for windows anymore

* Don't need matrix expressions for windows anymore

* Not using an enum to control the window type anymore.

* Not using an enum to control the window type anymore.

* Not using an enum to control the window type anymore.

* can't use a generic lambda in C++11

* reduced number of tests

* Don't needlessly convert float to double to float to double to float ... Added static assert in bessel functions. Use lambdas!

* If we're going to start using C++14, we don't need trailing return types. Just use auto. Much easier. Just let your IDE tell you want the return type is.

* Enable C++14. This is a basic change. I feel like all the cmake stuff in dlib needs to be updated to the v3 era.

* c++14 simplification

* trying another approach at enforcing C++14, and make sure dtest uses it

* keep windows happy

* trying to keep windows happy

* revert change

* Apply suggestions from code review

* - removed print statement

* - more accurate docs

* - don't use /*!!*/ for comments. That messes with dlib docgen
- more docs

* - better function names. Hopefully, it's clearer what they are doing

* Update dlib/matrix/matrix_fft_abstract.h

* Update dlib/matrix/matrix_fft_abstract.h

* Update dlib/matrix/matrix_fft_abstract.h

* Update dlib/matrix/matrix_fft_abstract.h

Co-authored-by: pfeatherstone <peter@me>
Co-authored-by: pf <pf@me>
Co-authored-by: Davis E. King <davis685@gmail.com>
2022-08-09 09:00:06 -04:00
Mohamed Isse
e2fa5f1e3a
Fix Cudnn test project bug (#2634) 2022-08-04 19:26:16 -04:00
Adrià Arrufat
69665eb0f7
Modernize rounding and cast statements (#2633)
* Use add_compile_definitions, enable -Wpedantic and use colors

* Use lround in rectangle and drectangle

* Use round in bigint

* Use round in canvas_drawing

* Modernize image_transforms

* Modernize image_pyramid

* Fix error in image_pyramid

* Modernize matrix

* Fix error in image_pyramid again

* Modernize fhog test

* Modernize image_keypoint/surf

* Remove extra ;
2022-08-04 18:36:12 -04:00
Davis King
89d573645b Only try to find iomp if we have really found the IntelMKL 2022-08-01 08:27:15 -04:00
Davis King
4867898c59 Make parallel_for_verbose() only print finish statement if it also printed something before then. 2022-08-01 07:56:06 -04:00
Davis King
4e9854204c Github actions deprecated windows-2016, switching to windows-2019 2022-07-31 17:45:46 -04:00
Davis King
29288e5d89 Make C++14 and CMake 3.8.0 the new minimum required versions 2022-07-31 17:45:18 -04:00
Davis King
4de26f1441 fix non-determinism in test due to reading uninitialized values. 2022-07-30 22:25:29 -04:00
Davis King
42a707d750 Make xml parser more robust to bad inputs 2022-07-30 09:09:35 -04:00
Adrià Arrufat
f81c4b2d00
YOLO improvements: Smoothed L1 loss, Focal Loss, Weighted Loss (#2628)
* Add some improvements to the YOLO loss layer

Notably:
- stabilized bounding box regression loss during training by smoothing the gradient
- added the possibility to compute the iou_anchor_threshod adaptively with ATSS
  (adaptive training sample selection)
- make use of the detection_confidence field in the truth box for class balanced loss
- added an optional gamma parameter to be able to use the focal loss in the classifier

* Added method to return a non-const reference to yolo_options

Also added the gamma_cls to loss_details operator<<

* Add focal gamma for objectness, too

* Fix yolo_options deserialization logic

* Remove non-const reference method to yolo_options

* use weight only for positive class, and be more consistent with floating types
2022-07-23 10:54:28 -04:00
pfeatherstone
6dfba4970d
Bug fix for fftr on matrix expression. Clearly nobody is doing FFTs with dlib as this bug has been lingering for a couple years now (#2626)
Co-authored-by: pf <pf@me>
2022-07-18 21:50:45 -04:00
Adrià Arrufat
ad06471a15
Fix typo in the self-supervised learning example (#2623) 2022-07-13 18:54:10 -04:00
Davis King
270b96c7d1 oops, add missing deps for some python tests 2022-07-12 21:18:04 -04:00
Davis King
71d95d76d9 more tweaks cleanup and fixes for ci builds 2022-07-12 20:40:11 -04:00
Davis King
c458c4f202 update how python tests are run on ubuntu and mac 2022-07-12 20:24:24 -04:00
Davis King
135e6ef06a try to fix windows ci testing 2022-07-12 20:07:50 -04:00
Davis King
a517aaa0bb remove broken python tests 2022-07-12 19:51:19 -04:00
Davis King
febac3adb2 Try to fix windows python tests 2022-07-12 19:35:07 -04:00
Davis King
20add2c88e removing travis configs since we haven't used travis in months 2022-07-12 19:01:46 -04:00
Adrià Arrufat
1066be80fd
Update libjpeg to version 9e (#2619)
* Update libjpeg to version 9e

Fixes #2618

* Comment out #define __inline__, which breaks Visual Studio
2022-07-11 08:28:06 -04:00
Adrià Arrufat
550a5744de
Use chrono in console progress indicator and add finish method (#2617)
* Use chrono in console progress indicator and add finish method

* Default print status to std::clog

* Print ellapsed time in parallel_for_verbose

* Fix typo

* Fix typo again

* Update release notes

* Fix spacing
2022-07-06 20:05:22 -04:00
pfeatherstone
3c73978de8
type_safe_union : visit() and apply_to_contents() performance improvements (#2615) 2022-07-02 20:43:00 -04:00
pfeatherstone
7c32e1c18e
fix spelling (#2614) 2022-06-28 06:55:34 -04:00
pfeatherstone
ec9a143e07
noexcept dlib::type_safe_union::swap() (#2604)
* [TYPE_SAFE_UNION] removed explicit swap(). let the compiler define swap from move semantics

* - added type traits:
    are_nothrow_move_construtible
    are_nothrow_move_assignable
    are_nothrow_copy_construtible
    are_nothrow_copy_assignable
- everything has (conditional) noexcept specifiers

* - formatting
- bug fix

* - added .swap() back in

* - type traits
- added .swap(item) and swap(a,b) back in, but with some cleanup and all the noexcept

* added docs for swap(a,b) back in

Co-authored-by: pfeatherstone <peter@me>
2022-06-27 08:05:50 -04:00