Commit e1b3f428 authored by AYOUB ABOUNAMER's avatar AYOUB ABOUNAMER

Delete paddleOCR.ipynb

parent fb0c2829
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "paddleOCR.ipynb",
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "DWtMMessJXUk",
"outputId": "b8503684-88fd-455f-82ce-09e3457b56d0"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://mirror.baidu.com/pypi/simple\n",
"Collecting paddlepaddle\n",
" Downloading https://mirror.baidu.com/pypi/packages/e4/42/3a91bff89038a9773b2df69610293e759ed6e1de6fe115503d1132805103/paddlepaddle-2.2.2-cp37-cp37m-manylinux1_x86_64.whl (108.4 MB)\n",
"\u001b[K |████████████████████████████████| 108.4 MB 24 kB/s \n",
"\u001b[?25hRequirement already satisfied: decorator in /usr/local/lib/python3.7/dist-packages (from paddlepaddle) (4.4.2)\n",
"Requirement already satisfied: astor in /usr/local/lib/python3.7/dist-packages (from paddlepaddle) (0.8.1)\n",
"Requirement already satisfied: numpy>=1.13 in /usr/local/lib/python3.7/dist-packages (from paddlepaddle) (1.21.5)\n",
"Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from paddlepaddle) (1.15.0)\n",
"Requirement already satisfied: protobuf>=3.1.0 in /usr/local/lib/python3.7/dist-packages (from paddlepaddle) (3.17.3)\n",
"Requirement already satisfied: requests>=2.20.0 in /usr/local/lib/python3.7/dist-packages (from paddlepaddle) (2.23.0)\n",
"Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from paddlepaddle) (7.1.2)\n",
"Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests>=2.20.0->paddlepaddle) (2.10)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests>=2.20.0->paddlepaddle) (2021.10.8)\n",
"Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests>=2.20.0->paddlepaddle) (3.0.4)\n",
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests>=2.20.0->paddlepaddle) (1.24.3)\n",
"Installing collected packages: paddlepaddle\n",
"Successfully installed paddlepaddle-2.2.2\n"
]
}
],
"source": [
"pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple\n"
]
},
{
"cell_type": "code",
"source": [
"pip install paddleOCR"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ELQZ8V9uKPyi",
"outputId": "2fbac3ec-9637-4590-a19b-e1d831993031"
},
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Collecting paddleOCR\n",
" Downloading paddleocr-2.4.0.4-py3-none-any.whl (339 kB)\n",
"\u001b[K |████████████████████████████████| 339 kB 24.9 MB/s \n",
"\u001b[?25hCollecting pyclipper\n",
" Downloading pyclipper-1.3.0.post2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (603 kB)\n",
"\u001b[K |████████████████████████████████| 603 kB 52.0 MB/s \n",
"\u001b[?25hRequirement already satisfied: scikit-image in /usr/local/lib/python3.7/dist-packages (from paddleOCR) (0.18.3)\n",
"Collecting premailer\n",
" Downloading premailer-3.10.0-py2.py3-none-any.whl (19 kB)\n",
"Collecting imgaug==0.4.0\n",
" Downloading imgaug-0.4.0-py2.py3-none-any.whl (948 kB)\n",
"\u001b[K |████████████████████████████████| 948 kB 34.1 MB/s \n",
"\u001b[?25hRequirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from paddleOCR) (1.21.5)\n",
"Requirement already satisfied: lxml in /usr/local/lib/python3.7/dist-packages (from paddleOCR) (4.2.6)\n",
"Collecting python-Levenshtein\n",
" Downloading python-Levenshtein-0.12.2.tar.gz (50 kB)\n",
"\u001b[K |████████████████████████████████| 50 kB 4.5 MB/s \n",
"\u001b[?25hRequirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from paddleOCR) (4.63.0)\n",
"Requirement already satisfied: shapely in /usr/local/lib/python3.7/dist-packages (from paddleOCR) (1.8.1.post1)\n",
"Collecting visualdl\n",
" Downloading visualdl-2.2.3-py3-none-any.whl (2.7 MB)\n",
"\u001b[K |████████████████████████████████| 2.7 MB 50.9 MB/s \n",
"\u001b[?25hRequirement already satisfied: lmdb in /usr/local/lib/python3.7/dist-packages (from paddleOCR) (0.99)\n",
"Collecting opencv-contrib-python==4.4.0.46\n",
" Downloading opencv_contrib_python-4.4.0.46-cp37-cp37m-manylinux2014_x86_64.whl (55.7 MB)\n",
"\u001b[K |████████████████████████████████| 55.7 MB 1.2 MB/s \n",
"\u001b[?25hRequirement already satisfied: cython in /usr/local/lib/python3.7/dist-packages (from paddleOCR) (0.29.28)\n",
"Requirement already satisfied: openpyxl in /usr/local/lib/python3.7/dist-packages (from paddleOCR) (3.0.9)\n",
"Requirement already satisfied: opencv-python in /usr/local/lib/python3.7/dist-packages (from imgaug==0.4.0->paddleOCR) (4.1.2.30)\n",
"Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from imgaug==0.4.0->paddleOCR) (1.4.1)\n",
"Requirement already satisfied: imageio in /usr/local/lib/python3.7/dist-packages (from imgaug==0.4.0->paddleOCR) (2.4.1)\n",
"Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from imgaug==0.4.0->paddleOCR) (1.15.0)\n",
"Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from imgaug==0.4.0->paddleOCR) (3.2.2)\n",
"Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from imgaug==0.4.0->paddleOCR) (7.1.2)\n",
"Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->paddleOCR) (2.6.3)\n",
"Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image->paddleOCR) (1.3.0)\n",
"Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.7/dist-packages (from scikit-image->paddleOCR) (2021.11.2)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->imgaug==0.4.0->paddleOCR) (1.4.0)\n",
"Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->imgaug==0.4.0->paddleOCR) (2.8.2)\n",
"Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->imgaug==0.4.0->paddleOCR) (3.0.7)\n",
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->imgaug==0.4.0->paddleOCR) (0.11.0)\n",
"Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from kiwisolver>=1.0.1->matplotlib->imgaug==0.4.0->paddleOCR) (3.10.0.2)\n",
"Requirement already satisfied: et-xmlfile in /usr/local/lib/python3.7/dist-packages (from openpyxl->paddleOCR) (1.1.0)\n",
"Requirement already satisfied: cachetools in /usr/local/lib/python3.7/dist-packages (from premailer->paddleOCR) (4.2.4)\n",
"Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from premailer->paddleOCR) (2.23.0)\n",
"Collecting cssselect\n",
" Downloading cssselect-1.1.0-py2.py3-none-any.whl (16 kB)\n",
"Collecting cssutils\n",
" Downloading cssutils-2.4.0-py3-none-any.whl (404 kB)\n",
"\u001b[K |████████████████████████████████| 404 kB 67.6 MB/s \n",
"\u001b[?25hRequirement already satisfied: importlib-metadata in /usr/local/lib/python3.7/dist-packages (from cssutils->premailer->paddleOCR) (4.11.3)\n",
"Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata->cssutils->premailer->paddleOCR) (3.7.0)\n",
"Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from python-Levenshtein->paddleOCR) (57.4.0)\n",
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->premailer->paddleOCR) (1.24.3)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->premailer->paddleOCR) (2021.10.8)\n",
"Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->premailer->paddleOCR) (2.10)\n",
"Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->premailer->paddleOCR) (3.0.4)\n",
"Collecting bce-python-sdk\n",
" Downloading bce-python-sdk-0.8.64.tar.gz (127 kB)\n",
"\u001b[K |████████████████████████████████| 127 kB 39.8 MB/s \n",
"\u001b[?25hCollecting pre-commit\n",
" Downloading pre_commit-2.18.1-py2.py3-none-any.whl (197 kB)\n",
"\u001b[K |████████████████████████████████| 197 kB 65.0 MB/s \n",
"\u001b[?25hRequirement already satisfied: protobuf>=3.11.0 in /usr/local/lib/python3.7/dist-packages (from visualdl->paddleOCR) (3.17.3)\n",
"Collecting Flask-Babel>=1.0.0\n",
" Downloading Flask_Babel-2.0.0-py3-none-any.whl (9.3 kB)\n",
"Collecting shellcheck-py\n",
" Downloading shellcheck_py-0.8.0.4-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)\n",
"\u001b[K |████████████████████████████████| 2.1 MB 65.2 MB/s \n",
"\u001b[?25hRequirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from visualdl->paddleOCR) (1.3.5)\n",
"Requirement already satisfied: flask>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from visualdl->paddleOCR) (1.1.4)\n",
"Collecting flake8>=3.7.9\n",
" Downloading flake8-4.0.1-py2.py3-none-any.whl (64 kB)\n",
"\u001b[K |████████████████████████████████| 64 kB 2.6 MB/s \n",
"\u001b[?25hCollecting pycodestyle<2.9.0,>=2.8.0\n",
" Downloading pycodestyle-2.8.0-py2.py3-none-any.whl (42 kB)\n",
"\u001b[K |████████████████████████████████| 42 kB 718 kB/s \n",
"\u001b[?25hCollecting pyflakes<2.5.0,>=2.4.0\n",
" Downloading pyflakes-2.4.0-py2.py3-none-any.whl (69 kB)\n",
"\u001b[K |████████████████████████████████| 69 kB 6.0 MB/s \n",
"\u001b[?25hCollecting mccabe<0.7.0,>=0.6.0\n",
" Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)\n",
"Collecting importlib-metadata\n",
" Downloading importlib_metadata-4.2.0-py3-none-any.whl (16 kB)\n",
"Requirement already satisfied: click<8.0,>=5.1 in /usr/local/lib/python3.7/dist-packages (from flask>=1.1.1->visualdl->paddleOCR) (7.1.2)\n",
"Requirement already satisfied: Werkzeug<2.0,>=0.15 in /usr/local/lib/python3.7/dist-packages (from flask>=1.1.1->visualdl->paddleOCR) (1.0.1)\n",
"Requirement already satisfied: Jinja2<3.0,>=2.10.1 in /usr/local/lib/python3.7/dist-packages (from flask>=1.1.1->visualdl->paddleOCR) (2.11.3)\n",
"Requirement already satisfied: itsdangerous<2.0,>=0.24 in /usr/local/lib/python3.7/dist-packages (from flask>=1.1.1->visualdl->paddleOCR) (1.1.0)\n",
"Requirement already satisfied: Babel>=2.3 in /usr/local/lib/python3.7/dist-packages (from Flask-Babel>=1.0.0->visualdl->paddleOCR) (2.9.1)\n",
"Requirement already satisfied: pytz in /usr/local/lib/python3.7/dist-packages (from Flask-Babel>=1.0.0->visualdl->paddleOCR) (2018.9)\n",
"Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from Jinja2<3.0,>=2.10.1->flask>=1.1.1->visualdl->paddleOCR) (2.0.1)\n",
"Collecting pycryptodome>=3.8.0\n",
" Downloading pycryptodome-3.14.1-cp35-abi3-manylinux2010_x86_64.whl (2.0 MB)\n",
"\u001b[K |████████████████████████████████| 2.0 MB 47.7 MB/s \n",
"\u001b[?25hRequirement already satisfied: future>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from bce-python-sdk->visualdl->paddleOCR) (0.16.0)\n",
"Collecting identify>=1.0.0\n",
" Downloading identify-2.4.12-py2.py3-none-any.whl (98 kB)\n",
"\u001b[K |████████████████████████████████| 98 kB 8.4 MB/s \n",
"\u001b[?25hCollecting cfgv>=2.0.0\n",
" Downloading cfgv-3.3.1-py2.py3-none-any.whl (7.3 kB)\n",
"Collecting toml\n",
" Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)\n",
"Collecting virtualenv>=20.0.8\n",
" Downloading virtualenv-20.14.1-py2.py3-none-any.whl (8.8 MB)\n",
"\u001b[K |████████████████████████████████| 8.8 MB 48.0 MB/s \n",
"\u001b[?25hCollecting nodeenv>=0.11.1\n",
" Downloading nodeenv-1.6.0-py2.py3-none-any.whl (21 kB)\n",
"Collecting pyyaml>=5.1\n",
" Downloading PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (596 kB)\n",
"\u001b[K |████████████████████████████████| 596 kB 63.5 MB/s \n",
"\u001b[?25hCollecting platformdirs<3,>=2\n",
" Downloading platformdirs-2.5.1-py3-none-any.whl (14 kB)\n",
"Requirement already satisfied: filelock<4,>=3.2 in /usr/local/lib/python3.7/dist-packages (from virtualenv>=20.0.8->pre-commit->visualdl->paddleOCR) (3.6.0)\n",
"Collecting distlib<1,>=0.3.1\n",
" Downloading distlib-0.3.4-py2.py3-none-any.whl (461 kB)\n",
"\u001b[K |████████████████████████████████| 461 kB 58.4 MB/s \n",
"\u001b[?25hBuilding wheels for collected packages: python-Levenshtein, bce-python-sdk\n",
" Building wheel for python-Levenshtein (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for python-Levenshtein: filename=python_Levenshtein-0.12.2-cp37-cp37m-linux_x86_64.whl size=149861 sha256=ae99f26d05485406ee1c40a1f8fcfd7aa34b4556616827b2256d66ba9f165171\n",
" Stored in directory: /root/.cache/pip/wheels/05/5f/ca/7c4367734892581bb5ff896f15027a932c551080b2abd3e00d\n",
" Building wheel for bce-python-sdk (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for bce-python-sdk: filename=bce_python_sdk-0.8.64-py3-none-any.whl size=202973 sha256=8badeb6a8030bbb9b3952fff9833a75115d31184862c5e355e07af25d03e4336\n",
" Stored in directory: /root/.cache/pip/wheels/fd/ee/a5/4ad3bdc0e60b48e892e8bd6f661a3201d7e76dccfa9e968b34\n",
"Successfully built python-Levenshtein bce-python-sdk\n",
"Installing collected packages: platformdirs, importlib-metadata, distlib, virtualenv, toml, pyyaml, pyflakes, pycryptodome, pycodestyle, nodeenv, mccabe, identify, cfgv, shellcheck-py, pre-commit, Flask-Babel, flake8, cssutils, cssselect, bce-python-sdk, visualdl, python-Levenshtein, pyclipper, premailer, opencv-contrib-python, imgaug, paddleOCR\n",
" Attempting uninstall: importlib-metadata\n",
" Found existing installation: importlib-metadata 4.11.3\n",
" Uninstalling importlib-metadata-4.11.3:\n",
" Successfully uninstalled importlib-metadata-4.11.3\n",
" Attempting uninstall: pyyaml\n",
" Found existing installation: PyYAML 3.13\n",
" Uninstalling PyYAML-3.13:\n",
" Successfully uninstalled PyYAML-3.13\n",
" Attempting uninstall: opencv-contrib-python\n",
" Found existing installation: opencv-contrib-python 4.1.2.30\n",
" Uninstalling opencv-contrib-python-4.1.2.30:\n",
" Successfully uninstalled opencv-contrib-python-4.1.2.30\n",
" Attempting uninstall: imgaug\n",
" Found existing installation: imgaug 0.2.9\n",
" Uninstalling imgaug-0.2.9:\n",
" Successfully uninstalled imgaug-0.2.9\n",
"\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
"markdown 3.3.6 requires importlib-metadata>=4.4; python_version < \"3.10\", but you have importlib-metadata 4.2.0 which is incompatible.\n",
"albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you have imgaug 0.4.0 which is incompatible.\u001b[0m\n",
"Successfully installed Flask-Babel-2.0.0 bce-python-sdk-0.8.64 cfgv-3.3.1 cssselect-1.1.0 cssutils-2.4.0 distlib-0.3.4 flake8-4.0.1 identify-2.4.12 imgaug-0.4.0 importlib-metadata-4.2.0 mccabe-0.6.1 nodeenv-1.6.0 opencv-contrib-python-4.4.0.46 paddleOCR-2.4.0.4 platformdirs-2.5.1 pre-commit-2.18.1 premailer-3.10.0 pyclipper-1.3.0.post2 pycodestyle-2.8.0 pycryptodome-3.14.1 pyflakes-2.4.0 python-Levenshtein-0.12.2 pyyaml-6.0 shellcheck-py-0.8.0.4 toml-0.10.2 virtualenv-20.14.1 visualdl-2.2.3\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"from paddleocr import PaddleOCR, draw_ocr # main OCR dependencies\n",
"from matplotlib import pyplot as plt # plot images\n",
"import cv2 #opencv\n",
"import os # folder directory navigation\n",
"# Paddleocr At present, it supports both Chinese and English 、 english 、 French 、 German 、 Korean 、 Japanese , It can be modified by lang Switch parameters \n",
"\n",
"# The parameters are `ch`, `en`, `french`, `german`, `korean`, `japan`.\n",
"\n",
"ocr = PaddleOCR(use_angle_cls=True, lang=\"ar\") # need to run only once to download and load model into memory\n",
"\n",
"# Select the image path you want to recognize "
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Ar5037fFKdxP",
"outputId": "67bc5ad8-755c-4189-8928-226175da5258"
},
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/usr/local/lib/python3.7/dist-packages/scipy/fft/__init__.py:97: DeprecationWarning: The module numpy.dual is deprecated. Instead of using dual, use the functions directly from numpy or scipy.\n",
" from numpy.dual import register_func\n",
"/usr/local/lib/python3.7/dist-packages/scipy/special/orthogonal.py:81: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.\n",
"Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\n",
" from numpy import (exp, inf, pi, sqrt, floor, sin, cos, around, int,\n",
"/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.\n",
" supported_dtypes = [np.typeDict[x] for x in supported_dtypes]\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"download https://paddleocr.bj.bcebos.com/dygraph_v2.0/multilingual/en_ppocr_mobile_v2.0_det_infer.tar to /root/.paddleocr/whl/det/en/en_ppocr_mobile_v2.0_det_infer/en_ppocr_mobile_v2.0_det_infer.tar\n"
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"100%|██████████| 3.16M/3.16M [00:15<00:00, 207kiB/s]\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"download https://paddleocr.bj.bcebos.com/dygraph_v2.0/multilingual/arabic_ppocr_mobile_v2.0_rec_infer.tar to /root/.paddleocr/whl/rec/arabic/arabic_ppocr_mobile_v2.0_rec_infer/arabic_ppocr_mobile_v2.0_rec_infer.tar\n"
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"100%|██████████| 2.72M/2.72M [00:09<00:00, 280kiB/s]\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"download https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar to /root/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer/ch_ppocr_mobile_v2.0_cls_infer.tar\n"
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"100%|██████████| 1.45M/1.45M [00:11<00:00, 128kiB/s]"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"[2022/04/13 01:14:11] ppocr DEBUG: Namespace(alpha=1.0, benchmark=False, beta=1.0, cls_batch_num=6, cls_image_shape='3, 48, 192', cls_model_dir='/root/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer', cls_thresh=0.9, cpu_threads=10, crop_res_save_dir='./output', det=True, det_algorithm='DB', det_db_box_thresh=0.6, det_db_score_mode='fast', det_db_thresh=0.3, det_db_unclip_ratio=1.5, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_east_score_thresh=0.8, det_fce_box_type='poly', det_limit_side_len=960, det_limit_type='max', det_model_dir='/root/.paddleocr/whl/det/en/en_ppocr_mobile_v2.0_det_infer', det_pse_box_thresh=0.85, det_pse_box_type='quad', det_pse_min_area=16, det_pse_scale=1, det_pse_thresh=0, det_sast_nms_thresh=0.2, det_sast_polygon=False, det_sast_score_thresh=0.5, draw_img_save_dir='./inference_results', drop_score=0.5, e2e_algorithm='PGNet', e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_limit_side_len=768, e2e_limit_type='max', e2e_model_dir=None, e2e_pgnet_mode='fast', e2e_pgnet_score_thresh=0.5, e2e_pgnet_valid_set='totaltext', enable_mkldnn=False, fourier_degree=5, gpu_mem=500, help='==SUPPRESS==', image_dir=None, ir_optim=True, label_list=['0', '180'], lang='ar', layout_label_map=None, layout_path_model='lp://PubLayNet/ppyolov2_r50vd_dcn_365e_publaynet/config', max_batch_size=10, max_text_length=25, min_subgraph_size=15, mode='structure', ocr_version='PP-OCRv2', output='./output', precision='fp32', process_id=0, rec=True, rec_algorithm='CRNN', rec_batch_num=6, rec_char_dict_path='/usr/local/lib/python3.7/dist-packages/paddleocr/ppocr/utils/dict/arabic_dict.txt', rec_image_shape='3, 32, 320', rec_model_dir='/root/.paddleocr/whl/rec/arabic/arabic_ppocr_mobile_v2.0_rec_infer', save_crop_res=False, save_log_path='./log_output/', scales=[8, 16, 32], show_log=True, structure_version='STRUCTURE', table_char_dict_path=None, table_char_type='en', table_max_len=488, table_model_dir=None, total_process_num=1, type='ocr', use_angle_cls=True, use_dilation=False, use_gpu=False, use_mp=False, use_onnx=False, use_pdserving=False, use_space_char=True, use_tensorrt=False, vis_font_path='./doc/fonts/simfang.ttf', warmup=False)\n"
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"\n",
"\n",
"img_path = 'sa.png'\n",
"\n",
"result = ocr.ocr(img_path)\n",
"\n",
"for line in result:\n",
"\n",
" print(line)\n",
"\n",
"# Show results \n",
"\n",
"from PIL import Image\n",
"\n",
"image = Image.open(img_path).convert('RGB')\n",
"\n",
"boxes = [line[0] for line in result]\n",
"\n",
"txts = [line[1][0] for line in result]\n",
"\n",
"scores = [line[1][1] for line in result]\n",
"\n",
"\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "UqzORhnXLBum",
"outputId": "04ee0b4a-d1a1-4914-a902-3a7aa6070685"
},
"execution_count": 8,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[2022/04/13 01:18:08] ppocr DEBUG: dt_boxes num : 36, elapse : 0.40086865425109863\n",
"[2022/04/13 01:18:09] ppocr DEBUG: cls num : 36, elapse : 1.2031359672546387\n",
"[2022/04/13 01:18:11] ppocr DEBUG: rec_res num : 36, elapse : 1.7852575778961182\n",
"[[[242.0, 337.0], [332.0, 337.0], [332.0, 350.0], [242.0, 350.0]], ('اعا', 0.7704049)]\n",
"[[[378.0, 338.0], [410.0, 342.0], [409.0, 356.0], [376.0, 352.0]], ('برم', 0.55957407)]\n",
"[[[475.0, 340.0], [706.0, 337.0], [706.0, 354.0], [475.0, 356.0]], ('حعلت', 0.6511162)]\n",
"[[[367.0, 391.0], [429.0, 391.0], [429.0, 402.0], [367.0, 402.0]], ('انت', 0.61497617)]\n",
"[[[475.0, 398.0], [709.0, 399.0], [709.0, 416.0], [475.0, 415.0]], ('احکتت', 0.7647204)]\n",
"[[[360.0, 408.0], [431.0, 408.0], [431.0, 429.0], [360.0, 429.0]], ('الا', 0.7701049)]\n",
"[[[160.0, 420.0], [193.0, 420.0], [193.0, 431.0], [160.0, 431.0]], ('وم', 0.6665861)]\n",
"[[[556.0, 422.0], [603.0, 422.0], [603.0, 432.0], [556.0, 432.0]], ('لت', 0.53132653)]\n",
"[[[93.0, 440.0], [134.0, 443.0], [132.0, 457.0], [92.0, 454.0]], ('ع', 0.6411213)]\n",
"[[[71.0, 444.0], [91.0, 444.0], [91.0, 451.0], [71.0, 451.0]], ('ال', 0.70341563)]\n",
"[[[588.0, 463.0], [661.0, 461.0], [661.0, 472.0], [588.0, 474.0]], ('دسکت', 0.50397027)]\n",
"[[[363.0, 500.0], [428.0, 500.0], [428.0, 514.0], [363.0, 514.0]], ('الاي', 0.55510557)]\n",
"[[[40.0, 531.0], [135.0, 531.0], [135.0, 545.0], [40.0, 545.0]], ('اوي', 0.9594281)]\n",
"[[[689.0, 543.0], [706.0, 543.0], [706.0, 555.0], [689.0, 555.0]], ('ال', 0.97591746)]\n",
"[[[340.0, 610.0], [393.0, 604.0], [396.0, 623.0], [342.0, 629.0]], ('الا', 0.7891887)]\n",
"[[[407.0, 611.0], [430.0, 611.0], [430.0, 627.0], [407.0, 627.0]], ('بل', 0.6574571)]\n",
"[[[475.0, 603.0], [706.0, 604.0], [706.0, 618.0], [475.0, 617.0]], ('مما', 0.7507376)]\n",
"[[[12.0, 613.0], [87.0, 608.0], [88.0, 622.0], [13.0, 626.0]], ('تلخوك', 0.5546564)]\n"
]
}
]
}
]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment