CV-CUDA使用gpu读取并处理图片

参考:https://zhuanlan.zhihu.com/p/584600231
https://baijiahao.baidu.com/s?id=1752902449981972686&wfr=spider&for=pc
开源地址:https://github.com/CVCUDA/CV-CUDA
NVIDIA 携手字节跳动机器学习团队开源众多图像预处理算子库CV-CUDA,它们能高效地运行在 GPU 上,算子速度能达到 OpenCV(运行在 CPU)的百倍左右。如果我们使用 CV-CUDA 作为后端替换OpenCV 和 TorchVision,整个推理的吞吐量能达到原来的二十多倍。此外,不仅是速度的提升,同时在效果上 CV-CUDA 在计算精度上已经对齐了OpenCV,因此训练推理能无缝衔接,大大降低工程师的工作量。
下载,编译
报错1,cmake版本不匹配,下载3.22版本,gcc版本不匹配,下载gcc11,升级完报cuda不匹配,升级nvidia驱动版本和cuda版本,nvidia515,cuda11.7
报错2,缺少依赖项,

CMake Error at 3rdparty/CMakeLists.txt:30 (add_subdirectory):
  The source directory

    CV-CUDA-release_v0.2.x/3rdparty/googletest

  does not contain a CMakeLists.txt file.

参考:https://blog.csdn.net/qq_43140627/article/details/119766876
进入CV-CUDA-release_v0.2.x/3rdparty目录,执行:

git clone https://github.com/google/googletest.git

报错3,文件格式不对,

/usr/bin/ld:CV-CUDA-release_v0.2.x/src/util/stubs/libdl-2.17_stub.so: file format not recognized; treating as linker script
/usr/bin/ld:CV-CUDA-release_v0.2.x/src/util/stubs/libdl-2.17_stub.so:1: syntax error
collect2: error: ld returned 1 exit status
src/nvcv_types/CMakeFiles/nvcv_types.dir/build.make:312: recipe for target 'lib/libnvcv_types.so.0.2.0' failed
make[2]: *** [lib/libnvcv_types.so.0.2.0] Error 1
CMakeFiles/Makefile2:743: recipe for target 'src/nvcv_types/CMakeFiles/nvcv_types.dir/all' failed
make[1]: *** [src/nvcv_types/CMakeFiles/nvcv_types.dir/all] Error 2
Makefile:155: recipe for target 'all' failed
make: *** [all] Error 2

参考:https://blog.csdn.net/qq_39093373/article/details/118220195
是原始文件有问题,去小目录重新下载再替换即可。
https://github.com/CVCUDA/CV-CUDA/issues/6
测试了,可用,不过得在https://github.com/CVCUDA/CV-CUDA/tree/release_v0.2.x/src/util/stubs网页端下直接点Download下载,而不能下载全部源码后才在src/util/stubs拿。

报错4,缺少依赖项,

CMake Error at CMakeLists.txt:29 (add_subdirectory):
  The source directory

    CV-CUDA-release_v0.2.x/3rdparty/pybind11

  does not contain a CMakeLists.txt file.

解决:

git clone https://github.com/pybind/pybind11.git

编译

ci/build.sh

(编译build_doc.sh和build_sample.sh报错,暂时跳过)
编译build.sh成功之后修改~/.bashrc文件,参考:
https://github.com/CVCUDA/CV-CUDA/issues/11
然后在base环境运行:

import cvcuda
import nvcv

可以正常导入。
但是在anaconda的env环境导入不成功。需要在env环境重新编译。编译完成后继续在~/.bashrc文件中添加生成的python路径,即可正常导入。
测试

CV-CUDA-release_v0.2.x$ python tests/cvcuda/python/test_opchannelreorder.py

测试脚本都可以正常运行。
运行测试demo
CV-CUDA-release_v0.2.x/samples/classification/python/inference.py
安装torchnvjpeg库。
https://github.com/itsliupeng/torchnvjpeg
报错:Line 679: ‘’ failed: no kernel image is available for execution on the device
报错同https://github.com/CVCUDA/CV-CUDA/issues/14,暂未看到解决办法,先搁置。

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值