[IE][VPU]: Add interpolate nearest 2x upscale optimization (#3315)
This commit is contained in:
parent
e1c9d91ece
commit
58aee75914
@ -15,14 +15,14 @@ include(dependency_solver)
|
||||
|
||||
set(VPU_SUPPORTED_FIRMWARES usb-ma2x8x pcie-ma2x8x)
|
||||
set(VPU_SUPPORTED_FIRMWARES_HASH
|
||||
"becaeea32805cc59a59fced0ed08235255a43a3c8535a36fa376351607b24ad6"
|
||||
"fa0303c0c073c68076190cb71ce8bf1cc04ade74ca9a7b5a538ceb99d24d3289")
|
||||
"2980b6d0726107888ec7ba02c43a245a699c19a0f1e25b54f0bb928c91bfa045"
|
||||
"c4692a7c3f44e6cdf6743c21d99570946d81ece9370fcd07725da95ad8fcd657")
|
||||
|
||||
#
|
||||
# Default packages
|
||||
#
|
||||
|
||||
set(FIRMWARE_PACKAGE_VERSION 1521)
|
||||
set(FIRMWARE_PACKAGE_VERSION 1532)
|
||||
set(VPU_CLC_MA2X8X_VERSION "movi-cltools-20.09.2")
|
||||
|
||||
#
|
||||
|
@ -61,6 +61,14 @@ void FrontEnd::parseInterpolate(const Model& model, const ie::CNNLayerPtr& _laye
|
||||
|
||||
if (cmp(coordinateTransformation, "asymmetric")) {
|
||||
coordinateTransformationMode = InterpolateCoordTransMode::Asymmetric;
|
||||
} else if (cmp(coordinateTransformation, "half_pixel")) {
|
||||
coordinateTransformationMode = InterpolateCoordTransMode::HalfPixel;
|
||||
} else if (cmp(coordinateTransformation, "pytorch_half_pixel")) {
|
||||
coordinateTransformationMode = InterpolateCoordTransMode::PytorchHalfPixel;
|
||||
} else if (cmp(coordinateTransformation, "tf_half_pixel_for_nn")) {
|
||||
coordinateTransformationMode = InterpolateCoordTransMode::TfHalfPixelForNn;
|
||||
} else if (cmp(coordinateTransformation, "align_corners")) {
|
||||
coordinateTransformationMode = InterpolateCoordTransMode::AlignCorners;
|
||||
}
|
||||
|
||||
if (cmp(nearest, "round_prefer_floor")) {
|
||||
@ -69,7 +77,12 @@ void FrontEnd::parseInterpolate(const Model& model, const ie::CNNLayerPtr& _laye
|
||||
nearestMode = InterpolateNearestMode::RoundPreferCeil;
|
||||
} else if (cmp(nearest, "floor")) {
|
||||
nearestMode = InterpolateNearestMode::Floor;
|
||||
} else if (cmp(nearest, "ceil")) {
|
||||
nearestMode = InterpolateNearestMode::Ceil;
|
||||
} else if (cmp(nearest, "simple")) {
|
||||
nearestMode = InterpolateNearestMode::Simple;
|
||||
}
|
||||
|
||||
_stageBuilder->addResampleNearestStage(model,
|
||||
_layer->name,
|
||||
_layer,
|
||||
|
@ -28,6 +28,15 @@ const std::vector<std::vector<size_t>> targetShapes = {
|
||||
{1, 8, 46, 46}, // * 1.3
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> inShapes2x = {
|
||||
{1, 19, 37, 37},
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> targetShapes2x = {
|
||||
{1, 19, 37 * 2, 37 * 2},
|
||||
};
|
||||
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::InterpolateMode> modesWithoutNearest = {
|
||||
ngraph::op::v4::Interpolate::InterpolateMode::linear,
|
||||
};
|
||||
@ -40,6 +49,13 @@ const std::vector<ngraph::op::v4::Interpolate::CoordinateTransformMode> coordina
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::half_pixel,
|
||||
};
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::CoordinateTransformMode> coordinateTransformModesNearest2x = {
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::half_pixel,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::pytorch_half_pixel,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::asymmetric,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::tf_half_pixel_for_nn,
|
||||
};
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::CoordinateTransformMode> coordinateTransformModesNearestMore = {
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::asymmetric,
|
||||
};
|
||||
@ -90,6 +106,19 @@ const std::vector<ngraph::op::v4::Interpolate::ShapeCalcMode> shapeCalculationMo
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::scales,
|
||||
};
|
||||
|
||||
const auto interpolateCasesNearestMode2x = ::testing::Combine(
|
||||
::testing::ValuesIn(nearestMode),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
::testing::ValuesIn(coordinateTransformModesNearest2x),
|
||||
::testing::ValuesIn(nearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(cubeCoefs),
|
||||
::testing::ValuesIn(defaultAxes),
|
||||
::testing::ValuesIn(defaultScales));
|
||||
|
||||
|
||||
const auto interpolateCasesNearestMode = ::testing::Combine(
|
||||
::testing::ValuesIn(nearestMode),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
@ -126,6 +155,18 @@ const auto interpolateCasesWithoutNearestMode = ::testing::Combine(
|
||||
::testing::ValuesIn(defaultAxes),
|
||||
::testing::ValuesIn(defaultScales));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_Interpolate_nearest_mode_2x, InterpolateLayerTest, ::testing::Combine(
|
||||
interpolateCasesNearestMode2x,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::ValuesIn(inShapes2x),
|
||||
::testing::ValuesIn(targetShapes2x),
|
||||
::testing::Values(CommonTestUtils::DEVICE_MYRIAD)),
|
||||
InterpolateLayerTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_Interpolate_nearest_mode, InterpolateLayerTest, ::testing::Combine(
|
||||
interpolateCasesNearestMode,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
|
Loading…
Reference in New Issue
Block a user