How do I use a pre-trained PaddleOCR model within code?

773 Views Asked by At

I intend to use PaddleOCR to detect image orientation and plan to use their Text Angle Classification Model. However, I got stuck trying to figure out how to install it and integrate it into my code (I just have a downloaded tar file). How do I use the model in my Python code?

If it matters, I am using WSL (Windows Subsystem for Linux) and do not have a GPU.

1

There are 1 best solutions below

1
On

You would need to create a virtual environment either via Anaconda or via Python venv and then install the PaddleOCR package via pip. Steps you should follow:

  1. Setup a virtual environment. You can follow the instructions from PaddleOCR to do this.
  2. Activate the virtual environment on the command terminal and then install the PaddleOCR package via: pip install "paddleocr>=2.0.1"
  3. Once the installation is done, you can use this snippet to test text detection and recognition via PaddleOCR.
  4. You can also follow this link for text direction classification.