AmiyaBot/Amiya-Bot

请求更换本地ocr为cnocr,以解决opencv安装困难的问题

fatinghenji opened this issue · 2 comments

如题,cnocr地址是:CNOCR
它不用装opencv,它太好了(我从V5某个版本开始折腾到现在都没装上paddleOCR要求的opencv-contribute-python这个依赖)

感谢,我测试一下适配性,新版本考虑加进内置模块

这个项目的确很好,不过谁告诉你的它不用 OpenCV?

而且,它真的很重!

参阅依赖树:

cnocr==2.2.2
  - click [required: Any, installed: 8.1.3]
    - colorama [required: Any, installed: 0.4.5]
  - cnstd [required: >=1.2, installed: 1.2]
    - click [required: Any, installed: 8.1.3]
      - colorama [required: Any, installed: 0.4.5]
    - matplotlib [required: Any, installed: 3.6.0]
      - contourpy [required: >=1.0.1, installed: 1.0.5]
        - numpy [required: >=1.16, installed: 1.23.3]
      - cycler [required: >=0.10, installed: 0.11.0]
      - fonttools [required: >=4.22.0, installed: 4.37.4]
      - kiwisolver [required: >=1.0.1, installed: 1.4.4]
      - numpy [required: >=1.19, installed: 1.23.3]
      - packaging [required: >=20.0, installed: 21.3]
        - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9]
      - pillow [required: >=6.2.0, installed: 9.1.1]
      - pyparsing [required: >=2.2.1, installed: 3.0.9]
      - python-dateutil [required: >=2.7, installed: 2.8.2]
        - six [required: >=1.5, installed: 1.16.0]
    - numpy [required: Any, installed: 1.23.3]
    - onnx [required: Any, installed: 1.12.0]
      - numpy [required: >=1.16.6, installed: 1.23.3]
      - protobuf [required: >=3.12.2,<=3.20.1, installed: 3.19.6]
      - typing-extensions [required: >=3.6.2.1, installed: 4.3.0]
    - onnxruntime [required: Any, installed: 1.12.1]
      - coloredlogs [required: Any, installed: 15.0.1]
        - humanfriendly [required: >=9.1, installed: 10.0]
          - pyreadline3 [required: Any, installed: 3.4.1]
      - flatbuffers [required: Any, installed: 22.9.24]
      - numpy [required: >=1.21.0, installed: 1.23.3]
      - packaging [required: Any, installed: 21.3]
        - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9]
      - protobuf [required: Any, installed: 3.19.6]
      - sympy [required: Any, installed: 1.11.1]
        - mpmath [required: >=0.19, installed: 1.2.1]
    - opencv-python [required: >=4.0.0, installed: 4.6.0.66]
      - numpy [required: >=1.17.3, installed: 1.23.3]
      - numpy [required: >=1.14.5, installed: 1.23.3]
    - pillow [required: >=5.3.0, installed: 9.1.1]
    - Polygon3 [required: Any, installed: 3.0.9.1]
    - pyclipper [required: Any, installed: 1.3.0.post3]
    - pytorch-lightning [required: Any, installed: 1.7.7]
      - fsspec [required: >=2021.05.0,!=2021.06.0, installed: 2022.8.2]
      - numpy [required: >=1.17.2, installed: 1.23.3]
      - packaging [required: >=17.0, installed: 21.3]
        - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9]
      - pyDeprecate [required: >=0.3.1, installed: 0.3.2]
      - PyYAML [required: >=5.4, installed: 6.0]
      - tensorboard [required: >=2.9.1, installed: 2.10.1]
        - absl-py [required: >=0.4, installed: 1.2.0]
        - google-auth [required: >=1.6.3,<3, installed: 2.12.0]
          - cachetools [required: >=2.0.0,<6.0, installed: 5.2.0]
          - pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
            - pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
          - rsa [required: >=3.1.4,<5, installed: 4.9]
            - pyasn1 [required: >=0.1.3, installed: 0.4.8]
          - six [required: >=1.9.0, installed: 1.16.0]
        - google-auth-oauthlib [required: >=0.4.1,<0.5, installed: 0.4.6]
          - google-auth [required: >=1.0.0, installed: 2.12.0]
            - cachetools [required: >=2.0.0,<6.0, installed: 5.2.0]
            - pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
              - pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
            - rsa [required: >=3.1.4,<5, installed: 4.9]
              - pyasn1 [required: >=0.1.3, installed: 0.4.8]
            - six [required: >=1.9.0, installed: 1.16.0]
          - requests-oauthlib [required: >=0.7.0, installed: 1.3.1]
            - oauthlib [required: >=3.0.0, installed: 3.2.1]
            - requests [required: >=2.0.0, installed: 2.27.1]
              - certifi [required: >=2017.4.17, installed: 2022.9.24]
              - charset-normalizer [required: ~=2.0.0, installed: 2.0.12]
              - idna [required: >=2.5,<4, installed: 3.4]
              - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.12]
        - grpcio [required: >=1.24.3, installed: 1.49.1]
          - six [required: >=1.5.2, installed: 1.16.0]
        - markdown [required: >=2.6.8, installed: 3.4.1]
          - importlib-metadata [required: >=4.4, installed: 4.12.0]
            - zipp [required: >=0.5, installed: 3.8.1]
        - numpy [required: >=1.12.0, installed: 1.23.3]
        - protobuf [required: >=3.9.2,<3.20, installed: 3.19.6]
        - requests [required: >=2.21.0,<3, installed: 2.27.1]
          - certifi [required: >=2017.4.17, installed: 2022.9.24]
          - charset-normalizer [required: ~=2.0.0, installed: 2.0.12]
          - idna [required: >=2.5,<4, installed: 3.4]
          - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.12]
        - setuptools [required: >=41.0.0, installed: 60.2.0]
        - tensorboard-data-server [required: >=0.6.0,<0.7.0, installed: 0.6.1]
        - tensorboard-plugin-wit [required: >=1.6.0, installed: 1.8.1]
        - werkzeug [required: >=1.0.1, installed: 2.2.2]
          - MarkupSafe [required: >=2.1.1, installed: 2.1.1]
        - wheel [required: >=0.26, installed: 0.37.1]
      - torch [required: >=1.9.*, installed: 1.12.1]
        - typing-extensions [required: Any, installed: 4.3.0]
      - torchmetrics [required: >=0.7.0, installed: 0.10.0]
        - numpy [required: >=1.17.2, installed: 1.23.3]
        - packaging [required: Any, installed: 21.3]
          - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9]
        - torch [required: >=1.3.1, installed: 1.12.1]
          - typing-extensions [required: Any, installed: 4.3.0]
        - typing-extensions [required: Any, installed: 4.3.0]
      - tqdm [required: >=4.57.0, installed: 4.64.1]
        - colorama [required: Any, installed: 0.4.5]
      - typing-extensions [required: >=4.0.0, installed: 4.3.0]
    - scipy [required: Any, installed: 1.9.1]
      - numpy [required: >=1.18.5,<1.25.0, installed: 1.23.3]
    - shapely [required: Any, installed: 1.8.4]
    - torch [required: >=1.8.0, installed: 1.12.1]
      - typing-extensions [required: Any, installed: 4.3.0]
    - torchvision [required: >=0.9.0, installed: 0.13.1]
      - numpy [required: Any, installed: 1.23.3]
      - pillow [required: >=5.3.0,!=8.3.*, installed: 9.1.1]
      - requests [required: Any, installed: 2.27.1]
        - certifi [required: >=2017.4.17, installed: 2022.9.24]
        - charset-normalizer [required: ~=2.0.0, installed: 2.0.12]
        - idna [required: >=2.5,<4, installed: 3.4]
        - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.12]
      - torch [required: ==1.12.1, installed: 1.12.1]
        - typing-extensions [required: Any, installed: 4.3.0]
      - typing-extensions [required: Any, installed: 4.3.0]
    - tqdm [required: Any, installed: 4.64.1]
      - colorama [required: Any, installed: 0.4.5]
    - unidecode [required: Any, installed: 1.3.6]
  - numpy [required: Any, installed: 1.23.3]
  - onnx [required: Any, installed: 1.12.0]
    - numpy [required: >=1.16.6, installed: 1.23.3]
    - protobuf [required: >=3.12.2,<=3.20.1, installed: 3.19.6]
    - typing-extensions [required: >=3.6.2.1, installed: 4.3.0]
  - onnxruntime [required: Any, installed: 1.12.1]
    - coloredlogs [required: Any, installed: 15.0.1]
      - humanfriendly [required: >=9.1, installed: 10.0]
        - pyreadline3 [required: Any, installed: 3.4.1]
    - flatbuffers [required: Any, installed: 22.9.24]
    - numpy [required: >=1.21.0, installed: 1.23.3]
    - packaging [required: Any, installed: 21.3]
      - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9]
    - protobuf [required: Any, installed: 3.19.6]
    - sympy [required: Any, installed: 1.11.1]
      - mpmath [required: >=0.19, installed: 1.2.1]
  - pillow [required: >=5.3.0, installed: 9.1.1]
  - pytorch-lightning [required: >=1.6.0, installed: 1.7.7]
    - fsspec [required: >=2021.05.0,!=2021.06.0, installed: 2022.8.2]
    - numpy [required: >=1.17.2, installed: 1.23.3]
    - packaging [required: >=17.0, installed: 21.3]
      - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9]
    - pyDeprecate [required: >=0.3.1, installed: 0.3.2]
    - PyYAML [required: >=5.4, installed: 6.0]
    - tensorboard [required: >=2.9.1, installed: 2.10.1]
      - absl-py [required: >=0.4, installed: 1.2.0]
      - google-auth [required: >=1.6.3,<3, installed: 2.12.0]
        - cachetools [required: >=2.0.0,<6.0, installed: 5.2.0]
        - pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
          - pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
        - rsa [required: >=3.1.4,<5, installed: 4.9]
          - pyasn1 [required: >=0.1.3, installed: 0.4.8]
        - six [required: >=1.9.0, installed: 1.16.0]
      - google-auth-oauthlib [required: >=0.4.1,<0.5, installed: 0.4.6]
        - google-auth [required: >=1.0.0, installed: 2.12.0]
          - cachetools [required: >=2.0.0,<6.0, installed: 5.2.0]
          - pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
            - pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
          - rsa [required: >=3.1.4,<5, installed: 4.9]
            - pyasn1 [required: >=0.1.3, installed: 0.4.8]
          - six [required: >=1.9.0, installed: 1.16.0]
        - requests-oauthlib [required: >=0.7.0, installed: 1.3.1]
          - oauthlib [required: >=3.0.0, installed: 3.2.1]
          - requests [required: >=2.0.0, installed: 2.27.1]
            - certifi [required: >=2017.4.17, installed: 2022.9.24]
            - charset-normalizer [required: ~=2.0.0, installed: 2.0.12]
            - idna [required: >=2.5,<4, installed: 3.4]
            - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.12]
      - grpcio [required: >=1.24.3, installed: 1.49.1]
        - six [required: >=1.5.2, installed: 1.16.0]
      - markdown [required: >=2.6.8, installed: 3.4.1]
        - importlib-metadata [required: >=4.4, installed: 4.12.0]
          - zipp [required: >=0.5, installed: 3.8.1]
      - numpy [required: >=1.12.0, installed: 1.23.3]
      - protobuf [required: >=3.9.2,<3.20, installed: 3.19.6]
      - requests [required: >=2.21.0,<3, installed: 2.27.1]
        - certifi [required: >=2017.4.17, installed: 2022.9.24]
        - charset-normalizer [required: ~=2.0.0, installed: 2.0.12]
        - idna [required: >=2.5,<4, installed: 3.4]
        - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.12]
      - setuptools [required: >=41.0.0, installed: 60.2.0]
      - tensorboard-data-server [required: >=0.6.0,<0.7.0, installed: 0.6.1]
      - tensorboard-plugin-wit [required: >=1.6.0, installed: 1.8.1]
      - werkzeug [required: >=1.0.1, installed: 2.2.2]
        - MarkupSafe [required: >=2.1.1, installed: 2.1.1]
      - wheel [required: >=0.26, installed: 0.37.1]
    - torch [required: >=1.9.*, installed: 1.12.1]
      - typing-extensions [required: Any, installed: 4.3.0]
    - torchmetrics [required: >=0.7.0, installed: 0.10.0]
      - numpy [required: >=1.17.2, installed: 1.23.3]
      - packaging [required: Any, installed: 21.3]
        - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9]
      - torch [required: >=1.3.1, installed: 1.12.1]
        - typing-extensions [required: Any, installed: 4.3.0]
      - typing-extensions [required: Any, installed: 4.3.0]
    - tqdm [required: >=4.57.0, installed: 4.64.1]
      - colorama [required: Any, installed: 0.4.5]
    - typing-extensions [required: >=4.0.0, installed: 4.3.0]
  - torch [required: >=1.8.0, installed: 1.12.1]
    - typing-extensions [required: Any, installed: 4.3.0]
  - torchmetrics [required: Any, installed: 0.10.0]
    - numpy [required: >=1.17.2, installed: 1.23.3]
    - packaging [required: Any, installed: 21.3]
      - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9]
    - torch [required: >=1.3.1, installed: 1.12.1]
      - typing-extensions [required: Any, installed: 4.3.0]
    - typing-extensions [required: Any, installed: 4.3.0]
  - torchvision [required: >=0.9.0, installed: 0.13.1]
    - numpy [required: Any, installed: 1.23.3]
    - pillow [required: >=5.3.0,!=8.3.*, installed: 9.1.1]
    - requests [required: Any, installed: 2.27.1]
      - certifi [required: >=2017.4.17, installed: 2022.9.24]
      - charset-normalizer [required: ~=2.0.0, installed: 2.0.12]
      - idna [required: >=2.5,<4, installed: 3.4]
      - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.12]
    - torch [required: ==1.12.1, installed: 1.12.1]
      - typing-extensions [required: Any, installed: 4.3.0]
    - typing-extensions [required: Any, installed: 4.3.0]
  - tqdm [required: Any, installed: 4.64.1]
    - colorama [required: Any, installed: 0.4.5]

