CodeProject.AI Version 2.0

cybernetics1d

Getting the hang of it
Joined
Nov 1, 2018
Messages
73
Reaction score
41
Location
North America
Done, thanks.

I have been very pleased with CodeProject.AI DeepStack worked great for me too. CP.AI YOLOv5 6.2 worked with no problems so I am sure YOLOv5.NET will do the same.

Our Neighborhood Cats are still being Identified as Birds :D, but Persons, Cars, Trucks are spot on which is all I care about.
Are you using Mike's custom model, ipcam-general or ipcam-combined? To my understanding, if you're using the ipcam-general model, it shouldn't have animal detection in it, but only person and vehicle, so it shouldn't have confirmed within Blue Iris as bird or whatever. I'd try that model if you're not using it now.

Also, if you're using IVS rule for triggering instead of BI's built-in motion detection, one thing you can help reducing the actual false alert itself is increasing the minimum size (0 x 0) inside the Target filter of the IVS rule itself. I'm using 5442 with AI detection and occasionally I see cat being triggered by the IVS rule so I added the min size like below and it seems to help reducing this false alert. If you're using SD card with the camera like I do, you actually review the playback clip within the web browser with the IVS "Rules Info" button enabled so you can see what rule is being triggered and in the video, you will notice there's a green box around the object it detects. You can then adjust the min size slightly bigger than that box to help prevent the cat or dog or etc.. from triggering the IVS rule again in the future.

Another thing to note, from the my observation, it seems "Intrusion" box detection with "appear, cross, enter&exit) options all enabled is more prone to false alert than using tripwire, but neither never missed any actual human or vehicle detection for me. I don't even use BI's built-in detection at all.


1682264762147.png
 

ajayjohn

n3wb
Joined
Jul 19, 2022
Messages
6
Reaction score
2
Location
US
@MikeLud1 Would it be possible for you to make an onnx version of your packages model, please?

I'd love to use it in my setup, but am running ObjectDetectionNet without a cuda GPU.
 

David L

IPCT Contributor
Joined
Aug 2, 2019
Messages
8,055
Reaction score
21,096
Location
USA
Are you using Mike's custom model, ipcam-general or ipcam-combined? To my understanding, if you're using the ipcam-general model, it shouldn't have animal detection in it, but only person and vehicle, so it shouldn't have confirmed within Blue Iris as bird or whatever. I'd try that model if you're not using it now.

Also, if you're using IVS rule for triggering instead of BI's built-in motion detection, one thing you can help reducing the actual false alert itself is increasing the minimum size (0 x 0) inside the Target filter of the IVS rule itself. I'm using 5442 with AI detection and occasionally I see cat being triggered by the IVS rule so I added the min size like below and it seems to help reducing this false alert. If you're using SD card with the camera like I do, you actually review the playback clip within the web browser with the IVS "Rules Info" button enabled so you can see what rule is being triggered and in the video, you will notice there's a green box around the object it detects. You can then adjust the min size slightly bigger than that box to help prevent the cat or dog or etc.. from triggering the IVS rule again in the future.

Another thing to note, from the my observation, it seems "Intrusion" box detection with "appear, cross, enter&exit) options all enabled is more prone to false alert than using tripwire, but neither never missed any actual human or vehicle detection for me. I don't even use BI's built-in detection at all.


View attachment 160827
Thanks, I have never played with IVS, guess when the 5442s came out there was issues with the firmware at that time, that was awhile back, I am a little behind, as always. :) I may Clone a CAM and play with IVS. There is always room for improvement. Mike's custom models is on my todo list also. I have not tried any yet. Dang, I sound like a Noob...

So the triggers come from the CAM to BI via ONVIF?

In my defense I just recently setup Home Assistant, went from SmartThings to Hubitat and now HA. Been slowly setting everything up.
 

cybernetics1d

Getting the hang of it
Joined
Nov 1, 2018
Messages
73
Reaction score
41
Location
North America
Yeah, there are numerous threads covering this already on this forum, but essentially, you go into the Camera's video setting where you do Find/Inspect and make sure to select the "Get ONVIF triggerring events" and that should do it. Forgot to mention this earlier, but also under Trigger cam, you'll need to select "Camera's digital input or motion alarm" as one of the source and remove the the one for BI's built-in motion detection.

If you are using 5442 or any of the Dahua/Loryta cams from Andy that support IVS, I'd take advantage of that and save the CPU cycles processing by having BI handles motion detection. If used effectively and especially if it has built-in AI detection, you should few false alerts. Occasionally, you might see some false alerts with cats or dogs or at night due to low lighting or whatever, so you might have to tweak the minimum size and/or use this CodeProject AI detection as secondary to confirm person/detection for accurate alerting purposes. Ideally, the goal is to reduce overall false alerts if you're using Pushover app or BI app in events that you do get an alert, you'd know for sure it's either a person or a car.

