mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
bug fix
This commit is contained in:
@@ -166,6 +166,17 @@ struct BlockLayoutTransformer
|
||||
CV_Assert(inputLayoutsNew.size() == ninputs);
|
||||
CV_Assert(outputLayouts.size() == noutputs);
|
||||
|
||||
fprintf(stderr, "BLKALL op=%s name=%s\n", op_name.c_str(), name.c_str());
|
||||
if (op_name == "Pooling" || op_name == "DequantizeLinear" || op_name == "QuantizeLinear") {
|
||||
fprintf(stderr, "BLKDBG op=%s name=%s deviceOp=%d defaultLayout=%d orig=[", op_name.c_str(), name.c_str(), (int)deviceOp, (int)defaultLayout);
|
||||
for (auto l : inputLayoutsOrig) fprintf(stderr, "%d,", (int)l);
|
||||
fprintf(stderr, "] new=[");
|
||||
for (auto l : inputLayoutsNew) fprintf(stderr, "%d,", (int)l);
|
||||
fprintf(stderr, "] out=[");
|
||||
for (auto l : outputLayouts) fprintf(stderr, "%d,", (int)l);
|
||||
fprintf(stderr, "]\n");
|
||||
}
|
||||
|
||||
if (deviceOp) {
|
||||
for (size_t i = 0; i < ninputs; i++)
|
||||
inputLayoutsNew[i] = defaultLayout;
|
||||
|
||||
@@ -396,7 +396,7 @@ MatShape deconvInferShape(const MatShape& inpShape, const MatShape& wshape,
|
||||
const std::vector<int>& adjustPads,
|
||||
AutoPadding autoPad)
|
||||
{
|
||||
bool blockLayout = true;
|
||||
bool blockLayout = (inpShape.layout == DATA_LAYOUT_BLOCK);
|
||||
int ndims = inpShape.dims;
|
||||
int nspatialdims = ndims - 2 - int(blockLayout);
|
||||
CV_Assert(nspatialdims >= 1);
|
||||
@@ -413,9 +413,13 @@ MatShape deconvInferShape(const MatShape& inpShape, const MatShape& wshape,
|
||||
kshape_[i] = wshape[i + 2];
|
||||
}
|
||||
|
||||
int C0 = inpShape[ndims - 1];
|
||||
int K_out = ngroups * wshape[1];
|
||||
outshape[1] = (K_out + C0 - 1) / C0;
|
||||
if (blockLayout) {
|
||||
int C0 = inpShape[ndims - 1];
|
||||
outshape[1] = (K_out + C0 - 1) / C0;
|
||||
} else {
|
||||
outshape[1] = K_out;
|
||||
}
|
||||
|
||||
CV_Assert(strides.empty() || (int)strides.size() == nspatialdims);
|
||||
CV_Assert(dilations.empty() || (int)dilations.size() == nspatialdims);
|
||||
@@ -439,7 +443,7 @@ MatShape deconvInferShape(const MatShape& inpShape, const MatShape& wshape,
|
||||
}
|
||||
outshape[i + 2] = outsz;
|
||||
}
|
||||
outshape.C = K_out;
|
||||
outshape.C = blockLayout ? K_out : 0;
|
||||
return outshape;
|
||||
}
|
||||
|
||||
|
||||
@@ -1180,6 +1180,10 @@ public:
|
||||
{
|
||||
CV_Assert(inputs.size() != 0);
|
||||
|
||||
fprintf(stderr, "DBG Pooling '%s' inp0 dims=%d layout=%d global=%d kernel=%zu pads_begin=%zu shape=[", name.c_str(), (int)inputs[0].size(), (int)inputs[0].layout, (int)globalPooling, kernel_size.size(), pads_begin.size());
|
||||
for (size_t _i=0;_i<inputs[0].size();_i++) fprintf(stderr, "%d,", inputs[0][_i]);
|
||||
fprintf(stderr, "]\n");
|
||||
|
||||
bool isPool1D = inputs[0].size() == 3;
|
||||
std::vector<int> inpShape(inputs[0].begin() + 2, inputs[0].end());
|
||||
std::vector<int> outShape(inputs[0].begin(), inputs[0].begin() + 2);
|
||||
|
||||
@@ -776,7 +776,7 @@ TEST_P(Reproducibility_ResNet50_ONNX, Accuracy)
|
||||
timeMax = std::max(timeMax, t);
|
||||
}
|
||||
|
||||
std::cout << "[ BENCHMARK ] ResNet50 ONNX (backend=" << backendId << ", target=" << targetId << ") over "
|
||||
std::cout << "[ BENCHMARK ] ResNet50 ONNX (backend=" << (int)backendId << ", target=" << (int)targetId << ") over "
|
||||
<< numRuns << " runs: avg=" << (timeSum / numRuns) << " ms"
|
||||
<< ", min=" << timeMin << " ms"
|
||||
<< ", max=" << timeMax << " ms" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user