Ask Your Question

DeepFlow: outputs NaN

asked 2015-03-14 04:51:36 -0500

Sourabh gravatar image

updated 2015-03-14 19:22:34 -0500


On video input which works with Farneback optical flow and TV-L1 optical flow, the deepflow code from the opencv contrib repository outputs NaN values. This does not happen deterministically, but happens randomly at some frame. It works with expected output sometimes but at times outputs NaN.

Has any one faced similar problems with deep flow code ?


git describe --long

  • opencv: 3.0.0-beta-0-gae4cb57
  • opencv-contrib: 3.0.0-beta-0-g08699f1

Input video:


Thanks and regards,

Sourabh Daptardar

edit retag flag offensive close merge delete


It would be easier if you also post your code so that others can reproduce the error.

FooBar gravatar imageFooBar ( 2015-03-14 07:09:40 -0500 )edit

Added code.

Sourabh gravatar imageSourabh ( 2015-03-14 19:23:59 -0500 )edit

This happened to me once, did not solve it, but I think the problem was related with the resolution of the images. I think there is a little bug somewhere.

juanmanpr gravatar imagejuanmanpr ( 2015-03-15 15:33:23 -0500 )edit

I've had the same issue. I'm building under MSVC. When I run with the debugger attached, it works fine. When I run without the debugger, deepflow returns a bunch of NaNs. I've seen this behavior before when it was related to Mats not getting properly initialized before use.

Have you found any more information about this issue?

werd80 gravatar imagewerd80 ( 2015-04-03 18:16:06 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-23 04:34:50 -0500

I also encoutered this issue. And I solved this problem via modifying the deepflow.cpp, line 155, remap funtion call in 'warpImage'

That is: change remap(input, output, mapX, mapY, interpolationType, BORDER_TRANSPARENT); to remap(input, output, mapX, mapY, interpolationType);

Hope this can sovle your problem.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-03-14 04:50:27 -0500

Seen: 492 times

Last updated: Mar 14 '15