See my response here:

  
    
    
    Libtorch with new C++11 ABI? C++
  
  
    I have integrated the new ABI lib in my Docker file which also encapsulates the correct OpenCV version so that the notorious cv::imread() method works. I worked days and nights on attempting to compile libtorch + OpenCV from scratch with or without the -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 flag.
  


I used a pre-compiled OpenCV version. This is the only solution that worked for me.