至于为什么说它重?参阅:

amiyabot==1.1.13
  - aiohttp [required: ~=3.7.4.post0, installed: 3.7.4.post0]
    - async-timeout [required: >=3.0,<4.0, installed: 3.0.1]
    - attrs [required: >=17.3.0, installed: 22.1.0]
    - chardet [required: >=2.0,<5.0, installed: 4.0.0]
    - multidict [required: >=4.5,<7.0, installed: 6.0.2]
    - typing-extensions [required: >=3.6.5, installed: 4.3.0]
    - yarl [required: >=1.0,<2.0, installed: 1.8.1]
      - idna [required: >=2.0, installed: 3.4]
      - multidict [required: >=4.0, installed: 6.0.2]
  - fastapi [required: ~=0.79.0, installed: 0.79.1]
    - pydantic [required: >=1.6.2,<2.0.0,!=1.8.1,!=1.8,!=1.7.3,!=1.7.2,!=1.7.1,!=1.7, installed: 1.9.2]
      - typing-extensions [required: >=3.7.4.3, installed: 4.3.0]
    - starlette [required: ==0.19.1, installed: 0.19.1]
      - anyio [required: >=3.4.0,<5, installed: 3.6.1]
        - idna [required: >=2.8, installed: 3.4]
        - sniffio [required: >=1.1, installed: 1.3.0]
      - typing-extensions [required: >=3.10.0, installed: 4.3.0]
  - fastapi-utils [required: ~=0.2.1, installed: 0.2.1]
    - fastapi [required: Any, installed: 0.79.1]
      - pydantic [required: >=1.6.2,<2.0.0,!=1.8.1,!=1.8,!=1.7.3,!=1.7.2,!=1.7.1,!=1.7, installed: 1.9.2]
        - typing-extensions [required: >=3.7.4.3, installed: 4.3.0]
      - starlette [required: ==0.19.1, installed: 0.19.1]
        - anyio [required: >=3.4.0,<5, installed: 3.6.1]
          - idna [required: >=2.8, installed: 3.4]
          - sniffio [required: >=1.1, installed: 1.3.0]
        - typing-extensions [required: >=3.10.0, installed: 4.3.0]
    - pydantic [required: >=1.0,<2.0, installed: 1.9.2]
      - typing-extensions [required: >=3.7.4.3, installed: 4.3.0]
    - sqlalchemy [required: >=1.3.12,<2.0.0, installed: 1.4.41]
      - greenlet [required: !=0.4.17, installed: 1.1.2]
  - graiax-silkcoder [required: ~=0.3.4, installed: 0.3.4]
  - jieba [required: ~=0.42.1, installed: 0.42.1]
  - peewee [required: ~=3.14.10, installed: 3.14.10]
  - pillow [required: ~=9.1.1, installed: 9.1.1]
  - playwright [required: ~=1.22.0, installed: 1.22.0]
    - greenlet [required: ==1.1.2, installed: 1.1.2]
    - pyee [required: ==8.1.0, installed: 8.1.0]
    - typing-extensions [required: Any, installed: 4.3.0]
    - websockets [required: ==10.1, installed: 10.1]
  - pydantic [required: ~=1.9.1, installed: 1.9.2]
    - typing-extensions [required: >=3.7.4.3, installed: 4.3.0]
  - pymysql [required: ~=1.0.2, installed: 1.0.2]
  - pyyaml [required: ~=6.0, installed: 6.0]
  - requests [required: ~=2.27.1, installed: 2.27.1]
    - certifi [required: >=2017.4.17, installed: 2022.9.24]
    - charset-normalizer [required: ~=2.0.0, installed: 2.0.12]
    - idna [required: >=2.5,<4, installed: 3.4]
    - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.12]
  - setuptools [required: ~=60.2.0, installed: 60.2.0]
  - starlette [required: ~=0.19.1, installed: 0.19.1]
    - anyio [required: >=3.4.0,<5, installed: 3.6.1]
      - idna [required: >=2.8, installed: 3.4]
      - sniffio [required: >=1.1, installed: 1.3.0]
    - typing-extensions [required: >=3.10.0, installed: 4.3.0]
  - uvicorn [required: ~=0.18.2, installed: 0.18.3]
    - click [required: >=7.0, installed: 8.1.3]
      - colorama [required: Any, installed: 0.4.5]
    - h11 [required: >=0.8, installed: 0.14.0]
  - websockets [required: ~=10.1, installed: 10.1]
  - zhon [required: ~=1.1.5, installed: 1.1.5]

比项目本体目前的依赖树还要可怕得多,它对于 Amiya 真的太重了......当然,虽然我因为没装飞桨也没用过不知道它的依赖重不重,不过我想大致是半斤八两的。尽管如此,在都需要装 OpenCV 的前提下它与飞桨相比飞桨的模型可以爆杀它。

讲道理,跟图像沾了边的项目很难不用 OpenCV,因为它真的太好用了......

如果你有不同意见,可以重新打开这个 issue。