From 1612fd9ac3af88f57d83f5e37fc9aac49c2ded72 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sun, 22 Mar 2026 02:52:52 +0800 Subject: [PATCH] dnn: fix BatchNorm bias blob index in validation When hasBias is true, CV_Assert must reference blobs[biasBlobIndex], not blobs[weightsBlobIndex], for the bias tensor. --- modules/dnn/src/layers/batch_norm_layer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dnn/src/layers/batch_norm_layer.cpp b/modules/dnn/src/layers/batch_norm_layer.cpp index 3cdbdc222b..745ca57a85 100644 --- a/modules/dnn/src/layers/batch_norm_layer.cpp +++ b/modules/dnn/src/layers/batch_norm_layer.cpp @@ -84,7 +84,7 @@ public: if( hasBias ) { CV_Assert((size_t)biasBlobIndex < blobs.size()); - const Mat& b = blobs[weightsBlobIndex]; + const Mat& b = blobs[biasBlobIndex]; CV_Assert(b.isContinuous() && b.type() == CV_32F && b.total() == (size_t)n); }