-
-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
27 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
# @Author: SWHL | ||
# @Contact: [email protected] | ||
from .main import TextRecognizer | ||
from .utils import TextRecognizerOutput | ||
from .utils import TextRecArguments, TextRecOutput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# -*- encoding: utf-8 -*- | ||
# @Author: SWHL | ||
# @Contact: [email protected] | ||
from dataclasses import dataclass, field | ||
from dataclasses import dataclass | ||
from pathlib import Path | ||
from typing import List, Optional, Tuple, Union | ||
|
||
import numpy as np | ||
|
||
|
||
@dataclass | ||
class TextRecognizerConfig: | ||
class TextRecConfig: | ||
intra_op_num_threads: int = -1 | ||
inter_op_num_threads: int = -1 | ||
use_cuda: bool = False | ||
|
@@ -21,18 +21,20 @@ class TextRecognizerConfig: | |
rec_keys_path: Union[str, Path, None] = None | ||
|
||
|
||
def cvt(img): | ||
if isinstance(img, np.ndarray): | ||
return [img] | ||
return img | ||
|
||
|
||
@dataclass | ||
class TextRecognizerInput: | ||
img_list: Union[np.ndarray, List[np.ndarray]] = field(init=False) | ||
class TextRecArguments: | ||
img: Union[np.ndarray, List[np.ndarray], None] = None | ||
return_word_box: bool = False | ||
|
||
def __pose_init__(self): | ||
if isinstance(self.img_list, np.ndarray): | ||
self.img_list = [self.img_list] | ||
|
||
|
||
@dataclass | ||
class TextRecognizerOutput: | ||
class TextRecOutput: | ||
line_results: Optional[Tuple[List]] = None | ||
word_results: Optional[List[List]] = None | ||
elapse: Optional[float] = None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters