Skip to content

Darknet/YoloV3, changing input resolution cause the "Inconsistent shape for ConcatLayer" error #13462

@yuril123

Description

@yuril123

OpenCV 4.0.0

I have a problem with running Darknet/YoloV3 network with different input resolutions on the same network. If I do not change input resolution I can process images with same resolution without problems.

  1. WORKS OK

cv::dnn::Net net = cv::dnn::readNetFromDarknet(....)

cv::dnn::blobFromImage(image, blob, 1 / 255.F, cv::Size(416, 416));
net.setInput(blob);
net.forward(outs, this->net_output_names);

cv::dnn::blobFromImage(image, blob, 1 / 255.F, cv::Size(416, 416));
net.setInput(blob);
net.forward(outs, this->net_output_names);

  1. WORKS OK

cv::dnn::Net net = cv::dnn::readNetFromDarknet(....)

cv::dnn::blobFromImage(image, blob, 1 / 255.F, cv::Size(448, 448));
net.setInput(blob);
net.forward(outs, this->net_output_names);

cv::dnn::blobFromImage(image, blob, 1 / 255.F, cv::Size(448, 448));
net.setInput(blob);
net.forward(outs, this->net_output_names);

  1. "Inconsistent shape for ConcatLayer" exception

cv::dnn::Net net = cv::dnn::readNetFromDarknet(....)

cv::dnn::blobFromImage(image, blob, 1 / 255.F, cv::Size(416, 416));
net.setInput(blob);
net.forward(outs, this->net_output_names);

cv::dnn::blobFromImage(image, blob, 1 / 255.F, cv::Size(448, 448)); // <=== resulution changed
net.setInput(blob);
net.forward(outs, this->net_output_names); // <=== "Inconsistent shape for ConcatLayer" exception

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions