OpenCV build switched off by default [2022/1.1] (#12358)

* OCV build off by default

* OCV on in the Linux Azure pipeline

* Copy of OCV in the linux pipeline
This commit is contained in:
Tomasz Dołbniak 2022-08-02 20:01:26 +02:00 committed by GitHub
parent c62251c89a
commit 39aba80957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 43 additions and 62 deletions

View File

@ -110,7 +110,6 @@ jobs:
-DANDROID_ABI=$(ANDROID_ABI_CONFIG)
-DANDROID_STL=c++_shared
-DANDROID_PLATFORM=$(ANDROID_SDK_VERSION)
-DENABLE_OPENCV=OFF
-DENABLE_TESTS=ON
-DENABLE_SAMPLES=ON
-DENABLE_INTEL_MYRIAD=OFF

View File

@ -157,6 +157,7 @@ jobs:
-DENABLE_FASTER_BUILD=ON
-DENABLE_STRICT_DEPENDENCIES=OFF
-DENABLE_REQUIREMENTS_INSTALL=OFF
-DENABLE_OPENCV=ON
-DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_C_COMPILER_LAUNCHER=ccache

View File

@ -127,7 +127,6 @@ jobs:
-GNinja
-DVERBOSE_BUILD=ON
-DOpenCV_DIR=$(INSTALL_OPENCV)/cmake
-DENABLE_OPENCV=OFF
-DPYTHON_INCLUDE_DIRS=$(INSTALL_PYTHON)/include/python3.8
-DPYTHON_LIBRARY=$(INSTALL_PYTHON)/lib/libpython3.8.so
-DENABLE_PYTHON=ON

View File

@ -95,7 +95,6 @@ jobs:
-DPYTHON_EXECUTABLE=/usr/bin/python3.8
-DENABLE_INTEL_MYRIAD_COMMON=OFF
-DENABLE_INTEL_GNA=OFF
-DENABLE_OPENCV=OFF
-DENABLE_CPPLINT=OFF
-DENABLE_TESTS=OFF
-DENABLE_INTEL_CPU=ON

View File

@ -145,7 +145,6 @@ jobs:
set -e
mkdir -p $(INSTALL_DIR)/opencv/
cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake
cp -R $(REPO_DIR)/temp/opencv_4.5.2_osx/opencv/* $(INSTALL_DIR)/opencv/
workingDirectory: $(BUILD_DIR)
displayName: 'Install tests'

View File

@ -169,7 +169,7 @@ jobs:
workingDirectory: $(BUILD_SAMPLES_TESTS_DIR)
displayName: 'Install Samples Tests'
- script: $(CMAKE_CMD) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake && xcopy $(REPO_DIR)\temp\opencv_4.5.2\opencv\* $(INSTALL_DIR)\opencv\ /e /h /y
- script: $(CMAKE_CMD) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake
workingDirectory: $(BUILD_DIR)
displayName: 'Install tests'

View File

@ -59,7 +59,6 @@ RUN cmake .. \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_INTEL_MYRIAD_COMMON=OFF \
-DENABLE_INTEL_GNA=OFF \
-DENABLE_OPENCV=OFF \
-DENABLE_CPPLINT=OFF \
-DENABLE_NCC_STYLE=OFF \
-DENABLE_TESTS=OFF \

View File

@ -126,7 +126,7 @@ ie_dependent_option (ENABLE_FUNCTIONAL_TESTS "functional tests" ON "ENABLE_TESTS
ie_dependent_option (ENABLE_SAMPLES "console samples are part of inference engine package" ON "NOT MINGW" OFF)
ie_option (ENABLE_OPENCV "enables OpenCV" ON)
ie_option (ENABLE_OPENCV "enables OpenCV" OFF)
ie_option (ENABLE_V7_SERIALIZE "enables serialization to IR v7" OFF)

View File

@ -4,17 +4,9 @@
set(TARGET_NAME "InferenceEngineCAPITests")
# Find OpenCV components if exist
find_package(OpenCV COMPONENTS core imgproc imgcodecs QUIET)
if(NOT OpenCV_FOUND)
message(WARNING "OPENCV is disabled or not found, ${TARGET_NAME} is disabled")
return()
endif()
add_executable(${TARGET_NAME} ie_c_api_test.cpp test_model_repo.hpp)
target_link_libraries(${TARGET_NAME} PRIVATE openvino_c ${OpenCV_LIBRARIES}
commonTestUtils gtest_main)
target_link_libraries(${TARGET_NAME} PRIVATE openvino_c commonTestUtils gtest_main)
target_compile_definitions(${TARGET_NAME}
PRIVATE

View File

@ -5,7 +5,6 @@
#include <gtest/gtest.h>
#include <stdio.h>
#include <stdlib.h>
#include <opencv2/opencv.hpp>
#include <condition_variable>
#include <mutex>
#include <c_api/ie_c_api.h>
@ -15,12 +14,10 @@
std::string xml_std = TestDataHelpers::generate_model_path("test_model", "test_model_fp32.xml"),
bin_std = TestDataHelpers::generate_model_path("test_model", "test_model_fp32.bin"),
input_image_std = TestDataHelpers::generate_image_path("224x224", "dog.bmp"),
input_image_nv12_std = TestDataHelpers::generate_image_path("224x224", "dog6.yuv");
const char* xml = xml_std.c_str();
const char* bin = bin_std.c_str();
const char* input_image = input_image_std.c_str();
const char* input_image_nv12 = input_image_nv12_std.c_str();
std::mutex m;
@ -58,29 +55,6 @@ size_t read_image_from_file(const char* img_path, unsigned char *img_data, size_
return read_size;
}
void Mat2Blob(const cv::Mat& img, ie_blob_t *blob)
{
dimensions_t dimenison;
IE_EXPECT_OK(ie_blob_get_dims(blob, &dimenison));
size_t channels = dimenison.dims[1];
size_t width = dimenison.dims[3];
size_t height = dimenison.dims[2];
ie_blob_buffer_t buffer;
IE_EXPECT_OK(ie_blob_get_buffer(blob, &buffer));
uint8_t *blob_data = (uint8_t *)(buffer.buffer);
cv::Mat resized_image;
cv::resize(img, resized_image, cv::Size(width, height));
for (size_t c = 0; c < channels; c++) {
for (size_t h = 0; h < height; h++) {
for (size_t w = 0; w < width; w++) {
blob_data[c * width * height + h * width + w] =
resized_image.at<cv::Vec3b>(h, w)[c];
}
}
}
}
size_t find_device(ie_available_devices_t avai_devices, const char *device_name) {
for (size_t i = 0; i < avai_devices.num_devices; ++i) {
if (strstr(avai_devices.devices[i], device_name))
@ -363,7 +337,7 @@ TEST(ie_core_import_network_from_memory, importNetworkFromMem) {
std::string export_path = TestDataHelpers::generate_model_path("test_model", "exported_model.blob");
IE_EXPECT_OK(ie_core_export_network(exe_network, export_path.c_str()));
std::vector<uchar> buffer(content_from_file(export_path.c_str(), true));
std::vector<uint8_t> buffer(content_from_file(export_path.c_str(), true));
ie_executable_network_t *network = nullptr;
IE_EXPECT_OK(ie_core_import_network_from_memory(core, buffer.data(), buffer.size(), "HETERO:CPU", nullptr, &network));
@ -1189,9 +1163,14 @@ TEST(ie_infer_request_infer, infer) {
ie_blob_t *blob = nullptr;
IE_EXPECT_OK(ie_infer_request_get_blob(infer_request, "data", &blob));
dimensions_t dims;
IE_EXPECT_OK(ie_blob_get_dims(blob, &dims));
const size_t blob_elems_count = dims.dims[0] * dims.dims[1] * dims.dims[2] * dims.dims[3];
cv::Mat image = cv::imread(input_image);
Mat2Blob(image, blob);
ie_blob_buffer_t buffer;
IE_EXPECT_OK(ie_blob_get_buffer(blob, &buffer));
auto* blob_internal_buffer = (uint8_t*)buffer.buffer;
std::fill(blob_internal_buffer, blob_internal_buffer + blob_elems_count, uint8_t{0});
IE_EXPECT_OK(ie_infer_request_infer(infer_request));
@ -1202,9 +1181,9 @@ TEST(ie_infer_request_infer, infer) {
EXPECT_EQ(dim_res.ranks, 2);
EXPECT_EQ(dim_res.dims[1], 10);
ie_blob_buffer_t buffer;
IE_EXPECT_OK(ie_blob_get_buffer(output_blob, &buffer));
float *output_data = (float *)(buffer.buffer);
ie_blob_buffer_t out_buffer;
IE_EXPECT_OK(ie_blob_get_buffer(output_blob, &out_buffer));
float *output_data = (float *)(out_buffer.buffer);
EXPECT_NEAR(output_data[9], 0.f, 1.e-5);
ie_blob_free(&output_blob);
@ -1239,9 +1218,14 @@ TEST(ie_infer_request_infer_async, inferAsyncWaitFinish) {
ie_blob_t *blob = nullptr;
IE_EXPECT_OK(ie_infer_request_get_blob(infer_request, "data", &blob));
dimensions_t dims;
IE_EXPECT_OK(ie_blob_get_dims(blob, &dims));
const size_t blob_elems_count = dims.dims[0] * dims.dims[1] * dims.dims[2] * dims.dims[3];
cv::Mat image = cv::imread(input_image);
Mat2Blob(image, blob);
ie_blob_buffer_t buffer;
IE_EXPECT_OK(ie_blob_get_buffer(blob, &buffer));
auto* blob_internal_buffer = (uint8_t*)buffer.buffer;
std::fill(blob_internal_buffer, blob_internal_buffer + blob_elems_count, uint8_t{0});
IE_EXPECT_OK(ie_infer_request_infer_async(infer_request));
@ -1252,9 +1236,9 @@ TEST(ie_infer_request_infer_async, inferAsyncWaitFinish) {
IE_EXPECT_OK(ie_infer_request_get_blob(infer_request, "fc_out", &output_blob));
EXPECT_NE(nullptr, output_blob);
ie_blob_buffer_t buffer;
IE_EXPECT_OK(ie_blob_get_buffer(output_blob, &buffer));
float *output_data = (float *)(buffer.buffer);
ie_blob_buffer_t out_buffer;
IE_EXPECT_OK(ie_blob_get_buffer(output_blob, &out_buffer));
float *output_data = (float *)(out_buffer.buffer);
EXPECT_NEAR(output_data[9], 0.f, 1.e-5);
}
@ -1291,9 +1275,14 @@ TEST(ie_infer_request_infer_async, inferAsyncWaitTime) {
IE_EXPECT_OK(ie_infer_request_get_blob(infer_request, "data", &blob));
EXPECT_NE(nullptr, blob);
dimensions_t dims;
IE_EXPECT_OK(ie_blob_get_dims(blob, &dims));
const size_t blob_elems_count = dims.dims[0] * dims.dims[1] * dims.dims[2] * dims.dims[3];
cv::Mat image = cv::imread(input_image);
Mat2Blob(image, blob);
ie_blob_buffer_t buffer;
IE_EXPECT_OK(ie_blob_get_buffer(blob, &buffer));
auto* blob_internal_buffer = (uint8_t*)buffer.buffer;
std::fill(blob_internal_buffer, blob_internal_buffer + blob_elems_count, uint8_t{0});
IE_EXPECT_OK(ie_infer_request_infer_async(infer_request));
@ -1307,9 +1296,9 @@ TEST(ie_infer_request_infer_async, inferAsyncWaitTime) {
IE_EXPECT_OK(ie_infer_request_get_blob(infer_request, "fc_out", &output_blob));
ie_blob_buffer_t buffer;
IE_EXPECT_OK(ie_blob_get_buffer(output_blob, &buffer));
float *output_data = (float *)(buffer.buffer);
ie_blob_buffer_t out_buffer;
IE_EXPECT_OK(ie_blob_get_buffer(output_blob, &out_buffer));
float *output_data = (float *)(out_buffer.buffer);
EXPECT_NEAR(output_data[9], 0.f, 1.e-5);
}
@ -1654,8 +1643,14 @@ TEST(ie_infer_set_completion_callback, setCallback) {
ie_blob_t *blob = nullptr;
IE_EXPECT_OK(ie_infer_request_get_blob(infer_request, "data", &blob));
cv::Mat image = cv::imread(input_image);
Mat2Blob(image, blob);
dimensions_t dims;
IE_EXPECT_OK(ie_blob_get_dims(blob, &dims));
const size_t blob_elems_count = dims.dims[0] * dims.dims[1] * dims.dims[2] * dims.dims[3];
ie_blob_buffer_t buffer;
IE_EXPECT_OK(ie_blob_get_buffer(blob, &buffer));
auto* blob_internal_buffer = (uint8_t*)buffer.buffer;
std::fill(blob_internal_buffer, blob_internal_buffer + blob_elems_count, uint8_t{0});
ie_complete_call_back_t callback;
callback.completeCallBackFunc = completion_callback;

View File

@ -45,7 +45,6 @@ set the mentioned flags to `ON`. Note the `CMAKE_INSTALL_PREFIX`, which defaults
cmake .. \
-DENABLE_INTEL_GPU=OFF \
-DENABLE_OPENCV=OFF \
-DENABLE_INTEL_MYRIAD_COMMON=OFF \
-DENABLE_PYTHON=ON \
-DENABLE_OV_ONNX_FRONTEND=ON \
@ -108,7 +107,6 @@ cmake .. ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX="%OPENVINO_BASEDIR%/openvino_dist" ^
-DENABLE_INTEL_GPU=OFF ^
-DENABLE_OPENCV=OFF ^
-DENABLE_INTEL_MYRIAD_COMMON=OFF ^
-DENABLE_OV_ONNX_FRONTEND=ON ^
-DENABLE_PYTHON=ON ^