-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Closed
Labels
Milestone
Description
System information (version)
- OpenCV => 4.2.0 (via OpenCVSharp https://github.com/shimat/opencvsharp realesed on 08.01.2020)
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017 (C#)
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
- Downloaded the model "flownet2-models.tar.gz" contained in the shell script https://github.com/lmb-freiburg/flownet2/blob/master/models/download-models.sh
- Using the largest model contained in the folder "FlowNet2".
- Changed the Placeholder Variables (Resolutions) in the prototext to the one i want to use. Based on the logic in https://github.com/lmb-freiburg/flownet2/blob/master/scripts/run-flownet.py
- My variant of the file: FlowNet2_deploy.prototxt.txt
- Run Forward like the C#-Code below.
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.
Reactions are currently unavailable