当我试图初始化黑网时,我会得到这个错误。
错误:断言失败(separator_index < line.size())在cv::dnn::dnn::ReadDarknetFromCfgStream中,文件line.size第507行
有人知道会发生什么吗?
我用的是yolov3.weights和yolov3.cfg
下面的代码。
我尝试过绝对文件路径
// Load names of classes
string classesFile = "B:/coco.names";
ifstream ifs(classesFile.c_str());
string line;
while (getline(ifs, line)) classes.push_back(line);
// Give the configuration and weight files for the model
String modelConfiguration = "B:/yolov3a.cfg";
String modelWeights = "B:/yolov3.weights";
// Load the network
Net net = readNetFromDarknet(modelConfiguration, modelWeights);
net.setPreferableBackend(DNN_BACKEND_OPENCV);
net.setPreferableTarget(DNN_TARGET_CPU);
//---------------
return 0;任何帮助都是非常感谢的。
发布于 2020-02-19 18:08:11
如果在darknet_io.cpp文件中的“#”后面有注释行而没有空白,那么.cfg中的行解析器就会失败。
[net]
# This is OK!
# Testing
# batch=1
# subdivisions=1
# Training
batch=64
subdivisions=16
width=416
height=416
...
[net]
#This would FAIL!
#batch=1
#subdivisions=1
#Training
batch=64
...https://stackoverflow.com/questions/55552722
复制相似问题