[tool] [tutorial] Free AI Person Detection for Blue Iris

Funny you mention that, Andygds007, I was coming here just to post similar about night time in black and white. I really think I need to have mine set up so that there's a daytime schedule which uses DeepStackAI and then black and white night time does regular motion detection...

The one picture it's falsely triggering on a house window saying it's a car, but then the next photo which CLEARLY has people walking by and it doesn't even see them.
 

Attachments

  • false2.png
    false2.png
    1 MB · Views: 49
  • false.png
    false.png
    880.2 KB · Views: 47
  • Like
Reactions: Andygds007
Funny you mention that, Andygds007, I was coming here just to post similar about night time in black and white. I really think I need to have mine set up so that there's a daytime schedule which uses DeepStackAI and then black and white night time does regular motion detection...

The one picture it's falsely triggering on a house window saying it's a car, but then the next photo which CLEARLY has people walking by and it doesn't even see them.
Glad it's not only me having this issue. As i can understand/ learn from your scenario, it does work on cars (well at least 1 of them all which is also not so accurate) but not on people while in black and white image.
 
Hi Guys, I would like to run my cameras and deepstack virtually via my ESXI server. Currently it is running on 2 e5-2690 v4 CPUs and 500GB of RAM. The CPUs do not support QuickSync (adding a single camera spikes my CPU usage on 6 cores to 50%) so I am hoping I can add a couple GTX 1080s for Blue Iris and for DeepStack AI and offload all of the compute to the GPUs. Has anyone tried this approach? If so how did it go?

I tried briefly with a quadro P1800 or something along those lines, but didn't have any luck with using the deepstack:gpu version. not sure if anyone has succeeded, but would also like to know. I am on windows though, possibly its better on linux?

I expect you're not buying 2 x 1080s just for this? Probably for other reasons. Someone else can probably chime in, but a cheap quicksync cpu should be much cheaper and faster and less overall watt usage, especially if most your current usage is due to the cameras. Unless you're going crazy with several cameras, triggering nonstop, the AI doesn't seem too taxing comparatively. You can always run deep stack on low / med / high, and lots of BI / camera settings to better optimize the workload.
 
I did follow the guide but 640x480 was too crappy for me so I switched back and used full 1080p resolution.
Do you have object detection enabled? If yes, check if it is set to only trigger when an object travels more than 100 pixels. This is an issue for some camera configurations, especially if the camera's are low resolution.
 
I’ve skipped the sub streams completely and have the cameras send a snapshot to my server via FTP (via private lan) for AI analysis. Works amazing and I’m down to 10% cpu (AI temporally spikes it’s to 50%) on an old i5. Recording 8 2mp cameras 24x7 using DD and now can turn on “limit decoding unless required” because all the heavy lifting is outside of BI.

Hikivision cameras were simple to setup with this because they put their snapshots in the directory exactly like bi but Dahua were harder because they upload their images to /CameraName/Year/Month/Day/Hour/minute/ and that has to get sorted with bp2008’s command line program before processing.
 
  • Like
Reactions: Flowerpowers
Hi everyone! First, amazing stuff this. Great work GentlePumpkin!
The question:
Im using this with Home Assistant and would love to be able to use the flagged pictures in automations. I saw the option to send the picture with telegram, but if I can avoid using Telegram for this it would be better.
Is the pictures with the red boxes stored somewhere? If so I could just send them over somehow to my Home Assistant VM.
 
  • Like
Reactions: aesterling
Only one file can be processed at a time by DeepStack. I'm guessing too many images are being generated so they all have to wait in line. The thread queue wait is how long it took for the previous images to be processed. Are you sure BI is set to generate images "Only when triggered"? 2000ms for deepstack is a bit long. If you could put it on faster hardware or a solid state drive that may help reduce time.
Thank you! That makes sense. I found one of my cameras was generating a flood of images - motion detector on the clone was set way too sensitive. Fixed that and now Thread queue time is now down to 0 most of the time, but Deepstack is still running in the 1500-2300ms range. I am running this on i7-7700K at 4.2GHz with a Toshiba RD400 SSD. Is there a way to dig into Deepstack and see exactly where the delay is coming in? Anything that could help it short of the hardware change? What is an average good time that I should be striving for?

