-
Notifications
You must be signed in to change notification settings - Fork 728
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] mmocr not working on mac anymore (MacBook M3 chip) #2045
Comments
I found a temporary fix while debugging:
From:
to:
|
Hi @R4Ajeti , how did you install mmcv? pip install openmim
mim install mmcv==2.1.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
python mmocr/utils/collect_env.py
sys.platform: darwin
Python: 3.12.1 (main, Apr 10 2024, 22:20:38) [Clang 15.0.0 (clang-1500.3.9.4)]
CUDA available: False
MUSA available: False
numpy_random_seed: 2147483648
GCC: Apple clang version 15.0.0 (clang-1500.3.9.4)
PyTorch: 2.2.2
PyTorch compiling details: PyTorch built with:
TorchVision: 0.17.2
OpenCV: 4.9.0
MMEngine: 0.10.4
MMOCR: 1.0.1+2caab0a
Reproduces the problem - code sample
Device: MacBook M3 chip
Following installation using this link:
https://github.com/open-mmlab/mmocr
Also following discussion from here:
open-mmlab/mmcv#204
Nothing worked for me to make OCR work.
The installation process is going all just fine but the package is not working when It comes to OCR samples.
I am getting this error:
File "../env/lib/python3.12/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext
ext = importlib.import_module('mmcv.' + name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
File "../.pyenv/versions/3.12.1/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'mmcv._ext'"
$ pip list | grep mm
Is giving me
mmcv 2.1.0
mmdet 3.3.0
mmengine 0.10.4
mmocr 1.0.1 ../repositories/mmocr
What am I doing wrong?
Does anyone, have any experience on mac releted to this one?
BTW: I am using python3.12.1
Reproduces the problem - command or script
from mmocr.apis import MMOCRInferencer
from mmocr.utils import poly2bbox
import numpy as np
import time
import cv2
Load models into memory
ocr = MMOCRInferencer(det='DBNet', rec=None, device='cpu') # Time taken: 1.3455498218536377 seconds
Perform inference
startTime = time.time()
aaa = ocr('../mmocr/images/00_04_24_000-00_04_24_375.jpg')
print(aaa["predictions"])
print([poly2bbox(poly) for poly in aaa["predictions"][0]["det_polygons"]])
print(f"Time taken: {time.time() - startTime} seconds")
img = cv2.imread('images/00_04_24_000-00_04_24_375.jpg', cv2.IMREAD_COLOR)
window_name = 'Image'
for text_lines_one in aaa["predictions"][0]["det_polygons"]:
# Polygon corner points coordinates
pts = np.array(text_lines_one,
np.int32)
Displaying the image
while(1):
cv2.destroyAllWindows()
Reproduces the problem - error message
I am using "DBNet"
Additional information
Device: MacBook M3 chip
Following installation using this link:
https://github.com/open-mmlab/mmocr
Also following discussion from here:
open-mmlab/mmcv#204
Nothing worked for me to make OCR work.
The installation process is going all just fine but the package is not working when It comes to OCR samples.
I am getting this error:
File "../env/lib/python3.12/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext
ext = importlib.import_module('mmcv.' + name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
File "../.pyenv/versions/3.12.1/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'mmcv._ext'"
$ pip list | grep mm
Is giving me
mmcv 2.1.0
mmdet 3.3.0
mmengine 0.10.4
mmocr 1.0.1 ../repositories/mmocr
What am I doing wrong?
Does anyone, have any experience on mac releted to this one?
BTW: I am using python3.12.1
The text was updated successfully, but these errors were encountered: