cnn-number-detection icon indicating copy to clipboard operation
cnn-number-detection copied to clipboard

Unable to run the code

Open KorneliaBastin opened this issue 3 years ago • 2 comments

Hi,

I am trying to run the code using already train models on one of the available images. I basically just want to test how it works.

I am in cnn-number-detection folder and I run python3 Tester/test_model.py -h and get the following error:

from Tester.tester import Tester ModuleNotFoundError: No module named 'Tester'

I am not sure what and how to change, the dependencies look ok so I have no idea what is wrong. Could you please help?

KorneliaBastin avatar Jan 13 '22 01:01 KorneliaBastin

The imports in the project are done by importing them as modules. Thus you have to start all scripts with the respective flag -m from python as follows: python3 -m Tester.test_model -h

FabianGroeger96 avatar Jan 13 '22 07:01 FabianGroeger96

Thank you!

I seem to have the code working now. But I encounter few more issues. When I run the code on picture without numbers I get:

Total params: 57,482 Trainable params: 57,482 Non-trainable params: 0


2022-01-13 15:35:07,428 - Tester - INFO - [Prediction] type: info, category: -1 (100.00%) : cannot connect to X server

Which seems fine, category is -1 so no digit detected, but when I run it on the picture with digits I get:

Total params: 57,482 Trainable params: 57,482 Non-trainable params: 0


and thats it! What is the detected digit? There is no prediction displayed anywhere....

Also another thing is I tried to run the code on my image and I get the error message as below:

Total params: 57,482 Trainable params: 57,482 Non-trainable params: 0


Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/content/cnn-number-detection/Tester/test_model.py", line 57, in main() File "/content/cnn-number-detection/Tester/test_model.py", line 37, in main tester.test_model_with_image(args.test_image) File "/content/cnn-number-detection/Tester/tester.py", line 25, in test_model_with_image regions_of_interest = self.isolator.get_regions_of_interest(image_array) File "/content/cnn-number-detection/Isolator/isolator.py", line 25, in get_regions_of_interest cropped_images = self.__crop(image) File "/content/cnn-number-detection/Isolator/isolator.py", line 78, in __crop info_start = self.CONSTANTS.CROP_INFO_HEIGHT_START AttributeError: 'NoneType' object has no attribute 'CROP_INFO_HEIGHT_START'

Not sure how I can give my image those attributes

Could you please advice?

Thanks, Kornelia

KorneliaBastin avatar Jan 13 '22 15:01 KorneliaBastin