Skip to content

DNN: Exception "inputs.size() >= 2" on calling Forward #16319

@steffenxonna

Description

@steffenxonna

System information (version)

Detailed description

I have tried to use FlowNet 2.0 (https://github.com/lmb-freiburg/flownet2) to calculate the Optical Flow between two images. I'm setting two inputs and changed the Resolutions in the prototxt.template to the resolution i want to use. Every time i call Forward i got the Exception "inputs.size() >= 2".

Steps to reproduce

left and right are some images read from an video-file or just two images loaded with ImRead. I think i should not attach some files during copyright problems.

using (var net = CvDnn.ReadNetFromCaffe(@"FlowNet2_deploy.prototxt.txt",
    @"FlowNet2_weights.caffemodel.h5"))
{
    net.SetPreferableBackend(Net.Backend.OPENCV);
    net.SetPreferableTarget(Net.Target.CPU);

    var img0 = CvDnn.BlobFromImage(left, 1.0, new Size(1024, 720), new Scalar(), true, false);
    var img1 = CvDnn.BlobFromImage(right, 1.0, new Size(1024, 720), new Scalar(), true, false);
    net.SetInput(img0, "img0");
    net.SetInput(img1, "img1");

    var predict = net.Forward("predict_flow_final");  << exception
}

I have used an face-detection model based on Caffe with one input and this worked fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions