About
Classify document image orientation as 0, 90, 180, or 270 degrees
This Ikomia plugin uses PaddleOCR's PP-LCNet_x1_0_doc_ori model to classify
a document image into one of four clockwise orientation classes: 0, 90,
180, or 270 degrees.
Use with Ikomia API
Install Ikomia API
We recommend using a virtual environment.
pip install ikomia
Create a workflow
from ikomia.dataprocess.workflow import Workflowwf = Workflow()orientation = wf.add_task(name="infer_document_orientation",auto_connect=True,)wf.run_on(url=("https://paddle-model-ecology.bj.bcebos.com/paddlex/""imgs/demo_image/img_rot180_demo.jpg"))display(orientation.get_image_with_graphics())display(orientation.get_output(4).get_image())
Parameters
model_name: PaddleOCR model name. Defaults toPP-LCNet_x1_0_doc_ori.cuda: use GPU 0 when enabled and the installed PaddlePaddle build supports CUDA. Defaults toFalse.enable_mkldnn: enable PaddlePaddle MKL-DNN CPU acceleration.cpu_threads: number of inference threads used on CPU. Defaults to10.auto_rotate: rotate the second image output to an upright orientation using the predicted class. Defaults toFalse.
orientation.set_parameters({"model_name": "PP-LCNet_x1_0_doc_ori","cuda": "False","enable_mkldnn": "True","cpu_threads": "10","auto_rotate": "True",})
Note: for GPU inference, replace the CPU paddlepaddle package with the appropriate
paddlepaddle-gpu build for your CUDA environment, following PaddlePaddle's
installation guide.
Output
Output 0 contains the predicted orientation label and its confidence score. The labels match PaddleOCR's four model categories:
| Class ID | Label |
|---|---|
| 0 | 0° |
| 1 | 90° |
| 2 | 180° |
| 3 | 270° |
Output 4 contains an image. When auto_rotate is enabled for whole-image
classification, it is rotated to an upright orientation using PaddleX's
counter-clockwise correction convention. Otherwise, it is an unchanged
pass-through image.
References
Developer
Ikomia
License
Apache License 2.0
A permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
| Permissions | Conditions | Limitations |
|---|---|---|
Commercial use | License and copyright notice | Trademark use |
Modification | State changes | Liability |
Distribution | Warranty | |
Patent use | ||
Private use |
This is not legal advice: this description is for informational purposes only and does not constitute the license itself. Provided by choosealicense.com.