Downloads · 30 days
0
fimu-docproc-research/standard_0.2.2_EasyOcrEngine
standard_0.2.2_EasyOcrEngine is a machine learning model from fimu-docproc-research. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Jul 18, 2023
Repo size
15.4 MB
Likes
0
Public
Click a slice to open those files.
.pth15.4 MB · 100%
From the Hugging Face model README
>>> import easyocr
>>> import torch
>>> from huggingface_hub import hf_hub_download
>>> # Initialize default easyocr model
>>> reader = easyocr.Reader(['en', 'cs', 'sk', 'pl'])
>>> # Download weights of recognition module.
>>> model_dir = hf_hub_download(repo_id="fimu-docproc-research/standard_0.2.2_EasyOcrEngine", filename="weights.pth")
>>> # Load the weights
>>> state_dict = torch.load(model_dir, map_location="cuda")
>>> # Load the state dictionary into the model
>>> reader.recognizer.load_state_dict(state_dict)
>>> # Typical usage of easyocr model to get predictions
>>> res = reader.readtext(input_img)
>>> from collections import OrderedDict
>>> import easyocr
>>> import torch
>>> from huggingface_hub import hf_hub_download
>>> # Initialize default easyocr model
>>> reader = easyocr.Reader(['en', 'cs', 'sk', 'pl'], quantize=False, gpu=False)
>>> # Download weights of recognition module.
>>> model_dir = hf_hub_download(repo_id="fimu-docproc-research/standard_0.2.2_EasyOcrEngine", filename="weights.pth")
>>> # Load the weights
>>> state_dict = torch.load(model_dir, map_location="cpu")
>>> # There is need to remove first 7 characters due to easyocr library
>>> new_state_dict = OrderedDict()
>>> for key, value in state_dict.items():
>>> new_key = key[7:]
>>> new_state_dict[new_key] = value
>>> # Load the state dictionary into the model
>>> reader.recognizer.load_state_dict(new_state_dict)
>>> # Typical usage of easyocr model to get predictions
>>> res = reader.readtext(input_img)