π Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
from typing import Any, Dict, List, Tuple
import numpy as np
class ToJSON:
@classmethod
def to(
cls, boxes: np.ndarray, txts: Tuple[str], scores: Tuple[float]
) -> List[Dict[Any, Any]]:
results = []
for box, txt, score in zip(boxes, txts, scores):
results.append({"box": box.tolist(), "txt": txt, "score": score})
return results