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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd6639aae7dbe444edd48de318840c7572f78e02
4
- data.tar.gz: 4062eebb691556a06ff1118e8f7f8d67a3c6ae75
3
+ metadata.gz: 28f85b804791454aa5a9e9f4bc8573f8af0c9da6
4
+ data.tar.gz: 0be4a7dfa32c83ea73640b483a2b0ecc5c45674c
5
5
  SHA512:
6
- metadata.gz: 081634764b995d7cbdad599705a39643603d69ea6d2da74bc2b24db1fd4e34103b56d49077ba7c93b627b8b77e114c055bcb5e220cdf58425400a909a6dc12b7
7
- data.tar.gz: 16d1b4afda5237f40234cdf609cc3da0b9cd87ff4bfb673d31749ed62d221e89876d73d4abf8635c1349a52e0abde2f5f92723fcfdc4934f46421326c248c6ee
6
+ metadata.gz: ce89bc27b7cf2b1e3cc3f94f0bbe37dddec6c99527d27dca67bb9bd5709340885838419f8d6e5bae100774e067ab453040ef966e5a2d7cb0dbd9500f1e8cbff6
7
+ data.tar.gz: 8dfa3750b3eef607aadfba745a6e8053864f10ce84563f47b3ff05ebd2bf2961875ec9e67fc374f061ca2ccc7990a6d7866dd35fdf49fc5188f8ab4d78ef9aec
data/Changes.md CHANGED
@@ -3,6 +3,12 @@
3
3
  At first, you can see original Release notes.
4
4
  http://dlib.net/release_notes.html
5
5
 
6
+ ## 1.1.4 (use dlib 19.4)
7
+
8
+ ### Bug fixes
9
+
10
+ * raise CudaError as ruby's Exception (Dlib::CudaError)
11
+
6
12
  ## 1.1.3 (use dlib 19.4)
7
13
 
8
14
  ### Bug fixes
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
 
@@ -6,7 +6,6 @@ static VALUE cDlibCuda;
6
6
 
7
7
  static VALUE eDlibCudaNotAvailableError;
8
8
 
9
-
10
9
  #define DLIB_RB_ASSERT_CUDA_AVILABILITY() \
11
10
  do { \
12
11
  VALUE ret = dlib_rb_cuda_check_availability(); \
@@ -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 \
@@ -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();
@@ -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
- dlib::deserialize(StringValueCStr(filename)) >> dnn_fdcont->net;
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(eDlibDNNFaceDetectorBadAllocationError, "Bad allocation memory while inferencing");
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);
@@ -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')
@@ -1,3 +1,3 @@
1
1
  module Dlib
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
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.3
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-09 00:00:00.000000000 Z
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.6
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.