@@ -173,6 +173,9 @@ bool OCVDNNDetector::Init(const config_t& config)
173173 dictNetType[" DFINE" ] = ModelType::DFINE ;
174174 dictNetType[" YOLOV13" ] = ModelType::YOLOV13 ;
175175 dictNetType[" DFINE_IS" ] = ModelType::DFINE_IS ;
176+ dictNetType[" YOLOV26" ] = ModelType::YOLOV26 ;
177+ dictNetType[" YOLOV26_OBB" ] = ModelType::YOLOV26_OBB ;
178+ dictNetType[" YOLOV26Mask" ] = ModelType::YOLOV26Mask;
176179
177180 auto netType = dictNetType.find (net_type->second );
178181 if (netType != dictNetType.end ())
@@ -400,16 +403,21 @@ void OCVDNNDetector::DetectInCrop(const cv::UMat& colorFrame, const cv::Rect& cr
400403 case ModelType::YOLOV12 :
401404 ParseYOLOv11 (crop, detections, tmpRegions);
402405 break ;
406+ case ModelType::YOLOV26 :
407+ ParseYOLOv26 (crop, detections, tmpRegions);
408+ break ;
403409
404410 case ModelType::YOLOV5_OBB :
405411 case ModelType::YOLOV8_OBB :
406412 case ModelType::YOLOV11_OBB :
413+ case ModelType::YOLOV26_OBB :
407414 ParseYOLOv5_8_11_obb (crop, detections, tmpRegions);
408415 break ;
409416
410417 case ModelType::YOLOV5Mask:
411418 case ModelType::YOLOV8Mask:
412419 case ModelType::YOLOV11Mask:
420+ case ModelType::YOLOV26Mask:
413421 ParseYOLOv5_8_11_seg (crop, detections, tmpRegions);
414422 break ;
415423
@@ -1071,3 +1079,50 @@ void OCVDNNDetector::ParseDFINE_IS(const cv::Rect& crop, std::vector<cv::Mat>& d
10711079 assert (0 );
10721080}
10731081
1082+ // /
1083+ // / \brief OCVDNNDetector::ParseYOLOv26
1084+ // / \param crop
1085+ // / \param detections
1086+ // / \param tmpRegions
1087+ // /
1088+ void OCVDNNDetector::ParseYOLOv26 (const cv::Rect& crop, std::vector<cv::Mat>& detections, regions_t & tmpRegions)
1089+ {
1090+ int rows = detections[0 ].size [1 ];
1091+
1092+ // 0: name: images, size: 1x3x640x640
1093+ // 1: name: output0, size: 1x300x6
1094+
1095+ float * dets = (float *)detections[0 ].data ;
1096+
1097+ float x_factor = crop.width / static_cast <float >(m_inWidth);
1098+ float y_factor = crop.height / static_cast <float >(m_inHeight);
1099+
1100+ // std::cout << "detections: " << rows << std::endl;
1101+
1102+ for (int i = 0 ; i < rows; ++i)
1103+ {
1104+ auto ind = 6 * i;
1105+
1106+ float maxClassScore = dets[ind + 4 ];
1107+ size_t classId = static_cast <size_t >(dets[ind + 5 ]);
1108+
1109+ if (maxClassScore > m_confidenceThreshold)
1110+ {
1111+ float x = dets[ind + 0 ];
1112+ float y = dets[ind + 1 ];
1113+ float w = dets[ind + 2 ] - x;
1114+ float h = dets[ind + 3 ] - y;
1115+
1116+ int left = cvRound (x * x_factor);
1117+ int top = cvRound (y * y_factor);
1118+
1119+ int width = cvRound (w * x_factor);
1120+ int height = cvRound (h * y_factor);
1121+
1122+ // std::cout << "ind: " << ind << ", score = " << maxClassScore << ", class = " << classId << ", rect = " << cv::Rect(left, top, width, height) << std::endl;
1123+
1124+ if (m_classesWhiteList.empty () || m_classesWhiteList.find (T2T (classId)) != std::end (m_classesWhiteList))
1125+ tmpRegions.emplace_back (cv::Rect (left + crop.x , top + crop.y , width, height), T2T (classId), static_cast <float >(maxClassScore));
1126+ }
1127+ }
1128+ }
0 commit comments