码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • GPU计算光流:gpu_flow


    只是想迅速计算个光流图片,结果搞了大半天都没装好。

    工具:
    https://github.com/feichtenhofer/gpu_flow

    安装步骤:

    • 首先确认依赖是否都装好:
      [OpenCV 2.4] (http://opencv.org/downloads.html)
      确认版本:pkg-config --modversion opencv
      [Qt 5.4] (https://www.qt.io/qt5-4/)
      确认版本:qmake -v
      [cmake] (https://cmake.org/)

    • 然后开始吧:

    1. git clone --recursive https://github.com/feichtenhofer/gpu_flow
    2. cd gpu_flow
    3. mkdir build
    4. cd build
    5. cmake -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF ..
    6. make

    problems

    • cannot find lopencv_dep_cudart

    https://github.com/opencv/opencv/issues/6542

    在CMakeLists.txt中:FIND_PACKAGE(OpenCV REQUIRED )之前添加:

    set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)

    参考链接:
    http://www.cnblogs.com/darkknightzh/p/5638117.html
    http://blog.csdn.net/qq_36130482/article/details/70171301
    http://blog.csdn.net/u012526003/article/details/64500596

    修改后的CMakeLists.txt:

    1. # OpenCV Config
    2. set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
    3. find_package( OpenCV REQUIRED )
    4. message(STATUS " version: ${OpenCV_VERSION}")
    5. message("-- OPENCV include: " ${OpenCV_INCLUDE_DIRS})
    6. message("-- OPENCV libs dir: " ${OpenCV_LIB_DIR})
    7. message("-- OPENCV libs: " ${OpenCV_LIBS} )

    试了几次还是不行,于是

    1. rm build -rf
    2. mkdir build && cd build
    3. cmake ..
    4. make

    还是不行。
    于是:https://github.com/caffe2/caffe2/issues/303

    1. rm -rf build
    2. mkdir build && cd build
    3. cmake -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF ..
    4. make

    可以了!感人。

    • ``lib/libstdc++.so.6: version GLIBCXX_3.4.20 not found (required by /usr/local/lib/libopencv_gpu.so.2.4)

    http://blog.csdn.net/xiaolong2w/article/details/23915171
    我的libstdc++.so.6是anaconda3里面的,用strings libstdc++.so.6查看了一下(忘了存结果):
    只到3.4.19。
    所以我升级了一下我的conda和所有的库:

    1. conda update conda #更新conda本身
    2. conda update --all #更新所有库,有点慢

    现在:

    1. root@Amax-02:~/anaconda3$ strings /home/root/anaconda3/lib/libstdc++.so.6 | grep GLIBCXX
    2. GLIBCXX_DEBUG_MESSAGE_LENGTH
    3. GLIBCXX_3.4
    4. GLIBCXX_3.4.1
    5. GLIBCXX_3.4.2
    6. GLIBCXX_3.4.3
    7. GLIBCXX_3.4.4
    8. GLIBCXX_3.4.5
    9. GLIBCXX_3.4.6
    10. GLIBCXX_3.4.7
    11. GLIBCXX_3.4.8
    12. GLIBCXX_3.4.9
    13. GLIBCXX_3.4.10
    14. GLIBCXX_3.4.11
    15. GLIBCXX_3.4.12
    16. GLIBCXX_3.4.13
    17. GLIBCXX_3.4.14
    18. GLIBCXX_3.4.15
    19. GLIBCXX_3.4.16
    20. GLIBCXX_3.4.17
    21. GLIBCXX_3.4.18
    22. GLIBCXX_3.4.19
    23. GLIBCXX_3.4.20
    24. GLIBCXX_3.4.21

    可以啦~

    其他的在作者的README.md都写的很清楚啦:

    Configuration:

    You should adjust the input and output directories by editing the variables vid_path, out_path and out_path_jpeg in compute_flow.cpp. Note that these folders have to exist before executing.

    Usage:

    ./brox_flow [OPTION]...

    Available options:
    * start_video: start with video number in vid_path directory structure [1]
    * gpuID: use this GPU ID [0]
    * type: use this flow method Brox = 0, TVL1 = 1 [1]
    * skip: the number of frames that are skipped between flow calcuation [1]

    Additional features in compute_flow.cpp:
    * float MIN_SZ = 256: defines the smallest side of the frame for optical flow computation
    * float OUT_SZ = 256: defines the smallest side of the frame for saving as .jpeg
    * bool clipFlow = true;: defines whether to clip the optical flow larger than [-20 20] pixels and maps the interval [-20 20] to [0 255] in grayscale image space. If no clipping is performed the mapping to the image space is achieved by finding the frame-wise minimum and maximum displacement and mapping to [0 255] via an adaptive scaling, where the scale factors are saved as a binary file to out_path.

    Example:

    ./brox_flow gpuID=0 type=1 
  • 相关阅读:
    java综合布线设备管理系统的研究与实现
    Linux shell - 目录栈操作(pushd popd dirs)
    Tomcat 漏洞总结
    小样本图像语义分割综述
    【Redis学习笔记】第十三章 Redis集群
    4、常用样式
    ZLMediaKit - webrtc录像
    强化学习 多臂赌博机
    《FFmpeg Basics》中文版-08-模糊,锐化和其他去噪
    多元回归分析 | RF随机森林多输入单输出预测(Matlab完整程序)
  • 原文地址:https://blog.csdn.net/liuliuhelingdao/article/details/127853458
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号