>>> import easyocr
>>> import torch
>>> from huggingface_hub import hf_hub_download
>>>
>>> reader = easyocr.Reader(['en', 'cs', 'sk', 'pl'])
>>>
>>> model_dir = hf_hub_download(repo_id="fimu-docproc-research/standard_0.2.1_EasyOcrEngine", filename="weights.pth")
>>>
>>> state_dict = torch.load(model_dir, map_location="cuda")
>>>
>>> reader.recognizer.load_state_dict(state_dict)
>>>
>>> res = reader.readtext(input_img)
Example usage (without GPU):
>>> from collections import OrderedDict
>>> import easyocr
>>> import torch
>>> from huggingface_hub import hf_hub_download
>>>
>>> reader = easyocr.Reader(['en', 'cs', 'sk', 'pl'], quantize=False, gpu=False)
>>>
>>> model_dir = hf_hub_download(repo_id="fimu-docproc-research/standard_0.2.1_EasyOcrEngine", filename="weights.pth")
>>>
>>> state_dict = torch.load(model_dir, map_location="cpu")
>>>
>>> new_state_dict = OrderedDict()
>>> for key, value in state_dict.items():
>>> new_key = key[7:]
>>> new_state_dict[new_key] = value
>>>
>>> reader.recognizer.load_state_dict(new_state_dict)
>>>
>>> res = reader.readtext(input_img)