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

[Bug] On the latest version of mmocr how do I set statically the model download path? #2046

Open
2 tasks done
R4Ajeti opened this issue May 14, 2024 · 0 comments
Open
2 tasks done
Assignees

Comments

@R4Ajeti
Copy link

R4Ajeti commented May 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants