1.序言
论文地址:https://arxiv.org/abs/2002.10200论文解析:点击
代码链接:
https://github.com/aim-uofa/AdelaiDet(detectron2,提供 完整训练测试代码,数据,demo 等,会持续更新)
https://github.com/Yuliang-Liu/bezier_curve_text_spotting (PyTorch版, 该版本目前只提供demo)
PS:由于本渣初入深度学习OCR,此项目只是探索性学习,所以没有在服务器上部署,使用了本机的win10系统进行环境搭建及试运行,奈何网上信息太少,特把踩坑经历记录下来,以供需要的人参考。大佬请出门左转,切莫嘲笑。
2.环境安装踩坑
2.1 安装基础环境和detectron2
本人环境CUDA=10.1, torch=1.4,torchversion=0.5.0,python=3.7 (torch和torchvision的版本必须一致!)
1.安装CUDA、torch、torchversion等可以参考 这篇文章
2.如果安装了其他版本的CUDA也可以不删除,多版本CUDA可以共存,参考 这篇文章 和 这篇文章 即可!
detectron2环境安装主要参考视频:B站视频【扫盲】Detectron2环境搭建(win10) ,但需要注意视频中detectron2的版本为0.1.3,但本项目需要的版本为0.2.1版本的detectron2(此处附上下载链接:https://pan.baidu.com/s/15VH7e3-bvX4aeaVlF2bXXw 提取码:gbj9 )安装时不需要再git clone下载,直接下载链接版本,然后按照视频中的步骤安装即可。detectron2的安装过程可以参考 这篇文章安装cocoapi:参考这篇文章 cd $INSTALL_DIR
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install
安装遇到的一些坑:
1.gcc++报错(我的没有gc++),可以参考 这篇文章
2.安装过程中可能出现一些其他的错误如“window下g++' 不是内部或外部命令”和“Microsoft Visual C++ 14.0 is required”等,网上大多数给出的建议是安装VS2019,但vs2019太大,有些时候不一定非要安装,可以安装部分Microsoft Visual C++ Build Tools解决问题,可以参考 这篇文章
3.“Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。”报错,解决方法参考 这篇文章
4.“lgeos = CDLL("geos_c.dll") OSError: [WinError 126] 找不到指定的模块Shapely\setup.py” ,一些dll找不到报错,这时候需要研究一下具体时间什么dll找不到,我的是geos_c.dll缺失引起的,安装shapely库 conda install -c conda-forge shapely 即可
2.2 安装AdelaiDet
cd your_install_directory
git clone https://github.com/aim-uofa/AdelaiDet.git
cd AdelaiDet
python setup.py build develop
2.3 全部环境如下
---------------------- -------------------------------------------------------------------------------------------------
sys.platform win32
Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
numpy 1.19.1
detectron2 0.2.1 @e:\pyproject\detectron2\detectron2-master\detectron2
Compiler MSVC 190024215
CUDA compiler CUDA 10.1
detectron2 arch flags e:\pyproject\detectron2\detectron2-master\detectron2\_C.cp37-win_amd64.pyd; cannot find cuobjdump
DETECTRON2_ENV_MODULE <not set>
PyTorch 1.4.0 @D:\Anaconda\envs\detectron2\lib\site-packages\torch
PyTorch debug build False
GPU available True
GPU 0 GeForce GTX 1050 Ti (arch=6.1)
CUDA_HOME C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
Pillow 7.2.0
torchvision 0.5.0 @D:\Anaconda\envs\detectron2\lib\site-packages\torchvision
torchvision arch flags D:\Anaconda\envs\detectron2\lib\site-packages\torchvision\_C.pyd; cannot find cuobjdump
fvcore 0.1.2.post20200929
cv2 4.4.0
---------------------- -------------------------------------------------------------------------------------------------
PyTorch built with:
- MSVC 191125547
- Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for Intel(R) 64 architecture applications
- OpenMP 200203
- CUDA Runtime 10.1
- NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
- CuDNN 7.5.1
- Magma 2.5.1
- Build settings: BLAS=MKL, BUILD_NAMEDTENSOR=OFF, BUILD_TYPE=Release, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /w /EHa /MP /bigobj -openmp, DISABLE_NUMA=1, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF,