dlib 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changes.md +6 -0
- data/README.md +2 -1
- data/ext/dlib/cuda.inc +0 -1
- data/ext/dlib/depend +1 -1
- data/ext/dlib/dlib.cpp +4 -0
- data/ext/dlib/dnn_detector.inc +12 -6
- data/ext/dlib/extconf.rb +1 -1
- data/lib/dlib/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28f85b804791454aa5a9e9f4bc8573f8af0c9da6
|
4
|
+
data.tar.gz: 0be4a7dfa32c83ea73640b483a2b0ecc5c45674c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce89bc27b7cf2b1e3cc3f94f0bbe37dddec6c99527d27dca67bb9bd5709340885838419f8d6e5bae100774e067ab453040ef966e5a2d7cb0dbd9500f1e8cbff6
|
7
|
+
data.tar.gz: 8dfa3750b3eef607aadfba745a6e8053864f10ce84563f47b3ff05ebd2bf2961875ec9e67fc374f061ca2ccc7990a6d7866dd35fdf49fc5188f8ab4d78ef9aec
|
data/Changes.md
CHANGED
data/README.md
CHANGED
@@ -16,8 +16,9 @@ $ brew install jpeg libpng
|
|
16
16
|
$ apt-get install libjpeg8-dev libpng12-dev
|
17
17
|
```
|
18
18
|
|
19
|
-
**If you want to use DNN based face detector, you would have to install CUDA SDKs.**
|
19
|
+
**If you want to use DNN based face detector, you would have to install CUDA SDKs and cuDNN SDK.**
|
20
20
|
**Please read this page.** http://docs.nvidia.com/cuda/#axzz4anGdXQuB
|
21
|
+
**This gem try to use CUDA if /usr/local/cuda directory is exists.**
|
21
22
|
|
22
23
|
Add this line to your application's Gemfile:
|
23
24
|
|
data/ext/dlib/cuda.inc
CHANGED
data/ext/dlib/depend
CHANGED
@@ -13,7 +13,7 @@ NVCC_RESULT := $(shell which nvcc 2> NULL)
|
|
13
13
|
NVCC_TEST := $(notdir $(NVCC_RESULT))
|
14
14
|
ifeq ($(NVCC_TEST),nvcc)
|
15
15
|
CUDA_NVCC = nvcc
|
16
|
-
CUDA_FLAGS = $(CPPFLAGS) -I /usr/local/cuda/include -arch=sm_30 -D__STRICT_ANSI__ -D_MWAITXINTRIN_H_INCLUDED -D_FORCE_INLINES -std=c++11 -Xcompiler -fPIC
|
16
|
+
CUDA_FLAGS = $(CPPFLAGS) -I /usr/local/cuda/include -arch=sm_30 -D__STRICT_ANSI__ -D_MWAITXINTRIN_H_INCLUDED -D_FORCE_INLINES -std=c++11 -Xcompiler -fPIC -Xcompiler -funwind-tables
|
17
17
|
DLIB_CUDA_SRCS = $(DLIB_SRCDIR)/dlib/dnn/curand_dlibapi.cpp \
|
18
18
|
$(DLIB_SRCDIR)/dlib/dnn/cudnn_dlibapi.cpp \
|
19
19
|
$(DLIB_SRCDIR)/dlib/dnn/cublas_dlibapi.cpp \
|
data/ext/dlib/dlib.cpp
CHANGED
@@ -11,6 +11,8 @@ static VALUE mDlib;
|
|
11
11
|
|
12
12
|
static VALUE eDlibError;
|
13
13
|
|
14
|
+
static VALUE eDlibCudaError;
|
15
|
+
|
14
16
|
#include "geometry.inc"
|
15
17
|
|
16
18
|
#include "image.inc"
|
@@ -32,6 +34,8 @@ Init_dlib(void)
|
|
32
34
|
|
33
35
|
eDlibError = rb_define_class_under(mDlib, "Error", rb_eStandardError);
|
34
36
|
|
37
|
+
eDlibCudaError = rb_define_class_under(mDlib, "CudaError", eDlibError);
|
38
|
+
|
35
39
|
Init_dlib_geometry();
|
36
40
|
Init_dlib_image();
|
37
41
|
Init_dlib_detector();
|
data/ext/dlib/dnn_detector.inc
CHANGED
@@ -19,8 +19,6 @@ using net_type = loss_mmod<con<1,9,9,1,1,rcon5<rcon5<rcon5<downsampler<input_rgb
|
|
19
19
|
|
20
20
|
static VALUE cDlibDNNFaceDetector;
|
21
21
|
|
22
|
-
static VALUE eDlibDNNFaceDetectorBadAllocationError;
|
23
|
-
|
24
22
|
struct dnn_fd_container {
|
25
23
|
net_type net;
|
26
24
|
};
|
@@ -71,7 +69,15 @@ static VALUE
|
|
71
69
|
dlib_rb_dnn_fd_initialize(VALUE dnn_fd, VALUE filename)
|
72
70
|
{
|
73
71
|
dnn_fd_container *dnn_fdcont = dlib_rb_dnn_fd_get_dnn_fd_container(dnn_fd);
|
74
|
-
|
72
|
+
|
73
|
+
try {
|
74
|
+
dlib::deserialize(StringValueCStr(filename)) >> dnn_fdcont->net;
|
75
|
+
} catch (dlib::cuda_error& error) {
|
76
|
+
rb_raise(eDlibCudaError, "cuda error during loading model: %s", error.info.c_str());
|
77
|
+
} catch (std::bad_alloc& error) {
|
78
|
+
rb_raise(rb_eNoMemError, "bad allocation memory during loading model");
|
79
|
+
}
|
80
|
+
|
75
81
|
return dnn_fd;
|
76
82
|
}
|
77
83
|
|
@@ -93,8 +99,10 @@ dlib_rb_dnn_fd_detect_in_batches(VALUE dnn_fd, VALUE images)
|
|
93
99
|
std::vector<std::vector<dlib::mmod_rect>> detections_in_batches;
|
94
100
|
try {
|
95
101
|
detections_in_batches = dnn_fdcont->net(matrixes);
|
102
|
+
} catch (dlib::cuda_error& error) {
|
103
|
+
rb_raise(eDlibCudaError, "cuda error during inferencing: %s", error.info.c_str());
|
96
104
|
} catch (std::bad_alloc& error) {
|
97
|
-
rb_raise(
|
105
|
+
rb_raise(rb_eNoMemError, "bad allocation memory during inferencing");
|
98
106
|
}
|
99
107
|
|
100
108
|
VALUE result_all = rb_ary_new_capa(detections_in_batches.size());
|
@@ -143,8 +151,6 @@ Init_dlib_dnn_detector()
|
|
143
151
|
{
|
144
152
|
cDlibDNNFaceDetector = rb_define_class_under(mDlib, "DNNFaceDetector", rb_cData);
|
145
153
|
|
146
|
-
eDlibDNNFaceDetectorBadAllocationError = rb_define_class_under(cDlibDNNFaceDetector, "BadAllocationError", eDlibError);
|
147
|
-
|
148
154
|
rb_define_alloc_func(cDlibDNNFaceDetector, dlib_rb_dnn_fd_alloc);
|
149
155
|
|
150
156
|
rb_define_method(cDlibDNNFaceDetector, "initialize", RUBY_METHOD_FUNC(dlib_rb_dnn_fd_initialize), 1);
|
data/ext/dlib/extconf.rb
CHANGED
@@ -20,7 +20,7 @@ $defs << '-DDLIB_NO_GUI_SUPPORT'
|
|
20
20
|
$defs << '-DNO_DEBUG'
|
21
21
|
$defs << '-O3'
|
22
22
|
$CPPFLAGS << " -I#{DLIB_SRCDIR}"
|
23
|
-
$CXXFLAGS << " -std=c++11"
|
23
|
+
$CXXFLAGS << " -std=c++11 -funwind-tables"
|
24
24
|
$ARCH_FLAG = '-march=native'
|
25
25
|
|
26
26
|
use_cuda = File.exist?('/usr/local/cuda/lib64/libcudart.so')
|
data/lib/dlib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Murata
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-03-
|
12
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -3556,7 +3556,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
3556
3556
|
version: '0'
|
3557
3557
|
requirements: []
|
3558
3558
|
rubyforge_project:
|
3559
|
-
rubygems_version: 2.4.
|
3559
|
+
rubygems_version: 2.4.5.1
|
3560
3560
|
signing_key:
|
3561
3561
|
specification_version: 4
|
3562
3562
|
summary: Ruby bindings of dlib C++ library.
|