Editing input layer of opencv dnn Net
I'm using tensorflow model in opencv using cv.dnn.readNetFromTensorflow
. The problem i'm facing is that, i have to set input blobs of variable sizes. But opencv dnn module requires fixed size of input blobs. Please guide me, Is it possible to edit input layer of Net object at run time.
Thanks in Advance.
why is that so ? please explain.
actually i'm detecting vehicles, in every frame i have to go through two phases, in first phase i down sample the frame to 320x180 to detect near vehicles and in 2nd phase i'm using high resolution cropped frame to detect far away vehicles in a specific region.
that probably happens at a fixed resolution, too, or no ?
we still don't know, what you're doing, what kind of tensorflow model you use, etc.
i'm using ssd_mobilenetv2 model. When using fixed size no problem occurs.But as the input blob size changes, predicted bounding boxes are no more accurate.
what i'm doing now is just initialize two separate models, and they are working at fixed input sizes =P
so, if your question was: can i use a single ssd network, and "switch" the input resolution for the 2nd pass, then the answer is: NO. you need 2 seperate models. (and both of them with a "fixed" resolution)
As @berak said, it's the best choice for now to use two separate networks for different fixed input resolutions. The thing is that changing input shape makes OpenCV reallocates all the internal buffers for a network and reinitialize acceleration backends, if used.
Thanks for guiding me. Now i have a reason to use two models. =P