Closed hlib-koshurnykov-deepsee closed 3 years ago
Or maybe some way to use only CPU instead of GPU
I don't have a mac, but if you can install mmcv on mac, then you can install mmocr.
Some model needs gpu, some does not. You may try different combinations using the demo code https://github.com/open-mmlab/mmocr/blob/main/demo/ocr_image_demo.py
I have the same question as @hlib-koshurnykov-deepsee.
@innerlee the issue is that on Mac we cannot install the cudatoolkit (I think... :) ).
E.g. I am installing mmcv
using pip install mmcv-full=="1.3.1" -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.1/index.html
.
Then I install mmdet
and mmocr
as explained here.
When everything is done, to check if things work, I run python demo/ocr_image_demo.py demo/demo_text_det.jpg demo/output.jpg
, which throws
Traceback (most recent call last):
File "demo/ocr_image_demo.py", line 118, in <module>
main()
File "demo/ocr_image_demo.py", line 86, in main
detect_model = init_detector(
File "/Users/francescopochetti/miniconda3/envs/ocr/lib/python3.8/site-packages/mmdet/apis/inference.py", line 51, in init_detector
model.to(device)
File "/Users/francescopochetti/miniconda3/envs/ocr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 673, in to
return self._apply(convert)
File "/Users/francescopochetti/miniconda3/envs/ocr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 387, in _apply
module._apply(fn)
File "/Users/francescopochetti/miniconda3/envs/ocr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 387, in _apply
module._apply(fn)
File "/Users/francescopochetti/miniconda3/envs/ocr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 409, in _apply
param_applied = fn(param)
File "/Users/francescopochetti/miniconda3/envs/ocr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 671, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
File "/Users/francescopochetti/miniconda3/envs/ocr/lib/python3.8/site-packages/torch/cuda/__init__.py", line 164, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
Ahh I see, the reason is that some mac does not have nvidia gpu, right?
Exactly. I guess all Macs, unfortunately.
@innerlee we have tried installing on Colab without a GPU and we get the same error. I am confused, is CUDA a prerequisite for MMOCR? e.g. even not on MacOS, the library won't work on CPU-only systems?
cc @lgvaz
DBNet and FCENet needs ModulatedDeformConv
, which is not implemented on cpu yet. So some models will not run on cpu-only systems. We will give a list for cpu/gpu compatibility of models later, and will try to make partial support for cpu-only environments.
Thanks a lot
fix
fix
@cuhk-hbsun does this mean CUDA is not a hard req anymore?
Is there any chance to use this on MacOS?