PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

【疑难解决】PaddleOCR依赖治理

Open Liyulingyue opened this issue 10 months ago • 5 comments

现状

PaddleOCR依赖了两个requirements.txt,分别是根目录下的 requirement.txt 和 ppstructure/recovery/requirements.txt,过多未标明版本的依赖项会导致依赖混乱。本ISSUE以Paddle v2.6和 requirement.txt 中的信息,对PaddleOCR当前的依赖情况进行梳理,并给出优化建议。

更多相关信息参考 PaddleOCR疑难解决

依赖信息

包名称 功能 调用说明/提供的功能 建议
shapely 用于对象几何操作的2D几何库。支持多种几何对象的创建和操作 LineString, Point, Polygon
scikit-image 图像处理 thin、random_noise
imgaug 图像增强库 augmenters、Keypoint、KeypointsOnImage
pyclipper 2D裁剪库 PyclipperOffset、JT_ROUND、ET_CLOSEDPOLYGON
lmdb 轻量级的磁盘键值存储数据库 为LMDBDataSetTableMaster提供支持 调用语句仅env = lmdb.open(...)
tqdm 显示长循环的进度
numpy 数学运算
visualdl 可视化深度学习训练过程的工具 LogWriter 使用位置较少,可以移除
rapidfuzz 字符串相似度匹配 Levenshtein
opencv-python<=4.6.0.66 图像处理 fillPoly、resize、INTER_NEAREST、INTER_LINEAR、INTER_CUBIC、INTER_AREA、getRotationMatrix2D、warpAffine、BORDER_REPLICATE、imdecode、IMREAD_UNCHANGED、cvtColor、COLOR_BGR2RGB、drawContours、erode、boxPoints、line、getGaussianKernel、sepFilter2D、rotate、ROTATE_90_CLOCKWISE、threshold、rectangle
opencv-contrib-python<=4.6.0.66 图像处理 minAreaRect
cython 绑定c模块 绑定c pse模块
lxml 用于解析XML和HTML的库 etree, html 仅在ppstructure里使用
premailer 将CSS内联到HTML中的库 Premailer 仅在ppstructure里使用
openpyxl 用于读写Excel 2010 xlsx/xlsm/xltx/xltm文件 cell、get_column_letter、Workbook、styles 仅在ppstructure里使用
attrdict 提供类似于字典的访问方式,但使用属性来访问其元素 无使用情况
Pillow>=10.0.0 提供广泛的图像处理和格式支持 Image
pyyaml 用于解析和生成YAML数据

总结

综上,对于当前依赖的包可以进行如下分类:

  1. 待移除的包
  • visualdl
  • attrdict
  1. 需要移动到structure的包
  • lxml
  • premailer
  • openpyxl
  1. 需要考察功能的包
  • cython,改包仅用于绑定pse模块,用于数据处理,可能可以排除该功能
  1. 依赖功能较少的包,对于此类,如有需要可以自行实现相关功能
  • shapely
  • scikit-image
  • imgaug
  • pyclipper
  • lmdb
  • rapidfuzz
  • opencv-contrib-python

其中,前三类可以优先处理。

此外,paddle框架限制numpy>=1.13, <2.0,可以发起对paddle框架进行numpy>2.0支持的活动。

Liyulingyue avatar Apr 13 '24 07:04 Liyulingyue