intel / ros_openvino_toolkit

Apache License 2.0
148 stars 74 forks source link

Segmentation function in ov2020.3 had changed a lot #156

Closed Corsair-cxs closed 3 years ago

Corsair-cxs commented 3 years ago

Version

dev-ov2020.3

Reproduction link

Steps to reproduce

When run roslaunch vino_launch pipeline_segmentation.launch in terminal.

What is expected?

Fit new feature of segmentation function in dev-ov2020.3.

What is actually happening?

Segmentation inference related function was not workd well when the network was loaded. It seems that the inference function of segmentation not fit openvino 2020.3.

The following code is in dynamic_vino_lib/src/inferences/object_segmentation.cpp:

  const size_t output_w = masks_blob->getTensorDesc().getDims().at(3);
  const size_t output_h = masks_blob->getTensorDesc().getDims().at(2);
  const size_t output_des = masks_blob->getTensorDesc().getDims().at(1);
  const size_t output_extra = masks_blob->getTensorDesc().getDims().at(0);

While the following code in OpenVINO2020.3 segmentation cpp demo:

  const InferenceEngine::SizeVector& outSizeVector = masks_blob->getTensorDesc().getDims();
  int output_des, output_h, output_w;
  switch(outSizeVector.size()) {
      case 3:
          output_des = 0;
          output_h = outSizeVector[1];
          output_w = outSizeVector[2];
          break;
      case 4:
          output_des = outSizeVector[1];
          output_h = outSizeVector[2];
          output_w = outSizeVector[3];
          break;
      default:
          throw std::runtime_error("Unexpected output blob shape. Only 4D and 3D output blobs are"
              "supported.");
  }