Commit Graph

1729 Commits

Author SHA1 Message Date
Tomoaki Teshima
ecb6bcf2e0 fix build error on Visual Studio 2012
* round doesn't exists in standard library of Visual Studio 2012
  * apply the correct computation of ROI
2017-12-13 17:40:07 +03:00
Vitaly Tuzov
51cb56ef2c Implementation of bit-exact resize. Internal calls to linear resize updated to use bit-exact version. (#9468) 2017-12-13 15:00:38 +03:00
Alexander Alekhin
eff42f6387 dnn: more debug info 2017-12-12 12:04:10 +03:00
Vadim Pisarevsky
7e680bd9ff Merge pull request #10215 from dkurt:dnn_js 2017-12-11 12:47:52 +00:00
Vadim Pisarevsky
c24f10d647 Merge pull request #10268 from dkurt:fix_scale_layer 2017-12-08 18:46:50 +00:00
Dmitry Kurtaev
f503515082 JavaScript bindings for dnn module 2017-12-08 18:33:48 +03:00
Dmitry Kurtaev
e307065c8e Scale layer in case of 2D inputs 2017-12-08 17:34:59 +03:00
Alexander Alekhin
f2070c9f5d Merge pull request #10255 from dkurt:dnn_roi_pooling 2017-12-08 11:20:07 +00:00
Dmitry Kurtaev
17dcf0e82d ROIPooling layer 2017-12-07 19:04:38 +03:00
Dmitry Kurtaev
ef0650179b Fix conv/deconv/fc layers FLOPS computation 2017-12-07 11:42:04 +03:00
Alexander Alekhin
6074f92d48 Merge pull request #10228 from pengli:dnn_new 2017-12-06 15:50:12 +00:00
Alexander Alekhin
0b688cd23f Merge pull request #10240 from alalek:dnn_perf_ssd 2017-12-06 15:41:18 +00:00
Li Peng
59cbaca4d3 detection_output layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2017-12-06 22:35:59 +08:00
Li Peng
66feea6cac region layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2017-12-07 02:26:46 +08:00
Li Peng
7707c9bfba reorg layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2017-12-07 02:26:46 +08:00
Li Peng
85b1c4060c support axis in concat layer ocl path
Signed-off-by: Li Peng <peng.li@intel.com>
2017-12-07 02:26:46 +08:00
Li Peng
07bec6bdcd reshape layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2017-12-07 02:26:40 +08:00
Alexander Alekhin
d8a737b4b0 dnn: SSD performance test 2017-12-06 15:55:18 +03:00
Li Peng
7b7033ac60 permute layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2017-12-05 22:10:05 +08:00
Dmitry Kurtaev
bbbec300a6 nn.BatchNormalization and nn.Dropout layers from Torch 2017-12-04 12:57:21 +03:00
Alexander Alekhin
cc2ee923e4 Merge pull request #10164 from pengli:dnn 2017-11-29 12:05:10 +00:00
Wu Zhiwen
1f465a0ef9 dnn(ocl4dnn): fuseLayer() use umat_input/outputBlobs for OpenCL target
Also, fix bug when use OPENCL target but no OpenCL runtime

Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
2017-11-27 22:25:53 +08:00
Li Peng
a47fbd2610 Add ocl accuracy test for a few dnn nets
They are alexnet, mobilenet-ssd, resnet50, squeezeNet_v1_1,
yolo and fast_neural_style.

Signed-off-by: Li Peng <peng.li@intel.com>
2017-11-27 23:33:21 +08:00
Dmitry Kurtaev
99ed085752 Update PriorBox layer 2017-11-27 16:47:20 +03:00
Alexander Alekhin
13f374660f dnn(ocl4dnn): drop unused batch_size_ in pooling 2017-11-23 20:46:56 +00:00
Alexander Alekhin
e34b64c979 dnn(ocl4dnn): refactor pooling OpenCL calls 2017-11-23 20:46:44 +00:00
Alexander Alekhin
f071a48ec7 Merge pull request #10143 from pengli:ocl4dnn 2017-11-23 18:47:14 +00:00
Alexander Alekhin
107582c767 Merge pull request #9996 from dkurt:dnn_multiple_inputs 2017-11-23 18:22:37 +00:00
Li Peng
636d6368ee use OutputArrayOfArrays in net forward interface
It allows umat buffers used in net forward interface

Signed-off-by: Li Peng <peng.li@intel.com>
2017-11-24 02:19:10 +08:00
Wu, Zhiwen
04edc8fe3a cleanup ocl4dnn spatial convolution kernels
remove unused macros and half definition macros,
also remove unused ocl::Queue

Signed-off-by: Li Peng <peng.li@intel.com>
2017-11-24 02:19:10 +08:00
Alexander Alekhin
49a5280198 Merge pull request #10139 from alalek:dnn_rename_caffe_proto_package 2017-11-23 14:10:42 +00:00
Alexander Alekhin
f37f4cf3b4 Merge pull request #9994 from r2d3:dnn_memory_load 2017-11-22 18:15:00 +00:00
Alexander Alekhin
e7d62d6ef3 Merge pull request #10126 from alalek:dnn_issue_10125 2017-11-22 18:03:51 +00:00
Alexander Alekhin
b29893b938 dnn: autogenerated files 2017-11-22 18:34:07 +03:00
Alexander Alekhin
1c88a566e0 dnn: rename caffe protobuf package 2017-11-22 18:34:07 +03:00
Alexander Alekhin
9db5cbf9a4 dnn: sync output/internals blobs back 2017-11-22 14:00:58 +03:00
Vadim Pisarevsky
f8ad289311 Merge pull request #10092 from alalek:dnn_rename_caffe_proto 2017-11-22 08:16:20 +00:00
Alexander Alekhin
0f34628af7 dnn: drop OpenCL code path for DetectionOutputLayer
getUMat()/getMat() calls are scope based. Results of these calls can't be
stored somewhere for future usage.
2017-11-21 17:28:42 +03:00
Alexander Alekhin
438e456ce9 Merge pull request #10113 from wzw-intel:fusion 2017-11-20 18:13:33 +00:00
Alexander Alekhin
f19f2bbcde dnn: autogenerated files
rename caffe.proto => opencv-caffe.proto
2017-11-20 19:04:02 +03:00
Alexander Alekhin
f6d927ef3b dnn: avoid conflicts with original caffe.proto
rename caffe.proto => opencv-caffe.proto
2017-11-20 19:04:00 +03:00
David Geldreich
f723cede2e add loading TensorFlow/Caffe net from memory buffer
add a corresponding test
2017-11-20 16:28:22 +01:00
Dmitry Kurtaev
6c5dd5cf6d Replace caffe::NormalizedBBox to local structure 2017-11-20 18:03:31 +03:00
Wu Zhiwen
45d11dde57 dnn(ocl4dnn): add fusion support for Power activation and eltwise add
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
2017-11-20 14:58:53 +08:00
Wu Zhiwen
394101d6ed dnn(ocl4dnn): Fix relu fusion bug
Incorrect type of negative_slope result in this bug.

Also and OCL test for darknet to validate this patch.

Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
2017-11-17 16:21:56 +08:00
Jcrist99
0608227e10 Merge pull request #9698 from abratchik:parse.doxygen
Support @deprecated tag in java wrappers (#9698)
2017-11-16 16:48:12 +03:00
Wu Zhiwen
88e6daa315 dnn(ocl4dnn): Fix wrong measurement for tuning time
convolution kernel use default queue to run, so that ocl::Timer
, to measure the kernel run time, should use the default queue too.
Also remove useless parameter for convolve()

Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
2017-11-16 13:09:57 +08:00
Li Peng
55260a8d3c reshape mat before doing computation in fc layer
Signed-off-by: Li Peng <peng.li@intel.com>
2017-11-13 09:29:50 +08:00
Alexander Alekhin
bafdc44d37 Merge pull request #10061 from Sahloul:dnn_torch_fix 2017-11-10 05:05:52 +00:00
Alexander Alekhin
8a3a75cc16 Merge pull request #9882 from pengli:ocl4dnn 2017-11-09 18:54:43 +00:00
Hamdi Sahloul
06bda58a2c DNN Torch - workaround when torch importer is disabled 2017-11-10 00:44:06 +09:00
Li Peng
8f99083726 Add new layer forward interface
Add layer forward interface with InputArrayOfArrays and
OutputArrayOfArrays parameters, it allows UMat buffer to be
processed and transferred in the layers.

Signed-off-by: Li Peng <peng.li@intel.com>
2017-11-09 15:59:39 +08:00
Alexander Alekhin
97181a90ba dnn(ocl4dnn/conv): bailout on missing kernel configuration 2017-11-07 17:02:17 +03:00
Alexander Alekhin
6e4f9433d0 Merge pull request #9998 from alalek:ocl_fix_dnn_softmax_9991 2017-11-03 09:16:39 +00:00
Dmitry Kurtaev
20a2dc6ac5 Fix multiple inputs models from Caffe.
Fixed Concat optimization.
2017-11-02 18:55:08 +03:00
Alexander Alekhin
bacc96f4e8 dnn(ocl): fix softmax global/local size consistency 2017-11-02 17:08:40 +03:00
Dmitry Kurtaev
14af2a0c0c Fixed Halide's copy_to_device invocation 2017-11-01 14:01:54 +03:00
Vadim Pisarevsky
bc348eb8ab Merge pull request #9963 from dkurt:fix_caffe_shrinker 2017-10-31 12:27:19 +00:00
Dmitry Kurtaev
e1ebc4e991 Specify layer types for Caffe FP32->FP16 weights converter 2017-10-31 12:31:40 +03:00
Dmitry Kurtaev
03cefa7bfe Set zero confidences in case of no detections 2017-10-30 10:17:57 +03:00
Vadim Pisarevsky
e0e40405ed Merge pull request #9847 from wzw-intel:ocl4dnn_fusion 2017-10-27 13:59:46 +00:00
Vadim Pisarevsky
ff037ebe5f Merge pull request #9845 from dkurt:fast_neural_style_models 2017-10-27 13:59:02 +00:00
Vadim Pisarevsky
5384d2f090 Merge pull request #9880 from dkurt:caffe_ceil_mode 2017-10-27 11:51:46 +00:00
Dmitry Kurtaev
4b52b8df34 Layers for fast-neural-style models: https://github.com/jcjohnson/fast-neural-style 2017-10-27 14:26:45 +03:00
Vadim Pisarevsky
bc93775385 Merge pull request #9862 from sovrasov:dnn_nms 2017-10-27 11:19:57 +00:00
Vadim Pisarevsky
825c0ffdb4 Merge pull request #9874 from dkurt:fix_identity_permute_layer 2017-10-27 11:11:48 +00:00
Vadim Pisarevsky
69f2590359 Merge pull request #9921 from dkurt:fix_prelu_after_fully_connected 2017-10-27 11:10:59 +00:00
Vadim Pisarevsky
7b8fb64f21 Merge pull request #9939 from alalek:fix_dnn_getUMat_crash 2017-10-27 11:06:22 +00:00
Vladislav Sovrasov
5bf39ceb5d dnn: handle 4-channel images in blobFromImage (#9944) 2017-10-27 14:06:53 +03:00
Alexander Alekhin
436a1f72a5 dnn: fix sporadic crashes in getUMat()
Incorrect "total" buffer size calculated in StdMatAllocator::allocate() due wrong step values.
2017-10-25 18:07:05 +03:00
Vladislav Sovrasov
7e3e9144de dnn: add an accuracy test for NMS 2017-10-25 13:40:56 +03:00
Vladislav Sovrasov
c704942b8a dnn: add a documentation for NMS, fix missing experimantal namespace 2017-10-25 13:35:49 +03:00
Vladislav Sovrasov
acedb4a579 dnn: make NMS function public 2017-10-25 13:35:49 +03:00
Alexander Alekhin
a871f9e4f7 Merge branch 'update_version' into release 2017-10-23 18:41:12 +03:00
Dmitry Kurtaev
a36ebaecdc PReLU layer for multidimensional input 2017-10-23 16:13:03 +03:00
Dmitry Kurtaev
410d44d67d Binary data for batch normalization test from Torch 2017-10-20 12:01:42 +03:00
Alexander Alekhin
185faf99bd ocl: simplify ocl::Timer interface 2017-10-18 16:01:21 +03:00
Dmitry Kurtaev
b903ff8992 Ceil mode from experimental version of Caffe, https://github.com/BVLC/caffe/pull/3057 2017-10-18 14:04:53 +03:00
Dmitry Kurtaev
a3a446c197 Output blobs shapes initialization in case of identity permutation (NCHW->NCHW) 2017-10-17 17:15:25 +03:00
Alexander Alekhin
110af09bf9 Merge pull request #9853 from catree:fix_dnn_samples_python3 2017-10-16 16:18:22 +00:00
Wu Zhiwen
2d8f2c2aea dnn(ocl4dnn): add fusion support
ocl4dnn supports following fusion styles:
Conv + [BN] + [Scale] + [ReLU/PReLU]

Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
2017-10-16 19:18:36 +08:00
Maksim Shabunin
b066dd36ff Fixed uninitialized class fields 2017-10-16 13:47:43 +03:00
catree
22dece8146 Fix DNN samples for compatibility with Python 3.
Add PyInt_Check in pyopencv_dnn.hpp.
2017-10-15 20:24:56 +02:00
Igor Wodiany
e2499e5b2f
Move vector_size_t and vector_vector_Mat
These two typdefs are not compiled when BUILD_opencv_dnn is set to
false, however there are other modules that uses these typedef so
it may cause build errors. Moving typedef to the python module
ensures they are always defined.
2017-10-14 19:06:15 +01:00
Alexander Alekhin
4857cae6ed dnn: don't use "experimental_dnn_v1" namespace directly 2017-10-12 18:16:53 +03:00
Alexander Alekhin
df5b2224d7 Merge pull request #9829 from pengli:ocl4dnn 2017-10-12 11:26:20 +00:00
Li Peng
937b8e4277 dnn(ocl4dnn): support log softmax in ocl4dnn
Signed-off-by: Li Peng <peng.li@intel.com>
2017-10-12 09:51:13 +08:00
Vadim Pisarevsky
e356ca2369 Merge pull request #9835 from sovrasov:blob_from_img_crop_opt 2017-10-11 17:18:40 +00:00
Vadim Pisarevsky
8b168175ec Merge pull request #9636 from dkurt:duplicate_lp_norm_layer 2017-10-11 13:36:14 +00:00
Vadim Pisarevsky
0873ebb9b0 Merge pull request #9820 from sovrasov:text_detector_dnn 2017-10-11 13:31:46 +00:00
Vadim Pisarevsky
babd21c764 Merge pull request #9823 from alalek:dnn_halide_bypass_tbb_threads 2017-10-11 13:28:38 +00:00
Vladislav Sovrasov
47e1133e71 dnn: add crop flag to blobFromImage 2017-10-11 15:46:20 +03:00
Vladislav Sovrasov
f7175f5050 dnn: fix additional text boxes handling after the latest adaptations for TF 2017-10-11 14:04:48 +03:00
Vladislav Sovrasov
050916fd6b dnn: modify priorBox layer 2017-10-11 11:43:50 +03:00
Dmitry Kurtaev
905a9dada2 Removed LPNormalize layer. 2017-10-10 20:38:55 +03:00
Alexander Alekhin
3935e13603 dnn(halide): don't compile Halide via parallel_for_()
To avoid problem with reduced stack size of inner threads.
2017-10-10 18:06:03 +03:00
Vadim Pisarevsky
b7ff9ddcdd Merge pull request #9705 from AlexeyAB:dnn_darknet_yolo_v2 2017-10-10 12:02:03 +00:00
Vadim Pisarevsky
046045239c Merge pull request #9750 from dkurt:feature_dnn_tf_text_graph 2017-10-10 10:06:24 +00:00
Alexander Alekhin
949ec486c5 experimental version++ 2017-10-10 12:29:57 +03:00
AlexeyAB
ecc34dc521 Added DNN Darknet Yolo v2 for object detection 2017-10-09 21:08:44 +03:00
Dmitry Kurtaev
eabf728682 PReLU layer from Caffe 2017-10-09 20:30:37 +03:00
Vadim Pisarevsky
fee87ea3f7 Merge pull request #9800 from alalek:fix_build_msvs2010 2017-10-09 12:33:08 +00:00
Vadim Pisarevsky
6a80834ed4 Merge pull request #9803 from wzw-intel:ocl_timer 2017-10-09 12:11:22 +00:00
Maksim Shabunin
5a22d81fe5 Fixed warnings produced by static analyzer 2017-10-09 13:37:18 +03:00
Wu Zhiwen
dbe9ee0924 ocl: simplify ocl::Timer
Use clFinish to gurantee commands completed, instead of waiting for events.

Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
2017-10-09 13:48:38 +08:00
Alexander Alekhin
e615fafe2d build: fix MSVS2010 2017-10-08 23:32:22 +03:00
Dmitry Kurtaev
e4aa39f9e5 Text TensorFlow graphs parsing. MobileNet-SSD for 90 classes. 2017-10-08 22:25:29 +03:00
Vadim Pisarevsky
21bd834a59 Merge pull request #9772 from dkurt:fix_caffe_eltwise_and_fc_layers 2017-10-06 13:47:54 +00:00
Vadim Pisarevsky
b969d86415 Merge pull request #9787 from dkurt:feature_dnn_resize_nearest_neighbor 2017-10-06 13:46:50 +00:00
Vadim Pisarevsky
fe58b58937 Merge pull request #9778 from dkurt:dnn_colorization 2017-10-06 11:48:05 +00:00
Dmitry Kurtaev
b9f94c9315 Nearest neighbor resize layer 2017-10-06 14:33:26 +03:00
Dmitry Kurtaev
e268606e26 Grayscale colorization model (https://github.com/richzhang/colorization) test. 2017-10-06 09:33:41 +03:00
Dmitry Kurtaev
ad8bbaf008 Multidimensional eltwise layer.
Fixed fully-connected layer axis.
2017-10-04 14:01:44 +03:00
Dmitry Kurtaev
2a21c10837 Fix TensorFlow split layer 2017-10-02 22:44:42 +03:00
pengli
e340ff9c3a Merge pull request #9114 from pengli:dnn_rebase
add libdnn acceleration to dnn module  (#9114)

* import libdnn code

Signed-off-by: Li Peng <peng.li@intel.com>

* add convolution layer ocl acceleration

Signed-off-by: Li Peng <peng.li@intel.com>

* add pooling layer ocl acceleration

Signed-off-by: Li Peng <peng.li@intel.com>

* add softmax layer ocl acceleration

Signed-off-by: Li Peng <peng.li@intel.com>

* add lrn layer ocl acceleration

Signed-off-by: Li Peng <peng.li@intel.com>

* add innerproduct layer ocl acceleration

Signed-off-by: Li Peng <peng.li@intel.com>

* add HAVE_OPENCL macro

Signed-off-by: Li Peng <peng.li@intel.com>

* fix for convolution ocl

Signed-off-by: Li Peng <peng.li@intel.com>

* enable getUMat() for multi-dimension Mat

Signed-off-by: Li Peng <peng.li@intel.com>

* use getUMat for ocl acceleration

Signed-off-by: Li Peng <peng.li@intel.com>

* use CV_OCL_RUN macro

Signed-off-by: Li Peng <peng.li@intel.com>

* set OPENCL target when it is available

and disable fuseLayer for OCL target for the time being

Signed-off-by: Li Peng <peng.li@intel.com>

* fix innerproduct accuracy test

Signed-off-by: Li Peng <peng.li@intel.com>

* remove trailing space

Signed-off-by: Li Peng <peng.li@intel.com>

* Fixed tensorflow demo bug.

Root cause is that tensorflow has different algorithm with libdnn
to calculate convolution output dimension.

libdnn don't calculate output dimension anymore and just use one
passed in by config.

* split gemm ocl file

split it into gemm_buffer.cl and gemm_image.cl

Signed-off-by: Li Peng <peng.li@intel.com>

* Fix compile failure

Signed-off-by: Li Peng <peng.li@intel.com>

* check env flag for auto tuning

Signed-off-by: Li Peng <peng.li@intel.com>

* switch to new ocl kernels for softmax layer

Signed-off-by: Li Peng <peng.li@intel.com>

* update softmax layer

on some platform subgroup extension may not work well,
fallback to non subgroup ocl acceleration.

Signed-off-by: Li Peng <peng.li@intel.com>

* fallback to cpu path for fc layer with multi output

Signed-off-by: Li Peng <peng.li@intel.com>

* update output message

Signed-off-by: Li Peng <peng.li@intel.com>

* update fully connected layer

fallback to gemm API if libdnn return false

Signed-off-by: Li Peng <peng.li@intel.com>

* Add ReLU OCL implementation

* disable layer fusion for now

Signed-off-by: Li Peng <peng.li@intel.com>

* Add OCL implementation for concat layer

Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>

* libdnn: update license and copyrights

Also refine libdnn coding style

Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
Signed-off-by: Li Peng <peng.li@intel.com>

* DNN: Don't link OpenCL library explicitly

* DNN: Make default preferableTarget to DNN_TARGET_CPU

User should set it to DNN_TARGET_OPENCL explicitly if want to
use OpenCL acceleration.

Also don't fusion when using DNN_TARGET_OPENCL

* DNN: refine coding style

* Add getOpenCLErrorString

* DNN: Use int32_t/uint32_t instread of alias

* Use namespace ocl4dnn to include libdnn things

* remove extra copyTo in softmax ocl path

Signed-off-by: Li Peng <peng.li@intel.com>

* update ReLU layer ocl path

Signed-off-by: Li Peng <peng.li@intel.com>

* Add prefer target property for layer class

It is used to indicate the target for layer forwarding,
either the default CPU target or OCL target.

Signed-off-by: Li Peng <peng.li@intel.com>

* Add cl_event based timer for cv::ocl

* Rename libdnn to ocl4dnn

Signed-off-by: Li Peng <peng.li@intel.com>
Signed-off-by: wzw <zhiwen.wu@intel.com>

* use UMat for ocl4dnn internal buffer

Remove allocateMemory which use clCreateBuffer directly

Signed-off-by: Li Peng <peng.li@intel.com>
Signed-off-by: wzw <zhiwen.wu@intel.com>

* enable buffer gemm in ocl4dnn innerproduct

Signed-off-by: Li Peng <peng.li@intel.com>

* replace int_tp globally for ocl4dnn kernels.

Signed-off-by: wzw <zhiwen.wu@intel.com>
Signed-off-by: Li Peng <peng.li@intel.com>

* create UMat for layer params

Signed-off-by: Li Peng <peng.li@intel.com>

* update sign ocl kernel

Signed-off-by: Li Peng <peng.li@intel.com>

* update image based gemm of inner product layer

Signed-off-by: Li Peng <peng.li@intel.com>

* remove buffer gemm of inner product layer

call cv::gemm API instead

Signed-off-by: Li Peng <peng.li@intel.com>

* change ocl4dnn forward parameter to UMat

Signed-off-by: Li Peng <peng.li@intel.com>

* Refine auto-tuning mechanism.

- Use OPENCV_OCL4DNN_KERNEL_CONFIG_PATH to set cache directory
  for fine-tuned kernel configuration.
  e.g. export OPENCV_OCL4DNN_KERNEL_CONFIG_PATH=/home/tmp,
  the cache directory will be /home/tmp/spatialkernels/ on Linux.

- Define environment OPENCV_OCL4DNN_ENABLE_AUTO_TUNING to enable
  auto-tuning.

- OPENCV_OPENCL_ENABLE_PROFILING is only used to enable profiling
  for OpenCL command queue. This fix basic kernel get wrong running
  time, i.e. 0ms.

- If creating cache directory failed, disable auto-tuning.

* Detect and create cache dir on windows

Signed-off-by: Li Peng <peng.li@intel.com>

* Refine gemm like convolution kernel.

Signed-off-by: Li Peng <peng.li@intel.com>

* Fix redundant swizzleWeights calling when use cached kernel config.

* Fix "out of resource" bug when auto-tuning too many kernels.

* replace cl_mem with UMat in ocl4dnnConvSpatial class

* OCL4DNN: reduce the tuning kernel candidate.

This patch could reduce 75% of the tuning candidates with less
than 2% performance impact for the final result.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>

* replace cl_mem with umat in ocl4dnn convolution

Signed-off-by: Li Peng <peng.li@intel.com>

* remove weight_image_ of ocl4dnn inner product

Actually it is unused in the computation

Signed-off-by: Li Peng <peng.li@intel.com>

* Various fixes for ocl4dnn

1. OCL_PERFORMANCE_CHECK(ocl::Device::getDefault().isIntel())
2. Ptr<OCL4DNNInnerProduct<float> > innerProductOp
3. Code comments cleanup
4. ignore check on OCL cpu device

Signed-off-by: Li Peng <peng.li@intel.com>

* add build option for log softmax

Signed-off-by: Li Peng <peng.li@intel.com>

* remove unused ocl kernels in ocl4dnn

Signed-off-by: Li Peng <peng.li@intel.com>

* replace ocl4dnnSet with opencv setTo

Signed-off-by: Li Peng <peng.li@intel.com>

* replace ALIGN with cv::alignSize

Signed-off-by: Li Peng <peng.li@intel.com>

* check kernel build options

Signed-off-by: Li Peng <peng.li@intel.com>

* Handle program compilation fail properly.

* Use std::numeric_limits<float>::infinity() for large float number

* check ocl4dnn kernel compilation result

Signed-off-by: Li Peng <peng.li@intel.com>

* remove unused ctx_id

Signed-off-by: Li Peng <peng.li@intel.com>

* change clEnqueueNDRangeKernel to kernel.run()

Signed-off-by: Li Peng <peng.li@intel.com>

* change cl_mem to UMat in image based gemm

Signed-off-by: Li Peng <peng.li@intel.com>

* check intel subgroup support for lrn and pooling layer

Signed-off-by: Li Peng <peng.li@intel.com>

* Fix convolution bug if group is greater than 1

Signed-off-by: Li Peng <peng.li@intel.com>

* Set default layer preferableTarget to be DNN_TARGET_CPU

Signed-off-by: Li Peng <peng.li@intel.com>

* Add ocl perf test for convolution

Signed-off-by: Li Peng <peng.li@intel.com>

* Add more ocl accuracy test

Signed-off-by: Li Peng <peng.li@intel.com>

* replace cl_image with ocl::Image2D

Signed-off-by: Li Peng <peng.li@intel.com>

* Fix build failure in elementwise layer

Signed-off-by: Li Peng <peng.li@intel.com>

* use getUMat() to get blob data

Signed-off-by: Li Peng <peng.li@intel.com>

* replace cl_mem handle with ocl::KernelArg

Signed-off-by: Li Peng <peng.li@intel.com>

* dnn(build): don't use C++11, OPENCL_LIBRARIES fix

* dnn(ocl4dnn): remove unused OpenCL kernels

* dnn(ocl4dnn): extract OpenCL code into .cl files

* dnn(ocl4dnn): refine auto-tuning

Defaultly disable auto-tuning, set OPENCV_OCL4DNN_ENABLE_AUTO_TUNING
environment variable to enable it.

Use a set of pre-tuned configs as default config if auto-tuning is disabled.
These configs are tuned for Intel GPU with 48/72 EUs, and for googlenet,
AlexNet, ResNet-50

If default config is not suitable, use the first available kernel config
from the candidates. Candidate priority from high to low is gemm like kernel,
IDLF kernel, basick kernel.

* dnn(ocl4dnn): pooling doesn't use OpenCL subgroups

* dnn(ocl4dnn): fix perf test

OpenCV has default 3sec time limit for each performance test.
Warmup OpenCL backend outside of perf measurement loop.

* use ocl::KernelArg as much as possible

Signed-off-by: Li Peng <peng.li@intel.com>

* dnn(ocl4dnn): fix bias bug for gemm like kernel

* dnn(ocl4dnn): wrap cl_mem into UMat

Signed-off-by: Li Peng <peng.li@intel.com>

* dnn(ocl4dnn): Refine signature of kernel config

- Use more readable string as signture of kernel config
- Don't count device name and vendor in signature string
- Default kernel configurations are tuned for Intel GPU with
  24/48/72 EUs, and for googlenet, AlexNet, ResNet-50 net model.

* dnn(ocl4dnn): swap width/height in configuration

* dnn(ocl4dnn): enable configs for Intel OpenCL runtime only

* core: make configuration helper functions accessible from non-core modules

* dnn(ocl4dnn): update kernel auto-tuning behavior

Avoid unwanted creation of directories

* dnn(ocl4dnn): simplify kernel to workaround OpenCL compiler crash

* dnn(ocl4dnn): remove redundant code

* dnn(ocl4dnn): Add more clear message for simd size dismatch.

* dnn(ocl4dnn): add const to const argument

Signed-off-by: Li Peng <peng.li@intel.com>

* dnn(ocl4dnn): force compiler use a specific SIMD size for IDLF kernel

* dnn(ocl4dnn): drop unused tuneLocalSize()

* dnn(ocl4dnn): specify OpenCL queue for Timer and convolve() method

* dnn(ocl4dnn): sanitize file names used for cache

* dnn(perf): enable Network tests with OpenCL

* dnn(ocl4dnn/conv): drop computeGlobalSize()

* dnn(ocl4dnn/conv): drop unused fields

* dnn(ocl4dnn/conv): simplify ctor

* dnn(ocl4dnn/conv): refactor kernelConfig localSize=NULL

* dnn(ocl4dnn/conv): drop unsupported double / untested half types

* dnn(ocl4dnn/conv): drop unused variable

* dnn(ocl4dnn/conv): alignSize/divUp

* dnn(ocl4dnn/conv): use enum values

* dnn(ocl4dnn): drop unused innerproduct variable

Signed-off-by: Li Peng <peng.li@intel.com>

* dnn(ocl4dnn): add an generic function to check cl option support

* dnn(ocl4dnn): run softmax subgroup version kernel first

Signed-off-by: Li Peng <peng.li@intel.com>
2017-10-02 15:38:00 +03:00
Vadim Pisarevsky
5e93c82023 Merge pull request #9491 from dkurt:tf_lstm 2017-09-28 21:04:06 +00:00
Vadim Pisarevsky
22467599c4 Merge pull request #9692 from alalek:dnn_perf_net 2017-09-28 13:44:24 +00:00
Vadim Pisarevsky
68cc2e292d Merge pull request #9734 from dkurt:fix_deconv_layer_kernel_layout 2017-09-28 11:42:57 +00:00
Vadim Pisarevsky
45365e4df1 Merge pull request #9691 from dkurt:padding_layer_refactoring 2017-09-28 11:34:28 +00:00
Dmitry Kurtaev
6e593cd1f0 Swap dimensions of deconvolution kernel 2017-09-27 22:38:34 +03:00
Alexander Alekhin
3dee92ec50 fix usage of CV_FMA3 macro 2017-09-26 17:23:54 +03:00
Dmitry Kurtaev
84cec17913 LSTM layer for TensorFlow importer 2017-09-26 12:59:36 +03:00
Alexander Alekhin
aea25e7f90 Merge pull request #9676 from jrobble:fix_caffe_swaprb 2017-09-25 16:05:11 +00:00
Alexander Alekhin
78788e1efb dnn(perf): update perf tests 2017-09-25 15:32:37 +03:00
jrobble
c67ad49378 Set swapRB to false in Caffe tests and examples. 2017-09-22 09:58:48 -04:00
Dmitry Kurtaev
222149b9c6 Refactored Padding layer 2017-09-22 12:39:00 +03:00
Dmitry Kurtaev
17a85b16fc Remove reorder_dims attribute of Reshape layer 2017-09-21 16:42:03 +03:00
Dmitry Kurtaev
bdd8cc697a Import wrapped Dropout subgraphs from TensorFlow 2017-09-20 13:30:25 +03:00
Alexander Alekhin
6a5298a532 Merge pull request #9664 from tomoaki0705:fixBuildVS2013 2017-09-19 12:25:18 +00:00
Tomoaki Teshima
48c4bea57c fix build on Visual Studio 2013 and earlier 2017-09-19 19:08:23 +09:00
Vadim Pisarevsky
f7df5dd32c Merge pull request #9305 from dkurt:public_dnn_importer_is_deprecated 2017-09-18 09:35:35 +00:00
Vadim Pisarevsky
e012ccda4a Merge pull request #9517 from dkurt:tf_mobilenet 2017-09-18 09:31:19 +00:00
Vadim Pisarevsky
3358b8910b Merge pull request #9591 from dkurt:feature_dnn_caffe_importer_fp16 2017-09-18 09:26:23 +00:00
Dmitry Kurtaev
bd8e6b7e14 Make external cv::dnn::Importer usage is deprecated 2017-09-18 08:52:36 +03:00
Vadim Pisarevsky
4196543cd5 Merge pull request #9313 from dkurt:dnn_perf_test 2017-09-16 19:39:23 +00:00
Dmitry Kurtaev
d891e9b1d8 Layers for MobileNet from TensorFlow 2017-09-15 20:17:30 +03:00
Dmitry Kurtaev
8646d5fb84 FP16 Caffe models import and export 2017-09-15 18:06:34 +03:00
Vadim Pisarevsky
6bf8fe815d Merge pull request #9384 from dkurt:torch_split 2017-09-15 13:05:05 +00:00
Vadim Pisarevsky
a391871cce Merge pull request #9301 from dkurt:dnn_npy 2017-09-15 12:42:02 +00:00
Vadim Pisarevsky
41b23fde9f Merge pull request #9524 from dkurt:dnn_torch_openface 2017-09-15 12:38:12 +00:00
Vadim Pisarevsky
cb0d695984 Merge pull request #9616 from dkurt:feature_dnn_tf_importer_atrous_conv 2017-09-15 10:24:05 +00:00
Dmitry Kurtaev
0ce7c33bc8 Torch's Concat and ConcatTable doesn't use Split layer 2017-09-14 09:26:57 +03:00
Dmitry Kurtaev
7dc6b1d7d4 Layers for OpenFace face recognition network 2017-09-14 09:11:31 +03:00
Dmitry Kurtaev
58b890b9f7 Dilated convolution import from TensorFlow 2017-09-13 18:44:14 +03:00
Dmitry Kurtaev
6639348c5e Disable SSD on CPU Halide test 2017-09-13 18:19:54 +03:00
Vadim Pisarevsky
8c7f19850f Merge pull request #9576 from dkurt:feature_dnn_tf_importer_fp16 2017-09-13 13:57:38 +00:00
Vadim Pisarevsky
93c3f20deb Merge pull request #9569 from dkurt:test_dnn_ssd_halide 2017-09-13 13:29:50 +00:00
Dmitry Kurtaev
ce41a15437 Import and convert FP16 weights from TensorFlow 2017-09-12 09:50:55 +03:00
Maksim Shabunin
248e2c7d47 Fixed some issues found by static analysis 2017-09-08 12:22:12 +03:00
Dmitry Kurtaev
cad7c4d51d MobileNet-SSD and VGG-SSD topologies in Halide 2017-09-08 09:55:53 +03:00
Alexander Alekhin
01519313d7 dnn: invalid bindings 2017-08-31 19:35:48 +03:00
Dmitry Kurtaev
5c43a394c5 Added performance test for Caffe framework 2017-08-27 19:40:58 +03:00
Alexander Alekhin
3202bbe17c Merge pull request #9349 from dkurt:tf_deconv 2017-08-24 15:58:38 +00:00
Alexander Alekhin
8e7e24ac80 Merge pull request #9394 from dkurt:fix_halide_wrapper 2017-08-24 15:56:54 +00:00
Alexander Alekhin
25a4559565 Merge pull request #9294 from arrybn:layers_perf 2017-08-24 09:37:49 +00:00
Aleksandr Rybnikov
8b1146deb2 Added function to get timings for layers 2017-08-23 13:40:05 +03:00
Dmitry Kurtaev
e74c475162 Removed 3rdparty serialized NumPy arrays parser 2017-08-22 18:14:32 +03:00
Dmitry Kurtaev
54f0616a13 Deconvolution layer from TensorFlow 2017-08-21 21:38:07 +03:00
Dmitry Kurtaev
4e28c00e7b Fix Halide buffer behavior in case of OpenCL device memory allocation 2017-08-17 13:27:54 +03:00
dkurt
339793143c Unit tests for TensorFlow importer 2017-08-03 11:29:48 +03:00
Alexander Alekhin
0bd357e7ec Merge pull request #9296 from dkurt:halide_device_interface 2017-08-02 20:26:30 +00:00
dkurt
b1ef44b1ac Replace halide_opencl_device_interface 2017-08-02 20:38:30 +03:00
Aleksandr Rybnikov
8d6b8b45b6 Added ELU and test for it 2017-08-02 11:13:59 +03:00
Alexander Alekhin
bab4bc0968 Merge pull request #9284 from ipuustin:dnn-opencl-fixes 2017-08-01 13:06:01 +00:00
Ismo Puustinen
c2de5cf735 dnn: force floating point literals to be float.
In OpenCL code in activations.cl, make the type of floating point
literals to be float. Otherwise the values will be interpreted as
doubles, causing Beignet to have type conversion issues.
2017-08-01 15:02:24 +03:00
Alexander Alekhin
2959e7aba9 Merge pull request #9188 from arrybn:mobilenet_ssd_sample 2017-08-01 11:12:54 +00:00
Aleksandr Rybnikov
ce1cc352d9 MobileNet SSD sample 2017-08-01 12:30:27 +03:00
Alexander Alekhin
cbced23de4 cmake: don't include protobuf on disabled DNN module 2017-07-31 14:18:59 +03:00
Alexander Alekhin
34f9c039c5 Merge pull request #9238 from alalek:valgrind_fixes 2017-07-27 14:33:01 +00:00
Alexander Alekhin
06407b4d14 Merge pull request #9233 from LaurentBerger:dnndoc 2017-07-26 16:25:28 +00:00
Alexander Alekhin
3f102e5d3a dnn: protobuf shutdown 2017-07-26 17:21:46 +03:00
LaurentBerger
69fd57bc96 update tutorial link for dnn 2017-07-25 19:32:17 +02:00
Alexander Alekhin
878a6906cc dnn: fix torch importer memory leaks 2017-07-25 12:20:55 +03:00
dkurt
70ff3804e9 Fix SqueezeNet Halide performance test 2017-07-24 10:45:04 +03:00
Tomoaki Teshima
0f91faddae fix linker error when trying CPU_BASELINE=AVX 2017-07-21 21:13:47 +09:00
Alexander Alekhin
ce6b06efb9 Merge pull request #9203 from tomoaki0705:eliminateRandFromTest 2017-07-20 15:31:41 +00:00
Alexander Alekhin
ab58cac236 Merge pull request #9194 from tomoaki0705:fixBuildErrorDnn 2017-07-20 15:27:07 +00:00
Tomoaki Teshima
e63d628677 remove some rand functions
* make test more reproducible
2017-07-20 22:43:11 +09:00
Alexander Alekhin
08c94aa5c0 build: reuse int32_t workaround from softfloat.hpp 2017-07-20 14:01:21 +03:00
Tomoaki Teshima
1989bc33a7 fix build error on Visual Studio 2012 2017-07-20 11:00:04 +09:00
Aleksandr Rybnikov
7d1140340e Rewrote googlenet tests 2017-07-18 18:49:14 +03:00
Alexander Alekhin
dc59476c34 Merge pull request #9078 from arrybn:resnet_squeezenet_tests
Added tests for ResNet-50 and SqueezeNet v1.1
2017-07-14 16:50:25 +00:00
Vadim Pisarevsky
0488d9bdb2 optimize out scaleLayer & concatLayer whenever possible
fixed problem in concat layer by disabling memory re-use in layers with multiple inputs

trying to fix the tests when Halide is used to run deep nets

another attempt to fix Halide tests

see if the Halide tests will pass with concat layer fusion turned off

trying to fix failures in halide tests; another try

one more experiment to make halide_concat & halide_enet tests pass

continue attempts to fix halide tests

moving on

uncomment parallel concat layer

seemingly fixed failures in Halide tests and re-enabled concat layer fusion; thanks to dkurt for the patch
2017-07-14 18:30:53 +03:00
Alexander Alekhin
4784c7be5f dnn: cleanup dispatched code, fix SIMD128 types 2017-07-13 19:00:34 +03:00
Alexander Alekhin
c3e6de293f dnn: code cleanup, refactor detection output layer 2017-07-13 19:00:34 +03:00
Alexander Alekhin
544908d06c dnn: some minor fixes in docs, indentation, unused code 2017-07-13 15:33:49 +03:00
Alexander Alekhin
520da7aaaf Merge pull request #9111 from vpisarev:dnn_optim_avx1 2017-07-13 12:27:05 +00:00
dkurt
3203635765 Eltwise layer fixes 2017-07-10 12:58:11 +03:00
Vadim Pisarevsky
ed9564106c reuse AVX2-optimized kernels for AVX1 CPUs (like IvyBridge) 2017-07-06 21:36:59 +03:00
Aleksandr Rybnikov
d3c14ce3ea Added tests for ResNet-50 and SqueezeNet v1.1 2017-07-04 12:19:27 +03:00
Alexander Alekhin
9aaf6a66a3 Merge pull request #9073 from berak:dnn_fix_tutorial_links 2017-07-03 16:11:10 +00:00
Alexander Alekhin
32d1eb36df dnn: fix links 2017-07-03 12:44:27 +03:00
berak
34c0ab5878 dnn: fix some tutorial links 2017-07-02 10:09:27 +02:00
abratchik
8f7181429f add java wrappers to dnn module 2017-07-02 11:46:20 +04:00
Alexander Alekhin
6ea6e4bceb binding: fix headers processing 2017-06-30 14:53:21 +03:00
Maksim Shabunin
638a01a014 Merge pull request #9038 from mshabunin:fix-static-4 2017-06-30 10:39:36 +00:00
Maksim Shabunin
90d2f8b5fe Merge pull request #9035 from alalek:dnn_fix_halide_tests 2017-06-30 10:29:13 +00:00
Maksim Shabunin
e0393f8557 Fixed some issues found by static analysis (4th round) 2017-06-30 12:26:53 +03:00
Aleksandr Rybnikov
fab4f4b9d5 Disabled logging in caffe parser in release 2017-06-29 17:36:48 +03:00
Alexander Alekhin
72a765d766 dnn: fix compilation of Halide tests 2017-06-29 16:36:34 +03:00
Vadim Pisarevsky
ac49a17a82 Merge pull request #9022 from dkurt:keep_conv_weights_for_halide 2017-06-29 11:09:17 +00:00
Vadim Pisarevsky
fb1dcdd17d Merge pull request #9029 from alalek:dnn_cleanup_torch 2017-06-29 11:07:35 +00:00
Maksim Shabunin
f1a56cb4b7 Merge pull request #9028 from alalek:dnn_experimental_namespace 2017-06-29 07:37:04 +00:00
Maksim Shabunin
ace0701a46 Merge pull request #9019 from alalek:dnn_trace 2017-06-29 07:33:46 +00:00
Alexander Alekhin
511e50c19c dnn: cleanup torch integration code 2017-06-28 21:49:37 +00:00
Alexander Alekhin
324851882a Merge pull request #9025 from mshabunin:fix-static-3 2017-06-28 20:50:21 +00:00
Alexander Alekhin
da0960321b dnn: added "hidden" experimental namespace
Main purpose of this namespace is to avoid using of incompatible
binaries that will cause applications crashes.

This additional namespace will not impact "Source code API".
This change allows to maintain ABI checks (with easy filtering out).
2017-06-28 20:36:57 +00:00
Maksim Shabunin
a769d69a9d Fixed several issues found by static analysis 2017-06-28 18:06:18 +03:00
dkurt
b46f5b1b38 Align convolutional layer weights separately from origin ones 2017-06-28 17:05:56 +03:00
Alexander Alekhin
ed10383359 dnn: added trace macros 2017-06-28 14:57:26 +03:00
Vadim Pisarevsky
c5faa9aefa Merge pull request #9013 from arrybn:ssd_last_layers_optim 2017-06-28 10:38:55 +00:00
Vadim Pisarevsky
bbb14d3746 Merge pull request #9003 from dkurt:halide_bug_fixes 2017-06-28 08:48:27 +00:00
Aleksandr Rybnikov
ec321e651f Removed usage of std::map in DetectionOutput layer 2017-06-28 11:31:38 +03:00
Vadim Pisarevsky
2ae849091c Merge pull request #9009 from alalek:fix_dnn_initialization 2017-06-28 08:26:29 +00:00
Vadim Pisarevsky
8b3d6603d5 another round of dnn optimization (#9011)
* another round of dnn optimization:
* increased malloc alignment across OpenCV from 16 to 64 bytes to make it AVX2 and even AVX-512 friendly
* improved SIMD optimization of pooling layer, optimized average pooling
* cleaned up convolution layer implementation
* made activation layer "attacheable" to all other layers, including fully connected and addition layer.
* fixed bug in the fusion algorithm: "LayerData::consumers" should not be cleared, because it desctibes the topology.
* greatly optimized permutation layer, which improved SSD performance
* parallelized element-wise binary/ternary/... ops (sum, prod, max)

* also, added missing copyrights to many of the layer implementation files

* temporarily disabled (again) the check for intermediate blobs consistency; fixed warnings from various builders
2017-06-28 11:15:22 +03:00
Alexander Alekhin
00dd433368 dnn: fix LayerFactory initialization 2017-06-27 23:19:53 +03:00
Alexander Alekhin
f8a75c4361 dispatch: added CV_TRY_${OPT} macro, fix dnn build
- 1: OPT is available directly or via dispatcher
- 0: optimization is not compiled at all
2017-06-27 17:05:15 +03:00
dkurt
121789f78e Fixed some bugs from Halide tests 2017-06-27 14:52:46 +03:00
Alexander Alekhin
16d1bbf2ea dnn: fix build
- winpack
- opencv_world
2017-06-27 09:07:01 +03:00
Alexander Alekhin
986d27e49c dnn: fix failed Torch tests
"Torch invalid argument 2: position must be smaller than LLONG_MAX"

These conditions are always true for "long position" argument.
2017-06-26 22:02:22 +03:00
Alexander Alekhin
93091ba203 dnn: AVX2 fix invalid unaligned read 2017-06-26 19:48:42 +03:00
Alexander Alekhin
623de337e8 dnn: fix build warnings 2017-06-26 19:48:42 +03:00
Alexander Alekhin
ee54bafe6b dnn: fix dnn python test files 2017-06-26 15:13:00 +03:00
Alexander Alekhin
e03569f3a8 dnn: remove obsolete "build opencv_contrib with dnn module" tutorial 2017-06-26 15:12:00 +03:00
Alexander Alekhin
382e38941c dnn: fix documentation links 2017-06-26 15:10:50 +03:00
Alexander Alekhin
14de8ac951 dnn: move samples 2017-06-26 14:51:12 +03:00
Alexander Alekhin
6031c79197 dnn: remove unused README 2017-06-26 14:51:12 +03:00
Alexander Alekhin
7f12836df9 dnn: fix public headers guards 2017-06-26 14:21:33 +03:00
Alexander Alekhin
93729784bb dnn: move module from opencv_contrib
e6f63c7a38/modules/dnn
2017-06-26 13:41:51 +03:00