mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
use rapidocr
This commit is contained in:
parent
08e54ec5c1
commit
c59f932bf0
10 changed files with 292 additions and 284 deletions
26
machine-learning/immich_ml/models/ocr/schemas.py
Normal file
26
machine-learning/immich_ml/models/ocr/schemas.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from typing import Iterable
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
from rapidocr.utils.typings import EngineType
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class TextDetectionOutput(TypedDict):
|
||||
resized: npt.NDArray[np.float32]
|
||||
boxes: npt.NDArray[np.float32]
|
||||
scores: Iterable[float]
|
||||
|
||||
|
||||
class TextRecognitionOutput(TypedDict):
|
||||
box: npt.NDArray[np.float32]
|
||||
boxScore: Iterable[float]
|
||||
text: Iterable[str]
|
||||
textScore: Iterable[float]
|
||||
|
||||
|
||||
# RapidOCR expects engine_type to be an attribute
|
||||
class OcrOptions(dict):
|
||||
def __init__(self, **options):
|
||||
super().__init__(**options)
|
||||
self.engine_type = EngineType.ONNXRUNTIME
|
||||
Loading…
Add table
Add a link
Reference in a new issue