Page 1 of 2

DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Sep 14, 2020 4:52 am
by GlennNZ
Indigoplugin for DeepQuestAI

See
https://github.com/Ghawken/DeepQuestAI/releases/
....

This is a Simple, well maybe not.. but powerful! plugin for DeepQuestAI or DeepStackAI.

DeepQuestAI is an interesting local Artificial Intelligence Object ML detection API AI engine.
https://deepquestai.com/

It runs locally on your network - no internet, or cloud involvement needed, unlike some of BlueIris alternatives
DeepQuest has also been used as a base for local AI addon application for Blue Iris (see ipcamtalk forums)

DeepQuest runs with a docker container on windows PC (Follow instructions), Docker on mac or within a rpi (ideallly with Intel NCS-2 stick)
A new beta and open sourcing of DeepQuest is expected at anytime.. (Sep 2020)

This plugin can tie deeply in with BlueIris plugin (where the latest BI Plugin version is needed), it then uses indigo 7+ Broadcast ability to communicate between plugins.

You need to install and setup a instance of DeepStack AI, as per its instructions.
After this is completed you will end up with a IP address and port where Deepstack is running.

Within Deepstack we need the Detection API Running or "VISION-DETECTION=True" in startup commands.

This will end up with a IP address and port where Deepstack is running.

On my now growing, now for over a year with a smattering of other users testing it works very well. It has become the - lack of a better word - ‘coolest’ Home Automation aspect.
Currently (have scanned 2021439 images so far - more than 700gigs!)

Is all local, which is both positive and negative:

Benefits:
1. have images to use and keep / Cars/ People saved forever
2. Plugin can move images to archive Network directory keeping time stamped photos of all people detected etc.
3. No security issues; nothing going offsite
4. Options running on RPI with NCS2 (get about 1sec processing per image)
5. Seems faster than off site options (like Sentry on BI)
6. Run Action Groups based on URL or BI Camera when Object or no object
(add Machine Learning to lights off - e.g timer expired, check cameras for people, turn off if none, of people reset timer..)
7. Archive images forever; Gate Camera scans for Car, when detected saves images; no data issues given size of images
8. On setup enabled Blue Iris Cameras - flags back to BI that object detected eg. flags camera videos in BI interface with a Alert.


Negatives:
1. need to setup Plugin
2. need CPU cycles to run the detection...
Although RPI with NCS2 averages about 1-2 seconds per image on my testing


Potential Uses

First: with BlueIris setup and/or BI Indigo Plugin

Setup, enable broadcast in BI Indigo plugin
All BI Cameras will send motion alerts to this DeepState Plugin.
Camera Images will be processed by Deepstate as you request for objects.

What images? - well all Motion/Triggered images from the Camera itself.
eg. When motion detected at Gate Cam -> alerts Deepstate, sends image and processes this image for object detection
If object found:
Can enable a Indigo Trigger - see DeepState Plugin Triggers

Can create a DeepState Plugin Device for important objects eg. DeepState Device Person or Cars
If DeepState Device exists for this object Plugin will save all images of these objects, archiving to Network storage if enabled/setup
Device States also have time/last detected, image links etc.

eg. flow

Image


or

No BlueIris, or BlueIris but only for occasional Action Group based use.
eg.
Check no person outside on BI Outside Cameras1,2,3,4 before turn lights off.

Action Group Only Usage:

