This code is working fine for me but how do I define the path of the model where "mmocr" should download the detection model and recognition model because I wanna send it statically on serverless to reduce time consuming?
Reproduces the problem - code sample
import numpy as np
import time
import cv2
from mmocr.apis import MMOCRInferencer
from mmocr.utils import poly2bbox
Prerequisite
Task
I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
Branch
main branch https://github.com/open-mmlab/mmocr
Environment
This code is working fine for me but how do I define the path of the model where "mmocr" should download the detection model and recognition model because I wanna send it statically on serverless to reduce time consuming?
Reproduces the problem - code sample
import numpy as np import time import cv2
from mmocr.apis import MMOCRInferencer from mmocr.utils import poly2bbox
Load models into memory
ocr = MMOCRInferencer(det='DBNet', rec='SAR', device='cpu')
startTime = time.time() img = cv2.imread('../mmocr/images/00_04_24_000-00_04_24_375.jpg', cv2.IMREAD_COLOR)
Perform inference
aaa = ocr(img) print(aaa["predictions"]) print([poly2bbox(poly) for poly in aaa["predictions"][0]["det_polygons"]]) print(f"Time taken: {time.time() - startTime} seconds")
Reproduces the problem - command or script
...
Reproduces the problem - error message
...
Additional information
No response