CodeProject.AI Version 2.0

I loved Deepstack. My cameras only triggers if there were car or person. That’s it. But one day DS was gone and CPAI was there. It’s probably me not knowing how to get CPAI working properly. And anlso updating with unstable BI. Well, let’s just say, i’v been pulling my hair out since.


I have my cameras at a country home and want to detect wildlife. I get a lot of false positives with Deepstack. 68% confidence that there is a person or vehicle in the trigger picture, but in reality it is only a shadow. Plus I'd like to continue to updating Blue Iris and I heard that Deepstack won't work after a certain BI update.
 
  • Like
Reactions: 1fxman and JNDATHP
Google is your friend.

HalfPrecision​
Module dependant, but for modules that use CUDA this specifies whether half-precision operations should be used. Valid only for cards with CUDA compute capability >= 6.0​
&

If you want a deeper dive into half precision (its math stuff)

Thanks Google is always my friend, but unfortunately its the internet and you can end up down a rabbit hole with people talking shit.

But thanks for this
 
  • Like
Reactions: slidermike
Good morning everyone. I did update my CPAI on Sunday and it went very well. I first updated to the most stable BI, 5.7.5.6 and did a computer restart. Everything looked good so I closed BI and did another restart and uninstall CPAI and did another computer restart. I deleted the files from program files and data and restarted the computer again. I installed CUDA first and did a restart then installed CPAI 2.1.8 and restarted the computer. I opened BI and went to settings and clicked on Open AI dashboard and waited for everything to install. The YOLOv5 6.2 would not stay running so I stopped it and waited until it was dead stopped and started YOLOv5 .NET. Now everything is working great so I restarted the computer again. My times are anywhere between 200ms to 300ms and that's fine, I'm more interested in detecting things.
Thanks to all here things went much better then I anticipated.
 
Since I was having a host of problems getting CPAI to function after one of the latest BI updates, I started over from scratch. cuDNN, CUDA, zlib, Path variables double checked, and finally CPAI re installed. A couple anomalies on the CPAI install.

First, it installed Face Processing, YOLOv5 .NET, and YOLOV5 6.2 without me asking it to. During the YOLOv5 6.2 install the server displayed this red line in the log:

19:12:00:ObjectDetectionYolo: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
19:12:00:ObjectDetectionYolo: botocore 1.29.133 requires urllib3<1.27,>=1.25.4, but you have urllib3 2.0.2 which is incompatible.
19:12:00:ObjectDetectionYolo: google-auth 2.18.0 requires urllib3<2.0, but you have urllib3 2.0.2 which is incompatible.

Then, when installing ALPR, it does this:

20:55:19: Preparing to install module 'ALPR'
20:55:19: Downloading module 'ALPR'
20:55:19: Installing module 'ALPR'
20:55:19: ALPR: Installing CodeProject.AI Analysis Module
20:55:19 ALPR: ========================================================================
20:55:19: ALPR: CodeProject.AI Installer
20:55:19: ALPR: ========================================================================
20:55:19: ALPR: CUDA Present...True
20:55:19: ALPR: Allowing GPU Support: Yes
20:55:19: ALPR: Allowing CUDA Support: Yes
20:55:19: ALPR: General CodeProject.AI setup
20:55:19: ALPR: Creating Directories...Done
20:55:19: ALPR: Installing module ALPR
20:55:19: ALPR: Installing python37 in C:\Program Files\CodeProject\AI\runtimes\bin\windows\python37
20:55:19: ALPR: Checking for python37 download...Present
20:55:23: ALPR: Creating Virtual Environment...Done
20:55:23: ALPR: Enabling our Virtual Environment...Done
20:55:23: ALPR: Confirming we have Python 3.7...present
20:55:24: ALPR: Ensuring Python package manager (pip) is installed...Done
20:55:28: ALPR: Ensuring Python package manager (pip) is up to date...Done
20:55:28: ALPR: Choosing Python packages from requirements.windows.cuda.txt
20:56:46:ALPR: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='www.paddlepaddle.org.cn', port=443): Read timed out. (read timeout=15)")': /whl/windows/mkl/avx/stable.html
20:57:59: ALPR: Installing Packages into Virtual Environment...Success
20:58:00: ALPR: Ensuring Python package manager (pip) is installed...Done
20:58:02: ALPR: Ensuring Python package manager (pip) is up to date...Done
20:58:02: ALPR: Choosing Python packages from requirements.txt
20:58:05: ALPR: Installing Packages into Virtual Environment...Success
20:58:05: ALPR: Applying patch for PaddlePaddle
20:58:05: ALPR: 1 file(s) copied.
20:58:14: ALPR: Downloading ALPR models...Expanding...Done.
20:58:14: ALPR: Module setup complete
20:58:14: Module ALPR installed successfully.
20:58:14:
20:58:14: Module 'License Plate Reader' (ID: ALPR)
20:58:14: Module Path: C:\Program Files\CodeProject\AI\modules\ALPR
20:58:14: AutoStart: True
20:58:14: Queue: alpr_queue
20:58:14: Platforms: windows,linux,macos,macos-arm64
20:58:14:GPU: Support enabled
20:58:14: Parallelism: 0
20:58:14:Accelerator:
20:58:14:Half Precis.: enable
20:58:14:Runtime: python37
20:58:14:Runtime Loc: Local
20:58:14:FilePath: ALPR_adapter.py
20:58:14: Pre installed: False
20:58:14:Start pause: 1 sec
20:58:14:LogVerbosity:
20:58:14:Valid: True
20:58:14:Environment Variables
20:58:14:AUTO_PLATE_ROTATE = True
20:58:14: PLATE_CONFIDENCE = 0.7
20:58:14: PLATE_RESCALE_FACTOR = 2
20:58:14: PLATE_ROTATE_DEG = 0
20:58:14:
20:58:14:Started License Plate Reader module
20:58:14:Installer exited with code 1
20:58:14:Unknown response from server
20:58:15:Module ALPR started successfully.
20:58:19:ALPR_adapter.py: Timeout connecting to the server


Thanks for any insights.

Z
 
Since I was having a host of problems getting CPAI to function after one of the latest BI updates, I started over from scratch. cuDNN, CUDA, zlib, Path variables double checked, and finally CPAI re installed. A couple anomalies on the CPAI install.

First, it installed Face Processing, YOLOv5 .NET, and YOLOV5 6.2 without me asking it to. During the YOLOv5 6.2 install the server displayed this red line in the log:

19:12:00:ObjectDetectionYolo: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
19:12:00:ObjectDetectionYolo: botocore 1.29.133 requires urllib3<1.27,>=1.25.4, but you have urllib3 2.0.2 which is incompatible.
19:12:00:ObjectDetectionYolo: google-auth 2.18.0 requires urllib3<2.0, but you have urllib3 2.0.2 which is incompatible.

Then, when installing ALPR, it does this:

20:55:19: Preparing to install module 'ALPR'
20:55:19: Downloading module 'ALPR'
20:55:19: Installing module 'ALPR'
20:55:19: ALPR: Installing CodeProject.AI Analysis Module
20:55:19 ALPR: ========================================================================
20:55:19: ALPR: CodeProject.AI Installer
20:55:19: ALPR: ========================================================================
20:55:19: ALPR: CUDA Present...True
20:55:19: ALPR: Allowing GPU Support: Yes
20:55:19: ALPR: Allowing CUDA Support: Yes
20:55:19: ALPR: General CodeProject.AI setup
20:55:19: ALPR: Creating Directories...Done
20:55:19: ALPR: Installing module ALPR
20:55:19: ALPR: Installing python37 in C:\Program Files\CodeProject\AI\runtimes\bin\windows\python37
20:55:19: ALPR: Checking for python37 download...Present
20:55:23: ALPR: Creating Virtual Environment...Done
20:55:23: ALPR: Enabling our Virtual Environment...Done
20:55:23: ALPR: Confirming we have Python 3.7...present
20:55:24: ALPR: Ensuring Python package manager (pip) is installed...Done
20:55:28: ALPR: Ensuring Python package manager (pip) is up to date...Done
20:55:28: ALPR: Choosing Python packages from requirements.windows.cuda.txt
20:56:46:ALPR: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='www.paddlepaddle.org.cn', port=443): Read timed out. (read timeout=15)")': /whl/windows/mkl/avx/stable.html
20:57:59: ALPR: Installing Packages into Virtual Environment...Success
20:58:00: ALPR: Ensuring Python package manager (pip) is installed...Done
20:58:02: ALPR: Ensuring Python package manager (pip) is up to date...Done
20:58:02: ALPR: Choosing Python packages from requirements.txt
20:58:05: ALPR: Installing Packages into Virtual Environment...Success
20:58:05: ALPR: Applying patch for PaddlePaddle
20:58:05: ALPR: 1 file(s) copied.
20:58:14: ALPR: Downloading ALPR models...Expanding...Done.
20:58:14: ALPR: Module setup complete
20:58:14: Module ALPR installed successfully.
20:58:14:
20:58:14: Module 'License Plate Reader' (ID: ALPR)
20:58:14: Module Path: C:\Program Files\CodeProject\AI\modules\ALPR
20:58:14: AutoStart: True
20:58:14: Queue: alpr_queue
20:58:14: Platforms: windows,linux,macos,macos-arm64
20:58:14:GPU: Support enabled
20:58:14: Parallelism: 0
20:58:14:Accelerator:
20:58:14:Half Precis.: enable
20:58:14:Runtime: python37
20:58:14:Runtime Loc: Local
20:58:14:FilePath: ALPR_adapter.py
20:58:14: Pre installed: False
20:58:14:Start pause: 1 sec
20:58:14:LogVerbosity:
20:58:14:Valid: True
20:58:14:Environment Variables
20:58:14:AUTO_PLATE_ROTATE = True
20:58:14: PLATE_CONFIDENCE = 0.7
20:58:14: PLATE_RESCALE_FACTOR = 2
20:58:14: PLATE_ROTATE_DEG = 0
20:58:14:
20:58:14:Started License Plate Reader module
20:58:14:Installer exited with code 1
20:58:14:Unknown response from server
20:58:15:Module ALPR started successfully.
20:58:19:ALPR_adapter.py: Timeout connecting to the server


Thanks for any insights.

Z
The ObjectDetectionYolo errors are ok the module should work. The ALPR module error we are working on a better site to download the PaddlePaddle package, not sure when it will be released. You can try uninstall the the ALPR module and reinstall, it might work.
 
The ObjectDetectionYolo errors are ok the module should work. The ALPR module error we are working on a better site to download the PaddlePaddle package, not sure when it will be released. You can try uninstall the the ALPR module and reinstall, it might work.

Thank you sir. Uninstall and reinstall this morning and everything loaded appropriately and ALPR is working again, at least through the CPAI dashboard. Still nothing on my LPR Camera. I appreciate your help.
 
Last edited:
  • Like
Reactions: MikeLud1
2.0.8-Beta vs 2.1.8-Beta

I've been running 2.0.8-Beta since the day of release using CUDA 11.7 with my 970GTX, and it runs rock solid - I'm kinda of the attitude that it if something is not broken, then don't muck about it with it. My question is, should I upgrade to 2.1.8-Beta or not? Are there any improvements? If it matters I only use ipcam-general.pt and the built-in high model (no face, no ALPR or other modules installed)
 
Does anyone have issues where Yolov5 is not switching to directML? If I read correctly should work with my CPU.

its not killing me but I was just curious. Thanks

CPU - i7-10700

Screenshotsa attached:
 

Attachments

  • Snag_22b1159.png
    Snag_22b1159.png
    117 KB · Views: 39
  • Snag_22b2119.png
    Snag_22b2119.png
    77.5 KB · Views: 39

I should have mentioned I did try that first before posting. but still the same result, performed a reboot as well.





Code:
17:31:11:Module ObjectDetectionNet has shutdown
17:31:11:ObjectDetectionNet.exe: has exited
17:31:11:
17:31:11:Module 'Object Detection (YOLOv5 .NET)' (ID: ObjectDetectionNet)
17:31:11:Module Path:   C:\Program Files\CodeProject\AI\modules\ObjectDetectionNet
17:31:11:AutoStart:     True
17:31:11:Queue:         objectdetection_queue
17:31:11:Platforms:     windows,linux,linux-arm64,macos,macos-arm64
17:31:11:GPU:           Support enabled
17:31:11:Parallelism:   0
17:31:11:Accelerator:
17:31:11:Half Precis.:  enable
17:31:11:Runtime:       execute
17:31:11:Runtime Loc:   Shared
17:31:11:FilePath:      ObjectDetectionNet.exe
17:31:11:Pre installed: False
17:31:11:Start pause:   1 sec
17:31:11:LogVerbosity:
17:31:11:Valid:         True
17:31:11:Environment Variables
17:31:11:CPAI_MODULE_SUPPORT_GPU = False
17:31:11:CUSTOM_MODELS_DIR       = %CURRENT_MODULE_PATH%\custom-models
17:31:11:MODELS_DIR              = %CURRENT_MODULE_PATH%\assets
17:31:11:MODEL_SIZE              = MEDIUM
17:31:11:USE_CUDA                = False
17:31:11:
17:31:11:Started Object Detection (YOLOv5 .NET) module
17:31:11:ObjectDetectionNet.exe:       Application started. Press Ctrl+C to shut down.
17:31:11:ObjectDetectionNet.exe:       Hosting environment: Production
17:31:11:ObjectDetectionNet.exe:       Content root path: C:\Program Files\CodeProject\AI\modules\ObjectDetectionNet
17:31:12:ObjectDetectionNet.exe:       Please ensure you don't enable this module along side any other Object Detection module using the 'vision/detection' route and 'objectdetection_queue' queue (eg. ObjectDetectionYolo). There will be conflicts
17:31:12:Object Detection (YOLOv5 .NET): Object Detection (YOLOv5 .NET) module started.
17:31:14:Object Detection (YOLOv5 .NET): Command completed in 1773 ms.
17:31:14:Object Detection (YOLOv5 .NET): Command completed in 1758 ms.
17:31:14:Object Detection (YOLOv5 .NET): Command completed in 1817 ms.
17:31:14:Object Detection (YOLOv5 .NET): Command completed in 1879 ms.
17:31:26:Object Detection (YOLOv5 .NET): Command completed in 210 ms.
17:31:28:Object Detection (YOLOv5 .NET): Command completed in 179 ms.
Logging level

Info
Object Detection (YOLOv5 .NET): Command completed in 179 ms.
Object Detection (YOLOv5 .NET)
Started
 
No luck, tried a full uninstall of both BI, and Code. It could just be my install, I can always reinstall the OS and go back to Windows 10
Which Windows O/S are you running?
 
Windows 11, not a big deal though I don’t mind reinstalling,
Gotcha. I am running Win10 but want to switch over to Win Server...thanks, just curious...
 
Windows 11, not a big deal though I don’t mind reinstalling,
It took me a while to get it going but have it running using GPU (DirecML) on Windows 11 without any issues. What worked for me was to update to the latest Graphics drivers and then install using "Option 1 with a vengeance" in the section "How to install a module" CodeProject.AI Discussions - CodeProject

You can also try to enable Auto Stop/Start with Blue Iris in the AI tab in Blue Iris Settings. This will allow you to toggle the "use GPU". Try to disable "use GPU", wait for BI to restart the Services/modules, and then enable "use GPU". you may have to restart your Blue Iris machine to ensure it loads correctly.

Edit: I'm running CPAI 2.1.8-Beta on a i7-11700 CPU using onboard Intel UHD 750 Graphics

1684209106663.png
 
Last edited:
  • Like
Reactions: Tinman and David L
I'm having a hell of a time trying to get BI to send in the correct frame to CPAI ALPR. I have a fairly tight shot of cars driving by. They are in the frame for just under 1 second. An example:
Untitled.png

What I'm finding is that BI is either sending the frames too early (only part of the car is visible) or is sending the frames too late and the car has moved out of the FOV so I'm getting nearly 100% of "nothing found" judging by me looking at the saved Hi-Res alert images. It's just alert images of an empty road most of time. I've played with trying to send it more/less images on the "+ real-time images" area of the AI trigger in BI. I've also played with the "analyze each one" time settings. I've increased/decreased them. It seems like it's a bit too complicated that we have to try and "time/calculate" what frames we think we need to send from BI to CPAI. Shouldn't there be an option to send every frame from the trigger in for analysis? The BI manual seems to state that is possible on page 86 but I don't see any option to select that anywhere.

I'm also finding that when I have two cars coming through, on the off chance BI sends in the correct frame to CPAI of the first car and it actually finds the plate, the alert is moved to confirmed and the second car following closely behind the first car is never analyzed.

I also seem to be getting lots of this in the CPAI Dashboard when running ALPR:

Code:
08:06:14:ALPR_adapter.py: [2023/05/16 08:06:14] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process
08:06:14:License Plate Reader:  [AttributeError] : Traceback (most recent call last):
  File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 227, in read_plate_chars_PaddleOCR
    ocr_response = ocr.ocr(image, cls=True)
  File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\paddleocr\paddleocr.py", line 555, in ocr
    dt_boxes, rec_res, _ = self.__call__(img, cls)
  File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\paddleocr\tools\infer\predict_system.py", line 71, in __call__
    dt_boxes, elapse = self.text_detector(img)
  File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\paddleocr\tools\infer\predict_det.py", line 244, in __call__
    self.input_tensor.copy_from_cpu(img)
  File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\paddle\fluid\inference\wrapper.py", line 36, in tensor_copy_from_cpu
    self.copy_from_cpu_bind(data)
RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_8.dll) that Paddle depends on is not configured correctly. (error code is 126)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:303)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR_adapter.py", line 40, in process
    result = await detect_platenumber(self, self.opts, image)
  File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 181, in detect_platenumber
    (label, confidence, plateInferenceMs) = await read_plate_chars_PaddleOCR(module_runner, numpy_plate)
  File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 278, in read_plate_chars_PaddleOCR
    module_runner.report_error_aync(ex, __file__)
AttributeError: 'ALPR_adapter' object has no attribute 'report_error_aync'

I'm using my GTX 3070 in my desktop to perform the ALPR. BI is sending images to that computer for analysis. That message is farily frequent in the logs. I'm also getting lots of normal logs as well:
Code:
08:06:14:License Plate Reader: Queue request for License Plate Reader command 'alpr' (...8718e5) took 132ms
08:06:14:Object Detection (YOLOv5 6.2): Detecting using license-plate
08:06:14:Object Detection (YOLOv5 6.2): Detecting using license-plate
08:06:14:Object Detection (YOLOv5 6.2): Queue request for Object Detection (YOLOv5 6.2) command 'custom' (...3457c8) took 58ms
08:06:14:Object Detection (YOLOv5 6.2): Queue request for Object Detection (YOLOv5 6.2) command 'custom' (...f7304e) took 52ms
08:06:14:License Plate Reader: Queue request for License Plate Reader command 'alpr' (...23cc76) took 106ms
08:06:14:Object Detection (YOLOv5 6.2): Detecting using license-plate
08:06:14:Object Detection (YOLOv5 6.2): Queue request for Object Detection (YOLOv5 6.2) command 'custom' (...139ede) took 43ms
08:06:14:License Plate Reader: Queue request for License Plate Reader command 'alpr' (...7ee2ed) took 67ms
08:06:15:Object Detection (YOLOv5 6.2): Detecting using license-plate
08:06:15:Object Detection (YOLOv5 6.2): Queue request for Object Detection (YOLOv5 6.2) command 'custom' (...2a3695) took 42ms
08:06:15:Object Detection (YOLOv5 6.2): Detecting using license-plate
08:06:15:Object Detection (YOLOv5 6.2): Queue request for Object Detection (YOLOv5 6.2) command 'custom' (...b988c9) took 35ms
08:06:15:License Plate Reader: Queue request for License Plate Reader command 'alpr' (...c55547) took 58ms
 
Last edited:
  • Like
Reactions: David L
I'm having a hell of a time trying to get BI to send in the correct frame to CPAI ALPR. I have a fairly tight shot of cars driving by. They are in the frame for just under 1 second. An example:
View attachment 163197

What I'm finding is that BI is either sending the frames too early (only part of the car is visible) or is sending the frames too late and the car has moved out of the FOV. I've played with trying to send it more/less images on the "+ real-time images" area of the AI trigger in BI. I've also played with the "analyze each one" time settings. I've increased/decreased them. It seems like it's a bit too complicated that we have to try and "time/calculate" what frames we think we need to send from BI to CPAI. Shouldn't there be an option to send every frame from the trigger in for analysis? The BI manual seems to state that is possible on page 86 but I don't see any option to select that anywhere.

I'm also finding that when I have two cars coming through, on the off chance BI sends in the correct frame to CPAI of the first car and it actually finds the plate, the alert is moved to confirmed and the second car following closely behind the first car is never analyzed.
Below are my settings. I have my camera set to 20 FPS with the below settings I capture all frames for CodeProject.AI to analyze.

1684242731318.png
1684242750022.png
1684242781596.png
1684242805051.png
1684242830268.png
1684242853928.png
1684242958656.png