Check this video out to see how powerful IVS rules can be and what you can do with it.

 
Last edited:

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,214
Reaction score
4,253
Location
Brooklyn, NY

Village Guy

Pulling my weight
Joined
May 6, 2020
Messages
291
Reaction score
161
Location
UK
For those folks experiencing the dreaded Error 500 on V2.16. I have found on my system that changing modules to the .NET version fixes them. I am running an Nvidia GTX 1060 GPU and achieving analysis times of well under 100ms most of the time.
 

brcarls

n3wb
Joined
Jun 30, 2017
Messages
28
Reaction score
16
For those folks experiencing the dreaded Error 500 on V2.16. I have found on my system that changing modules to the .NET version fixes them. I am running an Nvidia GTX 1060 GPU and achieving analysis times of well under 100ms most of the time.
I'm running a Nvidia 1660 Super and when I installed 2.1.6, GPU acceleration stopped working (2.0.8 worked). Like you, I also switched to the .NET module to keep going using CPU until I can fiddle with Nvidia drivers...

Are you saying that the .NET module can use the Nvidia GPU?
 

djmadfx

Getting the hang of it
Joined
Sep 29, 2014
Messages
106
Reaction score
19
I am using a Quadro P1000 4gb. I just switched from 6.2 to .NET and it's now utilizing my Intel i7 6700's iGPU. The times are sub-200ms with some even sub-100ms. I never expected this to work faster than CUDA. The Face Processing and License Plate Reader modules are still using CUDA.

To further confirm what I was seeing I ran the benchmark (CodeProject.AI Explorer > Benchmark) with each of the 2 YOLO modules enabled. The .NET benchmarked at 2x the operations per second of 6.2 (~30 vs ~15).
 

Village Guy

Pulling my weight
Joined
May 6, 2020
Messages
291
Reaction score
161
Location
UK
I'm running a Nvidia 1660 Super and when I installed 2.1.6, GPU acceleration stopped working (2.0.8 worked). Like you, I also switched to the .NET module to keep going using CPU until I can fiddle with Nvidia drivers...

Are you saying that the .NET module can use the Nvidia GPU?
Absolutely, initially I started .NET with CPU and measured sub 500ms and then enabled the Nvidia GTX1060 and am getting sub 100ms.

No errors at all so far and the system has been pretty active today :)
 

Village Guy

Pulling my weight
Joined
May 6, 2020
Messages
291
Reaction score
161
Location
UK
where do i need to put this onyx file...ima try the .net cpu on mine as well
The .NET model files are installed by default!

This was posted courtesy of Mike Lud to my question:

The .NET module uses .ONNX models and the 3.1 & 6.2 use .PT models. Most of the YOLOv5 and custom models that are included in the 3.1 & 6.2 module are also in the .NET module. You can convert .PT model following the instructions in the below link, it takes about a minute or two to do the conversion.

TFLite, ONNX, CoreML, TensorRT Export - Ultralytics YOLOv5 Docs
 
Last edited:

carteriii

Pulling my weight
Joined
Jan 8, 2016
Messages
146
Reaction score
157
Location
USA
For those of you running AMD rather than Intel/nVidia, I want to mention that the YOLOv5.NET integration with DirectML/DirectX 12 is working well for me, generally showing all sub-100ms times (most 40-60ms). I'm running on an AMD Ryzen 9 5900HX with built-in Radeon Graphics (arguably CPU overkill for Blue Iris alone). The built-in Radeon graphics lets me run in a mini PC form factor, so to get the GPU support without needing a discrete graphics card is (for me) fantastic. CodeProjectAI w/GPU support is showing a massive performance win over DeepStack that I was running until recently.

I also feel obligated to publicly thank @MikeLud1 again for everything he's done for the BI community. You're awesome!
 

thekeeb

n3wb
Joined
Apr 25, 2023
Messages
1
Reaction score
0
Location
US
Quick question regarding Coral. I have 2.1.4 running on a Raspberry PI, and it's working well. But, now none of Mike's custom/tuned models are available, only the "ObjectDetectionTFLite" one. Which works fine for "person," but hasn't caught my dogs or vehicles as well as Mike's custom ones did.

@MikeLud1 Is that the motivation for your Orange Pi testing? Or am I misunderstanding and I can still use the ipcam-combined, etc. models? Thank you!
 
Last edited:

carteriii

Pulling my weight
Joined
Jan 8, 2016
Messages
146
Reaction score
157
Location
USA
I may have spoken a bit too soon about everything working well. Looking at the logs, I do see recurring instances of CodeProject having a problem and BI restarting AI. At that point things work again just fine for some period of time, which is why I hadn't noticed until looking more closely.

I'll start with the BlueIris log entry since it's short & simple. IMHO, the odd thing to note is that the response time is 0ms, which is not a timeout:

Code:
AI: Alert cancelled [AI: not responding] 0ms
AI is being restarted
The CodeProject log is a bit more interesting. I'm going to include two successful requests shown over 8 lines, but there may be hundreds like this in a sequence before the error that begins with, "Unable to get request from objectdetection_queue for ObjectDetectionNet". I added a blank line before that in the log below, purely to make it more readable.

Does anyone know whether that is more likely to be a problem with CodeProject, or with BI making the request, and is it worth posting in a CodeProject thread/forum (if so, please point me to the right one) or to BI support?

Code:
2023-04-26 13:06:48: Client request 'custom' in queue 'objectdetection_queue' (#reqid e7c592eb-fbcd-45d6-830a-7711fc184e43)
2023-04-26 13:06:48: Request 'custom' dequeued from 'objectdetection_queue' (#reqid e7c592eb-fbcd-45d6-830a-7711fc184e43)
2023-04-26 13:06:48: Object Detection (YOLOv5 .NET): Command completed in 46 ms. (command timing) in Object Detection (YOLOv5 .NET)
2023-04-26 13:06:48: Response received (#reqid e7c592eb-fbcd-45d6-830a-7711fc184e43): No objects found
2023-04-26 13:06:48: Client request 'custom' in queue 'objectdetection_queue' (#reqid 7d495a03-a3c9-4b24-a23d-544a8273bfc6)
2023-04-26 13:06:48: Request 'custom' dequeued from 'objectdetection_queue' (#reqid 7d495a03-a3c9-4b24-a23d-544a8273bfc6)
2023-04-26 13:06:48: Object Detection (YOLOv5 .NET): Command completed in 45 ms. (command timing) in Object Detection (YOLOv5 .NET)
2023-04-26 13:06:48: Response received (#reqid 7d495a03-a3c9-4b24-a23d-544a8273bfc6): No objects found

2023-04-26 13:06:58: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:06:58: ObjectDetectionNet.exe: Pausing on error for 5 secs.
2023-04-26 13:06:58: ModuleRunner Stop
2023-04-26 13:06:58: Sending shutdown request to python/ALPR
2023-04-26 13:06:58: Client request 'Quit' in queue 'alpr_queue' (#reqid 60e86409-7008-4923-b0f8-c47e1ea822b1)
2023-04-26 13:06:58: Sending shutdown request to ObjectDetectionNet/ObjectDetectionNet
2023-04-26 13:06:58: Client request 'Quit' in queue 'objectdetection_queue' (#reqid e1bc9aca-cc86-49ca-9a79-e10327ab588a)
2023-04-26 13:06:58: FaceProcessing doesn't appear in the Process list, so can't stop it.
2023-04-26 13:07:01: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:01: ObjectDetectionNet.exe: Pausing on error for 10 secs.
2023-04-26 13:07:01: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:01: ObjectDetectionNet.exe: Pausing on error for 20 secs.
2023-04-26 13:07:01: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:01: ObjectDetectionNet.exe: Pausing on error for 40 secs.
2023-04-26 13:07:01: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:01: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:02: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:02: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:02: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:02: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:02: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:02: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:07: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:07: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:15: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:15: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:25: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:25: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:31: Forcing shutdown of python/ALPR
2023-04-26 13:07:31: Forcing shutdown of ObjectDetectionNet/ObjectDetectionNet
2023-04-26 13:07:31: ** Module ALPR has shutdown
2023-04-26 13:07:31: ALPR_adapter.py: has exited
2023-04-26 13:07:31: ** Module ObjectDetectionNet has shutdown
2023-04-26 13:07:31: ObjectDetectionNet.exe: has exited
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,214
Reaction score
4,253
Location
Brooklyn, NY
I may have spoken a bit too soon about everything working well. Looking at the logs, I do see recurring instances of CodeProject having a problem and BI restarting AI. At that point things work again just fine for some period of time, which is why I hadn't noticed until looking more closely.

I'll start with the BlueIris log entry since it's short & simple. IMHO, the odd thing to note is that the response time is 0ms, which is not a timeout:

Code:
AI: Alert cancelled [AI: not responding] 0ms
AI is being restarted
The CodeProject log is a bit more interesting. I'm going to include two successful requests shown over 8 lines, but there may be hundreds like this in a sequence before the error that begins with, "Unable to get request from objectdetection_queue for ObjectDetectionNet". I added a blank line before that in the log below, purely to make it more readable.

Does anyone know whether that is more likely to be a problem with CodeProject, or with BI making the request, and is it worth posting in a CodeProject thread/forum (if so, please point me to the right one) or to BI support?

Code:
2023-04-26 13:06:48: Client request 'custom' in queue 'objectdetection_queue' (#reqid e7c592eb-fbcd-45d6-830a-7711fc184e43)
2023-04-26 13:06:48: Request 'custom' dequeued from 'objectdetection_queue' (#reqid e7c592eb-fbcd-45d6-830a-7711fc184e43)
2023-04-26 13:06:48: Object Detection (YOLOv5 .NET): Command completed in 46 ms. (command timing) in Object Detection (YOLOv5 .NET)
2023-04-26 13:06:48: Response received (#reqid e7c592eb-fbcd-45d6-830a-7711fc184e43): No objects found
2023-04-26 13:06:48: Client request 'custom' in queue 'objectdetection_queue' (#reqid 7d495a03-a3c9-4b24-a23d-544a8273bfc6)
2023-04-26 13:06:48: Request 'custom' dequeued from 'objectdetection_queue' (#reqid 7d495a03-a3c9-4b24-a23d-544a8273bfc6)
2023-04-26 13:06:48: Object Detection (YOLOv5 .NET): Command completed in 45 ms. (command timing) in Object Detection (YOLOv5 .NET)
2023-04-26 13:06:48: Response received (#reqid 7d495a03-a3c9-4b24-a23d-544a8273bfc6): No objects found

2023-04-26 13:06:58: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:06:58: ObjectDetectionNet.exe: Pausing on error for 5 secs.
2023-04-26 13:06:58: ModuleRunner Stop
2023-04-26 13:06:58: Sending shutdown request to python/ALPR
2023-04-26 13:06:58: Client request 'Quit' in queue 'alpr_queue' (#reqid 60e86409-7008-4923-b0f8-c47e1ea822b1)
2023-04-26 13:06:58: Sending shutdown request to ObjectDetectionNet/ObjectDetectionNet
2023-04-26 13:06:58: Client request 'Quit' in queue 'objectdetection_queue' (#reqid e1bc9aca-cc86-49ca-9a79-e10327ab588a)
2023-04-26 13:06:58: FaceProcessing doesn't appear in the Process list, so can't stop it.
2023-04-26 13:07:01: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:01: ObjectDetectionNet.exe: Pausing on error for 10 secs.
2023-04-26 13:07:01: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:01: ObjectDetectionNet.exe: Pausing on error for 20 secs.
2023-04-26 13:07:01: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:01: ObjectDetectionNet.exe: Pausing on error for 40 secs.
2023-04-26 13:07:01: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:01: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:02: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:02: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:02: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:02: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:02: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:02: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:07: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:07: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:15: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:15: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:25: ObjectDetectionNet.exe: Unable to get request from objectdetection_queue for ObjectDetectionNet
2023-04-26 13:07:25: ObjectDetectionNet.exe: Pausing on error for 60 secs.
2023-04-26 13:07:31: Forcing shutdown of python/ALPR
2023-04-26 13:07:31: Forcing shutdown of ObjectDetectionNet/ObjectDetectionNet
2023-04-26 13:07:31: ** Module ALPR has shutdown
2023-04-26 13:07:31: ALPR_adapter.py: has exited
2023-04-26 13:07:31: ** Module ObjectDetectionNet has shutdown
2023-04-26 13:07:31: ObjectDetectionNet.exe: has exited
Try testing it using CodeProject.AI Explorer, if it works there then it is a Blue Iris issue. From the CP.AI log you posted looks like it is a CP.AI issue

1682541500714.png
 

carteriii

Pulling my weight
Joined
Jan 8, 2016
Messages
146
Reaction score
157
Location
USA
I tested using the images saved in Alerts, both the one at that time, the one before, and the one after. I used ipcam-combined and ipcam-dark (one at a time since that's what Explorer seems to allow) which are what I have specified to use. All calls succeeded with "No predictions returned" (as it should be). Of course that doesn't perfectly test the images Blue Iris might have used since BI is set to test 4 images per trigger, one second apart.

Any other suggestions to test & gather more information?

It would be nice if the CodeProject Explorer showed the execution time, even when "no predictions returned", but I'll let you decide if that's worth passing along since at best it's clearly a very low, low priority.
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,214
Reaction score
4,253
Location
Brooklyn, NY
I tested using the images saved in Alerts, both the one at that time, the one before, and the one after. I used ipcam-combined and ipcam-dark (one at a time since that's what Explorer seems to allow) which are what I have specified to use. All calls succeeded with "No predictions returned" (as it should be). Of course that doesn't perfectly test the images Blue Iris might have used since BI is set to test 4 images per trigger, one second apart.

Any other suggestions to test & gather more information?

It would be nice if the CodeProject Explorer showed the execution time, even when "no predictions returned", but I'll let you decide if that's worth passing along since at best it's clearly a very low, low priority.
To check if CP.AI is working use the test images in the C:\Program Files\CodeProject\AI\TestData\Objects folder, you should get results like the below images

1682545055571.png
1682545108261.png
 
Top