diff --git a/include/tkDNN/DarknetParser.h b/include/tkDNN/DarknetParser.h index bc1a8da..7238c99 100644 --- a/include/tkDNN/DarknetParser.h +++ b/include/tkDNN/DarknetParser.h @@ -4,12 +4,32 @@ namespace tk { namespace dnn { - tk::dnn::Network* DarknetParser(std::string cfg) { + tk::dnn::Network* DarknetParser(std::string cfg_file) { tk::dnn::dataDim_t dim; tk::dnn::Network *net = new tk::dnn::Network(dim); + std::ifstream if_cfg(cfg_file); + if(!if_cfg.is_open()) + FatalError("cloud not open cfg file: " + cfg_file); + std::string line; + while(std::getline(if_cfg, line)) { + // remove comments + std::size_t found = line.find("#"); + if ( found != std::string::npos ) { + line = line.substr(0, found); + } + + // skip empty lines + if(line.size() == 0) + continue; + + std::string type = parseType(line); + if(type.size() > 0) { + std::cout<<"type: "<