#include "machine_learning_config.h"
#include "machine_learning_key.h"
-#include "ObjectDetection3dParser.h"
-
using namespace std;
using namespace MediaVision::Common;
using namespace mediavision::machine_learning;
{
namespace machine_learning
{
-template<typename ParserType> MachineLearningConfig<ParserType>::MachineLearningConfig()
+MachineLearningConfig::MachineLearningConfig()
{}
-template<typename ParserType> void MachineLearningConfig<ParserType>::setBackendType(int backend_type)
+void MachineLearningConfig::setBackendType(int backend_type)
{
_backendType = backend_type;
}
-template<typename ParserType> void MachineLearningConfig<ParserType>::setTargetDeviceType(int device_type)
+void MachineLearningConfig::setTargetDeviceType(int device_type)
{
_targetDeviceType = device_type;
}
-template<typename ParserType> const std::string &MachineLearningConfig<ParserType>::getDefaultModelName() const
+const std::string &MachineLearningConfig::getDefaultModelName() const
{
return _defaultModelName;
}
-template<typename ParserType> const std::string &MachineLearningConfig<ParserType>::getModelFilePath() const
+const std::string &MachineLearningConfig::getModelFilePath() const
{
return _modelFilePath;
}
-template<typename ParserType> const std::string &MachineLearningConfig<ParserType>::getLabelFilePath() const
+const std::string &MachineLearningConfig::getLabelFilePath() const
{
return _modelLabelFilePath;
}
-template<typename ParserType> MetaMap &MachineLearningConfig<ParserType>::getInputMetaMap() const
+MetaMap &MachineLearningConfig::getInputMetaMap() const
{
return _parser->getInputMetaMap();
}
-template<typename ParserType> MetaMap &MachineLearningConfig<ParserType>::getOutputMetaMap() const
+MetaMap &MachineLearningConfig::getOutputMetaMap() const
{
return _parser->getOutputMetaMap();
}
-template<typename ParserType> double MachineLearningConfig<ParserType>::getConfidenceThreshold() const
+double MachineLearningConfig::getConfidenceThreshold() const
{
return _confidence_threshold;
}
-template<typename ParserType> int MachineLearningConfig<ParserType>::getBackendType() const
+int MachineLearningConfig::getBackendType() const
{
return _backendType;
}
-template<typename ParserType> int MachineLearningConfig<ParserType>::getTargetDeviceType() const
+int MachineLearningConfig::getTargetDeviceType() const
{
return _targetDeviceType;
}
-template<typename ParserType>
-void MachineLearningConfig<ParserType>::setUserModel(const string &model_file, const string &meta_file,
- const string &label_file)
+void MachineLearningConfig::setUserModel(const string &model_file, const string &meta_file, const string &label_file)
{
if (!model_file.empty())
_modelFilePath = _modelDefaultPath + model_file;
return (!fileName.substr(fileName.find_last_of(".") + 1).compare("json"));
}
-template<typename ParserType> void MachineLearningConfig<ParserType>::parseConfigFile(const std::string &configFilePath)
+void MachineLearningConfig::parseConfigFile(const std::string &configFilePath)
{
auto config = make_unique<EngineConfig>(MV_CONFIG_PATH + configFilePath);
LOGI("meta file path = %s", _modelMetaFilePath.c_str());
}
-template<typename ParserType> void MachineLearningConfig<ParserType>::loadMetaFile(int task_type)
+void MachineLearningConfig::loadMetaFile(unique_ptr<MetaParser> parser)
{
- _parser = make_unique<ParserType>(task_type);
+ _parser = move(parser);
_parser->load(_modelMetaFilePath);
}
-template class MachineLearningConfig<ObjectDetection3dParser>;
-
}
}
\ No newline at end of file
protected:
std::unique_ptr<mediavision::inference::Inference> _inference;
- std::shared_ptr<MachineLearningConfig<ObjectDetection3dParser> > _config;
+ std::shared_ptr<MachineLearningConfig> _config;
std::vector<std::string> _labels;
std::vector<std::string> _valid_backends;
std::vector<std::string> _valid_devices;
template<typename T> void inference(std::vector<std::vector<T> > &inputVectors);
public:
- ObjectDetection3d(ObjectDetection3dTaskType task_type,
- std::shared_ptr<MachineLearningConfig<ObjectDetection3dParser> > config);
+ ObjectDetection3d(ObjectDetection3dTaskType task_type, std::shared_ptr<MachineLearningConfig> config);
virtual ~ObjectDetection3d() = default;
ObjectDetection3dTaskType getTaskType();