Commit Graph

665 Commits

Author SHA1 Message Date
Dmitry Kurtaev
d959d7b9f0 Fuse deconvolution layer subgraphs from Keras 2018-04-20 16:51:38 +03:00
Dmitry Kurtaev
bd77d100e1 Enable some tests for clDNN plugin from Intel's Inference Engine 2018-04-20 10:47:46 +03:00
Dmitry Kurtaev
3b4a292ca9 Let switch CPU/OpenCL targets for models from Intel's Model Optimizer 2018-04-19 10:23:57 +03:00
Vadim Pisarevsky
b290bdafb9 Merge pull request #11322 from dkurt:dnn_yolov3 2018-04-18 12:11:13 +00:00
Dmitry Kurtaev
97fec07d96 Support YOLOv3 model from Darknet 2018-04-16 18:44:12 +03:00
Alexander Alekhin
ee90a6cbde dnn(test): update error tolerance for RCNN/RFCN tests 2018-04-16 14:24:41 +03:00
Vadim Pisarevsky
533bb89800 Merge pull request #11236 from dkurt:dnn_fuse_l2_norm 2018-04-11 15:09:55 +00:00
Vadim Pisarevsky
30175594e9 Merge pull request #11062 from dkurt:dnn_inf_engine_cldnn 2018-04-11 15:06:18 +00:00
Dmitry Kurtaev
4ef6c91583 Fix multiple inputs for models from Intel's Model Optimizer 2018-04-11 13:28:07 +03:00
Dmitry Kurtaev
1ba72ca0d3 Fuse tf.nn.l2_normalize layer 2018-04-10 10:12:44 +03:00
Dmitry Kurtaev
709cf5d038 OpenCL GPU target for Inference Engine deep learning backend
Enable FP16 GPU target for DL Inference Engine backend.
2018-04-09 17:21:35 +03:00
Dmitry Kurtaev
ef1aaf12c9 Fix Proposal deep learning layer 2018-04-04 14:48:29 +03:00
Alexander Alekhin
f95e91e2bc Merge pull request #11199 from dkurt:update_torch_testdata 2018-04-03 18:02:58 +00:00
Dmitry Kurtaev
818a91f4f7 Update Torch testdata 2018-03-31 12:04:44 +03:00
Dmitry Kurtaev
598039c0ed Fix embedded Torch's nn.ConcatTable 2018-03-31 11:11:10 +03:00
Alexander Alekhin
e8a67de0d2 Merge pull request #11182 from dkurt:fix_11102_part_2 2018-03-30 13:11:01 +00:00
Dmitry Kurtaev
e039fc3a63 Replace protobuf's ReleaseLast to RemoveLast to deallocate memory.
Change an order of PriorBox layer operations.
2018-03-28 17:27:36 +03:00
Dmitry Kurtaev
7972f47ed4 Load networks from intermediate representation of Intel's Deep learning deployment toolkit. 2018-03-26 07:24:21 +03:00
Dmitry Kurtaev
e8fe6ee4e3 Fix prior box generation in case of squared proposals.
Fix batch norm in training phase.
2018-03-23 09:44:59 +03:00
Dmitry Kurtaev
069f9add80 Fix an issue https://github.com/opencv/opencv/issues/11102 2018-03-18 10:49:12 +03:00
Alexander Alekhin
d68466bb6a Merge pull request #10940 from dkurt:dnn_tf_graph_optim 2018-03-14 14:36:25 +00:00
Alexander Alekhin
ab110c0ad1 Merge pull request #10979 from dkurt:unite_dnn_samples 2018-03-14 14:33:49 +00:00
Dmitry Kurtaev
69a8f110b6 Fuse subgraphs from Keras 2018-03-12 10:53:06 +03:00
Dmitry Kurtaev
9457bf10ab Fuse batch normalization and flatten TensorFlow subgraphs in runtime 2018-03-12 10:51:35 +03:00
Dmitry Kurtaev
0f01b40dd5 Reset OpenCL kernels if batch size changes 2018-03-07 17:06:59 +03:00
Dmitry Kurtaev
0a61ebdd66 Replace DNNTarget and DNNBackend in tests 2018-03-07 12:59:38 +03:00
Dmitry Kurtaev
e1c3237532 Parametric OpenCL deep learning tests 2018-03-05 20:53:18 +03:00
Dmitry Kurtaev
f2440ceae6 Update tutorials. A new cv::dnn::readNet function 2018-03-04 20:30:22 +03:00
Alexander Alekhin
fe97dc67dc Merge pull request #10962 from alalek:dnn_precomp_hpp 2018-03-02 11:38:16 +00:00
Alexander Alekhin
a838a97092 dnn: fix precomp.hpp usage 2018-02-28 17:06:26 +03:00
Wu Zhiwen
ef937dd676 ocl4dnn: Fix SAME padding mode for convolve
Signed-off-by: Wu, Zhiwen <zhiwen.wu@intel.com>
Signed-off-by: Li Peng <peng.li@intel.com>
2018-02-28 21:02:41 +08:00
Li Peng
608968aa83 Deconvolution ocl fix
Signed-off-by: Li Peng <peng.li@intel.com>
2018-02-23 18:31:30 +08:00
Vadim Pisarevsky
5e0f95b948 Merge pull request #9708 from dkurt:tf_face_detector 2018-02-22 12:04:26 +00:00
Li Peng
e7d35d51fa Fix for opencv face detector ocl test
Signed-off-by: Li Peng <peng.li@intel.com>
2018-02-22 23:37:54 +08:00
Li Peng
c524f669c7 Fallback for "SAME" padMode in ocl convolution and pooling
It fixes tensorflow ocl testcase of MobileNetSSD and Inception_v2_SSD

