71

Using CodeProject SenseAI with Blue Iris - CodeProject

 2 years ago
source link: https://www.codeproject.com/Articles/5323944/Using-CodeProject-SenseAI-with-Blue-Iris
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Introduction

Artificial Intelligence is becoming ubiquitous, but has always seemed to be Yet Another Technology To Learn in a world where there are too many things we need to stay on top of. This is why we are developing CodeProject SenseAI, with a goal to make using AI easier for the average user. The first Beta was released on January 16, 2022 and we're actively adding features, improvements and integrations every week.

This article is specific to CodeProject SenseAI Bata 2. This is a tech preview and so has some rough edges, but we'd rather bring you along for the ride rather than hold off until things are perfect!

A Very, Very Brief Backgrounder

SenseAI is based on the concept of aggregating the best ideas from the AI community and presenting them in a easy to use package. We take care of worrying about frameworks, compiler and interpreter versions, library mismatches, models, setup, download and all the annoying things that can make something fun become a chore.

For a consumer this means a single downloadable installer that Just Works. For a developer it means a single API (via the SenseAI Server) that you program against. The more modules and ideas we aggregate the more features we expose, but always through the same simple API and the same installer.

Using CodeProject SenseAI in The Real World

Because the SenseAI Server's Web Api is compatible with DeepStack (given that DeepStack was the first module we integrated), we were careful to ensure that it was a drop-in replacement for those who have already integrated DeepStack into their apps.

One such integration is with Blue Iris. Blue Iris is a Video Security and Web Camera system for those looking to manage multiple web cameras. With the integration, Blue Iris can detect objects and faces, and react to these in a number of ways, including alerts and emails.

This article with show how to configure Blue Iris to use CodeProject SenseAI Server as its vision AI service.

Preparation

The first step is to get the various pieces of software installed. I'm not going to walk you through these steps, rather I will point you the the installation instructions for each.

  1. Install Blue Iris if not already installed. Download and run the installer found at Blue Iris Downloads. You will be able to run with a Demo License for 15 days before you must buy a single or multi camera license. Don't worry, it is very inexpensive and a one-time expense, $35 or $70 respecively. Not bad for a robust and easy to use security system that keeps all your data local.
  2. Install CodeProject.SenseAI Server. The installer and installation instructions can be found at CodeProject SenseAI Server: AI the easy way.

Configuring Blue Iris

Blue Iris need to run as an Adminstrator. To do this, right-click on the Blue Iris start menu item and select Run as administrator.

Start Blue Iris

If you do not have a license you will see the following:

Blue Iris No License Screen

You can select to register by clicking Next, or continue with the demo license by clicking Demo. I am running in demo mode for the instance I am using to test the integration. You should now see the Blue Iris software running.

Blue Iris Main Screen

If you haven't already configured your cameras for use with Blue Iris, you will need to do this now. Click on the Cameras tab. I will not go into this process here, but it is detailed in the included help documentation in the Cameras section. Click on the ? in the menu bar and then select Help Documentation to view the help.

You can configure Blue Iris by clicking on the gear icon on the upper left menu bar. This will bring up the Blue Iris Settings panel.

Blue Iris Settings Panel

Click on the AI tab. This will open up the AI Settings Panel as shown below. Because we are replacing DeepStack, the information you need to worry about is in the DeepStack section. The setting should be as shown

  • check the Use DeepStack Server checkbox and set the IP/Port to '127.0.0.1' and 5000. These are the default values for SenseAI. You could also use 'localhost' for the IP. If you plan to run SenseAI on another server or port, adjust these values to reflect the server and port you are using.
  • clear the Auto start/stop checkbox. We have to start SenseAI in a different way as Blue Iris is expecting to run different executable than CodeProject.SenseAI.Server.exe. Don't worry, I will be showing you how to run SenseAI as a Windows Service.
  • You probably want to check the Default object detection checkbox so that Blue Iris can use SenseAI to detect object. The default Blue Iris setting is to detect persons, cars ,trucks ,buses,bicycles,and boats and fire alerts when they enter the cameras view.
  • checking the Facial Recognition checkbox will enable recognizing people in Blue Iris using SenseAI's Face Recognition API. This is optional.

AI Settings Panel

Starting SenseAI

In order for Blue Iris to use the AI functionality of CodeProject SenseAI, it must be running. There are a number of ways to start SenseAI. These are detailed below.

1. Manually Starting from the command line

The first way is to start SenseAI by executing the Start_SenseAI_Win.bat found in the directory in which you installed SenseAI. While simple, this does have the disadvantage of not starting up after a computer restart. Curse those automatic updates! If this is an issue, then one of the following options may be a better choice.

2. Lean on Windows: Add as a Startup up to Windows

You can have Windows start CodeProject SenseAI Server on startup by following the instructions at Add Startup Programs on Windows 10. Each time you login, CodeProject SenseAI Server will start and you'll be good to go. This is still a bit of a manual process so you could try...

3. Even easier: Running SenseAI as a Windows Service

SenseAI Server supports running as a Windows Service. In the src\API\Server\Frontend directory of the installation directory are two scripts that manage installation and cleanup. These scripts must be run as an Administrator as this is required to manage Windows Services.

  • CreateWindowsService.cmd will install the SenseAI Server as a Windows Service
    • with Face Detection/Recognition, Object Detection, and Scene Classifiaction services enabled
    • running on port 5000
    • with the service name of CodeProject SenseAI Server.
    • to automatically start on computer restart
    • to automatically restart on servie failure.
    • and starts the service immediately
  • DeleteWindowsService.cmd will stop the Windows Service and uninstall it.

4. Coming Soon: Integrated installer and Docker support

We are currently in Beta, and a Tech Preview Beta at that, so we're still leaning on developer-centric tools rather than consumer-friendly systems at this stage. We anticipate in the next week or two an installer that will manage both the setup of CodeProject SenseAI and the installation as a service, as well as a Docker image for an even easier install process (as well as cross platform support) for those who have Docker on their system.

CodeProject SenseAI in action

Below is a screengrab of Blue Iris with SenseAI acting as the AI provider. Notice on the left hand side a list of motion events, an image, and the object that was detected along with a confidence level. A car in the driveway, a person at the front door.

AI Settings Panel

Also note that the SenseAI server, in this case, is running on a different machine than the Blue Iris software. Just enter the server and port of the machine running SenseAI (in this case 192.158.1.30:5000) and Blue Iris will route the requests appropriately.

Wrapping up

Congratulations. You are now running SenseAI as the Vision AI provider in Blue Iris. Please give it a spin. We are eager to get feedback to help us improve this product.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK