CodeProject.AI Version 2.5

MikeLud1

IPCT Contributor
Apr 5, 2017
2,307
4,405
Brooklyn, NY
CodeProject.AI version 2.5 was released Jan 23, 2024, this thread is for all topic CodeProject.AI version 2.5 and greater. This version is no longer beta


1706149758767.png

If you need any info on CodeProject.AI version 2.0 to 2.4 please refer to the below link (there is some discussion on v2.5)
 
How to install or upgrade CodeProject.AI

If you have a Nvidia GPU and want to use it with CodeProject.AI you need to install CUDA 11.8 and cuDNN for CUDA 11.x before installing CodeProject.AI.

When installing CUDA 11.8 use all the default settings.



Step 1: If you are upgrading first disable AI. If you are installing CodeProject.AI for the first time skip to step 4.
1706150413841.png

Step 2: uninstall CodeProject.AI
1706150645152.png
1706150687964.png


Step 3: Delete the two folders that are shown below
1706150717459.png
1706150732903.png

Step 4: Download current version of CodeProject.AI and run install.

1706150850761.png
1706150868516.png
1706150900817.png
1706150921233.png
1706150948452.png
1706150966320.png
1706150989747.png

Step 5: Wait for all the default modules to install. For me it took about 10 minutes.
Also do a CTRL+F5 to refresh the page
1706151301043.png

Step 6: Test the Object Detection (YOLOv5 6.2) module using CodeProject.AI Explorer
1706151453075.png
1706151473274.png


Step 7: How to install additional modules. Below I am installing the License Plate Reader module
1706151545836.png
1706151641028.png

Step 8: Test the newly installed module using CodeProject.AI Explorer.

1706151798023.png
1706151848290.png

Step 9: Stop modules that you will not use and run modules that you will use. Below I am stopping the Object Detection (YOLOv5 6.2) module and running the Object Detection (YOLOv5 .NET) module.
1706151918051.png
1706151940536.png

Step 10: Test new module that you just started using CodeProject.AI Explorer.

1706152143988.png
1706152192045.png

Step 11: Uninstall modules that you will not be using. Below I am uninstall the Object Detection (YOLOv5 6.2) and Face Processing modules.
1706152319118.png
1706152456312.png
1706152485115.png

Step 12: Last step is to enable AI in Blue Iris. It is recommended to
disable Auto stat/stop with Blue Iris. Below I have custom models and ALPR enabled.
If the custom model list is blank restart Blue Iris service.
1706152536485.png
 
Last edited:
I still cant get the .NET YoloV5 module to run. Ive even done this on a fresh PC (another build) and always the same thing, where it starts, then ends up saying LOST CONTACT. Posted in Codeproject discussions but that didnt get anywhere unfortunately. Im wondering am I missing something like some .NET framework.

The Yolov5 6.2 works just fine. Wanted to try out .NET to see if its truly faster.

Here is my system info:
Code:
Server version:   2.5.1
System:           Windows
Operating System: Windows (Microsoft Windows 11 version 10.0.22631)
CPUs:             11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (Intel)
                  1 CPU x 8 cores. 16 logical processors (x64)
GPU (Primary):    Quadro P1000 (4 GiB) (NVIDIA)
                  Driver: 537.70, CUDA: 12.2 (up to: 12.2), Compute: 6.1, cuDNN: 8.5
System RAM:       16 GiB
Platform:         Windows
BuildConfig:      Release
Execution Env:    Native
Runtime Env:      Production
.NET framework:   .NET 7.0.15
Default Python:
Video adapter info:
  NVIDIA Quadro P1000:
    Driver Version     31.0.15.3770
    Video Processor    Quadro P1000
  Intel(R) UHD Graphics 750:
    Driver Version     31.0.101.4953
    Video Processor    Intel(R) UHD Graphics Family
System GPU info:
  GPU 3D Usage       36%
  GPU RAM Usage      423 MiB
Global Environment variables:
  CPAI_APPROOTPATH = <root>
  CPAI_PORT        = 32168