Even with BlueIris can have no enabled Cameras in PluginConfig (won't check any cameras regularly like about flow)
But you can trigger a actionGroup to run:

eg Check URL Image and Run Action Group if object Found or Not Found:
eg Check BlueIris Camera Feed and Run Action Group if Object Found or Not Found

Checks a URL Image from BI Camera for example, but can be any URL Image.
Checks for presence or absence of an object e.g car gone, person present.
Then runs an action group depending on presence or absence

eg.
Door closed trigger, run this AG, perhaps with delay,,,
Checks Camera for Person present - if no person run action group to turn lights off

eg.
Check Garage for Car - Car absent, run appropriate action groups

Flow:

Image




But wait there is a lot more...

HTTP Server:

Creates a very basic image Web server - for control page use, showing the last detected objects
Defaults to port 4142, set up in Plugin Config.

e.g
Code: Select all
http://INDIGO-IP-ADDRESSS:4142/car.html


Set the above as a refreshing URL in control page will show the last image of car found.

On refreshing the the same URL, the web server goes backwards in time through all saved non-archived images.
Cycling back to beginning again once reached end.

NB: To save images need to create Indigo DeepState Device for that particularly Object Type!

Hence can within a couple of minutes create a control page which shows all people detected within a control page, refreshing the image then goes backwards to next, next, next etc.

On my usage have three control page images, next to BlueIris cameras for Dog/Fox, person and car. Select each shows me the last detected example of each, and with each refresh the one before etc. This has become a incredibly easy way to check for presence of fox/dog and people. Easy to find/check and if interested can then go look at actual video within BlueIris.

Plugin Setup

Install DeepStack, run Deepstack remember the IP address and the Port running...
(API code now not needed and is free for all)

Start DeepStack Server - Detection recognition only API needed, pick port to run on DeepState on

Plugin Defaults to 7188

** DeepStack Plugin Needs Pillow installed/PIL for image control **

try:
Code: Select all
sudo pip install pillow


Install this Plugin and setup within PluginConfig
(Plugin Config has detailed descriptions of every setting within the Config page)

Enter the ipaddress of your DeepStateAI API
Enter the port that you are using.

Follow the detailed instructions and information in the Plugin Config page

Make sure running BlueIris Plugin version >1.1.12 and above
Enable within BlueIris plugin, the Broadcast setting

DeepStateAI Plugin

Plugin Config Settings:

Image

IP Address: IP address of computer where deepStackAI running, or localhost
Port: Port of DeepStackAI service
Enabled Cameras:
BlueIris Cameras that are enabled for image checking.
Overriding Camera selection, can select all, and then within multiple triggers further define.

SuperCharge Detection:
This setting, pulls multiple images from BlueIris following camera triggering and chucks them all at the DeepStackAI API if enabled.
Images Number: Once camera triggered - the number of images to pull
Seconds Apart: The numbers of seconds apart

eg.
SuperCharge Enabled:
Motion/Camera triggered.
DeepQuestAI will pull 5 images, 2 seconds apart one after another and send to DeepQuest API for image recognition.

Obviously the number of cameras enabled, and speed of DeepStack processing will be very important here


Image

Image


Warning:
Currently checks and if > Abort Image Time seconds behind image/checking will delete image and move on.

If velocity of Deepstate improving (eg. getting quicker) will continue without deleting
Additionally:
If image is a supercharge/additional image and the current processing delay is >1/2 total Abort time, will start skipping every 2nd supercharge image



Enabled HTTP Image Server

This is the 2nd major functionality of plugin - runs a local web server to server Plugin Images to ControlPages
Enable/Port used

Then can go to, any of the objectType name to display

http://192.168.1.19:4142/car.html
http://192.168.1.19:4142/person.html
http://192.168.1.19:4142/bench.html
etc..etc..


(192.168.1.19 - is local Indigo IP address)

As Refreshing URL within control page to show the last Image detected/Saved
If Page refreshed (and simply action replace Controlpage with self) Will move on to next image etc.etc.

Actions - to Reset Images to Zero

Image


Images Saved

Plugin saves all Images in users documents directory/Indigo-DeepQuestAI, or as selected with PluginConfig

New:
Will ONLY save images if a matching Indigo Device exists.

eg: Indigo Device DeepState Object == Car
Will save all images found of object = Car
& etc

Will trigger however, without any devices existing - just won't save images.

Within Cars/Faces always saves a copy of the whole Image (with bounding red box and Confidence in top left)
Also saves a cropped Copy of the Person/Car

Will shortly add ability to date/move/keep images for as long as wanted.

Plugin:
Has One User created Device:

Image


DeepState Object Device:
Choose between Vehicle and Person and Other - for everything else.
Enter the desired confidence for this Object.
When found the Device will be updated with details, including Image link

Has One Main Device:

Generated from within Plugin Config

Image

States as displayed above

Has One Trigger:

Edit Event Settings:
- Select the object Type that trigger is looking for Person versus Car, versus other
- Select the confidence interval to use eg. 0.6
- Select the Cameras you are using for this trigger, one or many
- Select the don't retrigger within this time period eg. 10 seconds or 120 seconds etc

Then usual indigo conditions, action groups apply.
eg.
person found, do this etc.

Image

This trigger will fire ignoring the missing Cameras with the SendURL Action Group

Actions

Image

Image

Image


These two action groups should be self-explanatory - basically do the same thing, one using raw URL, and the other using BI Camera Details.

Other

RAM Disk Usage
Optionally the Plugin creates and uses a RAM disk (set to 256MB) for saving ALL the incoming image data from BI
Given the traffic of data I felt best to use RAM and this seemed the best way.
All BI/URL images are downloaded from source to RAM drive, set to DeepStack and then deleted.
If Object detected and Deep Stack Device exists, these images are saved.

Archive Image Files
Optionally the plugin can archive images after a period of time to network storage for long term storage
Add ability to set a archive smb network directory.
Needs to be a smb network location: (if local directory just use SaveDirectory)
Format:
//USERNAME:PASSWORD@SERVER/Directory/Directory
Set up in Plugin Config

Optional 2nd DeepState Server
Optionally the plugin can use another DeepState Service, eg. 2 RPIs, or one PC/MAC one RPI
The 2nd device is used for Action Groups, as noted in the Action Group information

Supercharge Meaning

Optionally this downloads multiple images over set period of time for object detection.
eg.
Camera triggered - Plugin get ALERT image from BI - this is processed for object detection
If supercharge is setup, the plugin will download from BlueIris Camera further images
eg. Number of Images 10, Time apart 1 sec
It will download from BlueIris a image every second for 10 seconds, que and send these to DeepState for Object Detection.

This may mean that you get 10 images of car/person detected saved, but each closer/further away and with different details.
Still tiny small images compared to Video Files

Backend

The Plugin uses multiple threads for downloading images at the correct time, and from multiple sources simultaneously
All images are sent to the DeepState server in a tidy QUE, only one at a time.
DeepState server, can have issues if multiple requests of it at once, this overcomes this issue.
Most requests, are qued and then processed one-one by DeepState.
There are a number of settings to deal with a slow que, or processing that is taking to long.
Bottom line is if que is long, you should drop some supercharge image numbers or look at numbers of cameras enabled.

FAQ

Alert Images

The Plugins will use BI Alert Images (first captured motion with triggering event) Important to get these images otherwise quick motion gone in under a second may be missed
To enable Alert images
Within Camera on Blue Iris Server go to Trigger, and click enable Alert Jpg, ideally second checkbox Hi-Res Image

Within Camera on Blie Iris Server:
Image





ChangeLog:

Better late than Never!

0.6.8
Delete Action images from calls, rather than waiting for cleanup
Use &ALERT_PATH in BI trigger info, sometime in past this changed

0.6.7
Add some more information to Triggers/Actions regarding what happens
Add Possible Flow Charts to Readme.

0.6.6
Add BI Camera Checking Action Group - unfortunately needs BI server/port details entered in AG settings
Add option for 2nd DeepState service running - to be used for action groups if needed
Allows another instance of deepstate running on a localip eg. use RPI with deepstate/NCS somewhere to do some of the processing
If unchecked will use the main device for all calls (no change)
Shouldn't really be issue
Add new Action Group - for immediately sending back to DeepState the URL/or File, not que, send immediately
Change logic of new Action Groups to allow separate AG to be selected for object found/or not found and both...
Cosmetic changes

0.6.0
Report back to BlueIris and Flag video if object detected
Only will flag BI videos when Deep State Object device exists (same for saving images)
Use 'memo' = DeepState_ObjectType
Can't seem to access this memotext at moment within BI or iOS, but potentially with BI update.

0.5.9 Addition

Action Group
Check URL Image and Run Action Group:

Checks a URL Image from BI Camera for example, but can be any URL Image.
Checks for presence or absence of an object e.g car gone, person present.
Then runs an action group depending on presence or absence
eg.
Door closed trigger, run this AG, perhaps with delay
Checks Camera for Person present - if no person run action group to turn lights off
eg.
Check Garage for Car - Car absent, run appropriate action groups

0.5.5
Add ability to set a archive smb network directory.
Needs to be a smb network location: (if local directory just use SaveDirectory)
Format:
//USERNAME:PASSWORD@SERVER/Directory/Directory


Will copy files 2 days old, every 24 hours to this directory preserving datetime info of files for future reference
Add /archive/deepstateobject.html to HTML server - serving these archive images as well
Add menu item to copy to archive
Few text changes to config items

0.5.1
Trial of Daemon threads instead - to avoid hanging when closing RAMdisk
(only occured once, but needed restart as couldn't manually eject)

0.5.0
Better downloading, add to Que behaviour

Use BI ALertImages - changes to BI Plugin updates to version 1.1.16
If alertimage received/enabled in BI will always use Alert Image,plus whatever is setup
Uses hires AlertImages - Capture hi Res ALert images should be enabled in trigger tab of Camera

Changes to BI Trigger setup to format NB Changed to ALERT_PATH]b[/b]
On:
192.168.1.6:4556/&CAM/&TYPE/&PROFILE/True/&ALERT_PATH
Off:
192.168.1.6:4556/&CAM/&TYPE/&PROFILE/False/&ALERT_PATH

0.4.1
Change to download images threading, don't thread first or single image, thread the rest
Remove some more logging
Fixs download URL to work correctly with large images/slow internet
Add some examples from ipcam forums

0.4.0
Add Bytes and Human readable data processed - amount of Image data read/processed
Remove resetting counts to zero at restart.
Remove some logging

0.3.9
Further image verification
Change to using hdiutil to dismount - otherwise leaving diskimages-helper processes hanging
Using deattach to hopefully avoid
Oops

0.3.8
Verify image data before sending to DeepState (having some issues with invalid image data crashing deepstate)
Few unicode exception further fixes
Change to skip every 2nd supercharge image if 1/2 of set time delayed.

0.3.2
Stop adding to que if DeepStateService not responding/Down/Not on
Delete superCharge Images first if que speed becoming issue
[starts doing this 1/2 of the set time, eg. >30 seconds will skip Supercharge Images]
First Fix for orphan Temp files... every hour check for orphaned files and delete


0.3.1
Add Main Server Device - created with pluginConfig
Allows monitoring of DeepState service, images, delay etc. Found was constantly looking for this info
Force ejects RAM disk

0.3.0
Add check for Temp Files in directory, before delete
Use RAMdisk for temp files add setting:
Creates a 256MB Ram disk to use for all Temporary Files - downloading from BI
If drive full just skips and typically means > 200 files behind so not great
Ejects/Closes/Creates if and when needed
If PluginConfig changes will force restart of Plugin to create RamDisk
Further checks/balances for RAMdisk creation

With BI Plugin 1.1.15: Sends BlueIris Trigger Type
Ignores AUDIO triggers (yah!) as this was causing a lot of activity for me particularly when windy
[Add selection of particular triggers perhaps later]

0.2.6
Remove Unselected Cameras from being an option with Events (confusing), Can set up multiple events for objects, from one many or different cameras.
Just can't select a Camera which isn't enabled in Main Plugin Config

0.2.5
Add support for every every object available with DeepState - eg. cats, dogs etc.
Extend this support to Html Image Server (now every objectType is possible)
Extend this support to Devices and Events and Actions
Important:
Plugin will not save any images for any object, unless there is a corresponding device with that Object type within Indigo
eg. if want to save every Car image - need to create a Indigo Car device, etc for every object

TODO
- Add multiple similiar objects together as a list - eg.cat,dog, bear!
(decide how to do that with Indigo config currently)
- Return Car back to all vehicles (currently just car)
- Add time of photo taken to image, not time processed

DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Sep 14, 2020 10:40 am
by mundmc
Awesome and appreciated work, GlennNz! I will vouch that this plugin and DeepQuest are awesome

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Tue Dec 22, 2020 2:27 pm
by Turribeach
OMG! This is awesome, I will certainly have a go at it very soon (just ordered my Ubiquiti NVR system and cameras!). Quick question, has anyone tried the plugin on an Apple M1 Mac? It will be really interesting to see if DeepQuestAI can use the ML accelerators or the Neural Engine.

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Sun Dec 27, 2020 5:02 pm
by Sierra
This seams a fantastic plugin and with huge potencial :)

