Sharing setups with CodeProject AI on Coral hardware (Spring 2024)

koops

n3wb
Joined
May 13, 2020
Messages
13
Reaction score
5
Location
Australia
You should be always able to use the multi-TPU implementation
Is there anyway to be able to tell the difference between the two?

I do see the multi_tpu environment variable

21:52:10:CPAI_CORAL_MULTI_TPU = True

My start up logs show the attemping and then fall back messages.

21:52:12objectdetection_coral_adapter.py: TPU detected
21:52:12objectdetection_coral_adapter.py: Attempting multi-TPU initialisation
21:52:12 objectdetection_coral_adapter.py: Failed to init multi-TPU. Falling back to single TPU.
21:52:12 objectdetection_coral_adapter.py: Using Edge TPU
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
132
Reaction score
92
Location
California
It looks like you are attempting to use multi-TPU by default, but something is wrong so it falls back to the old method. If you’re feeling adventurous you could dig into it and figure out what’s wrong and let me know what to change. (But it may be just the installed coral library version, which is harder to fix.)
 

AlwaysSomething

Getting the hang of it
Joined
Apr 24, 2023
Messages
77
Reaction score
29
Location
US
I'm months behind on current projects so don't want to slide down the rabbit hole on a new adventure. :lol:

But should I trip into one as I'm walking around, what is the best setup? Mind you, I haven't coded in over a decade (besides a couple of small VBscript or javascript files to help someone automate a task). I used to use MS Visual Studio on Windows back in the day but I know that's OLD and have changed dramatically. I'm not opposed to Linux even though it would be more of a learning curve for me (I mean I would have already tripped into the rabbit hole right :lol: ).

Are most developers using Windows or Linux? Also, what IDE are they using?
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
132
Reaction score
92
Location
California
The Coral TPU code is all in python, although some of the failures may be related to the setup configuration/environment. There really isn’t any hardcore coding that you’d need to do. Just figure out how to make the existing code run more reliably via trial and error. Things like refining the logic to ensure the watchdog is working correctly and recovering from errors

Or logic like this:

Or make sure that the model segment download or module install code is working well, but I didn’t write that so I’m less familiar.

Edit: and I’d just focus on making sure it runs well on your setup first.
 
Last edited:

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
132
Reaction score
92
Location
California
As far as an IDE, I’ve used Eclipse, BBEdit, Sublime, and most recently VS Code. My Linux machine that I’ve done my Coral development on I’m using Sublime and the default Linux text editor (simple text?). And EMacs sometimes. Or vi if I have to. And sometimes I’ll work on some prototype code using the GitHub editing interface. Anyway, it depends.
 

AlwaysSomething

Getting the hang of it
Joined
Apr 24, 2023
Messages
77
Reaction score
29
Location
US
Yeah I think most of the issues are with the installer and not the actual execution/"running".

I wan't sure how the debugging works. I used to be able to put break points and step through code.

I've been hesitating since the only problem I really have is it says it's using the model I chose but I don't think it really is (based on testing). However, it is a pain point since I only really care about people on certain cameras and it is currently marking a lot of cars as people for some reason. In other words, a car will drive by and it gets marked as a person.

If I fall in the rabbit hole you may hear me screaming for help. :lol:
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
132
Reaction score
92
Location
California
I’ve been doing this for many years, but still prefer print statements over breakpoints for whatever reason. I’ve been doing all of my testing using a script to run and test the tpu_runner.py code, so I’m not really even that familiar with how things interact within CPAI, and I may not be of much use.
 

silencery

Pulling my weight
Joined
Oct 6, 2015
Messages
230
Reaction score
157
Software configuration
  • CP.AI version: 2.6.2
  • Modules: Object Detection (Coral) v2.2.2
  • Model: Medium yolov5. Note: my BI configuration says "Default Object Detection : small". Now I manually changed the model from small to medium within the codeproject control panel. I likely probably should have changed this from within BI itself.
Other
I didn't investigate this enough to realize that that there could be issues with single TPU implementations. Specifically the error "Unable to run inference: There is at least 1 reference to internal data". From googling this I think it means that TPU is already busy and is unable to process the current request.
Checked the codeproject AI log window and noticed what appeared to be near constant analysis.
Reduced this by checking my BI settings and seeing that I had "Static object analysis" turned on. This reduced the issue significantly. I'd guess that the dual TPU implementations do not see this nearly as much?
Great share and awesome feedback. I'll add in your findings about BI config to the top post. Good note that static object analysis should be disabled to prevent flooding requests. In my case, I'm not having BI control CPAI, so I wasn't able to adjust the model size from there. Good reminder about that too.
 

koops

n3wb
Joined
May 13, 2020
Messages
13
Reaction score
5
Location
Australia
Good note that static object analysis should be disabled to prevent flooding requests. In my case, I'm not having BI control CPAI, so I wasn't able to adjust the model size from there. Good reminder about that too.
This is documented in the codeproject AI blue iris faq here : Blue Iris Webcam Software - CodeProject.AI Server v2.6.2 under the section marked "CodeProject.AI Server log shows requests every minute or less when there is no motion detection"
 

AlwaysSomething

Getting the hang of it
Joined
Apr 24, 2023
Messages
77
Reaction score
29
Location
US
I think static object analysis is dependent on the user/camera needs.

For example, I have a couple of cameras that cover my driveway which can have a couple of cars parked in it. On those cameras I am tracking person, car, truck, cat, and dog. Without the static object analysis if there were was motion, like a bug flying across the camera, it would detect my parked cars and trigger an alert on the cars. So in that case I have detecting the static objects turned on to prevent false positives. This was a real PITA with some previous versions of BI where it wasn't working correctly. You may also want this if you have a camera in a garage with a parked car that may have motion such as a bug (especially if using IR which can attract the bugs).

Conversely, on my backyard and indoor cameras I do not have any static objects that would trigger so I do not have it turned on for those cameras. Oddly enough, there was a stuffed dog in my living room once that would trigger when the shadows caused motion (large window with lots of sun). So again, you have to evaluate based on your camera's situation.

One last thought is just how many cameras are configured for static object analysis. If only a couple (like in my case) you shouldn't be flooding CPAI. If you have a lot of cameras configured (like a parking garage) then you will have a lot traffic for CPAI. I would say turn off and see how many false positives you get to determine if you need it.
 

silencery

Pulling my weight
Joined
Oct 6, 2015
Messages
230
Reaction score
157
This is documented in the codeproject AI blue iris faq here : Blue Iris Webcam Software - CodeProject.AI Server v2.6.2 under the section marked "CodeProject.AI Server log shows requests every minute or less when there is no motion detection"
LOL, oops. I didn't even know a FAQ existed! Added this reminder to the top post in case anyone is lost in the future.


I think static object analysis is dependent on the user/camera needs.
100% Everyone's environment is different, so it's all about tuning things to fit your needs
 
Top