Nothing changed about the way the integration works with the deep stack api, so any changes in performance are likely due to the new way a user is using the integration, Calling the service 20 times will create 20 requests to deepstack and likely cause it to seize up
Ok, so more testing reveals something else - it is actually a huge delay to process the request. I hit the call service and anywhere between 4-15 seconds later I see the Coral request on the remote Pi execute with an average of about 8-10 second delay. when I get a response, I immediatly hit the call service again. Here I tail the remote coral-rest serverās log with random delayās of 5,6,10,8,6,8,6 seconds between requests:
2020-05-12 14:51:05,718 INFO werkzeug Thread-17173 : 192.168.1.250 - - [12/May/2020 14:51:05] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 14:51:10,125 INFO werkzeug Thread-17174 : 192.168.1.250 - - [12/May/2020 14:51:10] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 14:51:16,273 INFO werkzeug Thread-17175 : 192.168.1.250 - - [12/May/2020 14:51:16] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 14:51:26,812 INFO werkzeug Thread-17176 : 192.168.1.250 - - [12/May/2020 14:51:26] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 14:51:34,290 INFO werkzeug Thread-17177 : 192.168.1.250 - - [12/May/2020 14:51:34] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 14:51:40,092 INFO werkzeug Thread-17178 : 192.168.1.250 - - [12/May/2020 14:51:40] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 14:51:52,924 INFO werkzeug Thread-17179 : 192.168.1.250 - - [12/May/2020 14:51:52] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 14:51:58,158 INFO werkzeug Thread-17180 : 192.168.1.250 - - [12/May/2020 14:51:58] "POST /v1/vision/detection HTTP/1.1" 200 -
This morning before I upgraded to the 3.0 version, I had the 2.7 version scan_interval set to check every 3 seconds on one camera and 10 sec on another, and it worked great, and was very consistent as this log shows. So my Pi isnāt stressed:
2020-05-12 07:24:17,420 INFO werkzeug Thread-16742 : 192.168.1.250 - - [12/May/2020 07:24:17] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 07:24:20,871 INFO werkzeug Thread-16743 : 192.168.1.250 - - [12/May/2020 07:24:20] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 07:24:23,395 INFO werkzeug Thread-16744 : 192.168.1.250 - - [12/May/2020 07:24:23] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-12 07:24:26,814 INFO werkzeug Thread-16745 : 192.168.1.250 - - [12/May/2
CPU is 47% before I hit the service call, 56.4% during.
any idea where this delay might be coming from? I do ocassionally see this in the log:
20-05-12 16:18:41 WARNING (MainThread) [homeassistant.helpers.entity] Update of image_processing.frontgate_object_detection is taking over 10 seconds
And I still see no events when listening to event deepstack.object_detected.
UPDATE: removing the api_key: line and restarting gives me 3 second delays consistently. Better, but still perplexing.
Jeff
im kind of new in this. help please @robmarkcole
[custom_components.deepstack_face.image_processing] Depstack error : Error from Deepstack: Face endpoints not activated
@jazzmonger you can configure a longer timeout
. I see you are using the Coral instead of the deepstack docker api, well the Coral code is not designed to handle multiple requests (yet).
@typeonegative you are not dunning deepstack with the correct arguments, please read the docs
Yes, I took the plunge and bought the Coral and invested the time to get it all working just so Iād have better image processing times. It looks like the opposite is true nowā¦
Is this possibly why the event deepstack.object_detected never fires? Because Iām not calling it on the local machine?
And if you notice, Iām not firing multiple events. Iām waiting for the service to respond on the Coral rest server, hence the log entry. Time from service submit on home assistant to the Coral rest server responding is now about 3+ seconds.
This large delay is definitely in the home assistant and/or deep stack code as I can fire off successive events to the remote Coral server every second or faster from my Mac and it responds instantly. And as you can see from my Glance, the home assistant pi is idling along.
At least Iāve narrowed down the source of the delay. Iām not a talented code jockey like all you young bucks, so I unfortunately canāt help dig any further into the root cause.
Is it possible that itās related to the image size thatās being submitted? Iāve got the cam set to low res, so the image capture is a little less than 1mb. I canāt tell whatās being submitted by the deep stack object. All this gear is on GB LANs, no Wifi. Why would 2.7 work without the delay thoughā¦still perplexing.
Jeff
The coral can to 30 FPS, so it will require a deep dive to understand what is the issue here. If you give me a few days I will setup the coral at home again and look into it.
My plan is to integrate coral support into deepstack, since deepstack already handles request queuing etc. My currently implementation with coral is very basic CC @OlafenwaMoses
I also am standardising my rekognition and deepstack integrations, so each can be used with almost identical config.
Hi I searched this whole thread but am still not sure. Am I correct in my assumption that it is currently not possible to do face recognition (not detection) with Google Coral support?
The list of available models is at the following page. Face recognition is notable by its absence
Ok - the use case here is car detection at at gate. I have to fire the detection multiple times sometimes for it to recognize something as simple as a car, even though I have played with confidence levels all over the place. 75-80% seems about where it needs to be to not just show the entire frame as being detected as a ācarāā¦ so, that means that the delays stack up every time I fire the event. Firing it 3 times can take over 15 seconds, or longer. I might as well get out of the car and punch in the numbers on the keypad to open the gate!
When a REAL car appears, itās 95.3% sure itās a car. Whew!
So obviously itās not a critical use case, but there is something going on Deep inside causing processing delaysā¦ and itās not my Pi being overloaded. Glances shows overall 27-30% CPU usage pretty much at all times.
Hereās me sending the curl -X trigger from my Mac to the Coral Pi rest server in succession:
~/Downloads/:> curl -X POST -F [email protected] 'http://192.168.1.208:5000/v1/vision/detection'
{"predictions":[{"confidence":0.58203125,"label":"car",
"x_max":2688,"x_min":25,"y_max":1520,"y_min":36}],"success":true}
~/Downloads/:> curl -X POST -F [email protected] 'http://192.168.1.208:5000/v1/vision/detection'
{"predictions":[{"confidence":0.58203125,"label":"car",
"x_max":2688,"x_min":25,"y_max":1520,"y_min":36}],"success":true}
~/Downloads/:> curl -X POST -F [email protected] 'http://192.168.1.208:5000/v1/vision/detection'
{"predictions":[{"confidence":0.58203125,"label":"car",
"x_max":2688,"x_min":25,"y_max":1520,"y_min":36}],"success":true}
Interesting that it thinks my empty driveway jpg I submit is consistently identified as a ācarā with 58.20% confidence each time I submit it (could it be the shadows/sun outline?) Hence my need for a number greater than this for confidence levels so I eliminate false positives.
And the resulting log:
2020-05-13 09:01:56,722 INFO werkzeug Thread-17325 : 192.168.1.200 - - [13/May/2020 09:01:56] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-13 09:01:57,638 INFO werkzeug Thread-17326 : 192.168.1.200 - - [13/May/2020 09:01:57] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-13 09:01:58,880 INFO werkzeug Thread-17327 : 192.168.1.200 - - [13/May/2020 09:01:58] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-13 09:02:00,017 INFO werkzeug Thread-17328 : 192.168.1.200 - - [13/May/2020 09:02:00] "POST /v1/vision/detection HTTP/1.1" 200 -
2020-05-13 09:02:01,071 INFO werkzeug Thread-17329 : 192.168.1.200 - - [13/May/2020 09:02:01] "POST /v1/vision/detection HTTP/1.1" 200 -
as you can see from the timestamps, there is no delay, and Iām sending the 1MB image above for processing.
The good that comes from investigating all of this is my ānewā deep understanding of this component and how it all works together! Not time wasted at allā¦ Jeff
Just published v3.1 which allows filtering objects using a region of interest
Also a comparison of deepstack and rekognition, win for deepstack!
Hi all, Let me start by saying this is a such a great idea Rob you ahve done an amzing job with such a detailed instruction set up.
I would like to ask though has anyone tried installing deepstack on their hassio instance? I am having a problem that the component is running and the server is running (I can see the landing page at local ip) and i can see in portainer that the deepstack container is receiving a request every time I activate the service request but I am not getting an output and donāt know where to start to troubleshoot. I see that you can run the curl statement in the readme but I am not running a linux setup other than Hassio. Any tips would be appreciated. I am running Hassio on a VM machine on a windows laptop with an old core I7 and installed the deepstack:latest rather than novrm version as I believe virtual box and core i7 allow for vrm.
EDIT - I loaded up the windows based deepstack server and it worked seamlessly so it must be the portainer/docker deepstack server which has a problem. Still any tips would be welcomed.
EDIT - the problem was the I was looking at too many install documents and used VISION-SCENE=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack and didnāt realise i hadnāt put VISION- DETECTION =True . Thought I would leave this post in case it is helpful but maybe no one is as silly as I am.
Strange. Iām also running into the calls apparently not being made. When I first set it up, I got it to capture/analyze one frame. Worked great! This was to the pi/coral setup. Unfortunately, calling the service hasnāt worked since, though it DOES seem to run an analysis on startup. I also set it up on an intel nuc, and that isnāt seeming to be called either. Any tips for that situation?
How are you calling the service from HomeAssistant? Via Developer Tools or through an automation? I have found that calling the Coral Python flask app in quick succession can result in results not being returnedā¦
Post your relevant config and may be able to help troubleshoot
It is getting confusing when people talk about deepstack but are actually referring to my coral integration. For coral please use this thread instead, and we keep this one to discussion about the official deepstack docker container. Thanks
Hey sorry rob. Iām really talking about the custom component, because I canāt get it to fire against either endpoint. Thanks for all you awesome work btw. Even the little bit i got going was really cool.
BTW: Hereās my config:
image_processing:
- platform: deepstack_object
ip_address: skull.local
port: 5000
api_key: !secret deepstack_key
save_file_folder: /config/snapshots/
# save_timestamped_file: True
# roi_x_min: 0.35
# roi_x_max: 0.8
#roi_y_min: 0.4
# roi_y_max: 0.8
targets:
- person
source:
- entity_id: camera.loft
And im trying to trigger it from the services dev tool
EDIT:
Nothing shows up in DevTools-> Log. Is there somewhere else to look?
put logger in debug mode, this will show the api requests
If anyone wants to run a deepstack clone on an rpi and not need a movidius or coral stick, I have updated the following project to be compatible with deepstack integration:
Not seeing any requests for the most part. Oddly, i seem to be able to make maybe one request, but then future requests donāt go through.
So hereās the weird bit. It seems to be making calls (see the 1:26 websocket call), but it keeps setting the state back to the original one at 12:56.
Itās also not writing the latest image files to disk. It sometimes does, but I cant see any reason why/why not.
Log snippet here:
https://pastebin.com/XD9MYbbW