Skip to content

Commit 622b9d9

Browse files
committed
Merge pull request opencv#21267 from mshabunin:fix-kw-2021-12
2 parents b4bb98e + a079c2e commit 622b9d9

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

modules/dnn/src/int8layers/eltwise_layer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class EltwiseLayerInt8Impl CV_FINAL : public EltwiseLayerInt8
238238

239239
EltwiseInvoker(EltwiseLayerInt8Impl& self_)
240240
: self(self_)
241-
, nsrcs(0), dst(0), buf(0), nstripes(0), activ(0), channels(0)
241+
, nsrcs(0), dst(0), buf(0), nstripes(0), activLUT(0), activ(0), channels(0)
242242
, planeSize(0), offset(0)
243243
{}
244244

@@ -345,7 +345,8 @@ class EltwiseLayerInt8Impl CV_FINAL : public EltwiseLayerInt8
345345
int8_t* dstptr0 = dst->ptr<int8_t>();
346346
float* bufptr0 = buf->ptr<float>();
347347
int blockSize0 = 1 << 12;
348-
348+
CV_Assert(op != PROD || zeropointsptr);
349+
CV_Assert((op != PROD && op != SUM) || coeffsptr);
349350
for (size_t ofs = stripeStart; ofs < stripeEnd; )
350351
{
351352
int sampleIdx = (int)(ofs / planeSize);

modules/dnn/src/onnx/onnx_importer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,9 @@ void ONNXImporter::parseUnsqueeze(LayerParams& layerParams, const opencv_onnx::N
20632063
}
20642064
CV_Assert(axes.getIntValue(axes.size()-1) <= dims.size());
20652065
for (int j = 0; j < axes.size(); j++) {
2066-
dims.insert(dims.begin() + axes.getIntValue(j), 1);
2066+
const int idx = axes.getIntValue(j);
2067+
CV_Assert(idx <= dims.size());
2068+
dims.insert(dims.begin() + idx, 1);
20672069
}
20682070

20692071
Mat out = input.reshape(0, dims);

modules/objdetect/src/face_detect.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class FaceDetectorYNImpl : public FaceDetectorYN
142142
{64.0f, 96.0f},
143143
{128.0f, 192.0f, 256.0f}
144144
};
145+
CV_Assert(min_sizes.size() == feature_map_sizes.size()); // just to keep vectors in sync
145146
const std::vector<int> steps = { 8, 16, 32, 64 };
146147

147148
// Generate priors

modules/objdetect/src/face_recognize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class FaceRecognizerSFImpl : public FaceRecognizerSF
4545
double match(InputArray _face_feature1, InputArray _face_feature2, int dis_type) const override
4646
{
4747
Mat face_feature1 = _face_feature1.getMat(), face_feature2 = _face_feature2.getMat();
48-
face_feature1 /= norm(face_feature1);
49-
face_feature2 /= norm(face_feature2);
48+
normalize(face_feature1, face_feature1);
49+
normalize(face_feature2, face_feature2);
5050

5151
if(dis_type == DisType::FR_COSINE){
5252
return sum(face_feature1.mul(face_feature2))[0];

modules/objdetect/src/qrcode_encoder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,8 @@ void QRCodeEncoderImpl::findAutoMaskType()
881881
total_modules += 1;
882882
}
883883
}
884+
if (total_modules == 0)
885+
continue; // TODO: refactor, extract functions to reduce complexity
884886
int modules_percent = dark_modules * 100 / total_modules;
885887
int lower_bound = 45;
886888
int upper_bound = 55;

0 commit comments

Comments
 (0)