Problems with the unit-tests
UnitedMarsupials opened this issue · 0 comments
UnitedMarsupials commented
I'm trying to create a FreeBSD port of EasyOCR. I got the build part working, I think, but the testing remains a problem.
The command-line prescribed in the README.md
:
python ./unit_test/run_unit_test.py --easyocr ./easyocr --verbose 2 --test ./unit_test/EasyOcrUnitTestPackage.pickle --data_dir ./examples
does not work: the --data_dir
argument is unrecognized, and the pickle-file is in the wrong location. The following version works better:
python unit_test/run_unit_test.py --easyocr easyocr --verbose 2 --test unit_test/data/EasyOcrUnitTestPackage.pickle -d examples
But it still chokes, if one's torch installation has no CUDA-support:
Unit test is set for EasyOCR at /n/home/ports/graphics/easyocr/work-py311/EasyOCR-1.7.2/easyocr
Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU.
Testing EasyOCR: 9 modules will be tested.
##Testing module model initialization: 4 tests will be performed.
#### test01: Counting parameters of detector module.
#### Passed. [1/4]
#### test02: Calculating total norm of parameters in detector module.
#### Passed. [2/4]
#### test03: Counting parameters of recognition module.
#### Passed. [3/4]
#### test04: Calculating total norm of parameters in recognition module.
#### Passed. [4/4]
##Module model initialization: Passed.
##Testing module get_textbox function: 3 tests will be performed.
#### test01: Testing with default input.
Traceback (most recent call last):
File "/n/home/ports/graphics/easyocr/work-py311/EasyOCR-1.7.2/unit_test/run_unit_test.py", line 19, in <module>
main(args)
File "/n/home/ports/graphics/easyocr/work-py311/EasyOCR-1.7.2/unit_test/run_unit_test.py", line 9, in main
unit_test.do_test(args.verbose)
File "/n/home/ports/graphics/easyocr/work-py311/EasyOCR-1.7.2/unit_test/unit_test.py", line 198, in do_test
results = test_method(*test['input'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/n/home/ports/graphics/easyocr/work-py311/EasyOCR-1.7.2/easyocr/detection.py", line 95, in get_textbox
bboxes_list, polys_list = test_net(canvas_size, mag_ratio, detector,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/n/home/ports/graphics/easyocr/work-py311/EasyOCR-1.7.2/easyocr/detection.py", line 42, in test_net
x = x.to(device)
^^^^^^^^^^^^
File "/opt/lib/python3.11/site-packages/torch/cuda/__init__.py", line 305, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
If CUDA is not, actually, required for EasyOCR to function, perhaps, the test should skip the CUDA-related units instead of failing on them?