Coral TPU really does its work for CP.AI object recognition!

honkkis
Posts: 6
Joined: Sat Jul 29, 2023 4:11 pm

Coral TPU really does its work for CP.AI object recognition!

Post by honkkis »

Installed Coral m.2 board (single TPU A+E key) couple days ago into my AsRock Deskmini A300 (using Ryzen 3 3200G) and boy, Coral is a little miracle! I had a Coral USB for few months, but it was having certain issues (frequent CP.AI crashes), can't say if it was due to Coral USB-stick itself or CP.Ai, however m.2 Coral is rock solid on same configuration! Object recognition times vary slighlty, but average seems to be around 70ms to 75ms (model size small). Not bad for very compact camera server and cheap TPU!

Of course one could use cheap CUDA-cards, but power consumption and computers physical size would grow a lot compared to DeskMini (it's Mini-STX after all). DeskMini has two M.2 slots, one PCIe Gen3 x4 for SSD and second Gen3 x2/4x for wifi, using wifi slot for Coral, other m.2 has my system disk and I have conventional 2.5" 7200rpm SATA HDD for videostorage. Using this setup with 3pcs 3MP, 1pc 4Mp and single 8k camera with direct disc recording and substream motion analysis BI uses CPU about 2% to 3% on average.

Coral was earlier difficult to obtain, but it can be nowadays bought around its recommended price (25USD / EUR) and I got my m.2 version in a week from a German retailer.

Coral m.2 seems very reasonable and well working solution for systems with m.2 slots. It really allows ultra compact and power efficient computers to use AI.
User avatar
TimG
Posts: 2391
Joined: Tue Jun 18, 2019 10:45 am
Location: Nottinghamshire, UK.

Re: Coral TPU really does its work for CP.AI object recognition!

Post by TimG »

Excellent info. Could you do a write up on how to install it and get it working too ? Software side only - if somebody doesn't know how to install an M2 card they should read up on that first :idea:
Forum Moderator.
Problem ? Ask and we will try to assist, but please check the Help file.
honkkis
Posts: 6
Joined: Sat Jul 29, 2023 4:11 pm

Re: Coral TPU really does its work for CP.AI object recognition!

Post by honkkis »

TimG wrote: Sat Sep 02, 2023 10:46 am Excellent info. Could you do a write up on how to install it and get it working too ? Software side only - if somebody doesn't know how to install an M2 card they should read up on that first :idea:
Installation was very straightforward and fast, just followed Getting started directions from Coral.ai: (chapter 2b) https://coral.ai/docs/m2/get-started/

After installing Microsoft Visual C++ 2019 redistributable and edgetpu_runtime_20221024.zip Coral appears in Windows Device manager as Coral accelerator devices / Coral PCIe accelerator and is ready to use for Codeproject.AI. Remember to run edgetpu-installer as administrator, just to make sure there will be no permission management problems. Windows might show popup about untrusted software publisher at installation stage, just allow it (if you turst Google, that is).

Edgetpu-installer is simple old-school command-line bat-file, it asks only if you want to run Coral at half-speed or full-speed and that's it. But it works.

In CodeProject.AI Server control panel (the web page) in Install Modules tab it's required to install Object Detection (Coral)-module. CP.AI defaults properly module to Edge TPU, user needs really only to choose model size, if other than tiny is desired. Tiny and Small are more than adequate.

I didn't do step 3 from Coral.ai instructions (PyCoral library installation). Installation of PyCoral library and associated TensorFlow Lite might allow (?) using ObjectDetection(TF-Lite) on CP.AI, it's there as option in installable modules.

After installing Coral software and CP.AI with Object Detection(Coral), rest of the config is normal BlueIris AI-configuration, which is well described.

I do have quite advacnced skills on IT in general, but definitely I'm not expert on AI, CP.AI or Python and yet I got this working in minutes, so I would say this is not "advanced project" in traditional sense.

To summarize:
1. Surf to https://coral.ai/docs/m2/get-started/
2. Read instructons (2b)
3. Download and setup Microsoft Visual C++ 2019 redistributable
4. Download and setup edgetpu_runtime_20221024.zip (remember to admin and allow unsigned publisher)
5. Make sure Coral accelerator is shown in Windows Device manager
6. Add Object Detection(Coral)-module to CodeProject.AI modules and enable. Choose model size.
7. Config your BlueIris per instructions on this (and CP.AI) site.
8. Enjoy stable, reliable and power-efficient object-recognition benefits on BlueIris!

As usual, if there's problem, restart. If installer suggests restart, do it.
User avatar
TimG
Posts: 2391
Joined: Tue Jun 18, 2019 10:45 am
Location: Nottinghamshire, UK.

Re: Coral TPU really does its work for CP.AI object recognition!

Post by TimG »

Thank you :D
Forum Moderator.
Problem ? Ask and we will try to assist, but please check the Help file.
dangerdan
Posts: 1
Joined: Fri Oct 13, 2023 3:28 pm

Re: Coral TPU really does its work for CP.AI object recognition!

Post by dangerdan »

honkkis wrote: Sat Sep 02, 2023 5:02 pm
TimG wrote: Sat Sep 02, 2023 10:46 am Excellent info. Could you do a write up on how to install it and get it working too ? Software side only - if somebody doesn't know how to install an M2 card they should read up on that first :idea:
Installation was very straightforward and fast, just followed Getting started directions from Coral.ai: (chapter 2b) https://coral.ai/docs/m2/get-started/

After installing Microsoft Visual C++ 2019 redistributable and edgetpu_runtime_20221024.zip Coral appears in Windows Device manager as Coral accelerator devices / Coral PCIe accelerator and is ready to use for Codeproject.AI. Remember to run edgetpu-installer as administrator, just to make sure there will be no permission management problems. Windows might show popup about untrusted software publisher at installation stage, just allow it (if you turst Google, that is).

Edgetpu-installer is simple old-school command-line bat-file, it asks only if you want to run Coral at half-speed or full-speed and that's it. But it works.

In CodeProject.AI Server control panel (the web page) in Install Modules tab it's required to install Object Detection (Coral)-module. CP.AI defaults properly module to Edge TPU, user needs really only to choose model size, if other than tiny is desired. Tiny and Small are more than adequate.

I didn't do step 3 from Coral.ai instructions (PyCoral library installation). Installation of PyCoral library and associated TensorFlow Lite might allow (?) using ObjectDetection(TF-Lite) on CP.AI, it's there as option in installable modules.

After installing Coral software and CP.AI with Object Detection(Coral), rest of the config is normal BlueIris AI-configuration, which is well described.

I do have quite advacnced skills on IT in general, but definitely I'm not expert on AI, CP.AI or Python and yet I got this working in minutes, so I would say this is not "advanced project" in traditional sense.

To summarize:
1. Surf to https://coral.ai/docs/m2/get-started/
2. Read instructons (2b)
3. Download and setup Microsoft Visual C++ 2019 redistributable
4. Download and setup edgetpu_runtime_20221024.zip (remember to admin and allow unsigned publisher)
5. Make sure Coral accelerator is shown in Windows Device manager
6. Add Object Detection(Coral)-module to CodeProject.AI modules and enable. Choose model size.
7. Config your BlueIris per instructions on this (and CP.AI) site.
8. Enjoy stable, reliable and power-efficient object-recognition benefits on BlueIris!

As usual, if there's problem, restart. If installer suggests restart, do it.
Thanks for posting this. I folowed your steps but i dont think its working. Any ideas?
On the logs i see:
08:33:57:Started ObjectDetection (Coral) module
08:33:57:objectdetection_coral_adapter.py: Traceback (most recent call last):
08:33:57:objectdetection_coral_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py", line 10, in
08:33:57:objectdetection_coral_adapter.py: from module_runner import ModuleRunner
08:33:58:objectdetection_coral_adapter.py: File "../../SDK/Python\module_runner.py", line 28, in
08:33:58:objectdetection_coral_adapter.py: import aiohttp
08:33:58:objectdetection_coral_adapter.py: ModuleNotFoundError: No module named 'aiohttp'
08:33:58:Module ObjectDetectionCoral has shutdown
08:33:58:objectdetection_coral_adapter.py: has exited

I also notice that next to ObjectDetection (Coral) it shows CPU and not GPU(TPU).
blktbss07
Posts: 1
Joined: Sun Oct 22, 2023 12:01 am

Re: Coral TPU really does its work for CP.AI object recognition!

Post by blktbss07 »

dangerdan wrote: Fri Oct 13, 2023 3:36 pm
honkkis wrote: Sat Sep 02, 2023 5:02 pm
TimG wrote: Sat Sep 02, 2023 10:46 am Excellent info. Could you do a write up on how to install it and get it working too ? Software side only - if somebody doesn't know how to install an M2 card they should read up on that first :idea:
Installation was very straightforward and fast, just followed Getting started directions from Coral.ai: (chapter 2b) https://coral.ai/docs/m2/get-started/

After installing Microsoft Visual C++ 2019 redistributable and edgetpu_runtime_20221024.zip Coral appears in Windows Device manager as Coral accelerator devices / Coral PCIe accelerator and is ready to use for Codeproject.AI. Remember to run edgetpu-installer as administrator, just to make sure there will be no permission management problems. Windows might show popup about untrusted software publisher at installation stage, just allow it (if you turst Google, that is).

Edgetpu-installer is simple old-school command-line bat-file, it asks only if you want to run Coral at half-speed or full-speed and that's it. But it works.

In CodeProject.AI Server control panel (the web page) in Install Modules tab it's required to install Object Detection (Coral)-module. CP.AI defaults properly module to Edge TPU, user needs really only to choose model size, if other than tiny is desired. Tiny and Small are more than adequate.

I didn't do step 3 from Coral.ai instructions (PyCoral library installation). Installation of PyCoral library and associated TensorFlow Lite might allow (?) using ObjectDetection(TF-Lite) on CP.AI, it's there as option in installable modules.

After installing Coral software and CP.AI with Object Detection(Coral), rest of the config is normal BlueIris AI-configuration, which is well described.

I do have quite advacnced skills on IT in general, but definitely I'm not expert on AI, CP.AI or Python and yet I got this working in minutes, so I would say this is not "advanced project" in traditional sense.

To summarize:
1. Surf to https://coral.ai/docs/m2/get-started/
2. Read instructons (2b)
3. Download and setup Microsoft Visual C++ 2019 redistributable
4. Download and setup edgetpu_runtime_20221024.zip (remember to admin and allow unsigned publisher)
5. Make sure Coral accelerator is shown in Windows Device manager
6. Add Object Detection(Coral)-module to CodeProject.AI modules and enable. Choose model size.
7. Config your BlueIris per instructions on this (and CP.AI) site.
8. Enjoy stable, reliable and power-efficient object-recognition benefits on BlueIris!

As usual, if there's problem, restart. If installer suggests restart, do it.
Thanks for posting this. I folowed your steps but i dont think its working. Any ideas?
On the logs i see:
08:33:57:Started ObjectDetection (Coral) module
08:33:57:objectdetection_coral_adapter.py: Traceback (most recent call last):
08:33:57:objectdetection_coral_adapter.py: File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py", line 10, in
08:33:57:objectdetection_coral_adapter.py: from module_runner import ModuleRunner
08:33:58:objectdetection_coral_adapter.py: File "../../SDK/Python\module_runner.py", line 28, in
08:33:58:objectdetection_coral_adapter.py: import aiohttp
08:33:58:objectdetection_coral_adapter.py: ModuleNotFoundError: No module named 'aiohttp'
08:33:58:Module ObjectDetectionCoral has shutdown
08:33:58:objectdetection_coral_adapter.py: has exited

I also notice that next to ObjectDetection (Coral) it shows CPU and not GPU(TPU).
Hey did you ever figure this out? im having the same problem
honkkis
Posts: 6
Joined: Sat Jul 29, 2023 4:11 pm

Re: Coral TPU really does its work for CP.AI object recognition!

Post by honkkis »

blktbss07 wrote: Sun Oct 22, 2023 12:04 am Hey did you ever figure this out? im having the same problem
Have you taken look at this Codeproject AI troubleshooting (Readme if you are having issues)?
https://www.codeproject.com/Feature/Cod ... sions.aspx

Some people suggest removing and then reinstalling CP.AI on Reddit, CP.AI page (above) suggests installing single missing module is possible.
jensie
Posts: 15
Joined: Sat Nov 11, 2023 2:46 pm

Re: Coral TPU really does its work for CP.AI object recognition!

Post by jensie »

honkkis wrote: Sat Sep 02, 2023 5:02 pm
TimG wrote: Sat Sep 02, 2023 10:46 am Excellent info. Could you do a write up on how to install it and get it working too ? Software side only - if somebody doesn't know how to install an M2 card they should read up on that first :idea:
Installation was very straightforward and fast, just followed Getting started directions from Coral.ai: (chapter 2b) https://coral.ai/docs/m2/get-started/

After installing Microsoft Visual C++ 2019 redistributable and edgetpu_runtime_20221024.zip Coral appears in Windows Device manager as Coral accelerator devices / Coral PCIe accelerator and is ready to use for Codeproject.AI. Remember to run edgetpu-installer as administrator, just to make sure there will be no permission management problems. Windows might show popup about untrusted software publisher at installation stage, just allow it (if you turst Google, that is).

Edgetpu-installer is simple old-school command-line bat-file, it asks only if you want to run Coral at half-speed or full-speed and that's it. But it works.

In CodeProject.AI Server control panel (the web page) in Install Modules tab it's required to install Object Detection (Coral)-module. CP.AI defaults properly module to Edge TPU, user needs really only to choose model size, if other than tiny is desired. Tiny and Small are more than adequate.

I didn't do step 3 from Coral.ai instructions (PyCoral library installation). Installation of PyCoral library and associated TensorFlow Lite might allow (?) using ObjectDetection(TF-Lite) on CP.AI, it's there as option in installable modules.

After installing Coral software and CP.AI with Object Detection(Coral), rest of the config is normal BlueIris AI-configuration, which is well described.

I do have quite advacnced skills on IT in general, but definitely I'm not expert on AI, CP.AI or Python and yet I got this working in minutes, so I would say this is not "advanced project" in traditional sense.

To summarize:
1. Surf to https://coral.ai/docs/m2/get-started/
2. Read instructons (2b)
3. Download and setup Microsoft Visual C++ 2019 redistributable
4. Download and setup edgetpu_runtime_20221024.zip (remember to admin and allow unsigned publisher)
5. Make sure Coral accelerator is shown in Windows Device manager
6. Add Object Detection(Coral)-module to CodeProject.AI modules and enable. Choose model size.
7. Config your BlueIris per instructions on this (and CP.AI) site.
8. Enjoy stable, reliable and power-efficient object-recognition benefits on BlueIris!

As usual, if there's problem, restart. If installer suggests restart, do it.
How does your environment look like ? You are running it on a dedicated machine ? And what windows version are you using ?
jensie
Posts: 15
Joined: Sat Nov 11, 2023 2:46 pm

Re: Coral TPU really does its work for CP.AI object recognition!

Post by jensie »

Did someone figure this out in the end ?
jensie
Posts: 15
Joined: Sat Nov 11, 2023 2:46 pm

Re: Coral TPU really does its work for CP.AI object recognition!

Post by jensie »

Just for all who wants to figure this out. You need to or uninstall and install the module multiple times or restart your windows machine.
You should get the following in the logs

Code: Select all

objectdetection_coral_adapter.py: Edge TPU detected
If you get

Code: Select all

objectdetection_coral_adapter.py: has exited
reinstall the module or restart your windows machine
Post Reply