Here is the info off the .NET module itself
Code:
Module 'Object Detection (YOLOv5 .NET)' 1.9.2 (ID: ObjectDetectionYOLOv5Net)
Valid:         True
Module Path:   <root>\modules\ObjectDetectionYOLOv5Net
AutoStart:     False
Queue:         objectdetection_queue
Runtime:       dotnet
Runtime Loc:   Shared
FilePath:      bin\ObjectDetectionYOLOv5Net.exe
Pre installed: False
Start pause:   1 sec
LogVerbosity:  
Platforms:     all
GPU Libraries: installed if available
GPU Enabled:   enabled
Parallelism:   0
Accelerator:   
Half Precis.:  enable
Environment Variables
   CUSTOM_MODELS_DIR = <root>\modules\ObjectDetectionYOLOv5Net\custom-models
   MODELS_DIR        = <root>\modules\ObjectDetectionYOLOv5Net\assets
   MODEL_SIZE        = MEDIUM
Status Data:  
Started:      Not seen
LastSeen:     Not seen
Status:       NotEnabled
Requests:     0 (includes status calls)
Provider:     
CanUseGPU:    False
HardwareType: CPU
 
Last edited:
I still cant get the .NET YoloV5 module to run. Ive even done this on a fresh PC (another build) and always the same thing, where it starts, then ends up saying LOST CONTACT. Posted in Codeproject discussions but that didnt get anywhere unfortunately. Im wondering am I missing something like some .NET framework.

The Yolov5 6.2 works just fine. Wanted to try out .NET to see if its truly faster.

Here is my system info:
Code:
Server version:   2.5.1
System:           Windows
Operating System: Windows (Microsoft Windows 11 version 10.0.22631)
CPUs:             11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (Intel)
                  1 CPU x 8 cores. 16 logical processors (x64)
GPU (Primary):    Quadro P1000 (4 GiB) (NVIDIA)
                  Driver: 537.70, CUDA: 12.2 (up to: 12.2), Compute: 6.1, cuDNN: 8.5
System RAM:       16 GiB
Platform:         Windows
BuildConfig:      Release
Execution Env:    Native
Runtime Env:      Production
.NET framework:   .NET 7.0.15
Default Python:
Video adapter info:
  NVIDIA Quadro P1000:
    Driver Version     31.0.15.3770
    Video Processor    Quadro P1000
  Intel(R) UHD Graphics 750:
    Driver Version     31.0.101.4953
    Video Processor    Intel(R) UHD Graphics Family
System GPU info:
  GPU 3D Usage       36%
  GPU RAM Usage      423 MiB
Global Environment variables:
  CPAI_APPROOTPATH = <root>
  CPAI_PORT        = 32168

Here is the info off the .NET module itself
Code:
Module 'Object Detection (YOLOv5 .NET)' 1.9.2 (ID: ObjectDetectionYOLOv5Net)
Valid:         True
Module Path:   <root>\modules\ObjectDetectionYOLOv5Net
AutoStart:     False
Queue:         objectdetection_queue
Runtime:       dotnet
Runtime Loc:   Shared
FilePath:      bin\ObjectDetectionYOLOv5Net.exe
Pre installed: False
Start pause:   1 sec
LogVerbosity: 
Platforms:     all
GPU Libraries: installed if available
GPU Enabled:   enabled
Parallelism:   0
Accelerator:  
Half Precis.:  enable
Environment Variables
   CUSTOM_MODELS_DIR = <root>\modules\ObjectDetectionYOLOv5Net\custom-models
   MODELS_DIR        = <root>\modules\ObjectDetectionYOLOv5Net\assets
   MODEL_SIZE        = MEDIUM
Status Data: 
Started:      Not seen
LastSeen:     Not seen
Status:       NotEnabled
Requests:     0 (includes status calls)
Provider:    
CanUseGPU:    False
HardwareType: CPU
What version Object Detection (YOLOv5 .NET) module do you have installed, it should be 1.9.2..

1706153124149.png
 
  • Like
Reactions: Dudleydogg
What version Object Detection (YOLOv5 .NET) module do you have installed, it should be 1.9.2..

It is 1.9.2. Should be there on the info portion of the .NET module I posted. But Ive seen this issue on every version of CPAI Ive used. Going back to like 2.x to latest. I just remember you mentioning that you got better performance on .NET module and wanted to try it, but for some reason I just cannot get it to do anything. It always starts and then what seems like it crashes and just says Lost Contact. Here is the original post in CPAI discussions, that was on 2.1.9. CodeProject.AI Server: AI the easy way.

The logs never seem to show anything on why it stops running and shows Lost Contact.
 
It is 1.9.2. Should be there on the info portion of the .NET module I posted. But Ive seen this issue on every version of CPAI Ive used. Going back to like 2.x to latest. I just remember you mentioning that you got better performance on .NET module and wanted to try it, but for some reason I just cannot get it to do anything. It always starts and then what seems like it crashes and just says Lost Contact. Here is the original post in CPAI discussions, that was on 2.1.9. CodeProject.AI Server: AI the easy way.

The logs never seem to show anything on why it stops running and shows Lost Contact.
Try doing a CTRL+F5 to refresh the page to see if it fixes the Lost Contact.
 
It is 1.9.2. Should be there on the info portion of the .NET module I posted. But Ive seen this issue on every version of CPAI Ive used. Going back to like 2.x to latest. I just remember you mentioning that you got better performance on .NET module and wanted to try it, but for some reason I just cannot get it to do anything. It always starts and then what seems like it crashes and just says Lost Contact. Here is the original post in CPAI discussions, that was on 2.1.9. CodeProject.AI Server: AI the easy way.

The logs never seem to show anything on why it stops running and shows Lost Contact.
If you are using with blue iris, make sure auto start stop for cpai is not checked in BI...
 
@MikeLud1 can you post on your first post of this Thread, the Minimum Hardware (ex. CPU Gen., GPU) (even software, DirectX version supported, CUDA, etc.) requirements for version 2.5 and later? Or can you post an CodeProject URL to these requirements/hardware list?

I found this in the Articles section:

1706192705533.png
 
Last edited:
  • Like
Reactions: MikeLud1
Also, thank you for the Instructional on Uninstall/Install of 2.5
 
Try doing a CTRL+F5 to refresh the page to see if it fixes the Lost Contact.
Yea unfortunately that doesnt do much, this is happening on this box (which ive had BI/CPAI on it for a year now and keeps happening any version of CPAI). Then also got same issue on a brand new fresh install for another location. Brand new Win11 Pro, latest BI and CPAI 2.3.4 (at that time a week ago). Logs show nothing unfortunately even on trace, which im not getting why. All I have is the event of .NET module starting, then it dies about 1-2mins later and just sits in Lost Contact as shown in an example below.

Screenshot 2024-01-25 at 12.37.08 PM.png

This is what I get:
12:32:40:Object Detection (YOLOv5 .NET): Object Detection (YOLOv5 .NET) module started.

Then nothing else.
 
Yea unfortunately that doesnt do much, this is happening on this box (which ive had BI/CPAI on it for a year now and keeps happening any version of CPAI). Then also got same issue on a brand new fresh install for another location. Brand new Win11 Pro, latest BI and CPAI 2.3.4 (at that time a week ago). Logs show nothing unfortunately even on trace, which im not getting why. All I have is the event of .NET module starting, then it dies about 1-2mins later and just sits in Lost Contact as shown in an example below.



This is what I get:
12:32:40:Object Detection (YOLOv5 .NET): Object Detection (YOLOv5 .NET) module started.

Then nothing else.

Alright updating this that somehow now it just started working. I just let it sit for about 15-20mins after it went into Lost Contact, and now its started and processing.

1706205449598.png

Initial thoughts are its not faster since its showing like 200-300ms where as the Yolov6.2 and 8 were only taking about 100-125ms. But going to leave it on this to experiment some more.
 
  • Like
Reactions: MikeLud1
How to install or upgrade CodeProject.AI
...

Great guide! A couple questions, though: What should I use for testing in Step 10? Should I use a generic pic containing stuff that I want to detect, or should I use something I grab as a snapshot from my local environment? And does this do anything to help eliminate false hits, or is it just making sure things are working correctly?

Thanks!
 
@MikeLud1, I'm seeing a lot of these timeout error messages in the log files of the latest version of CPAI (2.5.1). They appear to be tied to the ALPR module (2.9.0), but don't seem to be causing any issues. Can I just ignore them or is this something that needs to be addressed?

18:14:30:License Plate Reader: [TimeoutError] : Traceback (most recent call last):
File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 83, in detect_platenumber
data={"min_confidence": opts.plate_confidence})
File "../../SDK/Python\module_runner.py", line 873, in call_api
timeout = self._response_timeout_secs
File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\aiohttp\client.py", line 1167, in aenter
self._resp = await self._coro
File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\aiohttp\client.py", line 586, in _request
await resp.start(conn)
File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\aiohttp\client_reqrep.py", line 920, in start
self._continue = None
File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\aiohttp\helpers.py", line 725, in exit
raise asyncio.TimeoutError from None
 
  • Like
Reactions: Skinny1
Is there a reason why you are using Yolov5 .NET instead of Yolov5 6.2? Is DirectML better than CUDA? I still cannot get Licence Plate Reader to load up CUDA
.NET is faster with all my Nvidia gpu. 30/40 series. Plus changing default power settings. Set to max performance in the gpu setting. Keeps the clock speed of the gpu up. Also AMD gpu’s are pretty quick using .Net. 20-40 ms on average.
@MikeLud1
Has stated several times .Net is faster as well.
 
  • Like
Reactions: wpiman
Does anybody know if the docker GPU tags have changed or are they just delaying updating it?

Currently I use the tag GPU to install the GPU version of the docker but that hasn't been updated in 4 months. The documentation still says to use this. I see that there are a bunch of other GPU tags added but not sure what the difference between them all are.

Just looking for some clarity.
 
Is there a way to get Coral to work in CP.AI under Docker in Windows?
Following message comes up (on CPAI 2.5.1): "Unable to find or initialise the Coral TPU. Falling back to CPU-only." I wasn't successful with CP.AI 2.3.4 either.
No problems with Coral (mini PCIe) when using Windows x64 CP.AI install.
Could the issue with Windows Docker be related to TPU passthrough? If so, is there a solution?
 
  • Like
Reactions: wpiman
My PC locked up this morning and I've noticed I'm getting the occasional:

AI: error 500

Background:
Yesterday, I followed the instructions in 2nd post and everything well. Also updated BI to 5.8.4.5 (from 5.8.3.3). PC is blocked from the internet with BI and MS auto updates turned off so figured if opening up to do CPAI I would just to BI as well. Test images worked fine and so did actual tests with the camera.

Then this morning my PC was hung up (I just go directly to the PC, no web ui). Rebooted and couldn't track down what caused the lock up but noticed I've been getting occasional:

AI: error 500

That's in the BI logs . Looked at a couple of threads including (AI: error 500 and AI: error 200) and didn't find a cause or 'fix' just that the next release would fix it (which these were old). I went back in the logs and saw these started when I upgraded from 5.7.6.7 to 5.8.2.5 and happen randomly throughout the day but mostly when there is a lot of motion.

As mentioned:
BI is 5.8.4.5
CPAI is 2.5.1
As far as modules I have a single Coral TPU and using Object Detection (Coral) 2.1.1.
I do have Object Detection YOLOv5.NET) 1.9.2 install but Stopped. I just kept it installed to compare to the TPU.
Never had used custom modules.
I do not have AI checked to Auto Start/stop with BI.

PC is Dell Optiplex 7060 SFF with i5-8500, 16 GB RAM.
No GPU (only integrated).
Windows 10

Only started upgrading after the holidays to get the Onvif/Memo feature to better handle the different Onvif settings I have as well as convert to Coral TPU. Using the GPU or CPU would cause problems when front cameras all triggered at the same which I was hoping to alleviate with the TPU. Unfortunately I do have a few cameras that don't have human/vehicle IVS detection so need the CPAI for those.