double getConfidenceThreshold() const;
int getBackendType() const;
int getTargetDeviceType() const;
- void loadMetaFile();
+ void loadMetaFile(int task_type = 0);
};
} // machine_learning
LOGI("meta file path = %s", _modelMetaFilePath.c_str());
}
-template<typename ParserType> void MachineLearningConfig<ParserType>::loadMetaFile()
+template<typename ParserType> void MachineLearningConfig<ParserType>::loadMetaFile(int task_type)
{
- _parser = make_unique<ParserType>();
+ _parser = make_unique<ParserType>(task_type);
_parser->load(_modelMetaFilePath);
}
void parsePostprocess(std::shared_ptr<MetaInfo> meta_info, JsonObject *in_obj) override;
public:
- FacenetParser();
+ FacenetParser(int task_type = 0);
~FacenetParser();
-
- void setTaskType(int type) override;
};
}
{
namespace machine_learning
{
-FacenetParser::FacenetParser()
+FacenetParser::FacenetParser(int task_type)
{
LOGI("ENTER");
LOGI("LEAVE");
FacenetParser::~FacenetParser()
{}
-void FacenetParser::setTaskType(int type)
-{
- throw InvalidOperation("setTaskType interface not supported yet.");
-}
-
void FacenetParser::parsePostprocess(shared_ptr<MetaInfo> meta_info, JsonObject *in_obj)
{
LOGI("ENTER");
void parsePostprocess(std::shared_ptr<MetaInfo> meta_info, JsonObject *in_obj) override;
public:
- ImageClassificationParser();
+ ImageClassificationParser(int task_type = 0);
~ImageClassificationParser();
-
- void setTaskType(int type) override;
};
}
{
namespace machine_learning
{
-ImageClassificationParser::ImageClassificationParser()
+ImageClassificationParser::ImageClassificationParser(int task_type)
{
LOGI("ENTER");
LOGI("LEAVE");
ImageClassificationParser::~ImageClassificationParser()
{}
-void ImageClassificationParser::setTaskType(int type)
-{
- throw InvalidOperation("setTaskType interface not supported yet.");
-}
-
void ImageClassificationParser::parsePostprocess(shared_ptr<MetaInfo> meta_info, JsonObject *in_obj)
{
LOGI("ENTER");
void parsePostprocess(std::shared_ptr<MetaInfo> meta_info, JsonObject *in_obj) override;
public:
- ImageSegmentationParser();
+ ImageSegmentationParser(int task_type = 0);
~ImageSegmentationParser();
-
- void setTaskType(int type) override;
};
}
_modelMetaFilePath = _modelDefaultPath + _modelMetaFilePath;
LOGI("meta file path = %s", _modelMetaFilePath.c_str());
- _parser->setTaskType(static_cast<int>(_task_type));
_parser->load(_modelMetaFilePath);
if (_modelLabelFilePath.empty()) {
{
namespace machine_learning
{
-ImageSegmentationParser::ImageSegmentationParser()
+ImageSegmentationParser::ImageSegmentationParser(int task_type)
{
LOGI("ENTER");
LOGI("LEAVE");
LOGI("LEAVE");
}
-void ImageSegmentationParser::setTaskType(int type)
-{
- LOGI("ENTER");
- LOGI("LEAVE");
-}
-
void ImageSegmentationParser::parsePostprocess(shared_ptr<MetaInfo> meta_info, JsonObject *in_obj)
{
LOGI("ENTER");
void parsePostprocess(std::shared_ptr<MetaInfo> meta_info, JsonObject *in_obj) override;
public:
- LandmarkDetectionParser();
+ LandmarkDetectionParser(int task_type = 0);
~LandmarkDetectionParser();
-
- void setTaskType(int type) override;
};
}
double getConfidenceThreshold() const;
int getBackendType() const;
int getTargetDeviceType() const;
- void loadMetaFile(LandmarkDetectionTaskType task_type);
+ void loadMetaFile();
};
} // machine_learning
{
namespace machine_learning
{
-LandmarkDetectionParser::LandmarkDetectionParser()
+LandmarkDetectionParser::LandmarkDetectionParser(int task_type)
{
LOGI("ENTER");
LOGI("LEAVE");
LandmarkDetectionParser::~LandmarkDetectionParser()
{}
-void LandmarkDetectionParser::setTaskType(int type)
-{
- // TODO.
-}
-
void LandmarkDetectionParser::parsePostprocess(shared_ptr<MetaInfo> meta_info, JsonObject *in_obj)
{
LOGI("ENTER");
}
// if model name is changed by user then reallocate the parser and reload the meta file corresponding to the model name.
- _config->loadMetaFile(task_type);
+ _config->loadMetaFile();
if (task_type == LandmarkDetectionTaskType::FLD_TWEAK_CNN)
_landmark_detection = make_unique<FldTweakCnn>(task_type, _config);
LOGI("label file path = %s", _modelLabelFilePath.c_str());
}
-void LandmarkDetectionConfig::loadMetaFile(LandmarkDetectionTaskType task_type)
+void LandmarkDetectionConfig::loadMetaFile()
{
_parser = make_unique<LandmarkDetectionParser>();
- _parser->setTaskType(static_cast<int>(task_type));
_parser->load(_modelMetaFilePath);
}
}
// if model name is changed by user then reallocate the parser and reload the meta file corresponding to the model name.
- _config->loadMetaFile(task_type);
+ _config->loadMetaFile();
if (task_type == LandmarkDetectionTaskType::PLD_CPM)
_landmark_detection = make_unique<PldCpm>(task_type, _config);
MetaParser();
virtual ~MetaParser();
- virtual void setTaskType(int type) = 0;
-
/**
* @brief Invoke the parsing work to a given meta file.
*/
void parsePostprocess(std::shared_ptr<MetaInfo> meta_info, JsonObject *in_obj) override;
public:
- ObjectDetectionParser();
+ ObjectDetectionParser(int task_type = 0);
~ObjectDetectionParser();
-
- void setTaskType(int type) override;
};
}
{
namespace machine_learning
{
-ObjectDetectionParser::ObjectDetectionParser()
+ObjectDetectionParser::ObjectDetectionParser(int task_type)
{
LOGI("ENTER");
+
+ if ((static_cast<ObjectDetectionTaskType>(task_type)) == ObjectDetectionTaskType::MOBILENET_V2_SSD)
+ _postprocessParser.SetTaskAnchorParser(make_shared<MobilenetV2AnchorParser>());
+
LOGI("LEAVE");
}
ObjectDetectionParser::~ObjectDetectionParser()
{}
-void ObjectDetectionParser::setTaskType(int type)
-{
- ObjectDetectionTaskType task_type = static_cast<ObjectDetectionTaskType>(type);
-
- if (task_type == ObjectDetectionTaskType::MOBILENET_V2_SSD)
- _postprocessParser.SetTaskAnchorParser(make_shared<MobilenetV2AnchorParser>());
-}
-
void ObjectDetectionParser::parsePostprocess(shared_ptr<MetaInfo> meta_info, JsonObject *in_obj)
{
LOGI("ENTER");
template void ObjectDetection::performAsync<unsigned char>(ObjectDetectionInput &input, shared_ptr<MetaInfo> metaInfo);
}
-}
\ No newline at end of file
+}
void ObjectDetectionConfig::loadMetaFile(ObjectDetectionTaskType task_type)
{
- _parser = make_unique<ObjectDetectionParser>();
- _parser->setTaskType(static_cast<int>(task_type));
+ _parser = make_unique<ObjectDetectionParser>(static_cast<int>(task_type));
_parser->load(_modelMetaFilePath);
}
void parsePostprocess(std::shared_ptr<MetaInfo> meta_info, JsonObject *in_obj) override;
public:
- ObjectDetection3dParser();
+ ObjectDetection3dParser(int task_type = 0);
~ObjectDetection3dParser();
-
- void setTaskType(int type) override;
};
}
{
namespace machine_learning
{
-ObjectDetection3dParser::ObjectDetection3dParser()
+ObjectDetection3dParser::ObjectDetection3dParser(int task_type)
{
LOGI("ENTER");
LOGI("LEAVE");
ObjectDetection3dParser::~ObjectDetection3dParser()
{}
-void ObjectDetection3dParser::setTaskType(int type)
-{
- throw InvalidOperation("setTaskType interface not supported yet.");
-}
-
void ObjectDetection3dParser::parsePostprocess(shared_ptr<MetaInfo> meta_info, JsonObject *in_obj)
{
LOGI("ENTER");