Thanks!
 
Running BI 5 and AITools 1.67 preview 7 on win 10 computer.
After windows update I now get a .net error everytime I start AItools.
If I click continue AItools another dialogbox comes stating ERROR LoadCameras() failed.
I click OK AItools start and work normally, but If I restart the computer the service won't start automagically as I have to press continue and OK due to the errors.
Anyone else with the same problem?
Attached the logfile of the .net error.
 

Attachments

Running BI 5 and AITools 1.67 preview 7 on win 10 computer.
After windows update I now get a .net error everytime I start AItools.
If I click continue AItools another dialogbox comes stating ERROR LoadCameras() failed.
I click OK AItools start and work normally, but If I restart the computer the service won't start automagically as I have to press continue and OK due to the errors.
Anyone else with the same problem?
Attached the logfile of the .net error.

Have you checked that "Read Only" is disabled on all AI-tool related files?

I had a few strange errors which went away after disabling "Read Only" on all files.
 
  • Like
Reactions: Sintei
I’ve skipped the sub streams completely and have the cameras send a snapshot to my server via FTP (via private lan) for AI analysis. Works amazing and I’m down to 10% cpu (AI temporally spikes it’s to 50%) on an old i5. Recording 8 2mp cameras 24x7 using DD and now can turn on “limit decoding unless required” because all the heavy lifting is outside of BI.

Hikivision cameras were simple to setup with this because they put their snapshots in the directory exactly like bi but Dahua were harder because they upload their images to /CameraName/Year/Month/Day/Hour/minute/ and that has to get sorted with bp2008’s command line program before processing.

Seems promising! I've had the exact same idea with my HiK cameras, due to problems with BI when it gets dark.
If it is also possible to trigger the cameras to record via a http-command/trigger, BI could be closed completely to save cpu power.
 
Thank you! That makes sense. I found one of my cameras was generating a flood of images - motion detector on the clone was set way too sensitive. Fixed that and now Thread queue time is now down to 0 most of the time, but Deepstack is still running in the 1500-2300ms range. I am running this on i7-7700K at 4.2GHz with a Toshiba RD400 SSD. Is there a way to dig into Deepstack and see exactly where the delay is coming in? Anything that could help it short of the hardware change? What is an average good time that I should be striving for?

Thanks!

In my limited experience with the Windows version of Deepstack, I average around 600ms. Thats on a Threadripper 1950x with 16 cores, 64 GB ram and Samsung M2 drives that are like 3000mb read speed. If you had less than 16 GB ram that appears like it could be a factor since I'm seeing over 8GB ram usage in all the deepstack processes. And I'm not 100% sure but I think it tries to use all of my cores, so that certainly is a factor. I could never get it to work, but if you have a good nvidia card you could try the "GPU" version in Docker.
 
Running BI 5 and AITools 1.67 preview 7 on win 10 computer.
After windows update I now get a .net error everytime I start AItools.
If I click continue AItools another dialogbox comes stating ERROR LoadCameras() failed.
I click OK AItools start and work normally, but If I restart the computer the service won't start automagically as I have to press continue and OK due to the errors.
Anyone else with the same problem?
Attached the logfile of the .net error.

Open each file in \Cameras\ subfolder in Notepad. If any are empty or have null's, weird charactors, etc, they are corrupt. Each file should be human readable. If not, delete them and recreate the camera.
 
Speaking of lack of night time detection. Deepstack didn't even consider this an object - i'm surprised.

View attachment 68907

Same, things at night are almost never detected for me. And your contrast is a lot better than mine. I have a camera ordered that does color night vision if the light is 1 lux or brighter, so I'll let you know if it helps: Amazon.com : Lorex LNB9272S 4K 8MP 30FPS Vari-Focal 4X Zoom Bullet Camera w/Listen-in Audio … : Camera & Photo
 
