 !

-
小白请教 使用yolov3不出现检测框 outputvec里面是显示检测到了
-
打不死的小强 |
你好 我使用Efficientdet训练自己的数据集 测试的时候发现满屏的框 是啥原因呢
 -
1(0.987501): 1154-623-97-126
0(0.790216): 1631-707-81-47
0(0.600490): 1878-716-37-72
0(0.561328): 1116-687-18-18
0(0.984929): 1058-678-35-34
0(0.604419): 1136-688-20-18
0(0.988162): 1089-685-24-26
输出的信息是这样的 但是图像中没有任何的框子 -
YOLOv3 YOLO; if (!m_sYoloInfo[1].bEnable) continue; char chCfgPath[1024]; char chWeightPath[1024]; strcpy(chCfgPath, m_sYoloInfo[0].strCfgPath.c_str()); strcpy(chWeightPath, m_sYoloInfo[0].strWeightPath.c_str()); YOLO.read_labels(m_sYoloInfo[0].strLabelPath); YOLO.load_ntw(chCfgPath, chWeightPath, m_sYoloInfo[0].nNetW, m_sYoloInfo[0].nNetH); // load network model and weights cv::Mat cvMatSrc, cvMatImg; CopyToCvMat(cvMatImg, sMain.cImage); int nNetW = 608; int nNetH = 608; cvMatSrc = cv::Mat(nNetH, nNetW, CV_8UC3, cv::Scalar(128, 128, 128)); float fResizeRate = min((float)nNetW / cvMatImg.cols, (float)nNetH / cvMatImg.rows); cv::Size sResizedSize(cvMatImg.cols * fResizeRate, cvMatImg.rows * fResizeRate); cv::resize(cvMatImg, cvMatImg, sResizedSize); cv::Rect sSrcRect((nNetW - sResizedSize.width) * 0.5, (nNetH - sResizedSize.height) * 0.5, sResizedSize.width, sResizedSize.height); cvMatImg.copyTo(cvMatSrc(sSrcRect)); //cv::imshow("sss", cvMatSrc(sSrcRect)); //cv::waitKey(); YOLO.forward(cvMatSrc); std::vector<std::vector<float>> outputVec = YOLO.GetOutputVec(); CString cStr; for (size_t i = 0; i < outputVec.size(); ++i) { int cls = outputVec[i][0]; float prob = outputVec[i][1]; if (prob < 0.5) continue; for (int j = 2; j < 6; j++) { float fTmp = outputVec[i][j]; if (j == 2 || j == 3) outputVec[i][j] = LIMIT(0, (fTmp - sSrcRect.x) / fResizeRate, sMain.cImage.Width()); else outputVec[i][j] = LIMIT(0, (fTmp - sSrcRect.y) / fResizeRate, sMain.cImage.Height()); } cv::Rect box; box.x = outputVec[i][2]; box.y = outputVec[i][4]; box.width = outputVec[i][3] - outputVec[i][2] - 1; box.height = outputVec[i][5] - outputVec[i][4] - 1; //cv::rectangle(cvMatImg, cv::Point(box.x, box.y), cv::Point(outputVec[i][3], outputVec[i][5]), (0, 0, 255));// , 1, 1, 0); cv::rectangle(cvMatImg, cv::Point((int)box.x, (int)box.y), cv::Point((int)box.x+ (int)box.width, (int)box.y+ (int)box.height), (0, 0, 255));// , 1, 1, 0); cStr.Format(_T(" %d(%f): %d-%d-%d-%d\n"), cls, prob, box.x, box.y, box.width, box.height); ::OutputDebugString(cStr);