# win10,显卡3070 # 创建名为mmocr的环境 conda create -n mmocr python=3.7 -y # 激活mmocr conda activate mmocr # 本人3070显卡,支持11.1以上的cuda版本,低版本不支持,故按照官网的安装命令行,并将pytorch版本固定在1.8.0(因为要安装mmcv-full,mmcv-full是官方编译好的,需要对应人家官方的版本) conda install pytorch==1.8.0 torchvision torchaudio cudatoolkit=11.3 -c pytorch # 安装mmcv-full,cu113,torch1.8.0,都是对应上一步的版本 pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.8.0/index.html # 安装mmdet所需要的库,因为mmocr是基于检测模块 pip install mmdet
下一步进入IDE安装。在pycharm中Terminal进入创建的虚拟环境。
pip install -r requirements.txt pip install -v -e .
报错,如果是网络问题,再次输入一次。如果是pycocotool问题,要安装c++安装工具,因为我之前安装了c++安装工具,没有报错。
demo测试环境配置情况。
python mmocr/utils/ocr.py demo/demo_text_det.jpg --output demo/det_out.jpg --det TextSnake --recog None --export demo/ --imshow
出现报错,Pillow版本问题.
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'
卸载Pillow(我当前是9.2.0),在安装低版本的(6.2.2)。
pip uninstall Pillow pip install Pillow==6.2.2
再次进行测试
python mmocr/utils/ocr.py demo/demo_text_det.jpg --output demo/det_out.jpg --det TextSnake --recog None --export demo/ --imshow



