Skip to content

[caffe2] Fails to build with OpenCV 4.0.0 #14355

@dbermond

Description

@dbermond

🐛 Bug

Caffe2 git master fails to build with OpenCV 4.0, giving the following error:

/storage/linux/abs/caffe2-git/src/pytorch/caffe2/video/optical_flow.cc: In function ‘void caffe2::OpticalFlowExtractor(const cv::Mat&, const cv::Mat&, int, cv::Mat&)’:
/storage/linux/abs/caffe2-git/src/pytorch/caffe2/video/optical_flow.cc:10:15: error: ‘DualTVL1OpticalFlow’ is not a member of ‘cv’
   cv::Ptr<cv::DualTVL1OpticalFlow> tvl1 = cv::DualTVL1OpticalFlow::create();
               ^~~~~~~~~~~~~~~~~~~
/storage/linux/abs/caffe2-git/src/pytorch/caffe2/video/optical_flow.cc:10:15: note: suggested alternative: ‘DISOpticalFlow’
   cv::Ptr<cv::DualTVL1OpticalFlow> tvl1 = cv::DualTVL1OpticalFlow::create();
               ^~~~~~~~~~~~~~~~~~~
               DISOpticalFlow
/storage/linux/abs/caffe2-git/src/pytorch/caffe2/video/optical_flow.cc:10:15: error: ‘DualTVL1OpticalFlow’ is not a member of ‘cv’
/storage/linux/abs/caffe2-git/src/pytorch/caffe2/video/optical_flow.cc:10:15: note: suggested alternative: ‘DISOpticalFlow’
   cv::Ptr<cv::DualTVL1OpticalFlow> tvl1 = cv::DualTVL1OpticalFlow::create();
               ^~~~~~~~~~~~~~~~~~~
               DISOpticalFlow
/storage/linux/abs/caffe2-git/src/pytorch/caffe2/video/optical_flow.cc:10:34: error: template argument 1 is invalid
   cv::Ptr<cv::DualTVL1OpticalFlow> tvl1 = cv::DualTVL1OpticalFlow::create();
                                  ^
/storage/linux/abs/caffe2-git/src/pytorch/caffe2/video/optical_flow.cc:10:47: error: ‘cv::DualTVL1OpticalFlow’ has not been declared
   cv::Ptr<cv::DualTVL1OpticalFlow> tvl1 = cv::DualTVL1OpticalFlow::create();
                                               ^~~~~~~~~~~~~~~~~~~
/storage/linux/abs/caffe2-git/src/pytorch/caffe2/video/optical_flow.cc:32:11: error: base operand of ‘->’ is not a pointer
       tvl1->calc(prev_gray, curr_gray, flow);
           ^~
make[2]: *** [caffe2/CMakeFiles/caffe2.dir/build.make:3400: caffe2/CMakeFiles/caffe2.dir/video/optical_flow.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:2157: caffe2/CMakeFiles/caffe2.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

To Reproduce

Steps to reproduce the behavior:

  1. mkdir build
  2. cd build
  3. cmake options
  4. make

Expected behavior

A successful build with opencv 4.0.0.

Environment

  • PyTorch Version: git master (currently at 60e7d04)
  • OS: Arch Linux x86_64
  • How you installed PyTorch: source
  • Build command you used (if compiling from source): already shown above
  • Python version: 3.7.1
  • CUDA/cuDNN version: not enabled in this example
  • GPU models and configuration: not enabled in this example
  • Compiler: gcc 8.2.1
  • OpenCV: 4.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions