Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some typos #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OCRopus 4 Inferece
# OCRopus 4 Inference

This package implements OCRopus 4 inference.

Expand All @@ -19,4 +19,4 @@ Next Steps:
- optimize the models (memory, speed, error rate)
- transformer-based text line recognizer
- linearizer and/or bounding box extractor (using transformers)
- integrate deep-learning document cleanup
- integrate deep-learning document cleanup
6 changes: 3 additions & 3 deletions ocropus4inf/ocrinf.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def get_model(url):
else:
raise ValueError(f"unknown url scheme: {url}")

def flatten_paramters(model):
def flatten_parameters(model):
for m in model.modules():
if hasattr(m, "flatten_parameters"):
m.flatten_parameters()
Expand All @@ -264,7 +264,7 @@ def load_model(path):
import torch.jit

model = torch.jit.load(path, map_location=torch.device("cpu"))
model = flatten_paramters(model)
model = flatten_parameters(model)
return model
elif path.endswith(".pth"):
import torch
Expand All @@ -274,7 +274,7 @@ def load_model(path):
model = models.make(mname, device="cpu")
mdict = torch.load(path, map_location=torch.device("cpu"))
model.load_state_dict(mdict)
model = flatten_paramters(model)
model = flatten_parameters(model)
return model
else:
raise Exception("unknown model type: " + path)
Expand Down