Deprecated legacy pre-processing dynamic and NV12/i420 API (#14565)

* Deprecated legacy pre-processing dynamic and NV12/i420 API

* Remove OPENVINO_DEPRECATED from headers

* Fixed code style

* Removed new macros

* Add doxygen deprecated messages
This commit is contained in:
Ilya Churaev 2022-12-13 00:11:42 +04:00 committed by GitHub
parent 8ba632f690
commit a234d45b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 45 additions and 3 deletions

View File

@ -257,6 +257,7 @@ void validateColorFormats(const G::Desc &in_desc,
if (desc.d.C != 4) throw_invalid_number_of_channels();
break;
}
IE_SUPPRESS_DEPRECATED_START
case ColorFormat::NV12: {
if (desc.d.C != 2) throw_invalid_number_of_channels();
break;
@ -265,6 +266,7 @@ void validateColorFormats(const G::Desc &in_desc,
if (desc.d.C != 3) throw_invalid_number_of_channels();
break;
}
IE_SUPPRESS_DEPRECATED_END
default: break;
}
@ -283,9 +285,11 @@ void validateColorFormats(const G::Desc &in_desc,
IE_THROW() << "Network's expected color format is unspecified";
}
IE_SUPPRESS_DEPRECATED_START
if (output_color_format == ColorFormat::NV12 || output_color_format == ColorFormat::I420) {
IE_THROW() << "NV12/I420 network's color format is not supported [by G-API]";
}
IE_SUPPRESS_DEPRECATED_END
verify_layout(in_layout, "Input blob");
verify_layout(out_layout, "Network's blob");
@ -489,6 +493,7 @@ class PlanarColorConversions {
public:
PlanarColorConversions() {
IE_SUPPRESS_DEPRECATED_START
m_conversions = {
{ {ColorFormat::RGB, ColorFormat::BGR}, reverse3 },
{ {ColorFormat::BGR, ColorFormat::RGB}, reverse3 },
@ -501,6 +506,7 @@ public:
{ {ColorFormat::I420, ColorFormat::BGR}, I420toBGR },
{ {ColorFormat::I420, ColorFormat::RGB}, I420toRGB }
};
IE_SUPPRESS_DEPRECATED_END
}
const CvtFunction& at(ColorFormat in_fmt, ColorFormat out_fmt) const {
@ -567,8 +573,10 @@ cv::GComputation buildGraph(const G::Desc &in_desc,
// 1. Requires interleaved image of type CV_8UC3/CV_8UC4 (except for NV12/I420 input)
// 2. Supports bilinear resize only
// 3. Supports NV12/I420 -> RGB/BGR color transformations
IE_SUPPRESS_DEPRECATED_START
const bool nv12_input = (input_color_format == ColorFormat::NV12);
const bool i420_input = (input_color_format == ColorFormat::I420);
IE_SUPPRESS_DEPRECATED_END
const bool specific_yuv420_input_handling = (nv12_input || i420_input)
&& (output_color_format == ColorFormat::RGB || output_color_format == ColorFormat::BGR);
const auto io_color_formats = std::make_tuple(input_color_format, output_color_format);
@ -991,6 +999,7 @@ void PreprocEngine::preprocessWithGAPI(const Blob::Ptr &inBlob, Blob::Ptr &outBl
// if input color format is not NV12, a MemoryBlob is expected. otherwise, NV12Blob is expected
switch (in_fmt) {
IE_SUPPRESS_DEPRECATED_START
case ColorFormat::NV12: {
auto inNV12Blob = as<NV12Blob>(inBlob);
if (!inNV12Blob) {
@ -1009,6 +1018,7 @@ void PreprocEngine::preprocessWithGAPI(const Blob::Ptr &inBlob, Blob::Ptr &outBl
return preprocessBlob(inI420Blob, outMemoryBlob, algorithm, in_fmt, out_fmt, omp_serial,
batch_size);
}
IE_SUPPRESS_DEPRECATED_END
default:
auto inMemoryBlob = as<MemoryBlob>(inBlob);

View File

@ -107,12 +107,14 @@ public:
Blob::Ptr GetBlob(const std::string& name);
/**
* @deprecated This method will be removed in 2023.1 release
* @brief Sets blob with a pre-process information
* @note Returns an error in case if data blob is output
* @param name Name of input blob.
* @param data A reference to input. The type of Blob must correspond to the network input precision and size.
* @param info Preprocess info for blob.
*/
INFERENCE_ENGINE_DEPRECATED("This method is deprecated and will be removed in 2023.1 release")
void SetBlob(const std::string& name, const Blob::Ptr& data, const PreProcessInfo& info);
/**

View File

@ -33,12 +33,24 @@
#if defined(_WIN32)
# define INFERENCE_ENGINE_DEPRECATED(msg) __declspec(deprecated(msg))
# if __cplusplus >= 201402L
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) [[deprecated(msg)]]
# else
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
# endif
#elif defined __INTEL_COMPILER
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) INFERENCE_ENGINE_DEPRECATED(msg)
#elif defined(__GNUC__)
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ < 6 && !defined(__clang__)
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
# else
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) INFERENCE_ENGINE_DEPRECATED(msg)
# endif
#else
# define INFERENCE_ENGINE_DEPRECATED(msg)
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996

View File

@ -145,8 +145,12 @@ enum ColorFormat : uint32_t {
BGR, ///< BGR color format, default in OpenVINO
RGBX, ///< RGBX color format with X ignored during inference
BGRX, ///< BGRX color format with X ignored during inference
NV12, ///< NV12 color format represented as compound Y+UV blob
I420, ///< I420 color format represented as compound Y+U+V blob
NV12 INFERENCE_ENGINE_ENUM_DEPRECATED(
"This type is deprecated and will be removed in 2023.1 release"), ///< NV12 color format represented as
///< compound Y+UV blob
I420 INFERENCE_ENGINE_ENUM_DEPRECATED(
"This type is deprecated and will be removed in 2023.1 release"), ///< I420 color format represented as
///< compound Y+U+V blob
};
/**
@ -167,8 +171,10 @@ inline std::ostream& operator<<(std::ostream& out, const ColorFormat& fmt) {
PRINT_COLOR_FORMAT(BGR);
PRINT_COLOR_FORMAT(RGBX);
PRINT_COLOR_FORMAT(BGRX);
IE_SUPPRESS_DEPRECATED_START
PRINT_COLOR_FORMAT(NV12);
PRINT_COLOR_FORMAT(I420);
IE_SUPPRESS_DEPRECATED_END
#undef PRINT_COLOR_FORMAT
default:

View File

@ -77,6 +77,7 @@ public:
virtual StatusCode GetBlob(const char* name, Blob::Ptr& data, ResponseDesc* resp) noexcept = 0;
/**
* @deprecated This method will be removed in 2023.1 release
* @brief Sets pre-process for input data
* @param name Name of input blob.
* @param data Reference to input or output blob. The type of Blob must match the network input precision and size.
@ -84,6 +85,7 @@ public:
* @param resp Optional: pointer to an already allocated object to contain information in case of failure
* @return Status code of the operation: OK (0) for success
*/
INFERENCE_ENGINE_DEPRECATED("This method is deprecated and will be removed in 2023.1 release")
virtual StatusCode SetBlob(const char* name,
const Blob::Ptr& data,
const PreProcessInfo& info,

View File

@ -24,7 +24,9 @@ TEST(InferRequestCPPTests, throwsOnUninitializedGetBlob) {
TEST(InferRequestCPPTests, throwsOnUninitializedSetBlobPreproc) {
InferRequest req;
IE_SUPPRESS_DEPRECATED_START
ASSERT_THROW(req.SetBlob({}, {}, {}), InferenceEngine::NotAllocated);
IE_SUPPRESS_DEPRECATED_END
}
TEST(InferRequestCPPTests, throwsOnUninitializedGetPreProcess) {

View File

@ -163,6 +163,7 @@ test::Scalar to_test(cv::Scalar const& sc) { return {sc[0], sc[1], sc[2], sc[3]}
cv::ColorConversionCodes toCvtColorCode(InferenceEngine::ColorFormat in,
InferenceEngine::ColorFormat out) {
using namespace InferenceEngine;
IE_SUPPRESS_DEPRECATED_START
static const std::map<std::pair<ColorFormat, ColorFormat>, cv::ColorConversionCodes> types = {
{{ColorFormat::RGBX, ColorFormat::BGRX}, cv::COLOR_RGBA2BGRA},
{{ColorFormat::RGBX, ColorFormat::BGR}, cv::COLOR_RGBA2BGR},
@ -179,6 +180,7 @@ cv::ColorConversionCodes toCvtColorCode(InferenceEngine::ColorFormat in,
{{ColorFormat::NV12, ColorFormat::BGR}, cv::COLOR_YUV2BGR_NV12},
{{ColorFormat::NV12, ColorFormat::RGB}, cv::COLOR_YUV2RGB_NV12}
};
IE_SUPPRESS_DEPRECATED_END
return types.at(std::make_pair(in, out));
}
@ -826,6 +828,8 @@ TEST_P(ResizeTestIE, AccuracyTest)
}
}
IE_SUPPRESS_DEPRECATED_START
TEST_P(ColorConvertTestIE, AccuracyTest)
{
using namespace InferenceEngine;

View File

@ -268,6 +268,7 @@ INSTANTIATE_TEST_SUITE_P(ColorConvertFluid_4ch, ColorConvertTestIE,
Values(TEST_SIZES),
Values(0)));
IE_SUPPRESS_DEPRECATED_START
INSTANTIATE_TEST_SUITE_P(ColorConvertYUV420Fluid, ColorConvertYUV420TestIE,
Combine(Values(InferenceEngine::NV12, InferenceEngine::I420),
Values(InferenceEngine::NHWC, InferenceEngine::NCHW),
@ -281,6 +282,7 @@ INSTANTIATE_TEST_SUITE_P(ColorConvertYUV420Fluid, ColorConvertYUV420TestIE,
cv::Size( 300, 300),
cv::Size( 150, 150)),
Values(1)));
IE_SUPPRESS_DEPRECATED_END
INSTANTIATE_TEST_SUITE_P(Reorder_HWC2CHW, ColorConvertTestIE,
Combine(Values(CV_8U, CV_32F, CV_16S, CV_16F),
@ -402,6 +404,7 @@ INSTANTIATE_TEST_SUITE_P(ColorFormats_4ch, PreprocTest,
Values(std::make_pair(4, 3)),
Values(TEST_SIZES_PREPROC)));
IE_SUPPRESS_DEPRECATED_START
INSTANTIATE_TEST_SUITE_P(ColorFormat_NV12, PreprocTest,
Combine(Values(U8toU8),
Values(IE::ResizeAlgorithm::RESIZE_BILINEAR, IE::ResizeAlgorithm::RESIZE_AREA),
@ -410,6 +413,7 @@ INSTANTIATE_TEST_SUITE_P(ColorFormat_NV12, PreprocTest,
Values(IE::Layout::NHWC, IE::Layout::NCHW),
Values(std::make_pair(1, 3)),
Values(TEST_SIZES_PREPROC)));
IE_SUPPRESS_DEPRECATED_END
INSTANTIATE_TEST_SUITE_P(PlainPrecisionConversions, PreprocTest,