I have been testing it and while I think all is configured properly I am not being able to get the images verified; below is my log:

Item : http://XXXX:ZZZZ@192.168.1.235:801/image/Cam1 (string)
Item : Cam1 (string)
Item : /Users/YYY/Documents/Indigo-BlueIris/Cam1.jpg (string)
Item : 1609109559.865256 (real)
Item : false (bool)
Item : 1691174874 (integer)
Item : EXTERNAL (string)
Item : (string)
DeepQuestAI Plugin Debug Thread:AdddtoQue called. & Number of Active Threads:4 and current que:0
DeepQuestAI Plugin Debug threadDownloadImages called. & Number of Active Threads:4
DeepQuestAI Plugin Debug Saved Image attempt for:/Volumes/DeepStateTemp/Temp/TempFile_2855fcdd-500d-4d86-85b3-4570cfba747b in [seconds]:0.0407660007477
DeepQuestAI Plugin Debug converting to Alert URL from urlphoto:http://XXXX:ZZZZ@192.168.1.235:801/image/Cam1?s=100
DeepQuestAI Plugin Debug AlertURL:http://XXXX:ZZZZ@192.168.1.235:801/admin?camera=Cam1&flagalert=1&memo=
DeepQuestAI Plugin Debug Putting SuperCharge.1 item into DeepState Que: Item:<__main__.deepstateitem instance at 0x10cb37440>
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing: Velocity here:-3.91006469727e-05
DeepQuestAI Plugin Debug ************** Downloading Images: Image:0 for Camera:Cam1
DeepQuestAI Plugin Debug Thread:SendtoDeepstate: Processing next item in que: Cameraname:Cam1, image file:/Volumes/DeepStateTemp/Temp/TempFile_2855fcdd-500d-4d86-85b3-4570cfba747b, from IndigoID:1691174874
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing items now 0.000118017196655 seconds later than image captured.
DeepQuestAI Plugin Debug threadDownloadandaddtoque called. & Number of Active Threads:5
DeepQuestAI Plugin Debug Now Validing Image Data before sending..
DeepQuestAI Plugin Debug imageVerify called for image Path:/Volumes/DeepStateTemp/Temp/TempFile_2855fcdd-500d-4d86-85b3-4570cfba747b
DeepQuestAI Plugin Debug Exception: Image Verification Failed:cannot identify image file '/Volumes/DeepStateTemp/Temp/TempFile_2855fcdd-500d-4d86-85b3-4570cfba747b'
DeepQuestAI Plugin Debug Image Failed Verification. Skipped.
DeepQuestAI Plugin Debug downloadandaddtoque Saved Image attempt for:/Volumes/DeepStateTemp/Temp/TempFile_0eb31870-69fa-4bff-a40a-787c89db24c8 in [seconds]:0.0382921695709
DeepQuestAI Plugin Debug converting to Alert URL from urlphoto:http://XXXX:ZZZZ@192.168.1.235:801/image/Cam1?s=100
DeepQuestAI Plugin Debug AlertURL:http://XXXX:ZZZZ@192.168.1.235:801/admin?camera=Cam1&flagalert=1&memo=
DeepQuestAI Plugin Debug downloadandaddtoque Putting item into DeepState Que: Item:<__main__.deepstateitem instance at 0x10cb58ab8>
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing: Velocity here:3.00407409668e-05
DeepQuestAI Plugin Debug Thread:SendtoDeepstate: Processing next item in que: Cameraname:Cam1, image file:/Volumes/DeepStateTemp/Temp/TempFile_0eb31870-69fa-4bff-a40a-787c89db24c8, from IndigoID:1691174874
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing items now 0.000148057937622 seconds later than image captured.
DeepQuestAI Plugin Debug Now Validing Image Data before sending..
DeepQuestAI Plugin Debug imageVerify called for image Path:/Volumes/DeepStateTemp/Temp/TempFile_0eb31870-69fa-4bff-a40a-787c89db24c8
DeepQuestAI Plugin Debug Exception: Image Verification Failed:cannot identify image file '/Volumes/DeepStateTemp/Temp/TempFile_0eb31870-69fa-4bff-a40a-787c89db24c8'
DeepQuestAI Plugin Debug Image Failed Verification. Skipped.
DeepQuestAI Plugin Debug received Camera motionTrue message: Data : (list)
Item : http://XXXX:ZZZZ@192.168.1.235:801/image/Cam1 (string)
Item : Cam1 (string)
Item : /Users/YYY/Documents/Indigo-BlueIris/Cam1.jpg (string)
Item : 1609109559.965178 (real)
Item : false (bool)
Item : 1691174874 (integer)
Item : EXTERNAL (string)
Item : http://XXXX:ZZZZ@192.168.1.235:801/aler ... g&fulljpeg (string)
DeepQuestAI Plugin Debug Thread:AdddtoQue called. & Number of Active Threads:5 and current que:0
DeepQuestAI Plugin Debug threadAddtoque: Checking Alert image as exists..
DeepQuestAI Plugin Debug threadDownloadandaddtoque called. & Number of Active Threads:6
DeepQuestAI Plugin Debug threadDownloadImages called. & Number of Active Threads:6
DeepQuestAI Plugin Debug downloadandaddtoque Saved Image attempt for:/Volumes/DeepStateTemp/Temp/TempFile_AlertIMAGE_52872db4-7ee7-4bcd-95ff-6881cafba533 in [seconds]:0.0399181842804
DeepQuestAI Plugin Debug Saved Image attempt for:/Volumes/DeepStateTemp/Temp/TempFile_e716092b-ee73-4093-a876-140fe9c293a5 in [seconds]:0.0397009849548
DeepQuestAI Plugin Debug converting to Alert URL from urlphoto:http://XXXX:ZZZZ@192.168.1.235:801/alerts/Cam1.20201227_221259.2352652.17.jpg&fulljpeg
DeepQuestAI Plugin Debug converting to Alert URL from urlphoto:http://XXXX:ZZZZ@192.168.1.235:801/image/Cam1?s=100
DeepQuestAI Plugin Debug AlertURL:http://XXXX:ZZZZ@192.168.1.235:801/admin?camera=Cam1&flagalert=1&memo=
DeepQuestAI Plugin Debug AlertURL:http://XXXX:ZZZZ@192.168.1.235:801/admin?camera=Cam1&flagalert=1&memo=
DeepQuestAI Plugin Debug downloadandaddtoque Putting item into DeepState Que: Item:<__main__.deepstateitem instance at 0x10cb103f8>
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing: Velocity here:-8.41617584229e-05
DeepQuestAI Plugin Debug Putting SuperCharge.1 item into DeepState Que: Item:<__main__.deepstateitem instance at 0x10c989128>
DeepQuestAI Plugin Debug Thread:SendtoDeepstate: Processing next item in que: Cameraname:Cam1, image file:/Volumes/DeepStateTemp/Temp/TempFile_e716092b-ee73-4093-a876-140fe9c293a5, from IndigoID:1691174874
DeepQuestAI Plugin Debug ************** Downloading Images: Image:0 for Camera:Cam1
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing items now 6.38961791992e-05 seconds later than image captured.
DeepQuestAI Plugin Debug Now Validing Image Data before sending..
DeepQuestAI Plugin Debug imageVerify called for image Path:/Volumes/DeepStateTemp/Temp/TempFile_e716092b-ee73-4093-a876-140fe9c293a5
DeepQuestAI Plugin Debug threadDownloadandaddtoque called. & Number of Active Threads:6
DeepQuestAI Plugin Debug Exception: Image Verification Failed:cannot identify image file '/Volumes/DeepStateTemp/Temp/TempFile_e716092b-ee73-4093-a876-140fe9c293a5'
DeepQuestAI Plugin Debug Image Failed Verification. Skipped.
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing: Velocity here:0.00296020507812
DeepQuestAI Plugin Debug Thread:SendtoDeepstate: Processing next item in que: Cameraname:Cam1, image file:/Volumes/DeepStateTemp/Temp/TempFile_AlertIMAGE_52872db4-7ee7-4bcd-95ff-6881cafba533, from IndigoID:1691174874
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing items now 0.00302410125732 seconds later than image captured.
DeepQuestAI Plugin Debug Now Validing Image Data before sending..
DeepQuestAI Plugin Debug imageVerify called for image Path:/Volumes/DeepStateTemp/Temp/TempFile_AlertIMAGE_52872db4-7ee7-4bcd-95ff-6881cafba533
DeepQuestAI Plugin Debug Exception: Image Verification Failed:cannot identify image file '/Volumes/DeepStateTemp/Temp/TempFile_AlertIMAGE_52872db4-7ee7-4bcd-95ff-6881cafba533'
DeepQuestAI Plugin Debug Image Failed Verification. Skipped.
DeepQuestAI Plugin Debug downloadandaddtoque Saved Image attempt for:/Volumes/DeepStateTemp/Temp/TempFile_0bc603f0-f014-452a-a230-7d1f22375920 in [seconds]:0.0384559631348
DeepQuestAI Plugin Debug converting to Alert URL from urlphoto:http://XXXX:ZZZZ@192.168.1.235:801/image/Cam1?s=100
DeepQuestAI Plugin Debug AlertURL:http://XXXX:ZZZZ@192.168.1.235:801/admin?camera=Cam1&flagalert=1&memo=
DeepQuestAI Plugin Debug downloadandaddtoque Putting item into DeepState Que: Item:<__main__.deepstateitem instance at 0x10cb767a0>
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing: Velocity here:-0.00287413597107
DeepQuestAI Plugin Debug Thread:SendtoDeepstate: Processing next item in que: Cameraname:Cam1, image file:/Volumes/DeepStateTemp/Temp/TempFile_0bc603f0-f014-452a-a230-7d1f22375920, from IndigoID:1691174874
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing items now 0.000149965286255 seconds later than image captured.
DeepQuestAI Plugin Debug Now Validing Image Data before sending..
DeepQuestAI Plugin Debug imageVerify called for image Path:/Volumes/DeepStateTemp/Temp/TempFile_0bc603f0-f014-452a-a230-7d1f22375920
DeepQuestAI Plugin Debug Exception: Image Verification Failed:cannot identify image file '/Volumes/DeepStateTemp/Temp/TempFile_0bc603f0-f014-452a-a230-7d1f22375920'
DeepQuestAI Plugin Debug Image Failed Verification. Skipped.
DeepQuestAI Plugin Debug ************** Downloading Images: Image:1 for Camera:Cam1
DeepQuestAI Plugin Debug threadDownloadandaddtoque called. & Number of Active Threads:6
DeepQuestAI Plugin Debug downloadandaddtoque Saved Image attempt for:/Volumes/DeepStateTemp/Temp/TempFile_9ae4cf3a-cdc7-4a2e-a09c-adf364f8367f in [seconds]:0.0382869243622
DeepQuestAI Plugin Debug converting to Alert URL from urlphoto:http://XXXX:ZZZZ@192.168.1.235:801/image/Cam1?s=100
DeepQuestAI Plugin Debug AlertURL:http://XXXX:ZZZZ@192.168.1.235:801/admin?camera=Cam1&flagalert=1&memo=
DeepQuestAI Plugin Debug downloadandaddtoque Putting item into DeepState Que: Item:<__main__.deepstateitem instance at 0x10cb7dea8>
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing: Velocity here:1.8835067749e-05
DeepQuestAI Plugin Debug Thread:SendtoDeepstate: Processing next item in que: Cameraname:Cam1, image file:/Volumes/DeepStateTemp/Temp/TempFile_9ae4cf3a-cdc7-4a2e-a09c-adf364f8367f, from IndigoID:1691174874
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing items now 0.000168800354004 seconds later than image captured.
DeepQuestAI Plugin Debug Now Validing Image Data before sending..
DeepQuestAI Plugin Debug imageVerify called for image Path:/Volumes/DeepStateTemp/Temp/TempFile_9ae4cf3a-cdc7-4a2e-a09c-adf364f8367f
DeepQuestAI Plugin Debug Exception: Image Verification Failed:cannot identify image file '/Volumes/DeepStateTemp/Temp/TempFile_9ae4cf3a-cdc7-4a2e-a09c-adf364f8367f'
DeepQuestAI Plugin Debug Image Failed Verification. Skipped.
DeepQuestAI Plugin Debug ************** Downloading Images: Image:1 for Camera:Cam1
DeepQuestAI Plugin Debug threadDownloadandaddtoque called. & Number of Active Threads:6
DeepQuestAI Plugin Debug downloadandaddtoque Saved Image attempt for:/Volumes/DeepStateTemp/Temp/TempFile_1b7a1a26-740f-40bc-92b1-2f48484b15e4 in [seconds]:0.0378439426422
DeepQuestAI Plugin Debug converting to Alert URL from urlphoto:http://XXXX:ZZZZ@192.168.1.235:801/image/Cam1?s=100
DeepQuestAI Plugin Debug AlertURL:http://XXXX:ZZZZ@192.168.1.235:801/admin?camera=Cam1&flagalert=1&memo=
DeepQuestAI Plugin Debug downloadandaddtoque Putting item into DeepState Que: Item:<__main__.deepstateitem instance at 0x10cadfe18>
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing: Velocity here:-9.53674316406e-07
DeepQuestAI Plugin Debug Thread:SendtoDeepstate: Processing next item in que: Cameraname:Cam1, image file:/Volumes/DeepStateTemp/Temp/TempFile_1b7a1a26-740f-40bc-92b1-2f48484b15e4, from IndigoID:1691174874
DeepQuestAI Plugin Debug Thread:SendtoDeepState: Processing items now 0.000167846679688 seconds later than image captured.
DeepQuestAI Plugin Debug Now Validing Image Data before sending..
DeepQuestAI Plugin Debug imageVerify called for image Path:/Volumes/DeepStateTemp/Temp/TempFile_1b7a1a26-740f-40bc-92b1-2f48484b15e4
DeepQuestAI Plugin Debug Exception: Image Verification Failed:cannot identify image file '/Volumes/DeepStateTemp/Temp/TempFile_1b7a1a26-740f-40bc-92b1-2f48484b15e4'
DeepQuestAI Plugin Debug Image Failed Verification. Skipped.
DeepQuestAI Plugin Debug Thread:AddtoQue: Number in que:0
DeepQuestAI Plugin Debug Thread:AddtoQue: Number in que:0

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 5:43 am
by GlennNZ
Hi

Sorry to hear about issues...

The logs seem to suggest that -
For whatever reason the images are failing verification - at a guess they are probably blank files?
Few possible causes - may need admin rights within BI
May be indigo Mac security issues
May be security of temp file location.

Would check the temp drive as these issues are created and see if can capture one; check the size and/or if valid image.
Checking whether valid image files or not. If not valid - then fixing that will be issue.

I’ll have a look at code shortly and update this post.

Glenn


Sent from my iPad using Tapatalk

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 6:04 am
by Sierra
Thanks a lot Glenn for you prompt reply.

I've been doing some additional checks and all seams OK:

may need admin rights within BI ==> user used has BI admin rights
May be indigo Mac security issues ==> I could not find any particular issue
May be security of temp file location ==> looked to access rights of folders and even granted read/write access to all users

I see the Temp folder updates the modified date each time an event is triggered but I do not any file stored. I do not know if they are deleted or that they are not saved in the first place.

One option I am thinking is that I do have a BI demo version, maybe this has some limitations for saving the image.

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 6:21 am
by neilk
I suspect you are right, the demo version has a number of limitations over and above timing out when expired, I know you cannot use the internal file format that is more efficient with it.

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 7:18 am
by Sierra
I got the licence and still the same problem so has to be something else.

I am running BigSur if that makes any difference.

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 8:04 am
by Sierra
Another option I am thinking is that there is a problem with Pillow setup.

I have it install and this is what currently shows:

XXXX@iMac ~ % sudo -H pip3 install Pillow
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/developme ... -2-support pip 21.0 will remove support for this functionality.
Requirement already satisfied: Pillow in /Library/Python/2.7/site-packages (6.2.2)

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 8:36 am
by Turribeach
pip3 is is for Python 3 and pip is for Python 2. Indigo uses Python 2. run "which pip3" to see which pip are you running. I believe you want to run the pip /usr/local/bin/pip which relates to the OS v2.7 python under /usr/bin/python.

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 8:55 am
by Sierra
Tx Turri

I uninstalled both and reinstalled only with pip

XXXX@iMac ~ % sudo -H pip install Pillow
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/developme ... -2-support pip 21.0 will remove support for this functionality.
Requirement already satisfied: Pillow in /Library/Python/2.7/site-packages (6.2.2)

XXXX@iMac ~ % which pip
/usr/local/bin/pip

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 11:44 am
by Sierra
Another option about this problem could be how I am running Docker; I am just using the standard command as per DeepState instructions (port updated to 7188):

docker run -e VISION-DETECTION=True -v localstorage:/datastore -p 7188:5000 deepquestai/deepstack

DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 1:56 pm
by GlennNZ
Hi

Turn up the supercharge number to really high - 40-59 over short space few seconds
Trigger motion and look in temp folder should see the files appear (they are deleted once process)
Grab and copy one - check contents. And/or put one of the URL links in a browser and see what is downloaded (replace Xxx/yyy with user password again)

There is a BI security setting which we highlight in BI plug-in documentation that needs to be off. These files will be HTML pages if that setting is on - basically for every image requests a HTML login:

I’ll find in the BI plug-in the setting and link here

Have a look on BI plug-in troubleshooting thread

Won't Download Images from BI:
Check Login Details.
Check User rights from with Blue Iris Server.
Check Webserver Settings:
Image
html picture upload

Particularly setting above
"Use secure session keys and login page"
This needs to be unchecked.

Glenn



Sent from my iPhone using Tapatalk

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 4:22 pm
by Sierra
Thanks a lot Glenn!! I think the "Use secure session keys and login page" setting made the trick :)

Sorry I have not noticed this in the BlueIris plugin...

I need to adjust the alerts but it seems to be working great and this plugin has huge potencial.

Do you know if with DeepState would be possible to save particular objects e.g. car plates or eventually phases? This could enable very targeted actions.

Re: DeepState AI Object Detection Indigo Plugin

PostPosted: Mon Dec 28, 2020 4:55 pm
by GlennNZ
Good to hear - it was the news that you were new to BI that twigged might be that issue

Saving files from Deepstate?
If you create a deepstate plug-in device in Indigo for the object you want saved.
Eg deepstate plug-in device object Car
If the device exists this plug-in will save the images detected for this object (then can archive to network storage - that setting is in plug-in config)

Currently it saves the full image (which for me has the date on it) and the cropped image of the object. Doesn’t zoom into details further - did consider it but really only saving a couple of KBs of the image file

Glenn


Sent from my iPhone using Tapatalk