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

Problems with the unit-tests #1347

Open
UnitedMarsupials opened this issue Dec 14, 2024 · 0 comments
Open

Problems with the unit-tests #1347

UnitedMarsupials opened this issue Dec 14, 2024 · 0 comments

Comments

@UnitedMarsupials
Copy link

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?

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

1 participant