Same, things at night are almost never detected for me. And your contrast is a lot better than mine. I have a camera ordered that does color night vision if the light is 1 lux or brighter, so I'll let you know if it helps: Amazon.com : Lorex LNB9272S 4K 8MP 30FPS Vari-Focal 4X Zoom Bullet Camera w/Listen-in Audio … : Camera & Photo

Interesting camera - i might have to try that as well. I just started using IR floods for better contrast and was hoping it would help with AI. It didn't. But it sure improves night vision and most importantly NO MORE SPIDERS with the the camera's LEDs turned off!!!!!
 
Open each file in \Cameras\ subfolder in Notepad. If any are empty or have null's, weird charactors, etc, they are corrupt. Each file should be human readable. If not, delete them and recreate the camera.
Funny, I actually did this before you posting this. And can confirm that this was exactly the problem.
One of the camera files was corrupt.
Deleting/recreating solved the problem.
Thanks!
 
Funny, I actually did this before you posting this. And can confirm that this was exactly the problem.
One of the camera files was corrupt.
Deleting/recreating solved the problem.
Thanks!

I had this previously when I was running AITools as a service and then ran up the GUI and then made some changes to the camera settings.
 
  • Like
Reactions: Sintei
I tried out the VorlonCD/bi-aidection fork of AI Tool that was posted by Chris Dodge and wow, there's a lot of nice improvements. I especially like the ability for AI Tool to automatically start DeepStack in Windows and not have to deal with the DeepStack console that can't be closed or minimized. This feature makes running DeepStack on the same computer that runs Blue Iris usable for me. My BI computer has a couple of monitors attached that constantly display the UI3 web interface. I could not use DeepStack in Windows without the console covering up a large part of one monitor.

The fork is up and running on my BI computer and it's mostly doing what I want, but there is one issue that I have not been able to resolve. When the camera sees motion it drops an image into D:\BlueIris\aiinput. AI Tool detects the new file in the folder and sends it to DeepStack where it's processed, the results are returned, and BI Tool handles it accordingly. The problem is that BI Tool then sends the same image to DeepStack again. Currently AI Tool is sending a single image to DeepStack twice, but at one time with a different install it was sending every image three times. Everything is working but DeepStack is having to do two to three times the amount of work that it should. I have checked the D:\BlueIris\aiinput folder to be sure that it does not contain duplicate images, and it does not.

While troubleshooting I found that removing the trigger URL stops the duplicate processing. However, duplicate processing is performed even if the image is considered irrelevant and the camera is not triggered. Here's the full trigger line. It is the default URL that is automatically filled in, but I have changed it to HTTP and port 81, as also added my credentials.


I've included a bit of the log file and my settings. Any help will be appreciated. Hopefully I have just overlooked a setting or two.

Thanks

AI Cameras.png

AI Settings.png

AI DeepStack.png

BI Trigger.png

BI Record.png

BI Alerts.png


[18.08.2020, 21:02:53.357]: DetectObjects>
[18.08.2020, 21:02:53.359]: DetectObjects> Starting analysis of D:\BlueIris\aiinput\GarageMotion.20200818_210253238.jpg...
[18.08.2020, 21:02:53.360]: DetectObjects> (1/6) Uploading image to DeepQuestAI Server at [18.08.2020, 21:03:06.147]: DeepStack> Server.exe> [GIN] 2020/08/18 - 21:03:06 | 200 | 12.7659097s | ::1 | POST /v1/vision/detection
[18.08.2020, 21:03:06.148]: DetectObjects> (2/6) Posted in 12785ms, Received a 207 byte response.
[18.08.2020, 21:03:06.150]: DetectObjects> (3/6) Processing results...
[18.08.2020, 21:03:06.161]: DetectObjects> Detected objects:car (99.98%), car (99.82%),
[18.08.2020, 21:03:06.162]: DetectObjects> (4/6) Checking if detected object is relevant and within confidence limits:
[18.08.2020, 21:03:06.197]: DetectObjects> car (99.98%) is irrelevant.
[18.08.2020, 21:03:06.225]: DetectObjects> car (99.82%) is irrelevant.
[18.08.2020, 21:03:06.243]: Save> Settings saved to C:\AI Tool\aitool.Settings.json
[18.08.2020, 21:03:06.243]: DetectObjects> (6/6) Camera GarageMotion caused an irrelevant alert.
[18.08.2020, 21:03:06.245]: DetectObjects> 2x irrelevant, so it's an irrelevant alert.
[18.08.2020, 21:03:06.250]: DetectObjects> ...Object detection finished:
[18.08.2020, 21:03:06.252]: DetectObjects> Total Time: 12971ms (Count=1, Min=12971ms, Max=12971ms, Avg=12971ms)
[18.08.2020, 21:03:06.253]: DetectObjects> DeepStack Time: 12785ms (Count=1, Min=12785ms, Max=12785ms, Avg=12785ms)
[18.08.2020, 21:03:06.255]: DetectObjects> File lock Time: 82ms (Count=1, Min=82ms, Max=82ms, Avg=82ms)
[18.08.2020, 21:03:06.256]: DetectObjects> Thread Queue Time: 0ms (Count=0, Min=0ms, Max=0ms, Avg=ms)
[18.08.2020, 21:03:06.259]: DetectObjects>
[18.08.2020, 21:03:06.259]: DetectObjects> Starting analysis of D:\BlueIris\aiinput\GarageMotion.20200818_210253238.jpg...
[18.08.2020, 21:03:06.260]: DetectObjects> (1/6) Uploading image to DeepQuestAI Server at [18.08.2020, 21:03:06.976]: DeepStack> Server.exe> [GIN] 2020/08/18 - 21:03:06 | 200 | 714.5911ms | ::1 | POST /v1/vision/detection
[18.08.2020, 21:03:06.976]: DetectObjects> (2/6) Posted in 715ms, Received a 207 byte response.
[18.08.2020, 21:03:06.980]: DetectObjects> (3/6) Processing results...
[18.08.2020, 21:03:06.982]: DetectObjects> Detected objects:car (99.98%), car (99.82%),
[18.08.2020, 21:03:06.983]: DetectObjects> (4/6) Checking if detected object is relevant and within confidence limits:
[18.08.2020, 21:03:07.018]: DetectObjects> car (99.98%) is irrelevant.
[18.08.2020, 21:03:07.045]: DetectObjects> car (99.82%) is irrelevant.
[18.08.2020, 21:03:07.055]: Save> Settings saved to C:\AI Tool\aitool.Settings.json
[18.08.2020, 21:03:07.055]: DetectObjects> (6/6) Camera GarageMotion caused an irrelevant alert.
[18.08.2020, 21:03:07.057]: DetectObjects> 2x irrelevant, so it's an irrelevant alert.
[18.08.2020, 21:03:07.064]: DetectObjects> ...Object detection finished:
[18.08.2020, 21:03:07.065]: DetectObjects> Total Time: 13798ms (Count=2, Min=12971ms, Max=13798ms, Avg=13385ms)
[18.08.2020, 21:03:07.066]: DetectObjects> DeepStack Time: 715ms (Count=2, Min=715ms, Max=12785ms, Avg=6750ms)
[18.08.2020, 21:03:07.070]: DetectObjects> File lock Time: 0ms (Count=1, Min=82ms, Max=82ms, Avg=82ms)
[18.08.2020, 21:03:07.072]: DetectObjects> Thread Queue Time: 12994ms (Count=1, Min=12994ms, Max=12994ms, Avg=12994ms)
[18.08.2020, 21:03:07.074]: DetectObjects>
[18.08.2020, 21:03:07.075]: DetectObjects> Starting analysis of D:\BlueIris\aiinput\GarageMotion.20200818_210257238.jpg...
[18.08.2020, 21:03:07.076]: DetectObjects> (1/6) Uploading image to DeepQuestAI Server at [18.08.2020, 21:03:07.827]: DeepStack> Server.exe> [GIN] 2020/08/18 - 21:03:07 | 200 | 749.5742ms | ::1 | POST /v1/vision/detection
[18.08.2020, 21:03:07.828]: DetectObjects> (2/6) Posted in 750ms, Received a 297 byte response.
[18.08.2020, 21:03:07.831]: DetectObjects> (3/6) Processing results...
[18.08.2020, 21:03:07.832]: DetectObjects> Detected objects:person (95.14%), car (99.99%), car (99.74%),
[18.08.2020, 21:03:07.833]: DetectObjects> (4/6) Checking if detected object is relevant and within confidence limits:
[18.08.2020, 21:03:07.859]: Outsidemask> ->Camera has no mask, the object is OUTSIDE of the masked area.
[18.08.2020, 21:03:07.860]: DetectObjects> person (95.14%) confirmed.
[18.08.2020, 21:03:07.893]: DetectObjects> car (99.99%) is irrelevant.
[18.08.2020, 21:03:07.927]: DetectObjects> car (99.74%) is irrelevant.
[18.08.2020, 21:03:07.930]: DetectObjects> The summary:person (95.14%)
[18.08.2020, 21:03:07.931]: DetectObjects> (5/6) Performing alert actions:
[18.08.2020, 21:03:07.943]: CallTriggerURLs> -> trigger URL called: , response: 'signal=green
profile=1
lock=0
clip=367485348
camera=Garage Motion
'
[18.08.2020, 21:03:07.955]: Save> Settings saved to C:\AI Tool\aitool.Settings.json
[18.08.2020, 21:03:07.955]: DetectObjects> (6/6) SUCCESS.
[18.08.2020, 21:03:07.957]: DetectObjects> Adding detection to history list.
[18.08.2020, 21:03:07.964]: DetectObjects> ...Object detection finished:
[18.08.2020, 21:03:07.964]: DetectObjects> Total Time: 10709ms (Count=3, Min=10709ms, Max=13798ms, Avg=12493ms)
[18.08.2020, 21:03:07.966]: DetectObjects> DeepStack Time: 750ms (Count=3, Min=715ms, Max=12785ms, Avg=4750ms)
[18.08.2020, 21:03:07.967]: DetectObjects> File lock Time: 0ms (Count=1, Min=82ms, Max=82ms, Avg=82ms)
[18.08.2020, 21:03:07.968]: DetectObjects> Thread Queue Time: 9822ms (Count=2, Min=9822ms, Max=12994ms, Avg=11408ms)
[18.08.2020, 21:03:07.970]: DetectObjects>
[18.08.2020, 21:03:07.971]: DetectObjects> Starting analysis of D:\BlueIris\aiinput\GarageMotion.20200818_210257238.jpg...
[18.08.2020, 21:03:07.972]: DetectObjects> (1/6) Uploading image to DeepQuestAI Server at [18.08.2020, 21:03:08.703]: DeepStack> Server.exe> [GIN] 2020/08/18 - 21:03:08 | 200 | 729.5792ms | ::1 | POST /v1/vision/detection
[18.08.2020, 21:03:08.703]: DetectObjects> (2/6) Posted in 730ms, Received a 297 byte response.
[18.08.2020, 21:03:08.706]: DetectObjects> (3/6) Processing results...
[18.08.2020, 21:03:08.707]: DetectObjects> Detected objects:person (95.14%), car (99.99%), car (99.74%),
[18.08.2020, 21:03:08.709]: DetectObjects> (4/6) Checking if detected object is relevant and within confidence limits:
[18.08.2020, 21:03:08.741]: Outsidemask> ->Camera has no mask, the object is OUTSIDE of the masked area.
[18.08.2020, 21:03:08.742]: DetectObjects> person (95.14%) confirmed.
[18.08.2020, 21:03:08.776]: DetectObjects> car (99.99%) is irrelevant.
[18.08.2020, 21:03:08.807]: DetectObjects> car (99.74%) is irrelevant.
[18.08.2020, 21:03:08.810]: DetectObjects> The summary:person (95.14%)
[18.08.2020, 21:03:08.811]: DetectObjects> (5/6) Performing alert actions:
[18.08.2020, 21:03:08.815]: CallTriggerURLs> -> trigger URL called: , response: 'signal=green
profile=1
lock=0
clip=367485348
camera=Garage Motion
'
[18.08.2020, 21:03:08.825]: Save> Settings saved to C:\AI Tool\aitool.Settings.json
[18.08.2020, 21:03:08.825]: DetectObjects> (6/6) SUCCESS.
[18.08.2020, 21:03:08.827]: DetectObjects> Adding detection to history list.
[18.08.2020, 21:03:08.836]: DetectObjects> ...Object detection finished:
[18.08.2020, 21:03:08.837]: DetectObjects> Total Time: 11581ms (Count=4, Min=10709ms, Max=13798ms, Avg=12265ms)
[18.08.2020, 21:03:08.838]: DetectObjects> DeepStack Time: 730ms (Count=4, Min=715ms, Max=12785ms, Avg=3745ms)
[18.08.2020, 21:03:08.839]: DetectObjects> File lock Time: 0ms (Count=1, Min=82ms, Max=82ms, Avg=82ms)
[18.08.2020, 21:03:08.841]: DetectObjects> Thread Queue Time: 10717ms (Count=3, Min=9822ms, Max=12994ms, Avg=11178ms)
[18.08.2020, 21:03:08.843]: DetectObjects>
 
Last edited:
Seems promising! I've had the exact same idea with my HiK cameras, due to problems with BI when it gets dark.
If it is also possible to trigger the cameras to record via a http-command/trigger, BI could be closed completely to save cpu power.

If you only use BI for viewing (no BI motion detection) and use "Direct to disk" with "Limit decoding unless required" it does not use much cpu power until you open a client connection.

I think you would have a difficult time using less CPU with a different program and you would be giving up all of the current options to connect client devices to BI vs any other software.
 
Last edited:
I've noticed a new issue with the Vorlon fork that appears to be randomly deleting images and entries from the log file way too soon. For some reason, it is deleting the files only a few minutes after they were captured, and then they either do not show up in the history list, or if they are still in the list, you get an unhandled exception error when clicking on the entry. Here is some of the log file - note the time stamps:

[10:48:39.334]: DeleteListItem> Removed alert image 'AI_Family_Room.20200819_104212056.jpg' from history list and from cameras/history.csv in 0ms (24 list items)
[10:48:39.356]: DeleteListItem> Removed alert image 'AI_Family_Room.20200819_104216069.jpg' from history list and from cameras/history.csv in 0ms (23 list items)
[10:48:39.387]: DeleteListItem> Removed alert image 'AI_FrtDrv.20200819_104540124.jpg' from history list and from cameras/history.csv in 0ms (22 list items)
[10:48:39.417]: DeleteListItem> Removed alert image 'AI_FrtYard.20200819_104542701.jpg' from history list and from cameras/history.csv in 0ms (21 list items)
[10:48:39.433]: DeleteListItem> Removed alert image 'AI_FrtDrv.20200819_104544124.jpg' from history list and from cameras/history.csv in 0ms (20 list items)
[10:48:39.464]: DeleteListItem> Removed alert image 'AI_FrtYard.20200819_104546701.jpg' from history list and from cameras/history.csv in 0ms (19 list items)
[10:48:39.496]: DeleteListItem> Removed alert image 'AI_FrtYard.20200819_104700711.jpg' from history list and from cameras/history.csv in 0ms (18 list items)
[10:48:39.530]: DeleteListItem> Removed alert image 'AI_FrtYard.20200819_104706711.jpg' from history list and from cameras/history.csv in 1ms (17 list items)
[10:48:39.557]: DeleteListItem> Removed alert image 'AI_FrtDrv.20200819_104821134.jpg' from history list and from cameras/history.csv in 0ms (16 list items)
[10:48:39.589]: DeleteListItem> Removed alert image 'AI_FrtYard.20200819_104823711.jpg' from history list and from cameras/history.csv in 0ms (15 list items)
[10:48:39.607]: DeleteListItem> Removed alert image 'AI_FrtDrv.20200819_104825134.jpg' from history list and from cameras/history.csv in 0ms (14 list items)
[10:48:39.637]: DeleteListItem> Removed alert image 'AI_FrtYard.20200819_104827711.jpg' from history list and from cameras/history.csv in 0ms (13 list items)
AI Tool Unhandled Exception.png

Any thoughts on what might be going on? Is the delete time adjustable?

John