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

Liicense Plate Reader 3.3.0 under CPAI version 2.8 and 2.65 "Failed to Start" #127

Open
1 of 6 tasks
dslackhome opened this issue Aug 27, 2024 · 11 comments
Open
1 of 6 tasks

Comments

@dslackhome
Copy link

dslackhome commented Aug 27, 2024

Area of Concern

  • Server
  • Behaviour of one or more Modules [provide name(s), e.g. ObjectDetectionYolo]
  • Installer
  • Runtime [e.g. Python3.7, .NET]
  • Module packages [e.g. PyTorch)
  • Something else

Describe the bug
A clear and concise description of what the bug is.
In an attempt to get my Nvidia 1650 GPU graphics card to work with Yolo5 6.2 and License Plate Reader, I installed Nvidia Cuda 11.8. Cudnn 9.3. CPAI version 2.6.5, then CPAI server version 2.8. CPAI server version 2.8 got the Yolo5 6.2 to see and use the GPU, but License Plate Reader is failing to load and stops after 1 minute or less of being up. This License Plate Reader failed to start was also present in the CPAI server 2.65 version as well. My previous setup (Yolo5 6.2 and License Plate Reader was stable when on CPAI 2.6.5 using a Radeon graphics card and CPU only on the CPAI server. This License Plate Reader problem started after I switched to the Nvidia 1650 graphics card and started installing various CUDA versions (tried latest 12.6?, 11.7 and eventually settled on CUDA 11.8.

The license plate reader "failed to start" error seems to be centered around the log error messages related to:
ALPR_adapter.py
ALPR.py

image ![Screenshot 2024-08-27 120708](https://github.com/user-attachments/assets/141267ae-052c-4017-8fb9-854bf3d5242c)

Expected behavior
License Plate Reader should start and stay up and not fail to start.
License Plate Reader should also use GPU rather than CPU since a usable Nvidia 1650 GPU is present and setup.

and the missing module utils.tools

ALPR_adapter.py: import utils.tools as tool
ALPR_adapter.py: ModuleNotFoundError: No module named 'utils.tools'

(see screen shot of log below)

Screenshots
11:48:08:Restarting License Plate Reader to apply settings change
11:48:08:
11:48:08:Module 'License Plate Reader' 3.3.0 (ID: ALPR)
11:48:08:Valid: True
11:48:08:Module Path: \modules\ALPR
11:48:08:Module Location: Internal
11:48:08:AutoStart: True
11:48:08:Queue: alpr_queue
11:48:08:Runtime: python3.9
11:48:08:Runtime Location: Local
11:48:08:FilePath: ALPR_adapter.py
11:48:08:Start pause: 3 sec
11:48:08:Parallelism: 0
11:48:08:LogVerbosity:
11:48:08:Platforms: all,!windows-arm64
11:48:08:GPU Libraries: installed if available
11:48:08:GPU: use if supported
11:48:08:Accelerator:
11:48:08:Half Precision: enable
11:48:08:Environment Variables
11:48:08:AUTO_PLATE_ROTATE = True
11:48:08:CROPPED_PLATE_DIR = \Server\wwwroot
11:48:08:MIN_COMPUTE_CAPABILITY = 6
11:48:08:MIN_CUDNN_VERSION = 7
11:48:08:OCR_OPTIMAL_CHARACTER_HEIGHT = 60
11:48:08:OCR_OPTIMAL_CHARACTER_WIDTH = 30
11:48:08:OCR_OPTIMIZATION = True
11:48:08:PLATE_CONFIDENCE = 0.7
11:48:08:PLATE_RESCALE_FACTOR = 2
11:48:08:PLATE_ROTATE_DEG = 0
11:48:08:REMOVE_SPACES = False
11:48:08:ROOT_PATH =
11:48:08:SAVE_CROPPED_PLATE = False
11:48:08:
11:48:08:Started License Plate Reader module
11:48:08:ALPR_adapter.py: Traceback (most recent call last):
11:48:08:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR_adapter.py", line 11, in
11:48:08:ALPR_adapter.py: from ALPR import init_detect_platenumber, detect_platenumber
11:48:08:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 7, in
11:48:08:ALPR_adapter.py: import utils.tools as tool
11:48:08:ALPR_adapter.py: ModuleNotFoundError: No module named 'utils.tools'
11:48:08:Module ALPR has shutdown
11:48:08:ALPR_adapter.py: has exited

Your System (please complete the following information):

  • CodeProject.AI Server version: 2.8 (2.6.5 also does not work)
  • CPU: Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz 3.00 GHz
  • OS: Windows 11
  • System RAM 32Gb
  • GPU : GeForce GTX 1650
  • GPU RAM: 4Gb

Additional context
Add any other context about the problem here.

@dslackhome
Copy link
Author

I found this on the internet. May be relevant to finding a solution to this problem.

https://stackoverflow.com/questions/27064348/no-module-named-utils-error-on-compiling-py-file

The specific error happens when the Python interpreter can't find a particular ".py" file. In your case, it is the file "utils.py".

First you need to find which file is trying to import "utils.py". Starting with your main file, look up all the files you are importing. (I am guessing this issue is coming from one of the non-library files, but I could be wrong.)

Once you have the "top level" import list, check each of those files to see what THEY are importing, and repeat the process for them. Eventually, you will find the .py file which is trying to import "utils". There might be a directory specification forcing Python to look in the wrong place.

Finally, using windows' file manager, perform a search for "utils.py". As a temporary fix, you can copy it from its current location into your working directory. That will at least allow you to get your project up and running until you sort out the real cause.

@dslackhome
Copy link
Author

Note: I did a windows explorer search for utils.py and I'm finding the utils.py file in a couple of places.
Here is one place I found utils.py; there are others.
C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python39\venv\Lib\site-packages\pip_vendor\requests\utils.py

@dslackhome
Copy link
Author

dslackhome commented Aug 27, 2024

I'm wondering if this is an environment variables issue, where an environment variable is missing or is wrong and isn't pointing the code to the necessary place to find what it's looking for. Note that the environment variables is kinda cluttered from all of the various trials and errors of installing various CUDA, Cudnn, and Python versions in an attempt to get the modules to use the GPU. But, I don't see any environment variables pointing to any CodeProject directories and that's where the utils.py file resides.

Here is a screenshot of some of my environment variables.
Environment Variables

@dslackhome
Copy link
Author

Uploading modulesettings.json file from ALPR 3.3.0 for reference.
Note: modulesettings.json file does includes things like:
"FilePath": "ALPR_adapter.py",
"ROOT_PATH": "%ROOT_PATH%",

modulesettings.json

@dslackhome
Copy link
Author

Note: re-installing License Plate Reader 3.3.0 does not resolve this problem.

@dslackhome
Copy link
Author

dslackhome commented Aug 27, 2024

Note:
Related to using the GPU. The Default modulesettings.json setting is to set install GPU to false. When I set both GPU settings to true, I start getting a paddle error messages.
13:39:17:ALPR_adapter.py: ModuleNotFoundError: No module named 'paddle'

13:39:17:Module 'License Plate Reader' 3.3.0 (ID: ALPR)
13:39:17:Valid: True
13:39:17:Module Path: \modules\ALPR
13:39:17:Module Location: Internal
13:39:17:AutoStart: True
13:39:17:Queue: alpr_queue
13:39:17:Runtime: python3.9
13:39:17:Runtime Location: Local
13:39:17:FilePath: ALPR_adapter.py
13:39:17:Start pause: 3 sec
13:39:17:Parallelism: 0
13:39:17:LogVerbosity:
13:39:17:Platforms: all,!windows-arm64
13:39:17:GPU Libraries: installed if available
13:39:17:GPU: use if supported
13:39:17:Accelerator:
13:39:17:Half Precision: enable
13:39:17:Environment Variables
13:39:17:AUTO_PLATE_ROTATE = True
13:39:17:CROPPED_PLATE_DIR = \Server\wwwroot
13:39:17:MIN_COMPUTE_CAPABILITY = 6
13:39:17:MIN_CUDNN_VERSION = 7
13:39:17:OCR_OPTIMAL_CHARACTER_HEIGHT = 60
13:39:17:OCR_OPTIMAL_CHARACTER_WIDTH = 30
13:39:17:OCR_OPTIMIZATION = True
13:39:17:PLATE_CONFIDENCE = 0.7
13:39:17:PLATE_RESCALE_FACTOR = 2
13:39:17:PLATE_ROTATE_DEG = 0
13:39:17:REMOVE_SPACES = False
13:39:17:ROOT_PATH =
13:39:17:SAVE_CROPPED_PLATE = False
13:39:17:
13:39:17:Started License Plate Reader module
13:39:17:ALPR_adapter.py: Traceback (most recent call last):
13:39:17:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR_adapter.py", line 11, in
13:39:17:ALPR_adapter.py: from ALPR import init_detect_platenumber, detect_platenumber
13:39:17:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 17, in
13:39:17:ALPR_adapter.py: from paddleocr import PaddleOCR
13:39:17:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python39\venv\lib\site-packages\paddleocr_init_.py", line 14, in
13:39:17:ALPR_adapter.py: from .paddleocr import *
13:39:17:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python39\venv\lib\site-packages\paddleocr\paddleocr.py", line 21, in
13:39:17:ALPR_adapter.py: import paddle
13:39:17:ALPR_adapter.py: ModuleNotFoundError: No module named 'paddle'
13:39:17:Module ALPR has shutdown
13:39:17:ALPR_adapter.py: has exited
13:39:18:Response rec'd from Object Detection (YOLOv5 6.2) command 'detect' (...743bf3) ['No objects found'] took 116ms
13:39:18:Object Detection (YOLOv5 6.2): Detecting using ipcam-combined
13:39:18:Response rec'd from Object Detection (YOLOv5 6.2) command 'custom' (...6ebf1d) ['No objects found'] took 46ms
13:39:31:Response rec'd from Object Detection (YOLOv5 6.2) command 'detect' (...7ffe8e) ['Found chair, chair, umbrella...'] took 52ms
13:39:31:Object Detection (YOLOv5 6.2): Detecting using ipcam-general
13:39:31:Response rec'd from Object Detection (YOLOv5 6.2) command 'custom' (...ea7120) ['No objects found'] took 33ms
13:39:34:Response rec'd from Object Detection (YOLOv5 6.2) command 'detect' (...65d383) ['Found person, bench, tv'] took 209ms
13:39:34:Object Detection (YOLOv5 6.2): Detecting using ipcam-combined
13:39:34:Response rec'd from Object Detection (YOLOv5 6.2) command 'custom' (...fb98fa) ['No objects found'] took 29ms
Logging level

Info
Clear logs
Object Detection (YOLOv5 6.2) 1.10.0

Note: A search of the ALPR directory using Windows Explorer found various padddleocr files (see search results):
PaddleOCR - search

@dslackhome
Copy link
Author

I tried re-installing CPAI version 2.8 and received a new error message when starting the License Plate Reader module
ALPR_adap ter.py: ImportError: attempted relative import with no known parent package.

13:29:59:Server version: 2.8
13:30:03:
13:30:03:Module 'License Plate Reader' 3.3.0 (ID: ALPR)
13:30:03:Valid: True
13:30:03:Module Path: \modules\ALPR
13:30:03:Module Location: Internal
13:30:03:AutoStart: True
13:30:03:Queue: alpr_queue
13:30:03:Runtime: python3.9
13:30:03:Runtime Location: Local
13:30:03:FilePath: ALPR_adapter.py
13:30:03:Start pause: 3 sec
13:30:03:Parallelism: 0
13:30:03:LogVerbosity:
13:30:03:Platforms: all,!windows-arm64
13:30:03:GPU Libraries: installed if available
13:30:03:GPU: use if supported
13:30:03:Accelerator:
13:30:03:Half Precision: enable
13:30:03:Environment Variables
13:30:03:AUTO_PLATE_ROTATE = True
13:30:03:CROPPED_PLATE_DIR = \Server\wwwroot
13:30:03:MIN_COMPUTE_CAPABILITY = 6
13:30:03:MIN_CUDNN_VERSION = 7
13:30:03:OCR_OPTIMAL_CHARACTER_HEIGHT = 60
13:30:03:OCR_OPTIMAL_CHARACTER_WIDTH = 30
13:30:03:OCR_OPTIMIZATION = True
13:30:03:PLATE_CONFIDENCE = 0.7
13:30:03:PLATE_RESCALE_FACTOR = 2
13:30:03:PLATE_ROTATE_DEG = 0
13:30:03:REMOVE_SPACES = False
13:30:03:ROOT_PATH =
13:30:03:SAVE_CROPPED_PLATE = False
13:30:03:
13:30:03:Started License Plate Reader module
13:30:04:ALPR_adapter.py: Traceback (most recent call last):
13:30:04:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR_adapter.py", line 11, in
13:30:04:ALPR_adapter.py: from ALPR import init_detect_platenumber, detect_platenumber
13:30:04:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 7, in
13:30:04:ALPR_adapter.py: import utils.tools as tool
13:30:04:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\utils.py", line 24, in
13:30:04:ALPR_adapter.py: from . import certs
13:30:04:ALPR_adapter.py: ImportError: attempted relative import with no known parent package
13:30:04:Module ALPR has shutdown
13:30:04:ALPR_adapter.py: has exited
13:30:05:Server: This is a new, unreleased version

This discussion on no known parent package may be relevent.

https://stackoverflow.com/questions/60593604/importerror-attempted-relative-import-with-no-known-parent-package

@dslackhome
Copy link
Author

Trying to reinstall License Plate Module.
Getting following in the log related to PaddlePaddle and PaddleOCR
Tried setting both the InstallGPU and EnableGPU to false to try and resolve the Paddle issue, but did not help.
Default seems to be InstallGPU false and EnableGPU true.
The installed Nvidia 1650 GPU does support CUDA and has specs that do work for Yolo5 6.2 which shows GPU support enabled and is working, but License Plate Module is having issues with install and startup and will not stay up and running and will not detect GPU.

"GpuOptions" : {
"InstallGPU": false, // PaddlePaddle-GPU only installs easily on Windows (though with issues on older cards)
"EnableGPU": false, // Will be coerced to false if InstallGPU = false
"AcceleratorDeviceName": null, // = default
"HalfPrecision": "enable", // 'Force', 'Enable', 'Disable': whether to force on, allow, or disable half-precision ops
"PostStartPauseSecs": 1 // Generally 1 if using GPU, 0 for CPU
},

ALPR: - Installing PaddlePaddle, Parallel Distributed Deep Learning...(� failed check) done

13:49:11:ALPR: Executing post-install script for License Plate Reader
13:49:11:ALPR: Applying PaddleOCR patch
13:49:11:ALPR: 1 file(s) copied.
13:49:12:ALPR: Traceback (most recent call last):
13:49:12:ALPR: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR_adapter.py", line 11, in
13:49:12:ALPR: from ALPR import init_detect_platenumber, detect_platenumber
13:49:12:ALPR: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 17, in
13:49:12:ALPR: from paddleocr import PaddleOCR
13:49:12:ALPR: File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python39\venv\lib\site-packages\paddleocr_init_.py", line 14, in
13:49:12:ALPR: from .paddleocr import *
13:49:12:ALPR: File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python39\venv\lib\site-packages\paddleocr\paddleocr.py", line 21, in
13:49:12:ALPR: import paddle
13:49:12:ALPR: ModuleNotFoundError: No module named 'paddle'
13:49:12:ALPR: Self test: Self-test failed
13:49:12:ALPR: Module setup time 00:02:43.12
13:49:12:ALPR: Setup complete
13:49:12:ALPR: Total setup time 00:02:46.17
13:49:12:ALPR: SETUP FAILED:
13:49:12:ALPR: - [ALPR] Self test failed
13:49:12:Module ALPR installed successfully.
13:49:12:
13:49:12:Module 'License Plate Reader' 3.3.0 (ID: ALPR)
13:49:12:Valid: True
13:49:12:Module Path: \modules\ALPR
13:49:12:Module Location: Internal
13:49:12:AutoStart: True
13:49:12:Queue: alpr_queue
13:49:12:Runtime: python3.9
13:49:12:Runtime Location: Local
13:49:12:FilePath: ALPR_adapter.py
13:49:12:Start pause: 3 sec
13:49:12:Parallelism: 0
13:49:12:LogVerbosity:
13:49:12:Platforms: all,!windows-arm64
13:49:12:GPU Libraries: installed if available
13:49:12:GPU: use if supported
13:49:12:Accelerator:
13:49:12:Half Precision: enable
13:49:12:Environment Variables
13:49:12:AUTO_PLATE_ROTATE = True
13:49:12:CROPPED_PLATE_DIR = \Server\wwwroot
13:49:12:MIN_COMPUTE_CAPABILITY = 6
13:49:12:MIN_CUDNN_VERSION = 7
13:49:12:OCR_OPTIMAL_CHARACTER_HEIGHT = 60
13:49:12:OCR_OPTIMAL_CHARACTER_WIDTH = 30
13:49:12:OCR_OPTIMIZATION = True
13:49:12:PLATE_CONFIDENCE = 0.7
13:49:12:PLATE_RESCALE_FACTOR = 2
13:49:12:PLATE_ROTATE_DEG = 0
13:49:12:REMOVE_SPACES = False
13:49:12:ROOT_PATH =
13:49:12:SAVE_CROPPED_PLATE = False
13:49:12:
13:49:12:Started License Plate Reader module
13:49:12:Installer exited with code 1
13:49:13:ALPR_adapter.py: Traceback (most recent call last):
13:49:13:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR_adapter.py", line 11, in
13:49:13:ALPR_adapter.py: from ALPR import init_detect_platenumber, detect_platenumber
13:49:13:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 17, in
13:49:13:ALPR_adapter.py: from paddleocr import PaddleOCR
13:49:13:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python39\venv\lib\site-packages\paddleocr_init_.py", line 14, in
13:49:13:ALPR_adapter.py: from .paddleocr import *
13:49:13:ALPR_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python39\venv\lib\site-packages\paddleocr\paddleocr.py", line 21, in
13:49:13:ALPR_adapter.py: import paddle
13:49:13:ALPR_adapter.py: ModuleNotFoundError: No module named 'paddle'
13:49:13:Module ALPR has shutdown
13:49:13:ALPR_adapter.py: has exited
13:49:13:Response rec'd from Object Detection (YOLOv5 6.2) command 'detect' (...8e3dd7) ['Found chair, chair, chair...'] took 262ms
13:49:13:Object Detection (YOLOv5 6.2): Detecting using ipcam-general
13:49:13:Response rec'd from Object Detection (YOLOv5 6.2) command 'custom' (...59788f) ['No objects found'] took 34ms
13:49:15:Module ALPR started successfully.

@dslackhome
Copy link
Author

This is a deep rabbit hole. I've tried installing Python 3.9, then
Python39> Python pip -m pip install --force-reinstall paddlepaddle

This installed the paddle directory and paddle.py to the Python39 site-packages folder but not the CPAI ALPR folder, so I manually copied over the paddle folder and re-started License Plate reader. This led to errors not finding "decorator", so I downloaded using pip "decorator" and found a folder called decorator-5.1.1.dist-info folder in the Python39 site-packages folder.
So I copied this folder and any .py files over to the ALPR folder root. I also added a system path environment variable to the ALPR root so that hopefully anything looking for anything could find it in the ALPR root folder.
This led to more error messages and the rabbit hole got deeper so I'm just going to give up at this point and leave it to the developers. Python coding is way out of my league.
Note: I did see code in the ALPR directory in the adapter.py file which tried to determine the CPU model and compatibility with paddle and if it determined it was not compatible it didn't do an import of paddle. The CPU it was looking for was an I7 920. My CPU is an Intel i7-9700 and my GPU is an Nvidia 1650 which supports CUDA and I now have the Yolo5 6.2 using GPU and CUDA, so my configuration does work, just not with the current version of License Plate Reader module 3.3.0

@dslackhome
Copy link
Author

I find it interesting that the Yolo5 6.2 module is able to startup and utilize GPU and CUDA using it's detect_adapter.py code, which shows no mention of paddle or paddleocr. Paddle and paddleocr doesn't seem to be used or an issue for Yolo5 6.2 to work. There may be a reason why the License Plate Reader module chose to use paddle and paddleocr, maybe because of the OCR optical character recognition that is required? Regardless, I can't seem to get the License Plate Reader 3.3.0 module to stay up and running and am getting the many errors mentioned above. I have seen other posts showing that others are encountering similar, if not the same, issue as I am.

@xavan83
Copy link

xavan83 commented Sep 12, 2024

I find it interesting that the Yolo5 6.2 module is able to startup and utilize GPU and CUDA using it's detect_adapter.py code, which shows no mention of paddle or paddleocr. Paddle and paddleocr doesn't seem to be used or an issue for Yolo5 6.2 to work. There may be a reason why the License Plate Reader module chose to use paddle and paddleocr, maybe because of the OCR optical character recognition that is required? Regardless, I can't seem to get the License Plate Reader 3.3.0 module to stay up and running and am getting the many errors mentioned above. I have seen other posts showing that others are encountering similar, if not the same, issue as I am.

Yes, we receive the same error using CPU version under docker since several months and no help to diagnose/fix the problem

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

2 participants