You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'"
for text_lines_one in aaa["predictions"][0]["det_polygons"]:
# Polygon corner points coordinates
pts = np.array(text_lines_one,
np.int32)
pts = pts.reshape((-1, 1, 2))
isClosed = True
# Blue color in BGR
color = (255, 0, 0)
# Line thickness of 2 px
thickness = 2
# Using cv2.polylines() method
# Draw a Blue polygon with
# thickness of 1 px
image = cv2.polylines(img, [pts],
isClosed, color, thickness)
Displaying the image
while(1):
cv2.imshow('image', image)
if cv2.waitKey(20) & 0xFF == 27:
break
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'"
go to file: "env/lib/python3.12/site-packages/mmcv/utils/ext_loader.py"
change line 13 - 17 with this code:
From:
ext = importlib.import_module('mmcv.' + name)
for fun in funcs:
assert hasattr(ext, fun), f'{fun} miss in module {name}'
return ext
to:
if not name == "_ext":
ext = importlib.import_module('mmcv.' + name)
for fun in funcs:
assert hasattr(ext, fun), f'{fun} miss in module {name}'
return ext
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: