SkillAgentSearch skills...

PPOCRLabel

PPOCRLabelv3 is a semi-automatic graphic annotation tool suitable for OCR field, with built-in PP-OCR model to automatically detect and re-recognize data.

Install / Use

/learn @PFCCLab/PPOCRLabel
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

English | 简体中文

PPOCRLabelv3

PyPI - Version PyPI - Downloads Downloads

PPOCRLabelv3 is a semi-automatic graphic annotation tool suitable for OCR field, with built-in PP-OCR model to automatically detect and re-recognize data. It is written in Python3 and PyQT5, supporting rectangular box, table, irregular text and key information annotation modes. Annotations can be directly used for the training of PP-OCR detection and recognition models.

| regular text annotation | table annotation | | :-------------------------------------------------: | :--------------------------------------------: | | <img src="./data/gif/steps_en.gif" width="80%"/> | <img src="./data/gif/table.gif" width="100%"/> | | irregular text annotation | key information annotation | | <img src="./data/gif/multi-point.gif" width="80%"/> | <img src="./data/gif/kie.gif" width="100%"/> |

Recent Update

  • 2026.03:
    • Add the Settings to change the application's font size.
  • 2025.06:
    • Add the Resort Bounding Box Positions features. For usage details, please refer to the 11. Additional Feature Description in the 2.1 Operational Steps section below.
  • 2024.11:
    • Add the label_font_path parameter to change the font of the label.
    • Add the selected_shape_color parameter to change the color of the selected label box and font.
  • 2024.09:
    • Added Re-recognition and Auto Save Unsaved changes features. For usage details, please refer to the 11. Additional Feature Description in the 2.1 Operational Steps section below.
    • Added the parameter --img_list_natural_sort, which defaults to natural sorting for the left image list. After configuring this parameter, character sorting will be used to easily locate images based on character order.
    • Add 6 custom model parameters:
      • det_model_dir: Path to the detection model directory
      • det_model_name: Name of the detection model
      • rec_model_dir: Path to the recognition model directory
      • rec_model_name: Name of the recognition model
      • rec_char_dict_path: Path to the recognition model dictionary file
      • cls_model_dir: Path to the classification model directory
    • Added the --bbox_auto_zoom_center parameter, which can be enabled when there is only one bounding box in the image, automatically centering and zooming in on the bounding box.
    • Added 5 shortcut keys z, x, c, v, b for controlling the 4 vertices of the bounding box. For usage details, see the '11. Additional Functionality Description' in "2.1 Operating Procedures" below.
  • 2022.05: Add table annotations, follow 2.2 Table Annotations for more information (by whjdark; Evezerest)
  • 2022.02: (by PeterH0323)
    • Add KIE Mode by using --kie, for [detection + identification + keyword extraction] labeling.
    • Improve user experience: prompt for the number of files and labels, optimize interaction, and fix bugs such as only use CPU when inference
    • New functions: Support using C or X to rotate box.
  • 2021.11.17:
    • Support install and start PPOCRLabel through the whl package (by d2623587501)
    • Dataset segmentation: Divide the annotation file into training, verification and testing parts (refer to section 3.5 below, by MrCuiHao)
  • 2021.8.11:
    • New functions: Open the dataset folder, image rotation (Note: Please delete the label box before rotating the image) (by Wei-JL)
    • Added shortcut key description (Help-Shortcut Key), repaired the direction shortcut key movement function under batch processing (by d2623587501)
  • 2021.2.5: New batch processing and undo functions (by Evezerest):
    • Batch processing function: Press and hold the Ctrl key to select the box, you can move, copy, and delete in batches.
    • Undo function: In the process of drawing a four-point label box or after editing the box, press Ctrl+Z to undo the previous operation.
    • Fix image rotation and size problems, optimize the process of editing the mark frame (by ninetailskimedencfc).
  • 2021.1.11: Optimize the labeling experience (by edencfc),
    • Users can choose whether to pop up the label input dialog after drawing the detection box in "View - Pop-up Label Input Dialog".
    • The recognition result scrolls synchronously when users click related detection box.
    • Click to modify the recognition result.(If you can't change the result, please switch to the system default input method, or switch back to the original input method again)
  • 2020.12.18: Support re-recognition of a single label box (by ninetailskim ), perfect shortcut keys.

1. Installation and Run

1.1 Install PaddlePaddle

pip3 install --upgrade pip

# If you only have cpu on your machine, please run the following command to install
python3 -m pip install paddlepaddle -i https://www.paddlepaddle.org.cn/packages/stable/cpu/

For more software version requirements, please refer to the instructions in Installation Document for operation.

1.2 Install and Run PPOCRLabel

PPOCRLabel can be started in two ways: whl package and Python script. The whl package form is more convenient to start, and the python script to start is convenient for secondary development.

Note: By default, PPOCRLabel starts with a Chinese UI (--lang ch). To switch to English, you need to launch the application with the --lang en parameter.

Windows

pip install PPOCRLabel  # install

# Select label mode and run
PPOCRLabel  # [Normal mode] for [detection + recognition] labeling
PPOCRLabel --kie True # [KIE mode] for [detection + recognition + keyword extraction] labeling

If you getting this error OSError: [WinError 126] The specified module could not be found when you install shapely on windows. Please try to download Shapely whl file using http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely.

Reference: Solve shapely installation on windows

Ubuntu Linux

pip3 install PPOCRLabel
pip3 install trash-cli
export QT_QPA_PLATFORM=wayland # Consider adding it to the system environment variables to avoid entering it multiple times.

# Select label mode and run
PPOCRLabel  # [Normal mode] for [detection + recognition] labeling
PPOCRLabel --kie True # [KIE mode] for [detection + recognition + keyword extraction] labeling

MacOS

pip3 install PPOCRLabel
pip3 install opencv-contrib-python-headless==4.2.0.32

# Select label mode and run
PPOCRLabel  # [Normal mode] for [detection + recognition] labeling
PPOCRLabel --kie True # [KIE mode] for [detection + recognition + keyword extraction] labeling

1.2.2 Run PPOCRLabel by Python Script

If you modify the PPOCRLabel file (for example, specifying a new built-in model), it will be more convenient to see the results by running the Python script. If you still want to start with the whl package, you need to uninstall the whl package in the current environment and then recompile it according to the next section.

cd ./PPOCRLabel  # Switch to the PPOCRLabel directory

# Select label mode and run
python PPOCRLabel.py  # [Normal mode] for [detection + recognition] labeling
python PPOCRLabel.py --kie True # [KIE mode] for [detection + recognition + keyword extraction] labeling

1.2.3 Build and Install the Whl Package Locally

cd ./PPOCRLabel
pip3 install -e .

1.2.4 Pyinstaller build

cd ./PPOCRLabel
# install pyinstaller
pip install pyinstaller

# Regenerate Resources
pyrcc5 -o libs/resources.py resources.qrc

# Packaging executable programs
pyinstaller -c PPOCRLabel.py --collect-all paddleocr --collect-all pyclipper --collect-all imghdr --collect-all skimage --collect-all imgaug --collect-all scipy.io --collect-all lmdb --collect-all paddle --hidden-import=pyqt5  -p ./libs -p ./ -p ./data -p ./resources -F

# Run the executable program in dist, windows as an example
PPOCRLabel.exe --lang ch

2. Usage

2.1 Steps

  1. Build and launch using the instructions above.

  2. Click 'Open Dir' in Menu/File to select the folder of the picture.<sup>[1]</sup>

  3. Click 'Auto recognition', use PP-OCR model to automatically annotate images which marked with 'X' <sup>[2]</sup>before the file name.

  4. Create Box:

    4.1 Click 'Create RectBox' or press 'W' in English keyboard mode to draw a new rectangle detection box. Click and release left mouse to select a region to annotate the text area.

    4.2 Press 'Q' to enter four-point labeling mode which enables you to create any four-point shape by clicking four points with the left mouse button in succession and DOUBLE CLICK the left mouse as the signal of labeling completion.

  5. After the marking frame is drawn, the user clicks "OK", and the detection frame will be pre-assigned a "TEMPORARY" label.

  6. Click 're-Recognition', model will rewrite ALL recognition results in ALL detection box<sup>[3]</sup>.

  7. Single click the result in 'recognition result' list to manually change inaccurate recognition results. Note: If the text is illegible or extremely blurry, it is recommended to change the label to ###. The PaddleOC

View on GitHub
GitHub Stars410
CategoryDevelopment
Updated28m ago
Forks103

Languages

Python

Security Score

80/100

Audited on Apr 1, 2026

No findings