Commit Graph

8119 Commits

Author SHA1 Message Date
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
Crayon 6c24e65f86
Fix typos (#2606) 2022-06-17 22:19:11 -04:00
Adrià Arrufat 7f46535cce
Fix potential memory leak when writing WebP throws (#2600) 2022-06-14 07:59:38 -04:00
Davis King 0f1d8e964f Fix assert having wrong condition 2022-06-06 22:01:59 -04:00
Adrià Arrufat 1de7924694
Fix saving grayscale WebP images (#2591) 2022-05-29 10:53:01 -04:00
Davis King c9a25fda0a update docs 2022-05-08 10:53:24 -04:00
Davis King 842931975e Record last changeset and set PATCH version to 99 2022-05-08 10:35:36 -04:00
Davis King 6097093ab3 Created release v19.24 2022-05-08 10:30:31 -04:00
Davis King 76a9a10736 update docs 2022-05-08 10:28:58 -04:00
Davis King aff6bc4402 make sphinx doc building work on newer versions of ubuntu 2022-05-08 10:08:55 -04:00
Adrià Arrufat 06b826540c
Add SiLU activation layer (#2584) 2022-05-08 09:28:47 -04:00
Davis King 8af4226057 Revert "Add a test on github actions that builds on windows in debug mode"
This reverts commit 7009080014.
2022-04-29 22:51:01 -04:00
Davis King 7009080014 Add a test on github actions that builds on windows in debug mode 2022-04-29 22:04:37 -04:00
Adrià Arrufat 9db84f4c24
Build ancillary tools on Windows (#2583)
* Build ancillary tools on Windows

* Fix dtoc name
2022-04-29 21:49:57 -04:00
Davis E. King 4d92c302c0
Remove this test on windows for now since it runs out of ram 2022-04-29 09:43:50 -04:00
Davis King 2bcb1c4436 See if using only one thread to build prevents running out of ram on github actions when building windows examples 2022-04-29 08:39:53 -04:00
Adrià Arrufat 8ceb91fb44
Do not build WebP features if WebP is not available (#2582) 2022-04-29 08:38:21 -04:00