Skip to content

Commit 0be1bf5

Browse files
committed
Merge pull request opencv#10244 from dkurt:issue_10239
2 parents ef04ca9 + ef06501 commit 0be1bf5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

modules/dnn/perf/perf_net.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class DNNTestNetwork : public ::perf::TestBaseWithParam< tuple<DNNBackend, DNNTa
8787
size_t weightsMemory = 0, blobsMemory = 0;
8888
net.getMemoryConsumption(netInputShape, weightsMemory, blobsMemory);
8989
int64 flops = net.getFLOPS(netInputShape);
90+
CV_Assert(flops > 0);
9091

9192
net.forward(outputLayer); // warmup
9293

modules/dnn/src/layers/convolution_layer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ class ConvolutionLayerImpl : public BaseConvolutionLayerImpl
10221022
int64 flops = 0;
10231023
for (int i = 0; i < inputs.size(); i++)
10241024
{
1025-
flops += total(outputs[i])*(2*kernel.area()*inputs[i][1] + 1);
1025+
flops += total(outputs[i])*(CV_BIG_INT(2)*kernel.area()*inputs[i][1] + 1);
10261026
}
10271027

10281028
return flops;
@@ -1440,7 +1440,7 @@ class DeConvolutionLayerImpl : public BaseConvolutionLayerImpl
14401440

14411441
for (int i = 0; i < inputs.size(); i++)
14421442
{
1443-
flops += 2*outChannels*kernel.area()*total(inputs[i]);
1443+
flops += CV_BIG_INT(2)*outChannels*kernel.area()*total(inputs[i]);
14441444
}
14451445

14461446
return flops;

modules/dnn/src/layers/fully_connected_layer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ class FullyConnectedLayerImpl : public InnerProductLayer
397397
int innerSize = blobs[0].size[1];
398398
for(int i = 0; i < outputs.size(); i++)
399399
{
400-
flops += 3*innerSize*total(outputs[i]);
400+
flops += CV_BIG_INT(3)*innerSize*total(outputs[i]);
401401
}
402402

403403
return flops;

0 commit comments

Comments
 (0)