Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin 2021-03-27 15:35:16 +00:00
commit 35eaacd1db
20 changed files with 558 additions and 84 deletions

View File

@ -1539,6 +1539,26 @@ OPENCV_HAL_IMPL_NEON_SELECT(v_float32x4, f32, u32)
OPENCV_HAL_IMPL_NEON_SELECT(v_float64x2, f64, u64)
#endif
#if CV_NEON_AARCH64
#define OPENCV_HAL_IMPL_NEON_EXPAND(_Tpvec, _Tpwvec, _Tp, suffix) \
inline void v_expand(const _Tpvec& a, _Tpwvec& b0, _Tpwvec& b1) \
{ \
b0.val = vmovl_##suffix(vget_low_##suffix(a.val)); \
b1.val = vmovl_high_##suffix(a.val); \
} \
inline _Tpwvec v_expand_low(const _Tpvec& a) \
{ \
return _Tpwvec(vmovl_##suffix(vget_low_##suffix(a.val))); \
} \
inline _Tpwvec v_expand_high(const _Tpvec& a) \
{ \
return _Tpwvec(vmovl_high_##suffix(a.val)); \
} \
inline _Tpwvec v_load_expand(const _Tp* ptr) \
{ \
return _Tpwvec(vmovl_##suffix(vld1_##suffix(ptr))); \
}
#else
#define OPENCV_HAL_IMPL_NEON_EXPAND(_Tpvec, _Tpwvec, _Tp, suffix) \
inline void v_expand(const _Tpvec& a, _Tpwvec& b0, _Tpwvec& b1) \
{ \
@ -1557,6 +1577,7 @@ inline _Tpwvec v_load_expand(const _Tp* ptr) \
{ \
return _Tpwvec(vmovl_##suffix(vld1_##suffix(ptr))); \
}
#endif
OPENCV_HAL_IMPL_NEON_EXPAND(v_uint8x16, v_uint16x8, uchar, u8)
OPENCV_HAL_IMPL_NEON_EXPAND(v_int8x16, v_int16x8, schar, s8)

View File

@ -1050,7 +1050,7 @@ bool ocl_convert_nv12_to_bgr(
k.args(clImageY, clImageUV, clBuffer, step, cols, rows);
size_t globalsize[] = { (size_t)cols, (size_t)rows };
size_t globalsize[] = { (size_t)cols/2, (size_t)rows/2 };
return k.run(2, globalsize, 0, false);
}
@ -1071,7 +1071,7 @@ bool ocl_convert_bgr_to_nv12(
k.args(clBuffer, step, cols, rows, clImageY, clImageUV);
size_t globalsize[] = { (size_t)cols, (size_t)rows };
size_t globalsize[] = { (size_t)cols/2, (size_t)rows/2 };
return k.run(2, globalsize, 0, false);
}

View File

@ -91,63 +91,50 @@ void YUV2BGR_NV12_8u(
{
int x = get_global_id(0);
int y = get_global_id(1);
// each iteration computes 2*2=4 pixels
int x2 = x*2;
int y2 = y*2;
if (x + 1 < cols)
{
if (y + 1 < rows)
{
__global uchar* pDstRow1 = pBGR + mad24(y, bgrStep, mad24(x, NCHANNELS, 0));
__global uchar* pDstRow2 = pDstRow1 + bgrStep;
if (x2 + 1 < cols) {
if (y2 + 1 < rows) {
__global uchar *pDstRow1 = pBGR + mad24(y2, bgrStep, mad24(x2, NCHANNELS, 0));
__global uchar *pDstRow2 = pDstRow1 + bgrStep;
float4 Y1 = read_imagef(imgY, (int2)(x+0, y+0));
float4 Y2 = read_imagef(imgY, (int2)(x+1, y+0));
float4 Y3 = read_imagef(imgY, (int2)(x+0, y+1));
float4 Y4 = read_imagef(imgY, (int2)(x+1, y+1));
float4 Y1 = read_imagef(imgY, (int2)(x2 + 0, y2 + 0));
float4 Y2 = read_imagef(imgY, (int2)(x2 + 1, y2 + 0));
float4 Y3 = read_imagef(imgY, (int2)(x2 + 0, y2 + 1));
float4 Y4 = read_imagef(imgY, (int2)(x2 + 1, y2 + 1));
float4 Y = (float4)(Y1.x, Y2.x, Y3.x, Y4.x);
float4 UV = read_imagef(imgUV, (int2)(x/2, y/2)) - d2;
float4 UV = read_imagef(imgUV, (int2)(x, y)) - d2;
__constant float* coeffs = c_YUV2RGBCoeffs_420;
__constant float *coeffs = c_YUV2RGBCoeffs_420;
Y1 = max(0.f, Y1 - d1) * coeffs[0];
Y2 = max(0.f, Y2 - d1) * coeffs[0];
Y3 = max(0.f, Y3 - d1) * coeffs[0];
Y4 = max(0.f, Y4 - d1) * coeffs[0];
Y = max(0.f, Y - d1) * coeffs[0];
float ruv = fma(coeffs[4], UV.y, 0.0f);
float guv = fma(coeffs[3], UV.y, fma(coeffs[2], UV.x, 0.0f));
float buv = fma(coeffs[1], UV.x, 0.0f);
float R1 = (Y1.x + ruv) * CV_8U_MAX;
float G1 = (Y1.x + guv) * CV_8U_MAX;
float B1 = (Y1.x + buv) * CV_8U_MAX;
float4 R = (Y + ruv) * CV_8U_MAX;
float4 G = (Y + guv) * CV_8U_MAX;
float4 B = (Y + buv) * CV_8U_MAX;
float R2 = (Y2.x + ruv) * CV_8U_MAX;
float G2 = (Y2.x + guv) * CV_8U_MAX;
float B2 = (Y2.x + buv) * CV_8U_MAX;
pDstRow1[0*NCHANNELS + 0] = convert_uchar_sat(B.x);
pDstRow1[0*NCHANNELS + 1] = convert_uchar_sat(G.x);
pDstRow1[0*NCHANNELS + 2] = convert_uchar_sat(R.x);
float R3 = (Y3.x + ruv) * CV_8U_MAX;
float G3 = (Y3.x + guv) * CV_8U_MAX;
float B3 = (Y3.x + buv) * CV_8U_MAX;
pDstRow1[1*NCHANNELS + 0] = convert_uchar_sat(B.y);
pDstRow1[1*NCHANNELS + 1] = convert_uchar_sat(G.y);
pDstRow1[1*NCHANNELS + 2] = convert_uchar_sat(R.y);
float R4 = (Y4.x + ruv) * CV_8U_MAX;
float G4 = (Y4.x + guv) * CV_8U_MAX;
float B4 = (Y4.x + buv) * CV_8U_MAX;
pDstRow2[0*NCHANNELS + 0] = convert_uchar_sat(B.z);
pDstRow2[0*NCHANNELS + 1] = convert_uchar_sat(G.z);
pDstRow2[0*NCHANNELS + 2] = convert_uchar_sat(R.z);
pDstRow1[0*NCHANNELS + 0] = convert_uchar_sat(B1);
pDstRow1[0*NCHANNELS + 1] = convert_uchar_sat(G1);
pDstRow1[0*NCHANNELS + 2] = convert_uchar_sat(R1);
pDstRow1[1*NCHANNELS + 0] = convert_uchar_sat(B2);
pDstRow1[1*NCHANNELS + 1] = convert_uchar_sat(G2);
pDstRow1[1*NCHANNELS + 2] = convert_uchar_sat(R2);
pDstRow2[0*NCHANNELS + 0] = convert_uchar_sat(B3);
pDstRow2[0*NCHANNELS + 1] = convert_uchar_sat(G3);
pDstRow2[0*NCHANNELS + 2] = convert_uchar_sat(R3);
pDstRow2[1*NCHANNELS + 0] = convert_uchar_sat(B4);
pDstRow2[1*NCHANNELS + 1] = convert_uchar_sat(G4);
pDstRow2[1*NCHANNELS + 2] = convert_uchar_sat(R4);
pDstRow2[1*NCHANNELS + 0] = convert_uchar_sat(B.w);
pDstRow2[1*NCHANNELS + 1] = convert_uchar_sat(G.w);
pDstRow2[1*NCHANNELS + 2] = convert_uchar_sat(R.w);
}
}
}
@ -172,12 +159,15 @@ void BGR2YUV_NV12_8u(
{
int x = get_global_id(0);
int y = get_global_id(1);
// each iteration computes 2*2=4 pixels
int x2 = x*2;
int y2 = y*2;
if (x < cols)
if (x2 + 1 < cols)
{
if (y < rows)
if (y2 + 1 < rows)
{
__global const uchar* pSrcRow1 = pBGR + mad24(y, bgrStep, mad24(x, NCHANNELS, 0));
__global const uchar* pSrcRow1 = pBGR + mad24(y2, bgrStep, mad24(x2, NCHANNELS, 0));
__global const uchar* pSrcRow2 = pSrcRow1 + bgrStep;
float4 src_pix1 = convert_float4(vload4(0, pSrcRow1 + 0*NCHANNELS)) * CV_8U_SCALE;
@ -196,12 +186,12 @@ void BGR2YUV_NV12_8u(
UV.x = fma(coeffs[3], src_pix1.z, fma(coeffs[4], src_pix1.y, fma(coeffs[5], src_pix1.x, d2)));
UV.y = fma(coeffs[5], src_pix1.z, fma(coeffs[6], src_pix1.y, fma(coeffs[7], src_pix1.x, d2)));
write_imagef(imgY, (int2)(x+0, y+0), Y1);
write_imagef(imgY, (int2)(x+1, y+0), Y2);
write_imagef(imgY, (int2)(x+0, y+1), Y3);
write_imagef(imgY, (int2)(x+1, y+1), Y4);
write_imagef(imgY, (int2)(x2+0, y2+0), Y1);
write_imagef(imgY, (int2)(x2+1, y2+0), Y2);
write_imagef(imgY, (int2)(x2+0, y2+1), Y3);
write_imagef(imgY, (int2)(x2+1, y2+1), Y4);
write_imagef(imgUV, (int2)((x/2), (y/2)), UV);
write_imagef(imgUV, (int2)(x, y), UV);
}
}
}

View File

@ -189,7 +189,7 @@ static bool ocl_convert_nv12_to_bgr(cl_mem clImageY, cl_mem clImageUV, cl_mem cl
k.args(clImageY, clImageUV, clBuffer, step, cols, rows);
size_t globalsize[] = { (size_t)cols, (size_t)rows };
size_t globalsize[] = { (size_t)cols/2, (size_t)rows/2 };
return k.run(2, globalsize, 0, false);
}
@ -202,7 +202,7 @@ static bool ocl_convert_bgr_to_nv12(cl_mem clBuffer, int step, int cols, int row
k.args(clBuffer, step, cols, rows, clImageY, clImageUV);
size_t globalsize[] = { (size_t)cols, (size_t)rows };
size_t globalsize[] = { (size_t)cols/2, (size_t)rows/2 };
return k.run(2, globalsize, 0, false);
}
#endif // HAVE_VA_INTEL

View File

@ -364,6 +364,7 @@ CV__DNN_INLINE_NS_BEGIN
* Inner vector has slice ranges for the first number of input dimensions.
*/
std::vector<std::vector<Range> > sliceRanges;
std::vector<std::vector<int> > sliceSteps;
int axis;
int num_split;

View File

@ -70,6 +70,7 @@ public:
SliceLayerImpl(const LayerParams& params)
{
setParamsFrom(params);
hasSteps = false;
axis = params.get<int>("axis", 1);
num_split = params.get<int>("num_split", 0);
hasDynamicShapes = params.get<bool>("has_dynamic_shapes", false);
@ -118,6 +119,22 @@ public:
sliceRanges[0][i].end = end; // We'll finalize a negative value later.
}
}
if (params.has("steps"))
{
const DictValue &steps = params.get("steps");
sliceSteps.resize(1);
sliceSteps[0].resize(steps.size());
for (int i = 0; i < steps.size(); ++i)
{
int step = steps.get<int>(i);
CV_Assert(step >= 1);
if (step > 1)
hasSteps = true;
sliceSteps[0][i] = step;
}
}
}
}
@ -126,14 +143,17 @@ public:
#ifdef HAVE_DNN_IE_NN_BUILDER_2019
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
return INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2019R1) &&
sliceRanges.size() == 1 && sliceRanges[0].size() == 4;
sliceRanges.size() == 1 && sliceRanges[0].size() == 4 && !hasSteps;
#endif
#ifdef HAVE_DNN_NGRAPH
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
return sliceRanges.size() == 1;
return sliceRanges.size() == 1 && !hasSteps;
#endif
return backendId == DNN_BACKEND_OPENCV ||
backendId == DNN_BACKEND_CUDA;
#ifdef HAVE_CUDA
if (backendId == DNN_BACKEND_CUDA)
return !hasSteps;
#endif
return backendId == DNN_BACKEND_OPENCV;
}
bool getMemoryShapes(const std::vector<MatShape> &inputs,
@ -154,6 +174,9 @@ public:
{
if (shapesInitialized || inpShape[j] > 0)
outputs[i][j] = normalize_axis_range(sliceRanges[i][j], inpShape[j]).size();
if (!sliceSteps.empty() && (i < sliceSteps.size()) && (j < sliceSteps[i].size()) && (sliceSteps[i][j] > 1))
outputs[i][j] = (outputs[i][j] + sliceSteps[i][j] - 1) / sliceSteps[i][j];
}
}
}
@ -188,6 +211,7 @@ public:
const MatSize& inpShape = inputs[0].size;
finalSliceRanges = sliceRanges;
if (sliceRanges.empty())
{
// Divide input blob on equal parts by axis.
@ -220,6 +244,9 @@ public:
}
}
if (!sliceSteps.empty() && sliceSteps[0].size() != inputs[0].dims)
sliceSteps[0].resize(inputs[0].dims, 1);
#if 0
std::cout << "DEBUG: DNN/Slice: " << outputs.size() << " inpShape=" << inpShape << std::endl;
for (int i = 0; i < outputs.size(); ++i)
@ -427,6 +454,9 @@ public:
{
CV_TRACE_FUNCTION();
if (hasSteps)
return false; // TODO not implemented yet: https://github.com/opencv/opencv/pull/19546
std::vector<UMat> inputs;
std::vector<UMat> outputs;
@ -485,9 +515,24 @@ public:
const Mat& inpMat = inputs[0];
CV_Assert(outputs.size() == finalSliceRanges.size());
for (size_t i = 0; i < outputs.size(); i++)
if (!hasSteps)
{
inpMat(finalSliceRanges[i]).copyTo(outputs[i]);
for (size_t i = 0; i < outputs.size(); i++)
{
inpMat(finalSliceRanges[i]).copyTo(outputs[i]);
}
}
else
{
int dimsNum = inpMat.dims;
for (size_t i = 0; i < outputs.size(); i++)
{
std::vector<int> inpIdx(dimsNum, 0);
std::vector<int> outIdx(dimsNum, 0);
getSliceRecursive(inpMat, inpIdx, finalSliceRanges[i], sliceSteps[i], 0, dimsNum, outputs[i], outIdx);
}
}
}
@ -603,11 +648,42 @@ public:
#endif
private:
void getSliceRecursive(const Mat &inpMat, std::vector<int> &inpIdx,
const std::vector<Range> &sliceRanges,
const std::vector<int> &sliceSteps, int dim, int dimsNum,
Mat &outputs, std::vector<int> &outIdx)
{
int begin = sliceRanges[dim].start;
int end = sliceRanges[dim].end;
int step = !sliceSteps.empty() ? sliceSteps[dim] : 1;
const bool is32F = inpMat.depth() == CV_32F;
// TODO optimization is required (for 2D tail case at least)
for (int k = begin, j = 0; k < end; k += step, j++)
{
inpIdx[dim] = k;
outIdx[dim] = j;
if (dim + 1 < dimsNum)
getSliceRecursive(inpMat, inpIdx, sliceRanges, sliceSteps, dim + 1, dimsNum, outputs, outIdx);
else
{
if (is32F)
outputs.at<float>(outIdx.data()) = inpMat.at<float>(inpIdx.data());
else
outputs.at<short>(outIdx.data()) = inpMat.at<short>(inpIdx.data()); // 16F emulation
}
}
}
protected:
// The actual non-negative values determined from @p sliceRanges depends on input size.
std::vector<std::vector<Range> > finalSliceRanges;
bool hasDynamicShapes;
bool shapesInitialized;
bool hasSteps;
};
class CropLayerImpl CV_FINAL : public SliceLayerImpl

View File

@ -112,14 +112,14 @@ ocl::Image2D ocl4dnnGEMMCopyBufferToImage(UMat buffer, int offset,
global_copy[0] = padded_width;
global_copy[1] = padded_height;
oclk_gemm_copy
bool res = oclk_gemm_copy
.args(
ocl::KernelArg::PtrReadOnly(buffer),
image, offset,
width, height,
ld)
.run(2, global_copy, NULL, false);
oclk_gemm_copy.run(2, global_copy, NULL, false);
CV_Assert(res);
}
}

View File

@ -641,20 +641,11 @@ void ONNXImporter::handleNode(const opencv_onnx::NodeProto& node_proto_)
int axis = 0;
std::vector<int> begin;
std::vector<int> end;
std::vector<int> steps;
int inp_size = node_proto.input_size();
if (inp_size == 1)
{
if (layerParams.has("steps"))
{
DictValue steps = layerParams.get("steps");
for (int i = 0; i < steps.size(); ++i)
{
if (steps.get<int>(i) != 1)
CV_Error(Error::StsNotImplemented,
"Slice layer only supports steps = 1");
}
}
if (layerParams.has("axes")) {
DictValue axes = layerParams.get("axes");
for (int i = 1; i < axes.size(); ++i) {
@ -677,7 +668,7 @@ void ONNXImporter::handleNode(const opencv_onnx::NodeProto& node_proto_)
int finish = ends.get<int>(i);
end.push_back((finish < 0) ? --finish : finish); // numpy doesn't include last dim
}
} else {
} else { // inp_size > 1
CV_Assert(inp_size >= 3);
for (int i = 1; i < inp_size; i++) {
CV_Assert(constBlobs.find(node_proto.input(i)) != constBlobs.end());
@ -711,6 +702,12 @@ void ONNXImporter::handleNode(const opencv_onnx::NodeProto& node_proto_)
if (inp_size == 5) {
CV_Assert(constBlobs.find(node_proto.input(4)) != constBlobs.end());
Mat step_blob = getBlob(node_proto, 4);
const int* steps_ptr = step_blob.ptr<int>();
if (axis > 0)
steps.resize(axis, 1);
std::copy(steps_ptr, steps_ptr + step_blob.total(), std::back_inserter(steps));
// Very strange application for Slice op with tensor reversing.
// We just workaround it for 2d constants.
@ -728,13 +725,15 @@ void ONNXImporter::handleNode(const opencv_onnx::NodeProto& node_proto_)
return;
}
}
CV_CheckEQ(countNonZero(step_blob != 1), 0, "Slice layer only supports steps = 1");
}
}
layerParams.set("begin", DictValue::arrayInt(&begin[0], begin.size()));
layerParams.set("end", DictValue::arrayInt(&end[0], end.size()));
layerParams.set("axis", axis);
if (!steps.empty())
layerParams.set("steps", DictValue::arrayInt(&steps[0], steps.size()));
if (constBlobs.find(node_proto.input(0)) != constBlobs.end())
{
Mat inp = getBlob(node_proto, 0);

View File

@ -258,7 +258,17 @@ TEST_P(LRN, Accuracy)
int sz[] = {1, inChannels, inSize.height, inSize.width};
Mat input(4, &sz[0], CV_32F);
test(lp, input, backendId, targetId);
double l1 = 0.0, lInf = 0.0;
// The OpenCL kernels use the native_ math functions which have
// implementation defined accuracy, so we use relaxed thresholds. See
// https://github.com/opencv/opencv/issues/9821 for more details.
if (targetId == DNN_TARGET_OPENCL)
{
l1 = 0.01;
lInf = 0.01;
}
test(lp, input, backendId, targetId, false, l1, lInf);
}
INSTANTIATE_TEST_CASE_P(Layer_Test_Halide, LRN, Combine(

View File

@ -169,8 +169,17 @@ TEST_P(Test_Caffe_layers, Softmax)
TEST_P(Test_Caffe_layers, LRN)
{
testLayerUsingCaffeModels("layer_lrn_spatial");
testLayerUsingCaffeModels("layer_lrn_channels");
double l1 = 0.0, lInf = 0.0;
// The OpenCL kernels use the native_ math functions which have
// implementation defined accuracy, so we use relaxed thresholds. See
// https://github.com/opencv/opencv/issues/9821 for more details.
if (target == DNN_TARGET_OPENCL)
{
l1 = 0.01;
lInf = 0.01;
}
testLayerUsingCaffeModels("layer_lrn_spatial", false, true, l1, lInf);
testLayerUsingCaffeModels("layer_lrn_channels", false, true, l1, lInf);
}
TEST_P(Test_Caffe_layers, Convolution)

View File

@ -664,6 +664,26 @@ TEST_P(Test_ONNX_layers, Slice)
#endif
}
TEST_P(Test_ONNX_layers, Slice_Steps_2DInput)
{
testONNXModels("slice_opset_11_steps_2d");
}
TEST_P(Test_ONNX_layers, Slice_Steps_3DInput)
{
testONNXModels("slice_opset_11_steps_3d");
}
TEST_P(Test_ONNX_layers, Slice_Steps_4DInput)
{
testONNXModels("slice_opset_11_steps_4d");
}
TEST_P(Test_ONNX_layers, Slice_Steps_5DInput)
{
testONNXModels("slice_opset_11_steps_5d");
}
TEST_P(Test_ONNX_layers, Softmax)
{
testONNXModels("softmax");

View File

@ -258,6 +258,14 @@ TEST_P(Test_Torch_layers, net_conv_gemm_lrn)
l1 = 0.0042;
lInf = 0.021;
}
// The OpenCL kernels use the native_ math functions which have
// implementation defined accuracy, so we use relaxed thresholds. See
// https://github.com/opencv/opencv/issues/9821 for more details.
else if (target == DNN_TARGET_OPENCL)
{
l1 = 0.02;
lInf = 0.02;
}
runTorchNet("net_conv_gemm_lrn", "", false, true, true, l1, lInf);
}

View File

@ -0,0 +1,13 @@
diff --git a/inference-engine/src/CMakeLists.txt b/inference-engine/src/CMakeLists.txt
index 0ba0dd78..7d34e7cb 100644
--- a/inference-engine/src/CMakeLists.txt
+++ b/inference-engine/src/CMakeLists.txt
@@ -26,7 +26,7 @@ endif()
add_subdirectory(hetero_plugin)
-add_subdirectory(multi_device)
+#add_subdirectory(multi_device)
add_subdirectory(transformations)

View File

@ -0,0 +1,219 @@
diff --git a/cmake/developer_package/add_ie_target.cmake b/cmake/developer_package/add_ie_target.cmake
index b081a6945..5468f09f0 100644
--- a/cmake/developer_package/add_ie_target.cmake
+++ b/cmake/developer_package/add_ie_target.cmake
@@ -91,7 +91,7 @@ function(addIeTarget)
if (ARG_TYPE STREQUAL EXECUTABLE)
add_executable(${ARG_NAME} ${all_sources})
elseif(ARG_TYPE STREQUAL STATIC OR ARG_TYPE STREQUAL SHARED)
- add_library(${ARG_NAME} ${ARG_TYPE} ${all_sources})
+ add_library(${ARG_NAME} ${ARG_TYPE} EXCLUDE_FROM_ALL ${all_sources})
else()
message(SEND_ERROR "Invalid target type ${ARG_TYPE} specified for target name ${ARG_NAME}")
endif()
diff --git a/inference-engine/CMakeLists.txt b/inference-engine/CMakeLists.txt
index 95c657222..3ab53f854 100644
--- a/inference-engine/CMakeLists.txt
+++ b/inference-engine/CMakeLists.txt
@@ -39,7 +39,7 @@ if(ENABLE_TESTS)
add_subdirectory(tests)
endif()
-add_subdirectory(tools)
+#add_subdirectory(tools)
function(ie_build_samples)
# samples should be build with the same flags as from OpenVINO package,
@@ -58,7 +58,7 @@ endfunction()
# gflags and format_reader targets are kept inside of samples directory and
# they must be built even if samples build is disabled (required for tests and tools).
-ie_build_samples()
+#ie_build_samples()
if (ENABLE_PYTHON)
add_subdirectory(ie_bridges/python)
@@ -138,7 +138,7 @@ endif()
# Developer package
#
-openvino_developer_export_targets(COMPONENT openvino_common TARGETS format_reader)
+#openvino_developer_export_targets(COMPONENT openvino_common TARGETS format_reader)
openvino_developer_export_targets(COMPONENT ngraph TARGETS ${NGRAPH_LIBRARIES})
# for Template plugin
@@ -146,7 +146,7 @@ if(NGRAPH_INTERPRETER_ENABLE)
openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph_backend interpreter_backend)
endif()
-ie_developer_export()
+#ie_developer_export()
configure_file(
"${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in"
diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt
index 1ea322763..b5c25837d 100644
--- a/inference-engine/src/inference_engine/CMakeLists.txt
+++ b/inference-engine/src/inference_engine/CMakeLists.txt
@@ -95,7 +95,7 @@ add_cpplint_target(${TARGET_NAME}_plugin_api_cpplint FOR_SOURCES ${plugin_api_sr
# Create object library
-add_library(${TARGET_NAME}_obj OBJECT
+add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL
${LIBRARY_SRC}
${LIBRARY_HEADERS}
${PUBLIC_HEADERS})
@@ -156,7 +156,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
# Static library used for unit tests which are always built
-add_library(${TARGET_NAME}_s STATIC
+add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL
$<TARGET_OBJECTS:${TARGET_NAME}_legacy_obj>
$<TARGET_OBJECTS:${TARGET_NAME}_obj>
${IE_STATIC_DEPENDENT_FILES})
diff --git a/inference-engine/src/legacy_api/CMakeLists.txt b/inference-engine/src/legacy_api/CMakeLists.txt
index 66498fdbd..4a6c7f619 100644
--- a/inference-engine/src/legacy_api/CMakeLists.txt
+++ b/inference-engine/src/legacy_api/CMakeLists.txt
@@ -26,7 +26,7 @@ endif()
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
-add_library(${TARGET_NAME}_obj OBJECT
+add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL
${LIBRARY_SRC}
${PUBLIC_HEADERS})
diff --git a/inference-engine/src/mkldnn_plugin/CMakeLists.txt b/inference-engine/src/mkldnn_plugin/CMakeLists.txt
index 73c7ba9f9..e8cf8d9f9 100644
--- a/inference-engine/src/mkldnn_plugin/CMakeLists.txt
+++ b/inference-engine/src/mkldnn_plugin/CMakeLists.txt
@@ -78,7 +78,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
# add test object library
-add_library(${TARGET_NAME}_obj OBJECT ${SOURCES} ${HEADERS})
+add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL ${SOURCES} ${HEADERS})
target_link_libraries(${TARGET_NAME}_obj PUBLIC mkldnn)
target_include_directories(${TARGET_NAME}_obj PRIVATE $<TARGET_PROPERTY:inference_engine_preproc_s,INTERFACE_INCLUDE_DIRECTORIES>
diff --git a/inference-engine/src/preprocessing/CMakeLists.txt b/inference-engine/src/preprocessing/CMakeLists.txt
index 973fafcbf..d886d6aa4 100644
--- a/inference-engine/src/preprocessing/CMakeLists.txt
+++ b/inference-engine/src/preprocessing/CMakeLists.txt
@@ -101,7 +101,7 @@ endif()
# Create object library
-add_library(${TARGET_NAME}_obj OBJECT
+add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL
${LIBRARY_SRC}
${LIBRARY_HEADERS})
@@ -153,7 +153,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
# Static library used for unit tests which are always built
-add_library(${TARGET_NAME}_s STATIC
+add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL
$<TARGET_OBJECTS:${TARGET_NAME}_obj>)
set_ie_threading_interface_for(${TARGET_NAME}_s)
diff --git a/inference-engine/src/vpu/common/CMakeLists.txt b/inference-engine/src/vpu/common/CMakeLists.txt
index 5c31c9a7a..adb170a5f 100644
--- a/inference-engine/src/vpu/common/CMakeLists.txt
+++ b/inference-engine/src/vpu/common/CMakeLists.txt
@@ -5,7 +5,7 @@
file(GLOB_RECURSE SOURCES *.cpp *.hpp *.h)
function(add_common_target TARGET_NAME STATIC_IE)
- add_library(${TARGET_NAME} STATIC ${SOURCES})
+ add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
ie_faster_build(${TARGET_NAME}
UNITY
@@ -62,7 +62,7 @@ add_common_target("vpu_common_lib" FALSE)
# Unit tests support for graph transformer
if(WIN32)
- add_common_target("vpu_common_lib_test_static" TRUE)
+ #add_common_target("vpu_common_lib_test_static" TRUE)
else()
add_library("vpu_common_lib_test_static" ALIAS "vpu_common_lib")
endif()
diff --git a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt
index 97bd4caa9..0f49ed144 100644
--- a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt
+++ b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt
@@ -5,7 +5,7 @@
file(GLOB_RECURSE SOURCES *.cpp *.hpp *.h *.inc)
function(add_graph_transformer_target TARGET_NAME STATIC_IE)
- add_library(${TARGET_NAME} STATIC ${SOURCES})
+ add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
set_ie_threading_interface_for(${TARGET_NAME})
@@ -63,7 +63,7 @@ add_graph_transformer_target("vpu_graph_transformer" FALSE)
# Unit tests support for graph transformer
if(WIN32)
- add_graph_transformer_target("vpu_graph_transformer_test_static" TRUE)
+ #add_graph_transformer_target("vpu_graph_transformer_test_static" TRUE)
else()
add_library("vpu_graph_transformer_test_static" ALIAS "vpu_graph_transformer")
endif()
diff --git a/inference-engine/thirdparty/pugixml/CMakeLists.txt b/inference-engine/thirdparty/pugixml/CMakeLists.txt
index 8bcb2801a..5a17fa3f7 100644
--- a/inference-engine/thirdparty/pugixml/CMakeLists.txt
+++ b/inference-engine/thirdparty/pugixml/CMakeLists.txt
@@ -41,7 +41,7 @@ if(BUILD_SHARED_LIBS)
else()
add_library(pugixml STATIC ${SOURCES})
if (MSVC)
- add_library(pugixml_mt STATIC ${SOURCES})
+ #add_library(pugixml_mt STATIC ${SOURCES})
#if (WIN32)
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
diff --git a/ngraph/core/builder/CMakeLists.txt b/ngraph/core/builder/CMakeLists.txt
index 13b31ee17..be613b65f 100644
--- a/ngraph/core/builder/CMakeLists.txt
+++ b/ngraph/core/builder/CMakeLists.txt
@@ -28,7 +28,7 @@ source_group("src" FILES ${LIBRARY_SRC})
source_group("include" FILES ${PUBLIC_HEADERS})
# Create shared library
-add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS})
+add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS})
if(COMMAND ie_faster_build)
ie_faster_build(${TARGET_NAME}
diff --git a/ngraph/core/reference/CMakeLists.txt b/ngraph/core/reference/CMakeLists.txt
index 62749a650..dc857f853 100644
--- a/ngraph/core/reference/CMakeLists.txt
+++ b/ngraph/core/reference/CMakeLists.txt
@@ -28,7 +28,7 @@ source_group("src" FILES ${LIBRARY_SRC})
source_group("include" FILES ${PUBLIC_HEADERS})
# Create shared library
-add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS})
+add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS})
if(COMMAND ie_faster_build)
ie_faster_build(${TARGET_NAME}
diff --git a/openvino/itt/CMakeLists.txt b/openvino/itt/CMakeLists.txt
index 648ac0a05..4291740d7 100644
--- a/openvino/itt/CMakeLists.txt
+++ b/openvino/itt/CMakeLists.txt
@@ -18,7 +18,7 @@ set(TARGET_NAME itt)
file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.hpp")
-add_library(${TARGET_NAME} STATIC ${SOURCES})
+add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
add_library(openvino::itt ALIAS ${TARGET_NAME})

View File

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f981ed2..90eb500a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,10 @@ endif()
project(OpenVINO)
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /FS")
+set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
+set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
+
set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(IE_MAIN_SOURCE_DIR ${OpenVINO_MAIN_SOURCE_DIR}/inference-engine)
list(APPEND CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake")

View File

@ -0,0 +1,16 @@
diff --git a/cmake/developer_package/vs_version/vs_version.cmake b/cmake/developer_package/vs_version/vs_version.cmake
index d857e2e4..453903fd 100644
--- a/cmake/developer_package/vs_version/vs_version.cmake
+++ b/cmake/developer_package/vs_version/vs_version.cmake
@@ -22,9 +22,9 @@ if(IE_VS_VER_HAS_VERSION)
endif()
set(IE_VS_VER_PRODUCTVERSION_STR "${CI_BUILD_NUMBER}")
-set(IE_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit")
+set(IE_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit (for OpenCV Windows package)")
set(IE_VS_VER_COPYRIGHT_STR "Copyright (C) 2018-2020, Intel Corporation")
-set(IE_VS_VER_COMMENTS_STR "https://docs.openvinotoolkit.org/")
+set(IE_VS_VER_COMMENTS_STR "https://github.com/opencv/opencv/wiki/Intel%27s-Deep-Learning-Inference-Engine-backend")
#
# ie_add_vs_version_file(NAME <name>

View File

@ -0,0 +1,3 @@
os.environ['CI_BUILD_NUMBER'] = '2021.3.0-opencv_winpack_dldt'
cmake_vars['ENABLE_V10_SERIALIZE'] = 'ON'

View File

@ -0,0 +1,4 @@
applyPatch('20210324-dldt-disable-unused-targets.patch')
applyPatch('20210324-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20210324-dldt-vs-version.patch')

View File

@ -0,0 +1,55 @@
sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin')
copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph')
#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')
build_config = 'Release' if not self.config.build_debug else 'Debug'
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config
def copy_bin(name):
global build_bin_dir, sysroot_bin_dir
copytree(build_bin_dir / name, sysroot_bin_dir / name)
dll_suffix = 'd' if self.config.build_debug else ''
def copy_dll(name):
global copy_bin, dll_suffix
copy_bin(name + dll_suffix + '.dll')
copy_bin(name + dll_suffix + '.pdb')
copy_bin('cache.json')
copy_dll('clDNNPlugin')
copy_dll('HeteroPlugin')
copy_dll('inference_engine')
copy_dll('inference_engine_ir_reader')
copy_dll('inference_engine_ir_v7_reader')
copy_dll('inference_engine_legacy')
copy_dll('inference_engine_transformations') # runtime
copy_dll('inference_engine_lp_transformations') # runtime
copy_dll('MKLDNNPlugin') # runtime
copy_dll('myriadPlugin') # runtime
#copy_dll('MultiDevicePlugin') # runtime, not used
copy_dll('ngraph')
copy_bin('plugins.xml')
copy_bin('pcie-ma2x8x.elf')
copy_bin('usb-ma2x8x.mvcmd')
copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb' / 'bin', sysroot_bin_dir)
copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb', self.sysrootdir / 'tbb')
sysroot_ie_dir = prepare_dir(self.sysrootdir / 'deployment_tools' / 'inference_engine')
sysroot_ie_lib_dir = prepare_dir(sysroot_ie_dir / 'lib' / 'intel64')
copytree(self.srcdir / 'inference-engine' / 'include', sysroot_ie_dir / 'include')
if not self.config.build_debug:
copytree(build_bin_dir / 'ngraph.lib', sysroot_ie_lib_dir / 'ngraph.lib')
copytree(build_bin_dir / 'inference_engine.lib', sysroot_ie_lib_dir / 'inference_engine.lib')
copytree(build_bin_dir / 'inference_engine_ir_reader.lib', sysroot_ie_lib_dir / 'inference_engine_ir_reader.lib')
copytree(build_bin_dir / 'inference_engine_legacy.lib', sysroot_ie_lib_dir / 'inference_engine_legacy.lib')
else:
copytree(build_bin_dir / 'ngraphd.lib', sysroot_ie_lib_dir / 'ngraphd.lib')
copytree(build_bin_dir / 'inference_engined.lib', sysroot_ie_lib_dir / 'inference_engined.lib')
copytree(build_bin_dir / 'inference_engine_ir_readerd.lib', sysroot_ie_lib_dir / 'inference_engine_ir_readerd.lib')
copytree(build_bin_dir / 'inference_engine_legacyd.lib', sysroot_ie_lib_dir / 'inference_engine_legacyd.lib')
sysroot_license_dir = prepare_dir(self.sysrootdir / 'etc' / 'licenses')
copytree(self.srcdir / 'LICENSE', sysroot_license_dir / 'dldt-LICENSE')
copytree(self.sysrootdir / 'tbb/LICENSE', sysroot_license_dir / 'tbb-LICENSE')

View File

@ -300,7 +300,9 @@ class BuilderDLDT:
# build
cmd = [self.cmake_path, '--build', '.', '--config', build_config, # '--target', 'install',
'--', '/v:n', '/m:2', '/consoleloggerparameters:NoSummary'
'--',
# '/m:2' is removed, not properly supported by 2021.3
'/v:n', '/consoleloggerparameters:NoSummary',
]
execute(cmd, cwd=build_dir)
@ -382,9 +384,18 @@ class Builder:
)
cmake_vars['INF_ENGINE_LIB_DIRS:PATH'] = str(builderDLDT.sysrootdir / 'deployment_tools/inference_engine/lib/intel64')
assert os.path.exists(cmake_vars['INF_ENGINE_LIB_DIRS:PATH']), cmake_vars['INF_ENGINE_LIB_DIRS:PATH']
cmake_vars['INF_ENGINE_INCLUDE_DIRS:PATH'] = str(builderDLDT.sysrootdir / 'deployment_tools/inference_engine/include')
cmake_vars['ngraph_DIR:PATH'] = str(builderDLDT.sysrootdir / 'ngraph/cmake')
assert os.path.exists(cmake_vars['INF_ENGINE_INCLUDE_DIRS:PATH']), cmake_vars['INF_ENGINE_INCLUDE_DIRS:PATH']
ngraph_DIR = str(builderDLDT.sysrootdir / 'ngraph/cmake')
if not os.path.exists(ngraph_DIR):
ngraph_DIR = str(builderDLDT.sysrootdir / 'ngraph/deployment_tools/ngraph/cmake')
assert os.path.exists(ngraph_DIR), ngraph_DIR
cmake_vars['ngraph_DIR:PATH'] = ngraph_DIR
cmake_vars['TBB_DIR:PATH'] = str(builderDLDT.sysrootdir / 'tbb/cmake')
assert os.path.exists(cmake_vars['TBB_DIR:PATH']), cmake_vars['TBB_DIR:PATH']
if self.config.build_debug:
cmake_vars['CMAKE_BUILD_TYPE'] = 'Debug'
@ -455,8 +466,8 @@ class Builder:
def main():
dldt_src_url = 'https://github.com/openvinotoolkit/openvino'
dldt_src_commit = '2021.2'
dldt_release = '2021020000'
dldt_src_commit = '2021.3'
dldt_release = '2021030000'
build_cache_dir_default = os.environ.get('BUILD_CACHE_DIR', '.build_cache')
build_subst_drive = os.environ.get('BUILD_SUBST_DRIVE', None)
@ -514,8 +525,12 @@ def main():
args.opencv_dir = os.path.abspath(args.opencv_dir)
if not args.dldt_config:
if args.dldt_src_commit == 'releases/2020/4' or args.dldt_src_branch == 'releases/2020/4':
args.dldt_config = '2020.4'
if str(args.dldt_src_commit).startswith('releases/20'): # releases/2020/4
args.dldt_config = str(args.dldt_src_commit)[len('releases/'):].replace('/', '.')
if not args.dldt_src_branch:
args.dldt_src_branch = args.dldt_src_commit
elif str(args.dldt_src_branch).startswith('releases/20'): # releases/2020/4
args.dldt_config = str(args.dldt_src_branch)[len('releases/'):].replace('/', '.')
else:
args.dldt_config = args.dldt_src_commit