Commit Graph

15873 Commits

Author SHA1 Message Date
Alexander Alekhin
e615fafe2d build: fix MSVS2010 2017-10-08 23:32:22 +03:00
Igor Wodiany
ffb9554787
Extract code from scalarToRawData
The same code was repeated several time for different data types, so
it was extracted as a templated function to improve maintability and
make a code more clear.
2017-10-07 19:46:45 +01:00
Vadim Pisarevsky
d25ee8a273 Merge pull request #9761 from Jazmann:ellipseFitAMS&Direct 2017-10-06 14:35:42 +00: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
Vadim Pisarevsky
87595a6b3a Merge pull request #9779 from Lightricks:feature/assetslibrary-remove-link 2017-10-06 11:45:36 +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
Yaron Inger
0d979a741b videoio: remove AssetsLibrary dependency.
The entire AssetsLibrary framework is deprecated since iOS 8.0. The code
used in the camera example code can use UIKit to save videos to the
camera instead, which allows to avoid linking with PhotoKit instead to
prevent increasing the iOS deployment target.
2017-10-05 20:22:56 +03:00
Vadim Pisarevsky
5f6ce6f4b0 Merge pull request #9762 from dkurt:fix_tensorflow_split_layer 2017-10-05 10:51:49 +00:00
Dmitry Kurtaev
ad8bbaf008 Multidimensional eltwise layer.
Fixed fully-connected layer axis.
2017-10-04 14:01:44 +03:00
Peter J. Stieber
5669ee815b Replace private.cuda.hpp with conditional include of cuda_fp16.h. 2017-10-03 17:47:52 -07:00
Dmitry Kurtaev
2a21c10837 Fix TensorFlow split layer 2017-10-02 22:44:42 +03:00
Jasper Shemilt
800da724a3 Fix Transposed eigenvals and vecs. Didn't notice at first 2017-10-02 17:56:08 +01:00
Jasper Shemilt
0136711cf4 Adds fitEllipseAMS to imgproc: The Approximate Mean Square (AMS) proposed by Taubin 1991.
Adds fitEllipseDirect to imgproc: The Direct least square (Direct) method by Fitzgibbon1999.

New Tests are included for the methods.
fitEllipseAMS Tests
fitEllipseDirect Tests

Comparative examples are added to fitEllipse.cpp in Samples.
2017-10-02 16:38:41 +01:00
Vadim Pisarevsky
49afb28738 Merge pull request #9744 from sturkmen72:Update_HOGDescriptor_Documentation 2017-10-02 14:50:46 +00:00
Alexander Alekhin
ab748188b1 Merge pull request #9596 from paroj:circle_board_params 2017-10-02 14:47:21 +00: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
Pavel Rojtberg
629a06d9b6 calib3d: export parameters of CALIB_CB_CLUSTERING 2017-10-02 14:27:32 +02:00
Vadim Pisarevsky
f646f61dad Merge pull request #9752 from alalek:eigenNonSymmetric 2017-10-02 11:51:13 +00:00
Vadim Pisarevsky
eca5906a75 Merge pull request #9746 from alalek:fix_msvs2017_warning 2017-10-02 11:15:48 +00:00
Suleyman TURKMEN
20c11d3b7b Update HOGDescriptor documentation 2017-10-02 07:14:35 +03:00
berak
089aac61f3 imgcodecs: fix 4 reading channel bmp images 2017-10-01 15:32:55 +02:00
Alexander Alekhin
1f18282f04 build: fix MSVS2017 warning 2017-10-01 10:48:35 +00:00
Alexander Alekhin
529632f8d0 core: cv::eigenNonSymmetric() via EigenvalueDecomposition 2017-10-01 07:45:32 +00:00
Alexander Alekhin
69103a9fab Merge pull request #9740 from tomoaki0705:universalArithm 2017-09-29 14:17:01 +00:00
Alexander Alekhin
a729f985fd Merge pull request #9726 from blendin:fix_oob 2017-09-29 14:16:40 +00:00
Alexander Alekhin
d43087cafe Merge pull request #9741 from alalek:stitching_test_update 2017-09-29 13:10:53 +00:00
Alexander Alekhin
0bf823e1eb stitching(perf): update condition threshold 2017-09-29 14:33:13 +03:00
Alexander Alekhin
39ee07b8f6 test: clarify fail messages 2017-09-29 14:33:00 +03:00
Tomoaki Teshima
e187219699 use universal intrinsic in arithm.cpp
* remove raw NEON/SSE2 implementation as much as possible
  * replace them to universal intrinsic in InRange/Compare/AddWeighted
2017-09-29 08:33:15 +09:00
Vadim Pisarevsky
5e93c82023 Merge pull request #9491 from dkurt:tf_lstm 2017-09-28 21:04:06 +00:00
Vadim Pisarevsky
a6d634b5b8 Merge pull request #9683 from terfendail:grects_weights 2017-09-28 14:02:12 +00:00
Vadim Pisarevsky
af8fc3e209 Merge pull request #9604 from alalek:ocl_kernel_profiling 2017-09-28 13:48:34 +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
Tomoaki Teshima
139b32734e Merge pull request #9714 from tomoaki0705:universalBilateral
imgproc: use universal intrinsic as much as possible (#9714)

* use universal intrinsic as much as possible
  * make SSE3 part as common as possible with universal intrinsic implementation
  * put the reducing part out of the main loop

* follow the comment
  * fix the typo
  * use v_reduce_sum4

* follow the comment again
  * remove all CV_SSE3 part from smooth.cpp
2017-09-28 12:30:22 +03:00
Alexander Alekhin
488d4df520 Merge pull request #9710 from savuor:ovx_harris_build_fix 2017-09-28 09:27:09 +00:00
Dmitry Kurtaev
6e593cd1f0 Swap dimensions of deconvolution kernel 2017-09-27 22:38:34 +03:00
Alexander Alekhin
55b7073aae Merge pull request #9730 from yanlend:patch-1 2017-09-27 16:02:09 +00:00
Alexander Alekhin
0f0f5652fb Merge pull request #9717 from alalek:fix_fma 2017-09-27 13:48:09 +00:00
Peter Fischer
332588fcee Fix bug: non-maximum suppression for hough circle
The non-maximum suppression in the Hough accumulator incorrectly ignores maxima that extend over more than one cell, i.e. two neighboring cells both have the same accumulator value. This maximum is dropped completely instead of picking at least one of the entries. This frequently results in obvious circles being missed.

The behavior is now changed to be the same as for hough_lines.

See also https://github.com/opencv/opencv/issues/4440
2017-09-27 11:47:30 +02:00
blendin
c58152d94b Fix out of bounds write 2017-09-26 23:04:01 -07:00
Deric Crago
a0d7cf89f2 Fixed 'boundary' spelling 2017-09-26 23:42:48 -04:00
Alexander Alekhin
7475d23fec Merge pull request #9707 from woodychow:fix_undistortrectifymap_avx2 2017-09-26 16:42:47 +00:00
Alexander Alekhin
3dee92ec50 fix usage of CV_FMA3 macro 2017-09-26 17:23:54 +03:00
Alexander Alekhin
513c2b92a4 Merge pull request #9709 from savuor:softfloat_r3d 2017-09-26 11:16:42 +00:00
Dmitry Kurtaev
84cec17913 LSTM layer for TensorFlow importer 2017-09-26 12:59:36 +03:00