Signed-off-by: Li Peng <peng.li@intel.com>
2018-02-22 21:17:59 +08:00
Dmitry Kurtaev
eab556e1e0 OpenCV face detection network in TensorFlow 2018-02-21 19:58:24 +03:00
Dmitry Kurtaev
34ba32ff27 Fix DNN flatten test 2018-02-18 12:45:43 +03:00
Alexander Alekhin
0e4eed0ba1 Merge pull request #10867 from dkurt:dnn_fix_ave_pooling_area 2018-02-16 11:17:32 +00:00
Dmitry Kurtaev
f8d0d6365e Add a flag to manage average pooling with padding 2018-02-14 16:56:31 +03:00
Alexander Alekhin
cff79609c8 Merge pull request #10854 from pengli:dnn 2018-02-14 12:49:53 +00:00
Vadim Pisarevsky
6dfd7e3da2 Merge pull request #10850 from dkurt:dnn_tf_deconv_tests 2018-02-14 10:35:14 +00:00
Li Peng
80d1f2ddfa re-enable tensor flow mobilenet ssd ocl test
Signed-off-by: Li Peng <peng.li@intel.com>
2018-02-14 01:04:58 +08:00
Dmitry Kurtaev
a6baedd02c Fix deconvolution layer. Add batch norm layer with mean-variance normalization from TensorFlow. 2018-02-13 11:00:27 +03:00
luz.paz
5718d09e39 Misc. modules/ typos
Found via `codespell`
2018-02-12 07:09:43 -05:00
Rémi Ratajczak
b67523550f dnn : Added an imagesFromBlob method to the dnn module (#10607)
* Added the imagesFromBlob method to the dnn module.

* Rewritten imagesFromBlob based on first dkurt comments

* Updated code with getPlane()

* Modify comment of imagesFromBlob() in dnn module

* modified comments, removed useless assertions & added OutputArrayOfArray

* replaced tabs with whitespaces & put vectorOfChannels instantiation outside the loop

* Changed pre-commit.sample to pre-commit in .git/hooks/

* Added a test for imagesFromBlob in test_misc.cpp (dnn)

* Changed nbOfImages, robustified test with cv::randu, modified assertion
2018-02-12 14:51:07 +03:00
Dmitry Kurtaev
7fe97376c2 MobileNet-SSD from TensorFlow 1.3 and Inception-V2-SSD using Inference Engine backend 2018-02-09 13:45:45 +03:00
Vadim Pisarevsky
835acd3f31 Merge pull request #10799 from dkurt:dnn_inference_engine_face_detection 2018-02-07 13:42:08 +00:00
Dmitry Kurtaev
ed94136548 OpenCV face detection network using Inference Engine backend 2018-02-06 17:53:24 +03:00
Alexander Alekhin
c973aaabc5 Merge pull request #10787 from dkurt:dnn_tutorial_face_detection 2018-02-06 14:37:09 +00:00
Dmitry Kurtaev
8817907647 Test for FP16 version of OpenCV face detection network 2018-02-06 13:16:07 +03:00
Alexander Alekhin
2a1f46c42d Merge pull request #9770 from alalek:refactor_test_files 2018-02-06 09:33:58 +00:00
Dmitry Kurtaev
10e1de74d2 Intel Inference Engine deep learning backend (#10608)
* Intel Inference Engine deep learning backend.

* OpenFace network using Inference Engine backend
2018-02-06 11:57:35 +03:00
Alexander Alekhin
4a297a2443 ts: refactor OpenCV tests
- removed tr1 usage (dropped in C++17)
- moved includes of vector/map/iostream/limits into ts.hpp
- require opencv_test + anonymous namespace (added compile check)
- fixed norm() usage (must be from cvtest::norm for checks) and other conflict functions
- added missing license headers
2018-02-03 19:39:47 +00:00
Vadim Pisarevsky
36222c9eed Merge pull request #10730 from dkurt:dnn_faster_rcnn_rfcn_tests 2018-02-01 13:28:10 +00:00
Alexander Alekhin
42569cfd61 Merge pull request #10748 from dkurt:fix_dnn_slice_layer 2018-02-01 13:21:17 +00:00
Alexander Alekhin
9698b93d10 Merge pull request #10717 from pengli:dnn 2018-02-01 10:49:54 +00:00
Dmitry Kurtaev
184862582c Fix slice layer from TensorFlow 2018-01-31 19:12:37 +03:00
Dmitry Kurtaev
a2e9bfbaf4 Fix padding for average pooling from TensorFlow 2018-01-31 15:54:30 +03:00
Dmitry Kurtaev
ae2e4af4a1 Faster-RCNN and RFCN tests
https://github.com/rbgirshick/py-faster-rcnn
https://github.com/YuwenXiong/py-R-FCN
2018-01-30 13:17:35 +03:00
Li Peng
7a4c5e9421 slice layer ocl support
Signed-off-by: Li Peng <peng.li@intel.com>
2018-01-29 22:34:32 +08:00
Dmitry Kurtaev
a3d74704e5 OpenCV face detection network test 2018-01-23 09:27:58 +03:00
Alexander Alekhin
c3569211d5 Merge pull request #10591 from drkoller:master 2018-01-19 09:44:21 +00:00
Li Peng
2124361ff7 ocl support for Deconvolution layer
Signed-off-by: Li Peng <peng.li@intel.com>
2018-01-18 23:40:22 +08:00
David Koller
d1a3b530be Make DNN Crop layer match Caffe default offset behavior
and add parametric unit test for crop layer.
2018-01-17 10:52:36 -05:00
Li Peng
e77af4ae33 MVN layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2018-01-17 17:11:32 +08:00
Li Peng
7bc017601f Power, Tanh and Channels ReLU layer ocl support
Signed-off-by: Li Peng <peng.li@intel.com>
2018-01-17 17:11:27 +08:00
Alexander Alekhin
1255bd8d4b Merge pull request #10585 from dkurt:dnn_weightless_scale 2018-01-15 06:07:50 +00:00
Dmitry Kurtaev
6a395d88ff dnn::blobFromImage with OutputArray 2018-01-13 18:20:24 +03:00
Dmitry Kurtaev
1f4fdfd599 Untrainable version of Scale layer from Caffe 2018-01-13 10:35:29 +03:00
Dmitry Kurtaev
64a9e92390 Merge pull request #10466 from dkurt:reduce_umat_try_2
* UMat blobs are wrapped

* Replace getUMat and getMat at OpenCLBackendWrapper
2018-01-10 21:50:54 +03:00
Li Peng
e3b42bf93b batch_norm and blank layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2018-01-09 21:58:46 +08:00
Li Peng
67f9406cbe add normalize_bbox layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2018-01-05 19:38:36 +08:00
Li Peng
f99a135eda add eltwise layer ocl implementation
Signed-off-by: Li Peng <peng.li@intel.com>
2018-01-05 19:38:30 +08:00
Alexander Alekhin
2b3c140f04
Merge pull request #10436 from alalek:test_threads 2017-12-28 18:29:30 +03:00
Li Peng
00f03c5739 Add ocl version FasterRCNN accuracy test
Signed-off-by: Li Peng <peng.li@intel.com>
2017-12-28 19:15:15 +08:00
Alexander Alekhin
9b131b5f7e dnn(test): avoid calling of cv::setNumThreads() in tests directly
It is not necessary by default.
Also it breaks test system command-line parameters: --perf_threads / --test_threads
2017-12-27 15:16:41 +00:00
Dmitry Kurtaev
70c605a03d Limit Concat layer optimization 2017-12-26 16:49:33 +03:00
Alexander Alekhin
019b7c5a66 Merge pull request #10402 from dkurt:dnn_tf_quantized 2017-12-22 15:58:56 +00:00
Dmitry Kurtaev
bcc669f3f7 TensorFlow weights dequantization 2017-12-22 17:25:10 +03:00
Dmitry Kurtaev
7e48fa58eb Manage TensorFlow's NHWC data layout is smoother 2017-12-20 14:13:40 +03:00
Alexander Alekhin
dcdd6af5a8 Merge pull request #10341 from pengli:dnn 2017-12-19 14:04:55 +00:00
Li Peng
3b84acfc48 add ocl accuracy test for tf mobilenet ssd
Signed-off-by: Li Peng <peng.li@intel.com>
2017-12-19 18:38:55 +08:00
Dmitry Kurtaev
6aabd6cc7a Remove cv::dnn::Importer 2017-12-18 18:08:28 +03:00
Dmitry Kurtaev
08112f3821 Faster-RCNN models support 2017-12-15 12:16:21 +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
bbbec300a6 nn.BatchNormalization and nn.Dropout layers from Torch 2017-12-04 12:57:21 +03: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
Alexander Alekhin
107582c767 Merge pull request #9996 from dkurt:dnn_multiple_inputs 2017-11-23 18:22:37 +00:00
Alexander Alekhin
f37f4cf3b4 Merge pull request #9994 from r2d3:dnn_memory_load 2017-11-22 18:15:00 +00:00
David Geldreich
f723cede2e add loading TensorFlow/Caffe net from memory buffer
add a corresponding test
2017-11-20 16:28:22 +01: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
Dmitry Kurtaev
20a2dc6ac5 Fix multiple inputs models from Caffe.
Fixed Concat optimization.
2017-11-02 18:55:08 +03:00
Dmitry Kurtaev
03cefa7bfe Set zero confidences in case of no detections 2017-10-30 10:17:57 +03: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
69f2590359 Merge pull request #9921 from dkurt:fix_prelu_after_fully_connected 2017-10-27 11:10:59 +00:00
Vladislav Sovrasov
5bf39ceb5d dnn: handle 4-channel images in blobFromImage (#9944) 2017-10-27 14:06:53 +03:00
Vladislav Sovrasov
7e3e9144de dnn: add an accuracy test for NMS 2017-10-25 13:40:56 +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
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
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
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
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
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
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
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
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
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
Dmitry Kurtaev
ce41a15437 Import and convert FP16 weights from TensorFlow 2017-09-12 09:50:55 +03:00
Dmitry Kurtaev
cad7c4d51d MobileNet-SSD and VGG-SSD topologies in Halide 2017-09-08 09:55:53 +03:00
Dmitry Kurtaev
5c43a394c5 Added performance test for Caffe framework 2017-08-27 19:40:58 +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
dkurt
339793143c Unit tests for TensorFlow importer 2017-08-03 11:29:48 +03:00
Aleksandr Rybnikov
8d6b8b45b6 Added ELU and test for it 2017-08-02 11:13:59 +03:00
Tomoaki Teshima
e63d628677 remove some rand functions
* make test more reproducible
2017-07-20 22:43:11 +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
dkurt
3203635765 Eltwise layer fixes 2017-07-10 12:58:11 +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
Alexander Alekhin
72a765d766 dnn: fix compilation of Halide tests 2017-06-29 16:36:34 +03:00
Vadim Pisarevsky
bbb14d3746 Merge pull request #9003 from dkurt:halide_bug_fixes 2017-06-28 08:48:27 +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
dkurt
121789f78e Fixed some bugs from Halide tests 2017-06-27 14:52:46 +03:00
Alexander Alekhin
ee54bafe6b dnn: fix dnn python test files 2017-06-26 15:13:00 +03:00
Alexander Alekhin
382e38941c dnn: fix documentation links 2017-06-26 15:10:50 +03:00
Alexander Alekhin
93729784bb dnn: move module from opencv_contrib
e6f63c7a38/modules/dnn
2017-06-26 13:41:51 +03:00