识别验证码用到warp-ctc,原版百度的不支持pytorch,找到https://github.com/SeanNaren/warp-ctc,按说明,需要gcc-4.9,接着又其他报错,下面是解决过程:
1 CentOS 7中默认gcc版本为4.8.5,编译warp-ctc提示需要4.9版本的gcc,通过以下命令:
1 yum install centos-release-scl-rh centos-release-scl
2 yum check-update
3 yum install devtoolset-3
4 scl enable devtoolset-3 bash
2 编译warp-ctc提示错误:
In file included from /root/anaconda2/lib/python2.7/site-packages/torch/include/ATen/cuda/CUDAContext.h:5:0,
from src/binding.cpp:9:
/root/anaconda2/lib/python2.7/site-packages/torch/include/c10/cuda/CUDAStream.h:6:30: fatal error: cuda_runtime_api.h: No such file or directory
#include <cuda_runtime_api.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
修改warp-ctc/pytorch_binding下面的setup.py文件
extra_compile_args = ['-std=c++11', '-fPIC']
为:
extra_compile_args = ['-std=c++11', '-fPIC','-I/usr/local/cuda/include']