Search code examples
pythonocr

layoutparser gives error "module layoutparser has no attribute ocr"


I am trying to use the new layoutparser package to do some OCR. However, coming from an R backgroud I have a hard time getting it up and running.

I installed it via (worked fine):

pip install layoutparser
pip install "layoutparser[ocr]"

Now, when I run the following I get an error:

import layoutparser as lp

import matplotlib.pyplot as plt

import pandas as pd
import numpy as np
import cv2

ocr_agent = lp.ocr.TesseractAgent()
AttributeError: module layoutparser has no attribute ocr

Solution

  • ocr_agent = lp.TesseractAgent()