{
namespace inference
{
- class Options
- {
- public:
- class Normalization
- {
- public:
- bool use;
- std::vector<double> mean;
- std::vector<double> std;
-
- Normalization() : use(false) {}
- ~Normalization() = default;
- };
-
- class Quantization
- {
- public:
- bool use;
- std::vector<double> scale;
- std::vector<double> zeropoint;
-
- Quantization() : use(false) {};
- ~Quantization() = default;
- };
+ struct Normalization {
+ bool use { false };
+ std::vector<double> mean;
+ std::vector<double> std;
+ };
+
+ struct Quantization {
+ bool use { false };
+ std::vector<double> scale;
+ std::vector<double> zeropoint;
+ };
+
+ struct Options {
Normalization normalization;
Quantization quantization;
-
- Options() = default;
- ~Options() = default;
};
- class LayerInfo
+ struct LayerInfo
{
- public:
-
std::string name;
std::vector<int> dims;
- mv_colorspace_e colorSpace;
- mv_inference_data_type_e dataType;
- inference_tensor_shape_type_e shapeType; // TODO: define mv_inference_shape_type_e
-
- LayerInfo() = default;
- ~LayerInfo() = default;
-
- int GetWidth() const;
- int GetHeight() const;
- int GetChannel() const;
+ mv_colorspace_e colorSpace {};
+ mv_inference_data_type_e dataType {};
+ inference_tensor_shape_type_e shapeType {}; // TODO: define mv_inference_shape_type_e
+
+ int getWidth() const {
+ if (shapeType == INFERENCE_TENSOR_SHAPE_NCHW) {
+ return dims[3];
+ } else { // INFERENCE_TENSOR_SHAPE_NHWC
+ return dims[2];
+ }
+ }
+
+ int getHeight() const {
+ if (shapeType == INFERENCE_TENSOR_SHAPE_NCHW) {
+ return dims[2];
+ } else { // INFERENCE_TENSOR_SHAPE_NHWC
+ return dims[1];
+ }
+ }
+
+ int getChannel() const {
+ if (shapeType == INFERENCE_TENSOR_SHAPE_NCHW) {
+ return dims[1];
+ } else { // INFERENCE_TENSOR_SHAPE_NHWC
+ return dims[3];
+ }
+ }
};
class InputMetadata
if (mMetadata.GetInputMeta().IsParsed()) {
const LayerInfo& layerInfo = mMetadata.GetInputMeta().GetLayer().at(buffer.first);
- const Options& opt = mMetadata.GetInputMeta().GetOption().empty() ? Options() : mMetadata.GetInputMeta().GetOption().at(buffer.first);
+ Options opt;
+
+ if (!mMetadata.GetInputMeta().GetOption().empty())
+ opt = mMetadata.GetInputMeta().GetOption().at(buffer.first);
+
mv_colorspace_e colorspace = MEDIA_VISION_COLORSPACE_INVALID;
mv_source_get_colorspace(mvSources[src_idx], &colorspace);
}
ObjectDecoder objDecoder(mOutputTensorBuffers, outputMeta, boxOffset,
- static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.GetWidth()),
- static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.GetHeight()),
+ static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.getWidth()),
+ static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.getHeight()),
numberOfObjects);
objDecoder.init();
}
ObjectDecoder objDecoder(mOutputTensorBuffers, outputMeta, boxOffset,
- static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.GetWidth()),
- static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.GetHeight()),
+ static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.getWidth()),
+ static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.getHeight()),
numberOfFaces);
objDecoder.init();
float inputH = 1.f;
if (outputMeta.GetLandmarkCoordinate() == INFERENCE_LANDMARK_COORDINATE_TYPE_PIXEL) {
- inputW = static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.GetWidth());
- inputH = static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.GetHeight());
+ inputW = static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.getWidth());
+ inputH = static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.getHeight());
}
float thresRadius = outputMeta.GetLandmarkType() == INFERENCE_LANDMARK_TYPE_2D_SINGLE ? 0.0 :
float thresRadius = outputMeta.GetLandmarkType() == INFERENCE_LANDMARK_TYPE_2D_SINGLE ? 0.0 :
outputMeta.GetLandmarkHeatMapInfo().nmsRadius;
if (outputMeta.GetLandmarkCoordinate() == INFERENCE_LANDMARK_COORDINATE_TYPE_PIXEL) {
- inputW = static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.GetWidth());
- inputH = static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.GetHeight());
+ inputW = static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.getWidth());
+ inputH = static_cast<float>(mMetadata.GetInputMeta().GetLayer().begin()->second.getHeight());
}
poseDecoder.decode(inputW, inputH, thresRadius);
// TODO: handling error
for (unsigned int elem = 0; elem < elements; ++elem, ++iterLayer) {
Options opt;
+
JsonNode *pNode = json_array_get_element(rootArray, elem);
JsonObject *pObject = json_node_get_object(pNode);
return MEDIA_VISION_ERROR_NONE;
}
- int LayerInfo::GetWidth() const {
- if (shapeType == INFERENCE_TENSOR_SHAPE_NCHW) {
- return dims[3];
- } else { // INFERENCE_TENSOR_SHAPE_NHWC
- return dims[2];
- }
- }
-
- int LayerInfo::GetHeight() const {
- if (shapeType == INFERENCE_TENSOR_SHAPE_NCHW) {
- return dims[2];
- } else { // INFERENCE_TENSOR_SHAPE_NHWC
- return dims[1];
- }
- }
-
- int LayerInfo::GetChannel() const {
- if (shapeType == INFERENCE_TENSOR_SHAPE_NCHW) {
- return dims[1];
- } else { // INFERENCE_TENSOR_SHAPE_NHWC
- return dims[3];
- }
- }
-
} /* Inference */
} /* MediaVision */
LOGI("ENTER");
// dest is a wrapper of the buffer
- cv::Mat dest(cv::Size(layerInfo.GetWidth(), layerInfo.GetHeight()),
+ cv::Mat dest(cv::Size(layerInfo.getWidth(), layerInfo.getHeight()),
dataType, buffer);
cv::Mat cvSource, cvDest;