MCPcopy Create free account
hub / github.com/Smorodov/Multitarget-tracker / parseConfigFile

Method parseConfigFile

src/Detector/tensorrt_yolo/yolo.cpp:1056–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1054}
1055
1056std::vector<std::map<std::string, std::string>> Yolo::parseConfigFile(const std::string cfgFilePath)
1057{
1058 assert(fileExists(cfgFilePath));
1059 std::ifstream file(cfgFilePath);
1060 assert(file.good());
1061 std::string line;
1062 std::vector<std::map<std::string, std::string>> blocks;
1063 std::map<std::string, std::string> block;
1064
1065 while (getline(file, line))
1066 {
1067 line = trim(line);
1068 if (line.empty() || line == "\r")
1069 continue;
1070 if (line.front() == '#')
1071 continue;
1072 if (line.front() == '[')
1073 {
1074 if (!block.empty())
1075 {
1076 blocks.push_back(block);
1077 block.clear();
1078 }
1079 std::string key = "type";
1080 std::string value = trim(line.substr(1, line.size() - 2));
1081 block.emplace(key, value);
1082 }
1083 else
1084 {
1085 size_t cpos = line.find('=');
1086 std::string key = trim(line.substr(0, cpos));
1087 std::string value = trim(line.substr(cpos + 1));
1088 block.emplace(key, value);
1089 }
1090 }
1091 blocks.push_back(block);
1092 return blocks;
1093}
1094
1095void Yolo::parseConfigBlocks()
1096{

Callers

nothing calls this directly

Calls 6

fileExistsFunction · 0.85
trimFunction · 0.70
emptyMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected